Commit 57383cc7 authored by liujiangnan's avatar liujiangnan

feat: 强提示框

parent 2e10f7af
......@@ -115,6 +115,40 @@ export default class NewClass extends middleLayerBase {
tipsLayer.active = false;
});
}
async hideConfirm() {
const tipsLayer = cc.find('middleLayer/confirmLayer');
const label = cc.find('middleLayer/confirmLayer/confirm_bg/label');
label.getComponent(cc.Label).string = ``;
const tips = cc.find('middleLayer/confirmLayer/confirm_bg');
tips.width = Math.max(684);
const yesBtn = cc.find('middleLayer/confirmLayer/confirm_bg/btn_yes');
const noBtn = cc.find('middleLayer/confirmLayer/confirm_bg/btn_no');
yesBtn.off("click");
noBtn.off("click");
tipsLayer.active = false;
}
async alert(str: string) {
if (this.IS_BUNDLE_LOADING) {
return;
}
this.hideConfirm();
const tipsLayer = cc.find('middleLayer/alertLayer');
const label = cc.find('middleLayer/alertLayer/confirm_bg/label');
label.getComponent(cc.Label).string = ` ${str} `;
const tips = cc.find('middleLayer/alertLayer/confirm_bg');
tipsLayer.active = true;
tips.width = Math.max(684, label.width + 50);
const yesBtn = cc.find('middleLayer/alertLayer/confirm_bg/btn_yes');
buttonOnceClick(yesBtn, (evt) => {
yesBtn.off("click");
label.getComponent(cc.Label).string = ``;
tips.width = Math.max(684);
tipsLayer.active = false;
});
}
hideBuyLoading() {
cc.find(`middleLayer/iosActiveLayer/buyloading`).active = false;
......@@ -636,6 +670,7 @@ export default class NewClass extends middleLayerBase {
console.log("===onHomeworkFinish===", callBack, data, isSaveAnswer);
// 表示正在等待解锁
this.waittingUnlock = true;
this.hideConfirm();
if (typeof (callBack) == 'object') {
data = callBack;
}
......@@ -1322,7 +1357,7 @@ export default class NewClass extends middleLayerBase {
kid_id: kidInfo.id, book_code: activeCode, token: cc.sys.localStorage.getItem('token')
});
if (res && res.code == 200) {
this.showTips(res.msg);
this.alert(res.msg);
iosActiveWin.active = false;
input.textLabel.string = "";
await this.getUserInfo();
......@@ -1458,7 +1493,7 @@ export default class NewClass extends middleLayerBase {
kid_id: kidInfo.id, book_code: activeCode, token: cc.sys.localStorage.getItem('token')
});
if (res && res.code == 200) {
this.showTips(res.msg);
this.alert(res.msg);
androidActiveWin.active = false;
input.textLabel.string = "";
await this.getUserInfo();
......
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