소스 검색

修改登录接口

wzz 4 년 전
부모
커밋
19bdf6e537
2개의 변경된 파일8개의 추가작업 그리고 9개의 파일을 삭제
  1. 4 6
      src/App.vue
  2. 4 3
      src/request/api.js

+ 4 - 6
src/App.vue

@@ -66,21 +66,19 @@ export default {
       this.$http({
         method: 'post',
         url: '/auth/checkSign',
-        data: {
-          token: token
-        }
+        data:token
       }).then((res) => {
         console.log(res);
         if(res.status === 200){
           if(res.data.code === 200) {
             let userInfo = res.data.data;
-            if (userInfo.role == '1' || userInfo.role == '2') {
+            if (userInfo.userRole == '1' || userInfo.userRole == '2') {
               this.isManufacturer = 'distributor';
             } else {
               this.isManufacturer = 'manufacturer';
             }
-            this.userAccount = userInfo.userAccount;
-            localStorage.setItem("userId", userInfo.userAccount);
+            this.userAccount = userInfo.userCode;
+            localStorage.setItem("userId", userInfo.agentId);
           }else {
             let message = res.data.message;
             console.log('message', message);

+ 4 - 3
src/request/api.js

@@ -12,9 +12,10 @@ axios.interceptors.request.use((config) => {
     if (config.method.toLowerCase() === 'post') {
         config.data = qs.stringify(config.data);
     }
-    //     if (config.url === '/auth/checkSign') {
-    //     config.data = baseData
-    // }
+    if (config.url === '/auth/checkSign') { //针对经销商导入文件的接口 data不做转义 否则会造成传值为空  config.data = 
+        config.headers['Content-Type']="application/json";
+        config.data=JSON.stringify(baseData);  
+    }
     if (config.url === '/firmsUpload') { //针对上传文件的接口 data不做转义 否则会造成传值为空
         config.data = baseData
     }