Commit f8366b22 authored by 李维's avatar 李维

修复连续点击导致的异常

parent be6f2eaf
......@@ -42,7 +42,7 @@ export default class NewClass extends cc.Component {
phoneNum: string = '';
yellowBtn: cc.Node;
greyBtn: cc.Node;
canClick: boolean = true;
isAgreement: boolean = false;
start () {
......@@ -73,14 +73,13 @@ export default class NewClass extends cc.Component {
initAnonymous() {
const anyBtn = cc.find("/anonymousLoginBtn", this.panelNode);
anyBtn.active = true; // cc.sys.os == cc.sys.OS_IOS;
// 是否开启审查模式,true: 将会判断设备类型和登录账号 false: 关闭审查模式
// const openReview = true;
// IOS设备 并且 手机号是15500000001 或者为空(未登录状态) - 判定为IOS审查状态
// global.iosReviewMode = openReview && cc.sys.os == cc.sys.OS_IOS && (global.userInfo.phone == "15500000001" || global.userInfo.phone == "");
}
clickAgreement() {
if(!this.canClick) {
return
}
this.canClick = false;
this.isAgreement = !this.isAgreement;
const icon = cc.find("/agreementSection/icon_agree", this.panelNode);
const bgRect = cc.find("/agreementSection/bg_agree", this.panelNode);
......@@ -95,6 +94,9 @@ export default class NewClass extends cc.Component {
.to(0.2 / 3, { scale: icon.scale * 1.2 })
.to(0.2 / 3, { scale: icon.scale * 0.8 })
.to(0.2 / 3, { scale: icon.scale * 1 })
.call(()=>{
this.canClick = true;
})
.start()
}
......@@ -139,9 +141,15 @@ export default class NewClass extends cc.Component {
}
async enterBtnClick() {
if(!this.canClick) {
return
}
this.canClick = false;
const phone = this.phoneNum;
if (!this.checkPhone(phone)) {
global.middleLayer.showTips('请输入正确的手机号码');
this.canClick = true;
return;
}
......@@ -156,6 +164,7 @@ export default class NewClass extends cc.Component {
.to(0.2 / 4, { x: baseX + 50 })
.call(()=>{
agreementNode.x = baseX;
this.canClick = true;
})
.start()
return
......@@ -164,6 +173,7 @@ export default class NewClass extends cc.Component {
const localDelPhone = cc.sys.localStorage.getItem('_del-phone-number');
if(localDelPhone == phone) {
global.middleLayer.showTips("此账号不存在!");
this.canClick = true;
return
}
......@@ -171,6 +181,7 @@ export default class NewClass extends cc.Component {
phone: phone,
});
this.canClick = true;
if (res.code != '200') {
global.middleLayer.showTips(res.msg);
this.showEnterFail();
......@@ -185,14 +196,6 @@ export default class NewClass extends cc.Component {
cc.sys.localStorage.setItem('token', res.data.token);
cc.sys.localStorage.setItem('phone', phone);
this.showEnterSuccess(true);
// if (Math.random() < 0.5) {
// this.showEnterSuccess();
// } else {
// this.showEnterFail();
// }
}
checkPhone(phone) {
......@@ -265,6 +268,5 @@ export default class NewClass extends cc.Component {
this.isDestroy = true;
}
// update (dt) {}
}
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