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

1

parent a3a2668d
...@@ -13,6 +13,8 @@ import Utils from "../../Utils"; ...@@ -13,6 +13,8 @@ import Utils from "../../Utils";
import { loadSvga } from "../../loadSvga"; import { loadSvga } from "../../loadSvga";
import getResPath from "../../../libs/new_tc/getResPath"; import getResPath from "../../../libs/new_tc/getResPath";
import wait from "../../../libs/new_tc/wait"; import wait from "../../../libs/new_tc/wait";
import tr = egret.sys.tr;
import { showToast } from "../../../libs/new_wx/ctrls/toastCtrl";
// export const loadTurntableSvga = (callback) => { // export const loadTurntableSvga = (callback) => {
// loadSvga(getResPath() + 'resource/assets/svgas/turntable.svga').then(async (mv: any) => { // loadSvga(getResPath() + 'resource/assets/svgas/turntable.svga').then(async (mv: any) => {
// // await wait(100); // // await wait(100);
...@@ -52,8 +54,6 @@ export default class Turntable extends Panel { ...@@ -52,8 +54,6 @@ export default class Turntable extends Panel {
this["closeBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this); this["closeBtn"].addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this);
this.start_btn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapStart, this); this.start_btn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapStart, this);
this.rulebtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapRulebtn, 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() { onTouchTap_closeBtn() {
...@@ -64,8 +64,7 @@ export default class Turntable extends Panel { ...@@ -64,8 +64,7 @@ export default class Turntable extends Panel {
super.removeEvents(); super.removeEvents();
this["closeBtn"].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this); this["closeBtn"].removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this);
this.start_btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapStart, this); this.start_btn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapStart, this);
GDispatcher.removeEvent('queryPrize', this.queryPrize, this); this.rulebtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTapRulebtn, this);
GDispatcher.removeEvent('panelEffect', this.panelEffect, this);
} }
onTapRulebtn() { onTapRulebtn() {
...@@ -75,7 +74,8 @@ export default class Turntable extends Panel { ...@@ -75,7 +74,8 @@ export default class Turntable extends Panel {
onTapStart() { onTapStart() {
this.setBtnTouch(false); // 锁定按钮 this.setBtnTouch(false); // 锁定按钮
Loading.instace.show(); Loading.instace.show();
GDispatcher.dispatchEvent('queryPrize'); this['container2'].visible = false;
this.queryPrize();
} }
updateIcon() { updateIcon() {
...@@ -100,23 +100,44 @@ export default class Turntable extends Panel { ...@@ -100,23 +100,44 @@ export default class Turntable extends Panel {
*/ */
private doJoin() { private doJoin() {
try { try {
if (window['getRST']) window['getRST'](); if(window['getRST']) window['getRST']();
} catch (error) { } catch(error) {
console.warn(error) console.warn(error)
} }
NetManager.ins.hc_turnableDojoin((success, res) => { NetManager.ins.hc_turnableDojoin((success, res) => {
Loading.instace.hide(); Loading.instace.hide();
if(!success) { // if(!success) {
return; // return;
} // }
const data = res.data; const data = res.data;
this.rotateByPrize(data.option.categoryType, () => { const code = res.code;
let id = data.option.categoryType;
//1换个姿势再来一次2 奖励溜走了3 离奖励只差一毫米 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(); this.updateIcon();
loadSvga(getResPath() + 'resource/assets/svgas/turnprize.svga').then(async (mv: any) => { loadSvga(getResPath() + 'resource/assets/svgas/turnprize.svga').then(async (mv: any) => {
...@@ -126,11 +147,8 @@ export default class Turntable extends Panel { ...@@ -126,11 +147,8 @@ export default class Turntable extends Panel {
PanelCtrl.instance.show('TurnPrize2Panel', _data); PanelCtrl.instance.show('TurnPrize2Panel', _data);
}); });
} else if(!data.option) { } else if(!data.option) {
PanelCtrl.instance.show("TurntableNoPrizePanel"); PanelCtrl.instance.show("TurntableNoPrizePanel", {type: 3});
} else {
} }
}); });
}) })
} }
......
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