diff --git a/assets/scripts/infoMenu.js b/assets/scripts/infoMenu.js index 08e7ceb..c579494 100644 --- a/assets/scripts/infoMenu.js +++ b/assets/scripts/infoMenu.js @@ -43,9 +43,9 @@ cc.Class({ onLoad () { let self = this; if (this.top.needCode) { - this.showCaptchaInput(); + this.showCaptchaImage(); this.codeImg.node.on('click', function () { - self.showCaptchaInput(); + self.showCaptchaImage(); }) } this.closeBtn.on('click', function () { @@ -78,7 +78,6 @@ cc.Class({ alert('发送太过频繁,请稍候再试。'); } else if (res.errcode === 101) { alert('图形验证码错误。'); - self.showCaptchaInput(); } else { alert('短信已发送至您手机, 请输入收到的验证码。'); } @@ -97,7 +96,7 @@ cc.Class({ this.top.node.addChild(result, 11); }, - showCaptchaInput() { + showCaptchaImage() { let self = this; cc.loader.load({ url: webapi.captchaUrl()+'?token='+cc.sys.localStorage.getItem('activity_token')+'&data='+new Date(), @@ -127,5 +126,8 @@ cc.Class({ return false; } this.top.userLogin(mobile, moileCaptcha); + }, + setMobileVal(mobile) { + this.mobileInput.string = mobile; } }); diff --git a/assets/scripts/main.js b/assets/scripts/main.js index d85301d..1e86b15 100644 --- a/assets/scripts/main.js +++ b/assets/scripts/main.js @@ -179,6 +179,12 @@ cc.Class({ this.infoView.getComponent('infoMenu').top = this; this.node.addChild(this.infoView, 11); }, + changeInfoMenu(mobile) { + this.needCode = true; + this.infoView.removeFromParent(true); + this.showInfoMenu(); + this.infoView.getComponent('infoMenu').setMobileVal(mobile); + }, showResultView() { this.infoView.getComponent('infoMenu').hide(); let resultView = cc.instantiate(this.resultPrefab); @@ -237,6 +243,11 @@ cc.Class({ if (this.logined && !this.allshow) { this.scheduleUpdateInfo(); } + } else if (rep.errcode === 104) { + alert('验证码错误, 请重新输入或重新获取'); + if (!self.needCode) { + self.changeInfoMenu(mobile); + } } }) .catch (err => {