From f3a78fb8f62918f0c2c0c569f2ea719f73a83cff Mon Sep 17 00:00:00 2001 From: zhl Date: Thu, 28 Feb 2019 11:04:15 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E8=BE=93=E9=94=99?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=A0=81=E5=90=8E=EF=BC=8C=E5=86=8D=E6=AC=A1?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=AA=8C=E8=AF=81=E7=A0=81=E6=97=B6=E9=9C=80?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E5=9B=BE=E5=BD=A2=E9=AA=8C=E8=AF=81=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/scripts/infoMenu.js | 10 ++++++---- assets/scripts/main.js | 11 +++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) 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 => {