接入短信验证码
Showing
3 changed files
with
106 additions
and
19 deletions
| ... | @@ -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,9 +239,6 @@ export default { | ... | @@ -231,9 +239,6 @@ export default { |
| 231 | // 刷新图形二维码 | 239 | // 刷新图形二维码 |
| 232 | }, | 240 | }, |
| 233 | handlerLogin() { | 241 | handlerLogin() { |
| 234 | if (this.oneAccountCenterOff) { | ||
| 235 | this.selfLogin(); | ||
| 236 | } else { | ||
| 237 | if ((this.type == 1 && this.pwdLoginDisabled) || (this.type == 2 && this.otpLoginDisabled)) { | 242 | if ((this.type == 1 && this.pwdLoginDisabled) || (this.type == 2 && this.otpLoginDisabled)) { |
| 238 | return; | 243 | return; |
| 239 | } | 244 | } |
| ... | @@ -247,7 +252,6 @@ export default { | ... | @@ -247,7 +252,6 @@ export default { |
| 247 | } else { | 252 | } else { |
| 248 | this._otpLogin(); | 253 | this._otpLogin(); |
| 249 | } | 254 | } |
| 250 | } | ||
| 251 | }, | 255 | }, |
| 252 | userIdLegalCheck() { | 256 | userIdLegalCheck() { |
| 253 | let mobile = this.loginForm.userId; | 257 | let mobile = this.loginForm.userId; |
| ... | @@ -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 | }, | ||
| 297 | 306 | ||
| 307 | sendOTPWhenOneAccountCenterOff() { | ||
| 308 | // 发送短信验证码 | ||
| 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,12 +24,6 @@ | ... | @@ -24,12 +24,6 @@ |
| 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 | </template> | ||
| 28 | <template v-else> | ||
| 29 | <div class="login-nav"> | ||
| 30 | <div class="login-nav-tit text-c pointer active">{{$t('login.loginType1')}}</div> | ||
| 31 | </div> | ||
| 32 | </template> | ||
| 33 | <div class="gird-g form"> | 27 | <div class="gird-g form"> |
| 34 | <div class="pure-u-1 form-item"> | 28 | <div class="pure-u-1 form-item"> |
| 35 | <div class="label"> | 29 | <div class="label"> |
| ... | @@ -76,8 +70,66 @@ | ... | @@ -76,8 +70,66 @@ |
| 76 | </div> | 70 | </div> |
| 77 | <div class="login-func"> | 71 | <div class="login-func"> |
| 78 | <div @click="toRegisterPage()" class="login-func-btn pointer">{{$t('login.register')}}</div> | 72 | <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> | 73 | <div @click="onForgetHandler()" class="login-func-btn pointer">{{$t('login.forget')}}</div> |
| 74 | </div> | ||
| 75 | </template> | ||
| 76 | <template v-else> | ||
| 77 | <!-- 不接入一账通 --> | ||
| 78 | <div class="login-nav"> | ||
| 79 | <div class="login-nav-tit text-c pointer active">{{$t('login.loginType1')}}</div> | ||
| 80 | </div> | ||
| 81 | <div class="gird-g form"> | ||
| 82 | <div class="pure-u-1 form-item"> | ||
| 83 | <div class="label"> | ||
| 84 | <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> | ||
| 92 | </div> | ||
| 93 | <div class="pure-u-1 form-item"> | ||
| 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> | ||
| 103 | </div> | ||
| 104 | <div class="pure-u-1 form-item"> | ||
| 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> | ||
| 118 | </div> | ||
| 119 | </div> | ||
| 120 | <div class="login-protocol pointer" :class="{loginLeft:locale!='en'}" @click="loginCheck.agreeProtocol = !loginCheck.agreeProtocol"> | ||
| 121 | <img v-if="!loginCheck.agreeProtocol" class="check" src="@/assets/images/login/uncheck.png"> | ||
| 122 | <img v-if="loginCheck.agreeProtocol" class="check" src="@/assets/images/login/check.png">{{$t('login.agree')}} | ||
| 123 | <span @click="onProtocolHandler()" class="protocol pointer">{{$t('login.protocol')}}</span> | ||
| 124 | </div> | ||
| 125 | <div @click="pwdLoginWhenOneAccountCenterOff()" class="login-submit pointer flex-center" :class="{disabled: pwdLoginDisabledOneAccountCenterOff}"> | ||
| 126 | <van-loading v-if="loading" /> | ||
| 127 | <span>{{$t('login.login')}}</span> | ||
| 128 | </div> | ||
| 129 | <div class="login-func"> | ||
| 130 | <div @click="toRegisterPage()" class="login-func-btn pointer">{{$t('login.register')}}</div> | ||
| 80 | </div> | 131 | </div> |
| 132 | </template> | ||
| 81 | </div> | 133 | </div> |
| 82 | 134 | ||
| 83 | <!-- OTP登陆 --> | 135 | <!-- OTP登陆 --> | ... | ... |
-
Please register or sign in to post a comment