Commit ef861fa8 authored by wildfirecode's avatar wildfirecode

1

parent a009714c
import { Data } from "../tw/data/Data"; import { Data } from "../tw/data/Data";
import { NetName } from "../tw/enum/NetName"; import { NetName } from "../tw/enum/NetName";
import showAlertPanel from "./ctrls/showAlertPanel"; import { showToast } from "./ctrls/toastCtrl";
export default (data?: Data, netname?: NetName) => { export default (data?: Data, netname?: NetName) => {
if (!data) { if (!data) {
return showAlertPanel('网络异常\n请隔一段时间再尝试'); return showToast('网络异常\n请隔一段时间再尝试');
} }
if (data.code == 'E999999999')//系统级别错误 系统异常,\n请刷新后重试。 if (data.code == 'E999999999')//系统级别错误 系统异常,\n请刷新后重试。
showAlertPanel('网络异常\n请隔一段时间再尝试'); showToast('网络异常\n请隔一段时间再尝试');
else if (data.code == 'C600004')
showToast('元宝不足哦,快去玩游戏赢元宝吧');
else if (data.code == 'E100201001') else if (data.code == 'E100201001')
showAlertPanel('请登录后重试。') showToast('请登录后重试。')
else if (data.code == 'E100201007') { else if (data.code == 'E100201007') {
showAlertPanel(`对不起\n您的${CFG.unitName}不足`); showToast(`对不起\n您的${CFG.unitName}不足`);
} }
else if (data.code == 'E100202007' || data.code == 'E100202008' || data.code == 'E100202009' || data.code == 'E100202010') else if (data.code == 'E100202007' || data.code == 'E100202008' || data.code == 'E100202009' || data.code == 'E100202010')
showAlertPanel('对不起\n您的次数不足。') showToast('对不起\n您的次数不足。')
else//其他异常 else//其他异常
showAlertPanel('网络异常\n请隔一段时间再尝试') showToast('网络异常\n请隔一段时间再尝试')
} }
// export default (data: Data) => { // export default (data: Data) => {
// if (data.code == 'E999999999') // if (data.code == 'E999999999')
......
...@@ -38,10 +38,12 @@ export default class BloodPanel extends Panel { ...@@ -38,10 +38,12 @@ export default class BloodPanel extends Panel {
NetManager.ins.hc_exchange((success) => { NetManager.ins.hc_exchange((success) => {
this['buyBtn'].enabled = true; this['buyBtn'].enabled = true;
if (success) { if (success) {
showToast('购买成功');
NetManager.ins.hc_home(() => { NetManager.ins.hc_home(() => {
this.updateData(); this.updateData();
SceneCtrl.instance.updateScene(); SceneCtrl.instance.updateScene();
}, window['collectRuleId'])
}, window['collectRuleId']);
} }
}, 1); }, 1);
} }
......
...@@ -3,6 +3,7 @@ import { NetManager } from "../../libs/tw/manager/NetManager"; ...@@ -3,6 +3,7 @@ import { NetManager } from "../../libs/tw/manager/NetManager";
import PropType from "../PropType"; import PropType from "../PropType";
import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl"; import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl";
import { getlogItem } from "../Main"; import { getlogItem } from "../Main";
import { showToast } from "../../libs/new_wx/ctrls/toastCtrl";
export default class Buy1Panel extends Panel { export default class Buy1Panel extends Panel {
buyBtn: eui.Button buyBtn: eui.Button
...@@ -24,6 +25,7 @@ export default class Buy1Panel extends Panel { ...@@ -24,6 +25,7 @@ export default class Buy1Panel extends Panel {
this.buyBtn.enabled = true; this.buyBtn.enabled = true;
if (success) { if (success) {
this.hidePanel(); this.hidePanel();
showToast('购买成功');
NetManager.ins.hc_home(() => { NetManager.ins.hc_home(() => {
SceneCtrl.instance.updateScene(); SceneCtrl.instance.updateScene();
}, window['collectRuleId']); }, window['collectRuleId']);
......
...@@ -3,6 +3,7 @@ import { NetManager } from "../../libs/tw/manager/NetManager"; ...@@ -3,6 +3,7 @@ import { NetManager } from "../../libs/tw/manager/NetManager";
import PropType from "../PropType"; import PropType from "../PropType";
import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl"; import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl";
import { getlogItem } from "../Main"; import { getlogItem } from "../Main";
import { showToast } from "../../libs/new_wx/ctrls/toastCtrl";
export default class Buy2Panel extends Panel { export default class Buy2Panel extends Panel {
start(data) { start(data) {
...@@ -20,6 +21,7 @@ export default class Buy2Panel extends Panel { ...@@ -20,6 +21,7 @@ export default class Buy2Panel extends Panel {
this.buyBtn.enabled = false; this.buyBtn.enabled = false;
NetManager.ins.hc_exchange((success) => { NetManager.ins.hc_exchange((success) => {
this.buyBtn.enabled = true; this.buyBtn.enabled = true;
showToast('购买成功');
if (success) { if (success) {
this.hidePanel(); this.hidePanel();
NetManager.ins.hc_home(() => { NetManager.ins.hc_home(() => {
......
...@@ -3,6 +3,7 @@ import { NetManager } from "../../libs/tw/manager/NetManager"; ...@@ -3,6 +3,7 @@ import { NetManager } from "../../libs/tw/manager/NetManager";
import PropType from "../PropType"; import PropType from "../PropType";
import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl"; import SceneCtrl from "../../libs/new_wx/ctrls/sceneCtrl";
import { getlogItem } from "../Main"; import { getlogItem } from "../Main";
import { showToast } from "../../libs/new_wx/ctrls/toastCtrl";
export default class Buy3Panel extends Panel { export default class Buy3Panel extends Panel {
start(data) { start(data) {
...@@ -20,6 +21,7 @@ export default class Buy3Panel extends Panel { ...@@ -20,6 +21,7 @@ export default class Buy3Panel extends Panel {
NetManager.ins.clickLog(getlogItem(14)); NetManager.ins.clickLog(getlogItem(14));
this.buyBtn.enabled = false; this.buyBtn.enabled = false;
NetManager.ins.hc_exchange((success) => { NetManager.ins.hc_exchange((success) => {
showToast('购买成功');
this.buyBtn.enabled = true; this.buyBtn.enabled = true;
if (success) { if (success) {
this.hidePanel(); this.hidePanel();
......
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