Commit 02a93b8c authored by zjz1994's avatar zjz1994

签到页面

parent 30f3e802
......@@ -59,7 +59,6 @@ export default class SignItem extends eui.ItemRenderer {
NetManager.ins.showLog(getlogItem(22));
}
console.log(this.data);
this['btn1'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
this.data.func(this.data.index, this)
}, this);
......
......@@ -9,11 +9,13 @@ import wait from "../../libs/new_tc/wait";
import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
import { getlogItem } from "../Main";
import {hortileLayout} from "../layout/hortileLayout";
import Utils from "../Utils";
export default class SignPanel extends Panel {
list: eui.List;
scroll: eui.Scroller;
signidx:number=-1;
signdata:Array<any> = [];
async start(data) {
super.start();
......@@ -68,7 +70,7 @@ export default class SignPanel extends Panel {
item.setSinged();
// showToast('签到成功!快去闯关吧~');
// PanelCtrl.instance.show('signPrize');
PanelCtrl.instance.addToShowPanels('signPrize');
// PanelCtrl.instance.addToShowPanels('signPrize');
wait(200).then(() => {
NetManager.ins.hc_home(() => {
updateMainTimer();
......@@ -107,6 +109,8 @@ export default class SignPanel extends Panel {
} else
ele.btn = 4;
});
this.signdata = Utils.deepClone(list);
this.list.dataProvider = new eui.ArrayCollection(list);
this.list.useVirtualLayout = false;
......@@ -217,12 +221,60 @@ export default class SignPanel extends Panel {
initEvents(){
super.initEvents();
this["closeBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this);
// this['close2Btn'].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this);
this["btn1"].addEventListener(egret.TouchEvent.TOUCH_TAP, this.signToday, this);
}
signToday(){
console.log(this.signidx);
console.log(this.list);
if(this.signidx!=-1){
try {
if (window['getRST']) window['getRST']();
} catch (error) {
console.warn(error)
}
this["btn1"].enabled = false;
NetManager.ins.doSign((s)=>{
NetManager.ins.clickLog(getlogItem(22));
this["btn1"].enabled = true;
var signidx = this.signidx;
this.signidx = -1;
wait(300).then(() => {
NetManager.ins.getSignInfo(() => {
SceneCtrl.instance.updateScene();
}, window['signActivityId']);
});
if (s) {
const { customInfo, success } = DataManager.ins.getData('dosign');
if (!success || !customInfo.success || customInfo.prizeType == 'none') {
if (customInfo.code == 100004) {
showToast('哎呀,奖励擦肩而过!明天再来试试吧!');
} else {
showToast('哎呀,奖励擦肩而过!');
}
return;
}
this.signdata[signidx].signed = true;
this.signdata[signidx].btn = 2;
this.list.dataProvider = new eui.ArrayCollection(this.signdata);
// showToast('签到成功!快去闯关吧~');
// PanelCtrl.instance.show('signPrize');
// PanelCtrl.instance.addToShowPanels('signPrize');
wait(200).then(() => {
NetManager.ins.hc_home(() => {
updateMainTimer();
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
});
} else {
showToast('哎呀,奖励擦肩而过!');
}
this.hidePanel();
},window["signActivityId"]);
}
}
removeEvents(){
super.removeEvents();
this["closeBtn"].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this);
this["btn1"].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.signToday, this);
}
}
\ No newline at end of file
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