Commit d1f1ba3d authored by wangzhujun's avatar wangzhujun

还差进度条

parent 44702ca3
...@@ -37,6 +37,8 @@ const API = generateAPI({ ...@@ -37,6 +37,8 @@ const API = generateAPI({
uri: "home/buriedPoint.do", uri: "home/buriedPoint.do",
showMsg: false, showMsg: false,
}, },
indexInfo:'main/index.do',
startGame:'main/start.do',
}) })
......
...@@ -3,20 +3,30 @@ ...@@ -3,20 +3,30 @@
import React from 'react'; import React from 'react';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import './failpop.less'; import './failpop.less';
import modalStore from '@src/store/modal';
import store from '@src/store';
import { Button } from '../Button';
@observer @observer
class Failpop extends React.Component { class Failpop extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
} }
closePop() {
modalStore.closePop()
}
async restartGame() {
await store.startGame();
modalStore.closePop()
}
render() { render() {
return ( return (
<div className="failpop modal_center"> <div className="failpop modal_center">
<span className="bg"></span> <span className="bg"></span>
<span className="close"></span> <Button className="close" onClick={this.closePop}></Button>
<span className="lab">本次我赚了xxxx</span> <span className="lab">本次我赚了{this.props.popData.score}</span>
<span className="goonbtn"></span> <Button className="goonbtn" onClick={this.restartGame}></Button>
<span className="endbtn"></span> <Button className="endbtn" onClick={this.closePop}></Button>
</div> </div>
); );
} }
......
...@@ -22,10 +22,11 @@ ...@@ -22,10 +22,11 @@
.sparkBg("failPop/close.png"); .sparkBg("failPop/close.png");
} }
.lab { .lab {
width: 259px; width: 651px;
height: 33px; height: 33px;
left: 253px; left: 49px;
top: 712px; top: 712px;
text-align: center;
position: absolute; position: absolute;
font-size: 34px; font-size: 34px;
line-height: 33px; line-height: 33px;
......
...@@ -3,23 +3,28 @@ ...@@ -3,23 +3,28 @@
import React from 'react'; import React from 'react';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import './successpop.less'; import './successpop.less';
import modalStore from '@src/store/modal';
import { Button } from '../Button';
@observer @observer
class Successpop extends React.Component { class Successpop extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
} }
closePop(){
modalStore.closePop("Successpop")
}
render() { render() {
return ( return (
<div className="successpop modal_center"> <div className="successpop modal_center">
<span className="close"></span> <Button className="close" onClick={this.closePop}></Button>
<span className="bg"></span> <span className="bg"></span>
<div className="barbox"> <div className="barbox">
<span className="barbg"></span> <span className="barbg"></span>
<span className="bar"></span> <span className="bar"></span>
</div> </div>
<span className="btn"></span> <Button className="btn" onClick={this.closePop}></Button>
<span className="score">本次我赚了xxxx 获得200青果</span> <span className="score"><p>本次我赚了{this.props.popData.score}</p><p>获得{this.props.popData.sendCount}青果</p></span>
</div> </div>
); );
} }
......
...@@ -53,10 +53,11 @@ ...@@ -53,10 +53,11 @@
.sparkBg("successPop/btn.png"); .sparkBg("successPop/btn.png");
} }
.score { .score {
width: 259px; width: 651px;
height: 76px; height: 76px;
left: 253px; left: 49px;
top: 596px; top: 596px;
text-align: center;
position: absolute; position: absolute;
font-size: 34px; font-size: 34px;
color: rgba(255, 255, 255, 1); color: rgba(255, 255, 255, 1);
......
...@@ -4,15 +4,44 @@ import React from 'react'; ...@@ -4,15 +4,44 @@ import React from 'react';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import './homepahe.less'; import './homepahe.less';
import modalStore from '@src/store/modal'; import modalStore from '@src/store/modal';
import { Button } from '@src/components/Button';
import store from '@src/store';
import { PAGE_MAP } from '@src/utils/constants';
import { Toast } from '@spark/ui';
@observer @observer
class Homepahe extends React.Component { class Homepahe extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
} }
click_Rule(){ click_Rule() {
if (!store.checkTime(false)) {
return
}
modalStore.pushPop("Rulepop") modalStore.pushPop("Rulepop")
} }
click_Rank() {
if (!store.checkTime(false)) {
return
}
store.changePage(PAGE_MAP.RANK_PAGE)
}
click_Detail() {
if (!store.checkTime(false)) {
return
}
store.changePage(PAGE_MAP.DETAIL_PAGE)
}
click_StartBtn() {
if (!store.checkTime()) {
return
}
// TODO 成长值没有
// if(store.userInfo.growthValue < 100){
// Toast("成长值不足,无法参与游戏")
// }
store.startGame()
}
render() { render() {
return ( return (
<div className="homepahe modal_center"> <div className="homepahe modal_center">
...@@ -20,7 +49,7 @@ class Homepahe extends React.Component { ...@@ -20,7 +49,7 @@ class Homepahe extends React.Component {
<span className="show"></span> <span className="show"></span>
<div className="infobox"> <div className="infobox">
<span className="infobg"></span> <span className="infobg"></span>
<span className="lab">我最高赚了xxxx</span> <span className="lab">我最高赚了{store.homeInfo.historyMaxScore}</span>
</div> </div>
<span className="gamebarbg"></span> <span className="gamebarbg"></span>
<div className="gamebar"> <div className="gamebar">
...@@ -44,11 +73,11 @@ class Homepahe extends React.Component { ...@@ -44,11 +73,11 @@ class Homepahe extends React.Component {
<span className="box3"></span> <span className="box3"></span>
<span className="box4"></span> <span className="box4"></span>
</div> </div>
<span className="startbtn"></span> <Button className="startbtn" onClick={this.click_StartBtn}></Button>
<span className="title"></span> <span className="title"></span>
<span className="rule" onClick={this.click_Rule}></span> <Button className="rule" onClick={this.click_Rule}></Button>
<span className="rank"></span> <Button className="rank" onClick={this.click_Rank}></Button>
<span className="detail"></span> <Button className="detail" onClick={this.click_Detail}></Button>
</div> </div>
); );
} }
......
...@@ -43,6 +43,35 @@ const store = makeAutoObservable({ ...@@ -43,6 +43,35 @@ const store = makeAutoObservable({
const { data } = await API.getFrontVariable(); const { data } = await API.getFrontVariable();
this.frontVariable = data || {}; this.frontVariable = data || {};
console.log('前端开发配置', data) console.log('前端开发配置', data)
},
timeStamp:'',
homeInfo:{},
async getIndexInfo() {
const { success, data } = await API.indexInfo()
if (success && data) {
this.timeStamp = data.currentTimestamp
this.homeInfo = data
}
},
checkTime(checkEnd = true) {
if (store.homeInfo?.actStartTimestamp > store.timeStamp) {
Toast("活动未开始")
return false
}
if (checkEnd && store.homeInfo?.actEndTimestamp < store.timeStamp) {
Toast("活动已结束")
return false
} }
return true
},
startInfo:{},
async startGame(){
const { success, data } = await API.startGame()
if(success){
this.startInfo = data
// TODO 游戏页面
}
}
}) })
export default store; export default store;
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