Commit 6a6cdeb4 authored by wildfirecode's avatar wildfirecode

1

parent 92cecba8
......@@ -34,10 +34,19 @@ export default class HbCutTime extends Panel {
this.ok_btn.anchorOffsetY = 52;
}
private hbRainBaseInfo() {
getData():any{
return new Promise((r)=>{
NetManager.ins.hbRainBaseInfo((success, res) => {
r(res);
});
});
}
private hbRainBaseInfo(updateData?) {
const success = this.data.res.success;
const res = this.data.res;
const data = this.data.res.data;
const res = updateData ||this.data.res;
const data = (updateData && updateData.data) || this.data.res.data;
if(updateData && updateData.data)
this.data.res=updateData;
if(!success) {
this.ok_btn.source = 'hbCutTime_btn_soon_png';
......@@ -45,11 +54,16 @@ export default class HbCutTime extends Panel {
this.ok_btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchOK, this);
return;
}
this.cutTimer = new CutTimer(this.cutTimeLabel, 'hh时mm分ss秒', () => {
this.hidePanel();
this.cutTimer = this.cutTimer || new CutTimer(this.cutTimeLabel, 'hh时mm分ss秒', async () => {
const getData = await this.getData(); //重新获取数据
if(getData.success) {
this.hbRainBaseInfo(getData);
}else {
this.hidePanel(); //没有数据关闭窗口
}
GDispatcher.dispatchEvent('updateHbRainIcon');
});
let sysTime = res.timestamp; // 当前系统时间
const sysTime = res.timestamp; // 当前系统时间
let time;
if(data.currentSession) {
time = data.currentSession.endTime - sysTime + 3000;
......@@ -68,6 +82,8 @@ export default class HbCutTime extends Panel {
this.cutTimer.start(time);
}
} else if(data.nextSession) {
egret.Tween.removeTweens(this.ok_btn);
this.ok_btn.scaleX=this.ok_btn.scaleY=1;
time = data.nextSession.startTime - sysTime + 3000;
this.ok_btn.source = 'hbCutTime_btn_soon_png';
this.ok_btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchOK, this);
......
......@@ -2,13 +2,19 @@
"success": true,
"code": "0000000000",
"desc": "OK",
"timestamp": 1573206010193,
"timestamp": 1573440905952,
"data": {
"currentRemainTimes": 0,
"currentSession": {
"sessionIndex": 10,
"startTime": 1573210800000,
"endTime": 1573212600000,
"endTime": 1573440915952,
"limitScore": 10
},
"nextSession": {
"sessionIndex": 10,
"startTime": 1573440915952,
"endTime": 1573440915952,
"limitScore": 10
},
"canJoin": true
......
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