Commit 66c730f0 authored by 邱旭's avatar 邱旭

1

parent 6f00a0d1
......@@ -84,6 +84,8 @@ export enum NetName {
SCRATCH_DOHELP,
HBRAIN_BASEINFO,
GET_TASKINFO,
EXCHANGE_COIN,
GET_CLOUD_NUM,
}
\ No newline at end of file
This diff is collapsed.
......@@ -3,6 +3,7 @@ import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
import { NetManager } from "../../libs/tw/manager/NetManager";
import { getlogItem } from "../Main";
import Utils from "../Utils";
import { showToast } from "../../libs/new_wx/ctrls/toastCtrl";
const MIN: number = 1;
const MAX: number = 100;
......@@ -24,7 +25,7 @@ export default class RechargePanel extends Panel {
private nowNumber: number = MIN; // 当前显示的数值
// private totalNum:number = 0; // 总共的数值
private totalNum: number = 0; // 总共的数值
private holdTimer = null;
private setNumTimer = null;
......@@ -134,7 +135,29 @@ export default class RechargePanel extends Panel {
private onTouchBtn(e: egret.TouchEvent) {
/// TODO 发接口兑换
NetManager.ins.clickLog(getlogItem(73));
PanelCtrl.instance.show('Shop');
if(this.nowNumber * 10 > this.totalNum) {
showToast('抱歉,您的云钻不足哦');
return;
}
this.btn.touchEnabled = false;
try {
if(window['getRST']) window['getRST']();
} catch(error) {
console.warn(error)
}
NetManager.ins.exchangeCoin((success, res) => {
this.btn.touchEnabled = true;
if(!success) {
showToast('网络开小差啦,请稍后再试');
return;
}
const data = res.data;
showToast('兑换成功,继续闯关吧');
PanelCtrl.instance.show('Shop');
NetManager.ins.hc_home(() => {
}, window['collectRuleId']);
}, this.nowNumber);
}
onTouchTap_closeBtn() {
......@@ -145,6 +168,14 @@ export default class RechargePanel extends Panel {
private getYunZuan() {
/// TODO 通过接口获取云钻数量并显示
this.zuanLabel.text = '我的云钻:0';
NetManager.ins.getCloudNum((success, res) => {
if(!success) {
return;
}
const data = res.data;
this.totalNum = data;
this.zuanLabel.text = `我的云钻:${data}`;
})
}
initEvents() {
......
......@@ -179,6 +179,13 @@ const config = {
'/customActivity/happyclear/taskSystem/award':{
data: './happyclear/taskAward.json'
},
//////////////////// 消消乐云钻兑换 ////////////////////
'/customActivity/happyclear/cloudDrill/getCloudDrillBalance':{
data: './happyclear/getCloudNum.json'
},
'/customActivity/happyclear/cloudDrill/exchangeCoin':{
data: './happyclear/exchangeCoin.json'
}
};
for (let item in config) {
......
{
"code": "0000000000",
"data": {
"changeCoin": 0,
"cloudDrillCost": 0,
"coinBalance": 0
},
"desc": "OK",
"success": true,
"timestamp": 1576225291430
}
\ No newline at end of file
{
"code": "0000000000",
"data": 999,
"desc": "OK",
"success": true,
"timestamp": 1576225291348
}
\ 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