Commit d8911132 authored by wangzhujun's avatar wangzhujun

bar

parent 28070c04
...@@ -46,9 +46,9 @@ class BarItem extends React.Component { ...@@ -46,9 +46,9 @@ class BarItem extends React.Component {
} }
render() { render() {
const { barInfo } = this.props; const { barInfo, left, top, scaleNum } = this.props;
return ( return (
<div className="gamebar"> <div className="gamebar" style={{ left: left / 100 + "rem", top: top / 100 + "rem", transform: `scale(${scaleNum})` }}>
<span className="bardown"></span> <span className="bardown"></span>
<div className='barbox'> <div className='barbox'>
<span className="baron" style={{ <span className="baron" style={{
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
.gamebar { .gamebar {
width: 571px; width: 571px;
height: 140px; height: 140px;
left: 88px; left: 0px;
top: 361px; top: 0px;
position: absolute; position: absolute;
.bardown { .bardown {
width: 522px; width: 522px;
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
left: 36px; left: 36px;
top: 69px; top: 69px;
position: absolute; position: absolute;
overflow: hidden;
} }
.baron { .baron {
width: 486px; width: 486px;
......
...@@ -5,13 +5,15 @@ import { observer } from 'mobx-react'; ...@@ -5,13 +5,15 @@ import { observer } from 'mobx-react';
import './successpop.less'; import './successpop.less';
import modalStore from '@src/store/modal'; import modalStore from '@src/store/modal';
import { Button } from '../Button'; import { Button } from '../Button';
import BarItem from '../barItem/barItem';
import store from '@src/store';
@observer @observer
class Successpop extends React.Component { class Successpop extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
} }
closePop(){ closePop() {
modalStore.closePop("Successpop") modalStore.closePop("Successpop")
} }
render() { render() {
...@@ -21,7 +23,8 @@ class Successpop extends React.Component { ...@@ -21,7 +23,8 @@ class Successpop extends React.Component {
<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> */}
<BarItem left={-10} top={20} scaleNum={0.95} barInfo={store.homeInfo?.boxInfo} nowScore={this.props.popData.score}></BarItem>
</div> </div>
<Button className="btn" onClick={this.closePop}></Button> <Button className="btn" onClick={this.closePop}></Button>
<span className="score"><p>本次我赚了{this.props.popData.score}</p><p>获得{this.props.popData.sendCount}青果</p></span> <span className="score"><p>本次我赚了{this.props.popData.score}</p><p>获得{this.props.popData.sendCount}青果</p></span>
......
...@@ -17,6 +17,13 @@ class Homepahe extends React.Component { ...@@ -17,6 +17,13 @@ class Homepahe extends React.Component {
} }
componentDidMount() { componentDidMount() {
store.getIndexInfo() store.getIndexInfo()
let data = {
boxId: 2,
score: 600,
sendCount: 500
}
// modalStore.pushPop("Failpop",data)
modalStore.pushPop("Successpop", data)
} }
click_Rule() { click_Rule() {
if (!store.checkTime(false)) { if (!store.checkTime(false)) {
...@@ -59,7 +66,7 @@ class Homepahe extends React.Component { ...@@ -59,7 +66,7 @@ class Homepahe extends React.Component {
</div> </div>
} }
<span className="gamebarbg"></span> <span className="gamebarbg"></span>
<BarItem barInfo={store.homeInfo?.boxInfo} nowScore={store.homeInfo.historyMaxScore}></BarItem> <BarItem left={88} top={361} scaleNum={1} barInfo={store.homeInfo?.boxInfo} nowScore={store.homeInfo.historyMaxScore}></BarItem>
<Button className="startbtn" onClick={this.click_StartBtn}></Button> <Button className="startbtn" onClick={this.click_StartBtn}></Button>
<span className="title"></span> <span className="title"></span>
<Button className="rule" onClick={this.click_Rule}></Button> <Button className="rule" onClick={this.click_Rule}></Button>
......
...@@ -3,6 +3,7 @@ import { makeAutoObservable } from 'mobx'; ...@@ -3,6 +3,7 @@ import { makeAutoObservable } from 'mobx';
import API from '../api/index'; import API from '../api/index';
import { GetCurrSkinId, getCustomShareId } from "@src/utils/utils"; import { GetCurrSkinId, getCustomShareId } from "@src/utils/utils";
import { Toast } from '@spark/ui'; import { Toast } from '@spark/ui';
import modalStore from './modal';
const skinId = GetCurrSkinId() || getCustomShareId(); const skinId = GetCurrSkinId() || getCustomShareId();
...@@ -45,8 +46,8 @@ const store = makeAutoObservable({ ...@@ -45,8 +46,8 @@ const store = makeAutoObservable({
this.frontVariable = data || {}; this.frontVariable = data || {};
console.log('前端开发配置', data) console.log('前端开发配置', data)
}, },
timeStamp:'', timeStamp: '',
homeInfo:{}, homeInfo: {},
async getIndexInfo() { async getIndexInfo() {
const { success, data } = await API.indexInfo() const { success, data } = await API.indexInfo()
if (success && data) { if (success && data) {
...@@ -65,13 +66,17 @@ const store = makeAutoObservable({ ...@@ -65,13 +66,17 @@ const store = makeAutoObservable({
} }
return true return true
}, },
startInfo:{}, startInfo: {},
async startGame(){ async startGame() {
const { success, data } = await API.startGame() const { success, data } = await API.startGame()
if(success){ if (success) {
this.startInfo = data this.startInfo = data
// TODO 游戏页面 // TODO 游戏页面
} }
},
updateScore() {
// modalStore.pushPop("Successpop", data)
// modalStore.pushPop("Failpop", data)
} }
}) })
......
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