Commit 332fcc7e authored by 邱旭's avatar 邱旭

1

parent 546965c3
...@@ -3,6 +3,8 @@ import { NetManager } from "../../../libs/tw/manager/NetManager"; ...@@ -3,6 +3,8 @@ import { NetManager } from "../../../libs/tw/manager/NetManager";
import PanelCtrl from "../../../libs/new_wx/ctrls/panelCtrl"; import PanelCtrl from "../../../libs/new_wx/ctrls/panelCtrl";
import { loadSvga } from "../../loadSvga"; import { loadSvga } from "../../loadSvga";
import getResPath from "../../../libs/new_tc/getResPath"; import getResPath from "../../../libs/new_tc/getResPath";
import getHomeData from "../../getHomeData";
import { GDispatcher } from "../../../libs/tc/util/GDispatcher";
// import { loadTurntableSvga } from "../../panels/TurntablePanel/Turntable"; // import { loadTurntableSvga } from "../../panels/TurntablePanel/Turntable";
export default class TurntableIcon extends IconBase { export default class TurntableIcon extends IconBase {
...@@ -12,13 +14,31 @@ export default class TurntableIcon extends IconBase { ...@@ -12,13 +14,31 @@ export default class TurntableIcon extends IconBase {
protected start() { protected start() {
super.start(); super.start();
//有免费次数 //有免费次数
//没有免费次数 //没有免费次数
//如果元宝足够 //如果元宝足够
this.updateIcon();
}
updateIcon(){
NetManager.ins.hc_turnableBaseInfo((success, res)=>{
if(!success){
return;
}
let data = res.data;
if (data.remainTimes > 0 || (getHomeData().wealth > data.nextTimeNeedCoin)) {
this.tipsVisible = true;
this.iconTips.text = "有优惠"
} else {
this.tipsVisible = false;
}
})
} }
protected initEvents() { protected initEvents() {
super.initEvents(); super.initEvents();
GDispatcher.addEvent('updateTurntableIcon', this.updateIcon, this);
} }
protected onTouchBtn(e: egret.TouchEvent) { protected onTouchBtn(e: egret.TouchEvent) {
...@@ -31,6 +51,7 @@ export default class TurntableIcon extends IconBase { ...@@ -31,6 +51,7 @@ export default class TurntableIcon extends IconBase {
protected removeEvents() { protected removeEvents() {
super.removeEvents(); super.removeEvents();
GDispatcher.removeEvent('updateTurntableIcon', this.updateIcon, this);
} }
protected destory() { protected destory() {
......
...@@ -117,6 +117,9 @@ export default class Turntable extends Panel { ...@@ -117,6 +117,9 @@ export default class Turntable extends Panel {
// if(!success) { // if(!success) {
// return; // return;
// } // }
GDispatcher.dispatchEvent('updateTurntableIcon'); // 更新icon
const data = res.data; const data = res.data;
const code = res.code; const code = res.code;
let id = data.option.categoryType; let id = data.option.categoryType;
...@@ -296,6 +299,6 @@ export default class Turntable extends Panel { ...@@ -296,6 +299,6 @@ export default class Turntable extends Panel {
} }
}); });
console.log(RotaryData); // console.log(RotaryData);
} }
} }
\ 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