db98d45f by joe

接入短信验证码

1 parent 9747be9d
...@@ -92,5 +92,7 @@ module.exports = { ...@@ -92,5 +92,7 @@ module.exports = {
92 92
93 // 为了香港上线而增加的身份自行管理接口 93 // 为了香港上线而增加的身份自行管理接口
94 doLoginV2: "/pingan_hklife_webapi/user/loginv2", 94 doLoginV2: "/pingan_hklife_webapi/user/loginv2",
95 doRegisterV2: "/pingan_hklife_webapi/user/registerv2" 95 doRegisterV2: "/pingan_hklife_webapi/user/registerv2",
96 // 刷新短信验证码
97 refreshSmgOtp: "/pingan_hklife_webapi/user/refreshSmgOtp"
96 } 98 }
......
...@@ -123,12 +123,20 @@ export default { ...@@ -123,12 +123,20 @@ export default {
123 let b3 = !this.loginForm.password; 123 let b3 = !this.loginForm.password;
124 124
125 let b = b1 || b2 || b3; 125 let b = b1 || b2 || b3;
126 return b;
127 },
128 pwdLoginDisabledOneAccountCenterOff() {
129 let b1 = !this.loginCheck.agreeProtocol;
130 let b2 = !this.loginForm.userId;
131 let b3 = !this.loginForm.password;
132 let b4 = !this.loginForm.otp;
133
134 let b = b1 || b2 || b3 || b4;
126 135
127 if (this.oneAccountCenterOff && !b) { 136 if (!b) {
128 let mobile = this.loginForm.userId; 137 let mobile = this.loginForm.userId;
129 let m1 = contactMethodCheck('hkmobile', mobile); 138 let m1 = contactMethodCheck('hkmobile', mobile);
130 let m2 = contactMethodCheck('mobile', mobile); 139 let m2 = contactMethodCheck('mobile', mobile);
131 console.log(b, m1, m2)
132 b = b || !(m1 || m2); 140 b = b || !(m1 || m2);
133 } 141 }
134 142
...@@ -167,11 +175,11 @@ export default { ...@@ -167,11 +175,11 @@ export default {
167 this.modalSimpleVisiable = false; 175 this.modalSimpleVisiable = false;
168 this.modalProtocolVisiable = false; 176 this.modalProtocolVisiable = false;
169 }, 177 },
170 onCheckHandler() {}, 178 onCheckHandler() { },
171 onProtocolHandler() { 179 onProtocolHandler() {
172 this.modalProtocolVisiable = true; 180 this.modalProtocolVisiable = true;
173 }, 181 },
174 onSubmitHandler() {}, 182 onSubmitHandler() { },
175 toRegisterPage() { 183 toRegisterPage() {
176 this.$router.push({ 184 this.$router.push({
177 path: "/register" 185 path: "/register"
...@@ -231,22 +239,18 @@ export default { ...@@ -231,22 +239,18 @@ export default {
231 // 刷新图形二维码 239 // 刷新图形二维码
232 }, 240 },
233 handlerLogin() { 241 handlerLogin() {
234 if (this.oneAccountCenterOff) { 242 if ((this.type == 1 && this.pwdLoginDisabled) || (this.type == 2 && this.otpLoginDisabled)) {
235 this.selfLogin(); 243 return;
244 }
245 this.refreshDeviceId();
246 if (!this.loginCheck.agreeProtocol) {
247 this._showAgreeProtocalTips();
248 return;
249 }
250 if (this.type == 1) {
251 this._passwordLogin();
236 } else { 252 } else {
237 if ((this.type == 1 && this.pwdLoginDisabled) || (this.type == 2 && this.otpLoginDisabled)) { 253 this._otpLogin();
238 return;
239 }
240 this.refreshDeviceId();
241 if (!this.loginCheck.agreeProtocol) {
242 this._showAgreeProtocalTips();
243 return;
244 }
245 if (this.type == 1) {
246 this._passwordLogin();
247 } else {
248 this._otpLogin();
249 }
250 } 254 }
251 }, 255 },
252 userIdLegalCheck() { 256 userIdLegalCheck() {
...@@ -260,8 +264,8 @@ export default { ...@@ -260,8 +264,8 @@ export default {
260 } 264 }
261 return true; 265 return true;
262 }, 266 },
263 // 登陆 267 // 不接入一账通登陆
264 selfLogin() { 268 pwdLoginWhenOneAccountCenterOff() {
265 if (this.pwdLoginDisabled) { 269 if (this.pwdLoginDisabled) {
266 return; 270 return;
267 } 271 }
...@@ -271,7 +275,8 @@ export default { ...@@ -271,7 +275,8 @@ export default {
271 this.loading = true; 275 this.loading = true;
272 let data = { 276 let data = {
273 account: this.loginForm.userId, 277 account: this.loginForm.userId,
274 password: this.loginForm.password 278 password: this.loginForm.password,
279 otp: this.loginForm.otp
275 }; 280 };
276 httpPost({ 281 httpPost({
277 url: api.doLoginV2, 282 url: api.doLoginV2,
...@@ -286,6 +291,9 @@ export default { ...@@ -286,6 +291,9 @@ export default {
286 case 404: 291 case 404:
287 this.errorTips.e2 = this.i18n.login.tips.e5; 292 this.errorTips.e2 = this.i18n.login.tips.e5;
288 break; 293 break;
294 case 1104:
295 this.errorTips.oe2 = this.i18n.login.tips.oe4;
296 break;
289 case 1102: 297 case 1102:
290 this.errorTips.e2 = this.i18n.login.tips.e6; 298 this.errorTips.e2 = this.i18n.login.tips.e6;
291 break; 299 break;
...@@ -294,7 +302,32 @@ export default { ...@@ -294,7 +302,32 @@ export default {
294 break; 302 break;
295 } 303 }
296 }) 304 })
305 },
306
307 sendOTPWhenOneAccountCenterOff() {
308 // 发送短信验证码
297 309
310 let m1 = contactMethodCheck('hkmobile', this.loginForm.userId);
311 let m2 = contactMethodCheck('mobile', this.loginForm.userId);
312 if (!m1 && !m2) {
313 this._showMobileNoIllegalTip();
314 return;
315 }
316 if (this.times.remain > 0) {
317 return;
318 }
319 let data = {
320 mobile: this.loginForm.userId,
321 lan : this.locale
322 }
323 this._startTimeClick();
324 httpPost({
325 url: api.refreshSmgOtp,
326 data: data
327 }).then(res => {
328 }).catch(e => {
329 console.error(e);
330 })
298 }, 331 },
299 // 刷新图形二维码 332 // 刷新图形二维码
300 _passwordLogin() { 333 _passwordLogin() {
......
...@@ -24,60 +24,112 @@ ...@@ -24,60 +24,112 @@
24 <div class="login-nav-v-line"></div> 24 <div class="login-nav-v-line"></div>
25 <div @click="onLoginTypeHandler(2)" class="login-nav-tit pointer">{{$t('login.loginType2')}}</div> 25 <div @click="onLoginTypeHandler(2)" class="login-nav-tit pointer">{{$t('login.loginType2')}}</div>
26 </div> 26 </div>
27 <div class="gird-g form">
28 <div class="pure-u-1 form-item">
29 <div class="label">
30 <img src="@/assets/images/login/icon-login-user.png"> {{$t('login.account')}}
31 </div>
32 <div class="ipt-wrap">
33 <input v-model="loginForm.userId" :placeholder="$t('login.accountPlaceholder')" class="ipt" :class="{ err : errorTips.e1.length > 0 }" type="text" @blur="userIdLegalCheck">
34 </div>
35 <div class="validator" v-if="errorTips.e1.length > 0 ">
36 <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.e1}}
37 </div>
38 </div>
39 <div class="pure-u-1 form-item">
40 <div class="label">
41 <img src="@/assets/images/login/icon-login-password.png"> {{$t('login.password')}}
42 </div>
43 <div class="ipt-wrap">
44 <input v-model="loginForm.password" :placeholder="$t('login.passwordPlaceholder')" class="ipt" :class="{ err : errorTips.e2.length > 0 }" type="password">
45 </div>
46 <div class="validator" v-if="errorTips.e2.length > 0 ">
47 <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.e2}}
48 </div>
49 </div>
50 <div class="pure-u-1 form-item" v-if="type == 1 && loginCheck.showImageCode">
51 <div class="ipt-wrap">
52 <input :placeholder="$t('login.verifyPlaceholder')" class="ipt ipt-verify" :class="{ err : errorTips.e3.length > 0 }" type="text" v-model="loginForm.imageValue">
53 <div class="ipt verify-btn pointer vcode" @click="handlerRefreshImageValue">
54 <img :src="values.imageBase64">
55 </div>
56 </div>
57 <div class="validator" v-if="errorTips.e3.length > 0 ">
58 <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.e3}}
59 </div>
60 </div>
61 </div>
62 <div class="login-protocol pointer" :class="{loginLeft:locale!='en'}" @click="loginCheck.agreeProtocol = !loginCheck.agreeProtocol">
63 <img v-if="!loginCheck.agreeProtocol" class="check" src="@/assets/images/login/uncheck.png">
64 <img v-if="loginCheck.agreeProtocol" class="check" src="@/assets/images/login/check.png">{{$t('login.agree')}} &nbsp;
65 <span @click="onProtocolHandler()" class="protocol pointer">{{$t('login.protocol')}}</span>
66 </div>
67 <div @click="handlerLogin()" class="login-submit pointer flex-center" :class="{disabled: pwdLoginDisabled}">
68 <van-loading v-if="loading" />
69 <span>{{$t('login.login')}}</span>
70 </div>
71 <div class="login-func">
72 <div @click="toRegisterPage()" class="login-func-btn pointer">{{$t('login.register')}}</div>
73 <div @click="onForgetHandler()" class="login-func-btn pointer">{{$t('login.forget')}}</div>
74 </div>
27 </template> 75 </template>
28 <template v-else> 76 <template v-else>
77 <!-- 不接入一账通 -->
29 <div class="login-nav"> 78 <div class="login-nav">
30 <div class="login-nav-tit text-c pointer active">{{$t('login.loginType1')}}</div> 79 <div class="login-nav-tit text-c pointer active">{{$t('login.loginType1')}}</div>
31 </div> 80 </div>
32 </template> 81 <div class="gird-g form">
33 <div class="gird-g form"> 82 <div class="pure-u-1 form-item">
34 <div class="pure-u-1 form-item"> 83 <div class="label">
35 <div class="label"> 84 <img src="@/assets/images/login/icon-login-user.png"> {{$t('login.account')}}
36 <img src="@/assets/images/login/icon-login-user.png"> {{$t('login.account')}} 85 </div>
86 <div class="ipt-wrap">
87 <input v-model="loginForm.userId" :placeholder="$t('login.accountPlaceholder')" class="ipt" :class="{ err : errorTips.e1.length > 0 }" type="text" @blur="userIdLegalCheck">
88 </div>
89 <div class="validator" v-if="errorTips.e1.length > 0 ">
90 <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.e1}}
91 </div>
37 </div> 92 </div>
38 <div class="ipt-wrap"> 93 <div class="pure-u-1 form-item">
39 <input v-model="loginForm.userId" :placeholder="$t('login.accountPlaceholder')" class="ipt" :class="{ err : errorTips.e1.length > 0 }" type="text" @blur="userIdLegalCheck"> 94 <div class="label">
95 <img src="@/assets/images/login/icon-login-password.png"> {{$t('login.password')}}
96 </div>
97 <div class="ipt-wrap">
98 <input v-model="loginForm.password" :placeholder="$t('login.passwordPlaceholder')" class="ipt" :class="{ err : errorTips.e2.length > 0 }" type="password">
99 </div>
100 <div class="validator" v-if="errorTips.e2.length > 0 ">
101 <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.e2}}
102 </div>
40 </div> 103 </div>
41 <div class="validator" v-if="errorTips.e1.length > 0 "> 104 <div class="pure-u-1 form-item">
42 <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.e1}} 105 <div class="label">
106 <img src="@/assets/images/login/icon-login-message.png"> {{$t('login.verifyCode')}}
107 </div>
108 <div class="ipt-wrap">
109 <div class="ipt ipt2" :class="{ err : errorTips.oe2.length > 0 }">
110 <input :placeholder="$t('login.verifyCodePlaceholder')" class="ipt-code" type="text" v-model="loginForm.otp">
111 <div v-if="times.remain == 0" class="veri-btn pointer" @click="sendOTPWhenOneAccountCenterOff">{{$t('register.verifyCodeGet')}}</div>
112 <div v-else class="veri-btn-default">{{times.tip}}</div>
113 </div>
114 </div>
115 <div class="validator" v-if="errorTips.oe2.length > 0 ">
116 <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.oe2}}
117 </div>
43 </div> 118 </div>
44 </div> 119 </div>
45 <div class="pure-u-1 form-item"> 120 <div class="login-protocol pointer" :class="{loginLeft:locale!='en'}" @click="loginCheck.agreeProtocol = !loginCheck.agreeProtocol">
46 <div class="label"> 121 <img v-if="!loginCheck.agreeProtocol" class="check" src="@/assets/images/login/uncheck.png">
47 <img src="@/assets/images/login/icon-login-password.png"> {{$t('login.password')}} 122 <img v-if="loginCheck.agreeProtocol" class="check" src="@/assets/images/login/check.png">{{$t('login.agree')}} &nbsp;
48 </div> 123 <span @click="onProtocolHandler()" class="protocol pointer">{{$t('login.protocol')}}</span>
49 <div class="ipt-wrap">
50 <input v-model="loginForm.password" :placeholder="$t('login.passwordPlaceholder')" class="ipt" :class="{ err : errorTips.e2.length > 0 }" type="password">
51 </div>
52 <div class="validator" v-if="errorTips.e2.length > 0 ">
53 <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.e2}}
54 </div>
55 </div> 124 </div>
56 <div class="pure-u-1 form-item" v-if="type == 1 && loginCheck.showImageCode"> 125 <div @click="pwdLoginWhenOneAccountCenterOff()" class="login-submit pointer flex-center" :class="{disabled: pwdLoginDisabledOneAccountCenterOff}">
57 <div class="ipt-wrap"> 126 <van-loading v-if="loading" />
58 <input :placeholder="$t('login.verifyPlaceholder')" class="ipt ipt-verify" :class="{ err : errorTips.e3.length > 0 }" type="text" v-model="loginForm.imageValue"> 127 <span>{{$t('login.login')}}</span>
59 <div class="ipt verify-btn pointer vcode" @click="handlerRefreshImageValue">
60 <img :src="values.imageBase64">
61 </div>
62 </div>
63 <div class="validator" v-if="errorTips.e3.length > 0 ">
64 <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.e3}}
65 </div>
66 </div> 128 </div>
67 </div> 129 <div class="login-func">
68 <div class="login-protocol pointer" :class="{loginLeft:locale!='en'}" @click="loginCheck.agreeProtocol = !loginCheck.agreeProtocol"> 130 <div @click="toRegisterPage()" class="login-func-btn pointer">{{$t('login.register')}}</div>
69 <img v-if="!loginCheck.agreeProtocol" class="check" src="@/assets/images/login/uncheck.png"> 131 </div>
70 <img v-if="loginCheck.agreeProtocol" class="check" src="@/assets/images/login/check.png">{{$t('login.agree')}} &nbsp; 132 </template>
71 <span @click="onProtocolHandler()" class="protocol pointer">{{$t('login.protocol')}}</span>
72 </div>
73 <div @click="handlerLogin()" class="login-submit pointer flex-center" :class="{disabled: pwdLoginDisabled}">
74 <van-loading v-if="loading" />
75 <span>{{$t('login.login')}}</span>
76 </div>
77 <div class="login-func">
78 <div @click="toRegisterPage()" class="login-func-btn pointer">{{$t('login.register')}}</div>
79 <div v-if="!oneAccountCenterOff" @click="onForgetHandler()" class="login-func-btn pointer">{{$t('login.forget')}}</div>
80 </div>
81 </div> 133 </div>
82 134
83 <!-- OTP登陆 --> 135 <!-- OTP登陆 -->
......