Authored by 郭成尧

Merge branch 'feature/loginview' into release/6.0.1

@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 </div> 17 </div>
18 <div class="form-group verify-code"> 18 <div class="form-group verify-code">
19 <label for="verifyCode" class="iconfont">&#xe71c;</label><input type="text" name="verifyCode" placeholder="请输入验证码" 19 <label for="verifyCode" class="iconfont">&#xe71c;</label><input type="text" name="verifyCode" placeholder="请输入验证码"
20 - class="verify-code-input"><button id="getVerifyCodeBtn" class="get-verify-code active">获取验证码</button> 20 + class="verify-code-input"><button id="getVerifyCodeBtn" class="get-verify-code">获取验证码</button>
21 </div> 21 </div>
22 <div class="form-group password"> 22 <div class="form-group password">
23 <label for="password" class="iconfont">&#xe723;</label><input type="password" name="password" placeholder="请输入密码"> 23 <label for="password" class="iconfont">&#xe723;</label><input type="password" name="password" placeholder="请输入密码">
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 <label for="inviteCode" class="iconfont">&#xe71e;</label><input type="text" name="inviteCode" placeholder="邀请码(无邀请码非必填)"> 28 <label for="inviteCode" class="iconfont">&#xe71e;</label><input type="text" name="inviteCode" placeholder="邀请码(无邀请码非必填)">
29 </div> 29 </div>
30 <input name="token" type="hidden" value="{{token}}"> 30 <input name="token" type="hidden" value="{{token}}">
31 - <div data-geetest="{{useGeetest}}" id="js-img-check"{{#unless useGeetest}} class="full-img-verify hide"{{/unless}}></div> 31 + <div data-geetest="{{useGeetest}}" id="js-img-check"{{#unless useGeetest}} class="full-img-verify"{{/unless}}></div>
32 <button id="regBtn" class="reg-btn">注册</button> 32 <button id="regBtn" class="reg-btn">注册</button>
33 </div> 33 </div>
34 </div> 34 </div>
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 <label for="verifyCode" class="iconfont">&#xe71c;</label><input type="text" name="verifyCode" placeholder="请输入验证码" 25 <label for="verifyCode" class="iconfont">&#xe71c;</label><input type="text" name="verifyCode" placeholder="请输入验证码"
26 class="verify-code-input"><button id="getVerifyCodeBtn" class="get-verify-code">获取验证码</button> 26 class="verify-code-input"><button id="getVerifyCodeBtn" class="get-verify-code">获取验证码</button>
27 </div> 27 </div>
28 - <div data-geetest="{{useGeetest}}" id="js-img-check" {{#unless useGeetest}} class="full-img-verify hide" {{/unless}}></div> 28 + <div data-geetest="{{useGeetest}}" id="js-img-check" {{#unless useGeetest}} class="full-img-verify" {{/unless}}></div>
29 <button id="smsLoginBtn" class="sms-login-btn">登录</button> 29 <button id="smsLoginBtn" class="sms-login-btn">登录</button>
30 <div class="other-info"> 30 <div class="other-info">
31 <a href="{{internationalUrl}}">海外账号</a> 31 <a href="{{internationalUrl}}">海外账号</a>
@@ -32,32 +32,16 @@ class RegisterNew { @@ -32,32 +32,16 @@ class RegisterNew {
32 32
33 this.requested = false; 33 this.requested = false;
34 34
  35 + validate.init();
  36 +
35 this.view.clearMobile.on('click', this.clearMobile.bind(this)); 37 this.view.clearMobile.on('click', this.clearMobile.bind(this));
36 this.view.regBtn.on('click', this.register.bind(this)); 38 this.view.regBtn.on('click', this.register.bind(this));
37 - this.view.mobileInput.bind('input', this.changeRegBtnStatus.bind(this));  
38 - this.view.inviteCodeInput.bind('input', this.changeRegBtnStatus.bind(this));  
39 - this.view.passwordInput.bind('input', this.changeRegBtnStatus.bind(this)); 39 + this.view.mobileInput.bind('input', this.changeBtnStatus.bind(this));
  40 + this.view.inviteCodeInput.bind('input', this.changeBtnStatus.bind(this));
  41 + this.view.passwordInput.bind('input', this.changeBtnStatus.bind(this));
40 this.view.passwordEyeIcon.on('click', this.passwordShowStatus.bind(this)); 42 this.view.passwordEyeIcon.on('click', this.passwordShowStatus.bind(this));
  43 + this.view.getVerifyCodeBtn.on('click', this.getVerifyCode.bind(this));
41 44
42 - if ($captcha.data('geetest')) {  
43 - this.view.getVerifyCodeBtn.on('click', this.getVerifyCode.bind(this));  
44 - } else {  
45 - validate.init();  
46 - this.view.getVerifyCodeBtn.on('click', this.imgVerifyInit.bind(this));  
47 - }  
48 - }  
49 -  
50 - /**  
51 - * 图片验证码初始化  
52 - */  
53 - imgVerifyInit() {  
54 - if (!this.view.getVerifyCodeBtn.hasClass('active')) {  
55 - return;  
56 - }  
57 - validate.refresh();  
58 - $(document).off('click.refresh').on('click.refresh', '.img-check-refresh', this.imgVerifyInit.bind(this));  
59 - $captcha.removeClass('hide');  
60 - this.getVerifyCode();  
61 } 45 }
62 46
63 /** 47 /**
@@ -107,9 +91,17 @@ class RegisterNew { @@ -107,9 +91,17 @@ class RegisterNew {
107 } 91 }
108 92
109 /** 93 /**
110 - * 改变登录按钮状态 94 + * 输入监听,改变按钮状态
111 */ 95 */
112 - changeRegBtnStatus() { 96 + changeBtnStatus() {
  97 + // 获取验证码按钮
  98 + if (this.view.mobileInput.val()) {
  99 + this.view.getVerifyCodeBtn.addClass('active');
  100 + } else {
  101 + this.view.getVerifyCodeBtn.removeClass('active');
  102 + }
  103 +
  104 + // 登录按钮
113 if (this.view.mobileInput.val() && 105 if (this.view.mobileInput.val() &&
114 this.view.passwordInput.val() && 106 this.view.passwordInput.val() &&
115 this.view.verifyCodeInput.val()) { 107 this.view.verifyCodeInput.val()) {
@@ -229,7 +221,6 @@ class RegisterNew { @@ -229,7 +221,6 @@ class RegisterNew {
229 data: params, 221 data: params,
230 success: postResult => { 222 success: postResult => {
231 validate.type === 2 && validate.refresh(); 223 validate.type === 2 && validate.refresh();
232 - $captcha.addClass('hide');  
233 if (postResult.code === 200) { 224 if (postResult.code === 200) {
234 this.view.tokenInput.val(postResult.data.token); 225 this.view.tokenInput.val(postResult.data.token);
235 this.countDown(); 226 this.countDown();
@@ -35,6 +35,7 @@ class SmsLoginNew extends Page { @@ -35,6 +35,7 @@ class SmsLoginNew extends Page {
35 * 初始化 35 * 初始化
36 */ 36 */
37 init() { 37 init() {
  38 + validate.init();
38 this.bindEvents(); 39 this.bindEvents();
39 } 40 }
40 41
@@ -49,13 +50,7 @@ class SmsLoginNew extends Page { @@ -49,13 +50,7 @@ class SmsLoginNew extends Page {
49 this.selector.getPswrdBtn.on('click', this.showGetPasswordBox.bind(this)); 50 this.selector.getPswrdBtn.on('click', this.showGetPasswordBox.bind(this));
50 this.selector.getPasswordBox.on('click', this.hiddenGetPasswordBox.bind(this)); 51 this.selector.getPasswordBox.on('click', this.hiddenGetPasswordBox.bind(this));
51 this.selector.showYohoFamilyTip.on('click', this.showYohoFamilyTip.bind(this)); 52 this.selector.showYohoFamilyTip.on('click', this.showYohoFamilyTip.bind(this));
52 -  
53 - if ($captcha.data('geetest')) {  
54 - this.selector.getVerifyCodeBtn.on('click', this.getVerifyCode.bind(this));  
55 - } else {  
56 - validate.init();  
57 - this.selector.getVerifyCodeBtn.on('click', this.imgVerifyInit.bind(this));  
58 - } 53 + this.selector.getVerifyCodeBtn.on('click', this.getVerifyCode.bind(this));
59 } 54 }
60 55
61 /** 56 /**
@@ -66,19 +61,6 @@ class SmsLoginNew extends Page { @@ -66,19 +61,6 @@ class SmsLoginNew extends Page {
66 } 61 }
67 62
68 /** 63 /**
69 - * 图片验证码初始化  
70 - */  
71 - imgVerifyInit() {  
72 - if (!this.selector.getVerifyCodeBtn.hasClass('active')) {  
73 - return;  
74 - }  
75 - validate.refresh();  
76 - $(document).off('click.refresh').on('click.refresh', '.img-check-refresh', this.imgVerifyInit.bind(this));  
77 - $captcha.removeClass('hide');  
78 - this.getVerifyCode();  
79 - }  
80 -  
81 - /**  
82 * 获取验证码倒计时 64 * 获取验证码倒计时
83 */ 65 */
84 countDown(during) { 66 countDown(during) {
@@ -177,7 +159,6 @@ class SmsLoginNew extends Page { @@ -177,7 +159,6 @@ class SmsLoginNew extends Page {
177 data: params 159 data: params
178 }).then(data => { 160 }).then(data => {
179 validate.type === 2 && validate.refresh(); 161 validate.type === 2 && validate.refresh();
180 - $captcha.addClass('hide');  
181 if (data.code === 200) { 162 if (data.code === 200) {
182 checkPoint('YB_MOBILE_NEXT_C'); // 埋点 163 checkPoint('YB_MOBILE_NEXT_C'); // 埋点
183 this.countDown(); 164 this.countDown();