Commit 6a6cdeb4 authored by wildfirecode's avatar wildfirecode

1

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