Commit dc94f44e authored by wangzhujun's avatar wangzhujun

ba'rbar

parent 084ec15e
...@@ -31,7 +31,7 @@ module.exports = { ...@@ -31,7 +31,7 @@ module.exports = {
"sendCount": 400 "sendCount": 400
} }
], ],
"historyMaxScore": 2259892.7346440405, "historyMaxScore": 1900,
"currentTimestamp": 46409094.17754674, "currentTimestamp": 46409094.17754674,
"actEndTimestamp": 43535651.10143122 "actEndTimestamp": 43535651.10143122
} }
......
...@@ -7,13 +7,42 @@ import modalStore from '@src/store/modal'; ...@@ -7,13 +7,42 @@ import modalStore from '@src/store/modal';
import store from '@src/store'; import store from '@src/store';
import { Button } from '../Button'; import { Button } from '../Button';
const barPoint = [-451, -290, -126]
@observer @observer
class BarItem extends React.Component { class BarItem extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = {
left: -486
}
} }
componentDidUpdate() { componentDidUpdate() {
console.log(this.props,"!@!@!@!@!@!@") console.log(this.props, "!@!@!@!@!@!@")
}
updateLength() {
const { barInfo, nowScore } = this.props;
let left = 0;
if (barInfo && barInfo.length > 0) {
if (nowScore <= barInfo[0].score) {
left = -486
} else if (barInfo[3].score <= nowScore) {
left = 0
} else {
for (let i = 0; i < barInfo.length; i++) {
if (nowScore <= barInfo[i].score) {
let num = nowScore - barInfo[i - 1].score
let length = barInfo[i].score - barInfo[i - 1].score
console.log(i, barInfo[i - 1].score, num, length, "left", "num,length")
left = barPoint[i - 1] + num / length * (i == 3 ? 100 : 113)
break
}
}
}
console.log(left, "left")
return left
}
} }
render() { render() {
...@@ -21,7 +50,11 @@ class BarItem extends React.Component { ...@@ -21,7 +50,11 @@ class BarItem extends React.Component {
return ( return (
<div className="gamebar"> <div className="gamebar">
<span className="bardown"></span> <span className="bardown"></span>
<span className="baron"></span> <div className='barbox'>
<span className="baron" style={{
left: this.updateLength() / 100 + "rem"
}}></span>
</div>
{ {
barInfo?.map((item, index) => { barInfo?.map((item, index) => {
return ( return (
...@@ -32,7 +65,7 @@ class BarItem extends React.Component { ...@@ -32,7 +65,7 @@ class BarItem extends React.Component {
item.receive && <span className="prizebg"></span> item.receive && <span className="prizebg"></span>
} }
<span className="prize">{item.sendCount}青果</span> <span className="prize">{item.sendCount}青果</span>
</div> </div>
) )
}) })
} }
......
...@@ -13,12 +13,19 @@ ...@@ -13,12 +13,19 @@
position: absolute; position: absolute;
.sparkBg("homePahe/bardown.png"); .sparkBg("homePahe/bardown.png");
} }
.baron { .barbox {
width: 486px; width: 486px;
height: 10px; height: 10px;
left: 36px; left: 36px;
top: 69px; top: 69px;
position: absolute; position: absolute;
}
.baron {
width: 486px;
height: 10px;
left: 0px;
top: 0px;
position: absolute;
.sparkBg("homePahe/baron.png"); .sparkBg("homePahe/baron.png");
} }
.boxitem { .boxitem {
......
...@@ -2,6 +2,7 @@ import { PAGE_MAP } from '@src/utils/constants'; ...@@ -2,6 +2,7 @@ import { PAGE_MAP } from '@src/utils/constants';
import { makeAutoObservable } from 'mobx'; 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';
const skinId = GetCurrSkinId() || getCustomShareId(); const skinId = GetCurrSkinId() || getCustomShareId();
...@@ -55,7 +56,7 @@ const store = makeAutoObservable({ ...@@ -55,7 +56,7 @@ const store = makeAutoObservable({
}, },
checkTime(checkEnd = true) { checkTime(checkEnd = true) {
if (store.homeInfo?.actStartTimestamp > store.timeStamp) { if (store.homeInfo?.actStartTimestamp > store.timeStamp) {
Toast("活动未开始") Toasts("活动未开始")
return false return false
} }
if (checkEnd && store.homeInfo?.actEndTimestamp < store.timeStamp) { if (checkEnd && store.homeInfo?.actEndTimestamp < store.timeStamp) {
......
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