Commit d1f1ba3d authored by wangzhujun's avatar wangzhujun

还差进度条

parent 44702ca3
......@@ -37,6 +37,8 @@ const API = generateAPI({
uri: "home/buriedPoint.do",
showMsg: false,
},
indexInfo:'main/index.do',
startGame:'main/start.do',
})
......
......@@ -3,20 +3,30 @@
import React from 'react';
import { observer } from 'mobx-react';
import './failpop.less';
import modalStore from '@src/store/modal';
import store from '@src/store';
import { Button } from '../Button';
@observer
class Failpop extends React.Component {
constructor(props) {
super(props);
}
closePop() {
modalStore.closePop()
}
async restartGame() {
await store.startGame();
modalStore.closePop()
}
render() {
return (
<div className="failpop modal_center">
<span className="bg"></span>
<span className="close"></span>
<span className="lab">本次我赚了xxxx</span>
<span className="goonbtn"></span>
<span className="endbtn"></span>
<Button className="close" onClick={this.closePop}></Button>
<span className="lab">本次我赚了{this.props.popData.score}</span>
<Button className="goonbtn" onClick={this.restartGame}></Button>
<Button className="endbtn" onClick={this.closePop}></Button>
</div>
);
}
......
......@@ -22,10 +22,11 @@
.sparkBg("failPop/close.png");
}
.lab {
width: 259px;
width: 651px;
height: 33px;
left: 253px;
left: 49px;
top: 712px;
text-align: center;
position: absolute;
font-size: 34px;
line-height: 33px;
......
......@@ -3,23 +3,28 @@
import React from 'react';
import { observer } from 'mobx-react';
import './successpop.less';
import modalStore from '@src/store/modal';
import { Button } from '../Button';
@observer
class Successpop extends React.Component {
constructor(props) {
super(props);
}
closePop(){
modalStore.closePop("Successpop")
}
render() {
return (
<div className="successpop modal_center">
<span className="close"></span>
<Button className="close" onClick={this.closePop}></Button>
<span className="bg"></span>
<div className="barbox">
<span className="barbg"></span>
<span className="bar"></span>
</div>
<span className="btn"></span>
<span className="score">本次我赚了xxxx 获得200青果</span>
<Button className="btn" onClick={this.closePop}></Button>
<span className="score"><p>本次我赚了{this.props.popData.score}</p><p>获得{this.props.popData.sendCount}青果</p></span>
</div>
);
}
......
......@@ -53,10 +53,11 @@
.sparkBg("successPop/btn.png");
}
.score {
width: 259px;
width: 651px;
height: 76px;
left: 253px;
left: 49px;
top: 596px;
text-align: center;
position: absolute;
font-size: 34px;
color: rgba(255, 255, 255, 1);
......
......@@ -4,15 +4,44 @@ import React from 'react';
import { observer } from 'mobx-react';
import './homepahe.less';
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
class Homepahe extends React.Component {
constructor(props) {
super(props);
}
click_Rule(){
click_Rule() {
if (!store.checkTime(false)) {
return
}
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() {
return (
<div className="homepahe modal_center">
......@@ -20,7 +49,7 @@ class Homepahe extends React.Component {
<span className="show"></span>
<div className="infobox">
<span className="infobg"></span>
<span className="lab">我最高赚了xxxx</span>
<span className="lab">我最高赚了{store.homeInfo.historyMaxScore}</span>
</div>
<span className="gamebarbg"></span>
<div className="gamebar">
......@@ -44,11 +73,11 @@ class Homepahe extends React.Component {
<span className="box3"></span>
<span className="box4"></span>
</div>
<span className="startbtn"></span>
<Button className="startbtn" onClick={this.click_StartBtn}></Button>
<span className="title"></span>
<span className="rule" onClick={this.click_Rule}></span>
<span className="rank"></span>
<span className="detail"></span>
<Button className="rule" onClick={this.click_Rule}></Button>
<Button className="rank" onClick={this.click_Rank}></Button>
<Button className="detail" onClick={this.click_Detail}></Button>
</div>
);
}
......
......@@ -43,6 +43,35 @@ const store = makeAutoObservable({
const { data } = await API.getFrontVariable();
this.frontVariable = 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;
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