Commit 9473bd5e authored by 邱旭's avatar 邱旭

1

parent a3a2668d
......@@ -13,6 +13,8 @@ import Utils from "../../Utils";
import { loadSvga } from "../../loadSvga";
import getResPath from "../../../libs/new_tc/getResPath";
import wait from "../../../libs/new_tc/wait";
import tr = egret.sys.tr;
import { showToast } from "../../../libs/new_wx/ctrls/toastCtrl";
// export const loadTurntableSvga = (callback) => {
// loadSvga(getResPath() + 'resource/assets/svgas/turntable.svga').then(async (mv: any) => {
// // await wait(100);
......@@ -52,8 +54,6 @@ export default class Turntable extends Panel {
this["closeBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this);
this.start_btn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapStart, this);
this.rulebtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapRulebtn, this);
GDispatcher.addEvent('queryPrize', this.queryPrize, this);
GDispatcher.addEvent('panelEffect', this.panelEffect, this);
}
onTouchTap_closeBtn() {
......@@ -64,8 +64,7 @@ export default class Turntable extends Panel {
super.removeEvents();
this["closeBtn"].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this);
this.start_btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapStart, this);
GDispatcher.removeEvent('queryPrize', this.queryPrize, this);
GDispatcher.removeEvent('panelEffect', this.panelEffect, this);
this.rulebtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapRulebtn, this);
}
onTapRulebtn() {
......@@ -75,7 +74,8 @@ export default class Turntable extends Panel {
onTapStart() {
this.setBtnTouch(false); // 锁定按钮
Loading.instace.show();
GDispatcher.dispatchEvent('queryPrize');
this['container2'].visible = false;
this.queryPrize();
}
updateIcon() {
......@@ -100,23 +100,44 @@ export default class Turntable extends Panel {
*/
private doJoin() {
try {
if (window['getRST']) window['getRST']();
} catch (error) {
if(window['getRST']) window['getRST']();
} catch(error) {
console.warn(error)
}
NetManager.ins.hc_turnableDojoin((success, res) => {
Loading.instace.hide();
if(!success) {
return;
}
// if(!success) {
// return;
// }
const data = res.data;
this.rotateByPrize(data.option.categoryType, () => {
//1换个姿势再来一次2 奖励溜走了3 离奖励只差一毫米
//抽奖结束
const code = res.code;
let id = data.option.categoryType;
if(data.isScratchCard) {
id = "scratch";
} else if(!success || !data.option) {
id = "thanks";
}
this.rotateByPrize(id, () => {
if(!success) {
switch(true) {
case (code == "600051"): // 元宝不足
showToast("元宝不足咯~快去闯关赢元宝吧");
this.hidePanel();
break;
case (code == "600015"): // 命中风控参与规则
PanelCtrl.instance.show("TurntableNoPrizePanel", {type: 1});
break;
case (code == "600016"): // 苏宁风控 命中
PanelCtrl.instance.show("TurntableNoPrizePanel", {type: 1});
break;
default:
break;
}
return;
}
if(data.isScratchCard && data.option) { // 刮刮卡
if(data.isScratchCard) { // 刮刮卡
//如果是刮刮卡类型
this.updateIcon();
loadSvga(getResPath() + 'resource/assets/svgas/turnprize.svga').then(async (mv: any) => {
......@@ -126,11 +147,8 @@ export default class Turntable extends Panel {
PanelCtrl.instance.show('TurnPrize2Panel', _data);
});
} else if(!data.option) {
PanelCtrl.instance.show("TurntableNoPrizePanel");
} else {
PanelCtrl.instance.show("TurntableNoPrizePanel", {type: 3});
}
});
})
}
......
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