Browse Source

1. 调整短信验证码登录

MONSTER-ygh 1 năm trước cách đây
mục cha
commit
1a07d84247

+ 2 - 1
src/api/login.js

@@ -71,9 +71,10 @@ export function getCodeNum(data) {
   })
   })
 }
 }
 
 
-export function loginCode(username, code) {
+export function loginCode(username, smsToken,code) {
   const data = {
   const data = {
     username,
     username,
+    smsToken,
     code
     code
   }
   }
   return request({
   return request({

+ 3 - 1
src/store/modules/user.js

@@ -35,6 +35,8 @@ const user = {
       const password = userInfo.password
       const password = userInfo.password
       const code = userInfo.code
       const code = userInfo.code
       const uuid = userInfo.uuid
       const uuid = userInfo.uuid
+      const smsToken = userInfo.smsToken
+      const phone = userInfo.phone
       return new Promise((resolve, reject) => {
       return new Promise((resolve, reject) => {
         if(userInfo.loginType == 1){ // 密码登录
         if(userInfo.loginType == 1){ // 密码登录
           login(username, password, code, uuid).then(res => {
           login(username, password, code, uuid).then(res => {
@@ -45,7 +47,7 @@ const user = {
             reject(error)
             reject(error)
           })
           })
         }else { // 验证码登录
         }else { // 验证码登录
-          loginCode(username,  code).then(res => {
+          loginCode(phone, smsToken, code).then(res => {
             setToken(res.data.access_token)
             setToken(res.data.access_token)
             commit('SET_TOKEN', res.data.access_token)
             commit('SET_TOKEN', res.data.access_token)
             resolve()
             resolve()

+ 2 - 0
src/views/login.vue

@@ -147,6 +147,7 @@ export default {
 
 
         loginType: 1,
         loginType: 1,
         phone: null,
         phone: null,
+        smsToken: null, // 短信验证token,由短信发送接口获取
       },
       },
       loginRules: {
       loginRules: {
         username: [
         username: [
@@ -233,6 +234,7 @@ export default {
         getCodeNum({
         getCodeNum({
           "mobile": this.loginForm.phone
           "mobile": this.loginForm.phone
         }).then(res => {
         }).then(res => {
+          this.loginForm.smsToken = res.data.smsToken
           this.codeType = 1
           this.codeType = 1
           this.codeLoading = false
           this.codeLoading = false
           this.codeEffectiveTime = 60
           this.codeEffectiveTime = 60