Просмотр исходного кода

注册登录关联学员跳过身份验证和用户信息接口新增来源平台传参

xuqiaoying 3 лет назад
Родитель
Сommit
0516a56339
4 измененных файлов с 43 добавлено и 42 удалено
  1. 3 2
      src/axios.js
  2. 18 18
      src/pages/home/index.vue
  3. 21 21
      src/pages/login/index.vue
  4. 1 1
      src/store/index.js

+ 3 - 2
src/axios.js

@@ -3,8 +3,8 @@ import store from './store'
 import { Message } from 'element-ui'
 // export const BASE_URL = 'https://api.xyyxt.net'   //release
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test
-export const BASE_URL = 'https://test.xyyxt.net'   //预发布
-// export const BASE_URL = 'http://192.168.1.24:5055'    //dev
+// export const BASE_URL = 'https://test.xyyxt.net'   //预发布
+export const BASE_URL = 'http://192.168.1.24:5055'    //dev
 // export const BASE_URL = 'http://120.79.166.78:19012'    //测试-外网
 export const tenantId = '867735392558919680'
 
@@ -114,6 +114,7 @@ async function refreshToken(response) {
     var userInfo = {
       url: '/app/user/getInfo',
       method: 'get',
+      params: {fromPlat: 2}, // 来源平台 1小程序 2PC网站
     }
     const resUser = await request(userInfo)
     if (resUser.data.code === 200) {

+ 18 - 18
src/pages/home/index.vue

@@ -249,7 +249,7 @@
                   <el-button
                     type="primary"
                     class="submit"
-                    @click="login"
+                    @click="login()"
                     :loading="isLogin"
                     >登录</el-button
                   >
@@ -503,7 +503,7 @@
             type="primary"
             :loading="isBind"
             round
-            @click="bind"
+            @click="bind()"
             >确定</el-button
           >
           <div class="bind-next" @click="bindNext">下次再关联</div>
@@ -585,7 +585,7 @@ export default {
         read: [{ required: true, trigger: "blur", message: "请勾选服务协议" }],
       },
       bindShow: false,
-      loginType: 1,
+      loginType: 2,
       loginForm: {},
       loginSmsForm: {},
       bindForm: {},
@@ -914,17 +914,17 @@ export default {
      * 微信登入—返回数据
      */
     wxLoginBack(res) {
-      if (res.data.full_info) {
+      // if (res.data.full_info) {
         localStorage.setItem("user_account", res.data.user_account);
         localStorage.setItem("token", res.data.token);
         this.getInfo();
-      } else {
+      // } else {
         this.indexUserAccount = res.data.user_account;
         this.indexToken = res.data.token;
-        this.isLogin = false;
+        // this.isLogin = false;
         //弹窗
-        this.bindShow = true;
-      }
+        // this.bindShow = true;
+      // }
     },
     goLast() {
       if (this.recordList.goodsType == 6) {
@@ -1201,18 +1201,18 @@ export default {
           this.$request
             .login(loginForm)
             .then((res) => {
-              if (res.data.full_info) {
+              // if (res.data.full_info) {
                 localStorage.setItem("user_account", res.data.user_account);
                 localStorage.setItem("token", res.data.token);
 
                 this.getInfo();
-              } else {
+              // } else {
                 this.indexUserAccount = res.data.user_account;
                 this.indexToken = res.data.token;
-                this.isLogin = false;
+                // this.isLogin = false;
                 //弹窗
-                this.bindShow = true;
-              }
+                // this.bindShow = true;
+              // }
             })
             .catch((err) => {
               this.isLogin = false;
@@ -1271,16 +1271,16 @@ export default {
             .loginSms(this.loginSmsForm)
             .then((res) => {
               this.isloginSms = false;
-              if (res.data.full_info) {
+              // if (res.data.full_info) {
                 localStorage.setItem("user_account", res.data.user_account);
                 localStorage.setItem("token", res.data.token);
                 this.$tools.setUuid(new Date().valueOf() + "");
                 this.getInfo();
-              } else {
+              // } else {
                 this.indexUserAccount = res.data.user_account;
                 this.indexToken = res.data.token;
-                this.bindShow = true;
-              }
+                // this.bindShow = true;
+              // }
             })
             .catch((err) => {
               this.isloginSms = false;
@@ -1320,7 +1320,7 @@ export default {
      */
     getInfo() {
       this.$request
-        .getInfo()
+        .getInfo({fromPlat: 2})
         .then((res) => {
           this.loginForm = {};
           this.loginSmsForm = {};

+ 21 - 21
src/pages/login/index.vue

@@ -77,7 +77,7 @@
                     </div>
                     <el-button
                       class="submit"
-                      @click="login"
+                      @click="login()"
                       type="primary"
                       round
                       :loading="islogin"
@@ -126,7 +126,7 @@
                     </div>
                     <el-button
                       class="submit"
-                      @click="loginSms"
+                      @click="loginSms()"
                       :loading="isloginSms"
                       type="primary"
                       round
@@ -215,7 +215,7 @@
                   </div>
                   <el-button
                     class="submit"
-                    @click="register"
+                    @click="register()"
                     type="primary"
                     round
                     :loading="isRegister"
@@ -339,7 +339,7 @@
                     type="primary"
                     :loading="isBind"
                     round
-                    @click="bind"
+                    @click="bind()"
                     >确定</el-button
                   >
                   <div class="bind-next" @click="nextBind">下次再关联</div>
@@ -868,7 +868,7 @@ export default {
     };
     return {
       state: 1, //1登录 2注册  3找回密码 4绑定学员身份
-      tabIndex: 0,
+      tabIndex: 1,
       loginForm: {},
       loginSmsForm: {},
       registerForm: {},
@@ -961,17 +961,17 @@ export default {
      * 微信登入—返回数据
      */
     wxLoginBack(res) {
-      if (res.data.full_info) {
+      // if (res.data.full_info) {
         localStorage.setItem("user_account", res.data.user_account);
         localStorage.setItem("token", res.data.token);
         this.$tools.setUuid(new Date().valueOf() + "");
         this.getInfo();
-      } else {
+      // } else {
         this.user_account = res.data.user_account;
         this.token = res.data.token;
-        this.islogin = false;
-        this.state = 4;
-      }
+        // this.islogin = false;
+        // this.state = 4;
+      // }
     },
     /**
      * 账号密码登录
@@ -988,18 +988,18 @@ export default {
           this.$request
             .login(loginForm)
             .then((res) => {
-              if (res.data.full_info) {
+              // if (res.data.full_info) {
                 localStorage.setItem("user_account", res.data.user_account);
                 localStorage.setItem("token", res.data.token);
                 this.$tools.setUuid(new Date().valueOf() + "");
                 this.getInfo();
-              } else {
+              // } else {
                 this.user_account = res.data.user_account;
                 this.token = res.data.token;
                 console.log(this.token);
-                this.islogin = false;
-                this.state = 4;
-              }
+                // this.islogin = false;
+                // this.state = 4;
+              // }
             })
             .catch((err) => {
               this.islogin = false;
@@ -1097,17 +1097,17 @@ export default {
           this.$request
             .loginSms(this.loginSmsForm)
             .then((res) => {
-              if (res.data.full_info) {
+              // if (res.data.full_info) {
                 localStorage.setItem("user_account", res.data.user_account);
                 localStorage.setItem("token", res.data.token);
                 this.$tools.setUuid(new Date().valueOf() + "");
                 this.getInfo();
-              } else {
+              // } else {
                 this.user_account = res.data.user_account;
                 this.token = res.data.token;
-                this.isloginSms = false;
-                this.state = 4;
-              }
+                // this.isloginSms = false;
+                // this.state = 4;
+              // }
             })
             .catch((err) => {
               this.isloginSms = false;
@@ -1124,7 +1124,7 @@ export default {
      */
     getInfo() {
       this.$request
-        .getInfo()
+        .getInfo({fromPlat: 2})
         .then((res) => {
           this.isRegister = false;
           this.islogin = false;

+ 1 - 1
src/store/index.js

@@ -143,7 +143,7 @@ export default new Vuex.Store({
      */
     getUserInfo(context) {
       return new Promise(resolve => {
-        login.getInfo().then(res => {
+        login.getInfo({fromPlat: 2}).then(res => {
           context.commit('setUserInfo', res.data)
           if(!tools.getUuid()) {
             tools.setUuid(new Date().valueOf() + "")