Commit 1c0a81d9 authored by xinglei's avatar xinglei

修改跳转方法

parent be5feb62
...@@ -28,7 +28,8 @@ class Scene extends Component { ...@@ -28,7 +28,8 @@ class Scene extends Component {
mode: 'divider', mode: 'divider',
cardItems: [], cardItems: [],
selectScene: categoryScene[0], selectScene: categoryScene[0],
selectMiniSence: miniSences[0] selectMiniSence: miniSences[0],
token: null
// mode2: 'line', // mode2: 'line',
// mode3: 'bullet' // mode3: 'bullet'
}; };
...@@ -84,22 +85,23 @@ class Scene extends Component { ...@@ -84,22 +85,23 @@ class Scene extends Component {
}; };
handleClick = (templateLink) => { handleClick = (templateLink) => {
getSceneLoginToken().then(d => { const { token } = this.state;
window.open(templateLink + "&token=" + d); if (!token){
}) getSceneLoginToken().then(d => {
.catch(e => { this.setState({
window.open(templateLink); token: d
}); });
});
}
window.open(templateLink + "&token=" + token);
} }
renderListCards = (cardItems) => { renderListCards = (cardItems) => {
const rows = []; const rows = [];
for (let i = 0; i < cardItems.length; i += 4) { for (let i = 0; i < cardItems.length; i += 4) {
const rowItems = cardItems.slice(i, i + 4); const rowItems = cardItems.slice(i, i + 4);
const cols = rowItems.map((cardItems, index) => ( const cols = rowItems.map((item, index) => (
<Col span={6} key={index}> <Col span={6} key={index}>
<div style={{ margin: 15, display: 'flex', justifyContent: 'center' }}> <div style={{ margin: 15, display: 'flex', justifyContent: 'center' }}>
<button style={{ width: '100%', height: '100%', border: 0, padding: 0 }} onClick={() => this.handleClick(cardItems.templateLink)}> <button style={{ width: '100%', height: '100%', border: 0, padding: 0 }} onClick={() => this.handleClick(cardItems.templateLink)}>
...@@ -108,10 +110,10 @@ class Scene extends Component { ...@@ -108,10 +110,10 @@ class Scene extends Component {
<img alt="example" width="100%" height="100%" style={{ objectFit: 'cover', borderRadius: 10 }} src={cardItems.sketch} /> <img alt="example" width="100%" height="100%" style={{ objectFit: 'cover', borderRadius: 10 }} src={cardItems.sketch} />
</div> </div>
<div style={{ padding: '10px 0px 10px 80px' }}> <div style={{ padding: '10px 0px 10px 80px' }}>
<h2 style={{ textAlign: 'left', margin: 0 }}>{cardItems.templateName}</h2> <h2 style={{ textAlign: 'left', margin: 0 }}>{item.templateName}</h2>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<p style={{ textAlign: 'left', marginTop: '5px', fontSize: '16px' }}> <p style={{ textAlign: 'left', marginTop: '5px', fontSize: '16px' }}>
{cardItems.agencyName} | 热度指数:{cardItems.viewTimes} {item.agencyName} | 热度指数:{item.viewTimes}
</p> </p>
</div> </div>
</div> </div>
...@@ -120,7 +122,7 @@ class Scene extends Component { ...@@ -120,7 +122,7 @@ class Scene extends Component {
</div> </div>
</Col> </Col>
)); ));
rows.push( rows.push(
<Row gutter={16} key={((i + 1) / 4) | 0}> <Row gutter={16} key={((i + 1) / 4) | 0}>
{cols} {cols}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment