Ver Fonte

测试本地kuayu

Shannon_mu há 3 anos atrás
pai
commit
18443d283f

+ 18 - 22
accessControlSystem/src/utils/http.js

@@ -14,28 +14,24 @@ var http = axios.create({
 // axios request 拦截器
 http.interceptors.request.use(
     (config) => {
-        if (config.url.indexOf('/sc-user-auth') !== -1) {
-            config.url = config.url;
-        } else if (config.url.indexOf('/sc-message') !== -1) {
-            config.url = config.url;
-        } else if (config.url.indexOf('/operation-manager') !== -1) {
-            config.url = config.url;
-        } else if (config.url.indexOf('/zoniot-water') !== -1) {
-            config.url = config.url;
-        } else if (config.url.indexOf('/sc-user-center') !== -1) {
-            config.url = config.url;
-        } else if (config.url.indexOf('/sc-community') !== -1) {
-            config.url = config.url;
-        } else if (config.url.indexOf('/sc-charge') !== -1) {
-            config.url = config.url;
-        } else if (config.url.indexOf('/sc-gate-web') !== -1) {
-            config.url = config.url;
-        } else if (config.url.indexOf('/card') !== -1) {
-            config.url = config.url;
-        }
-
-        // else {
-        //     config.url = `/sc-community${config.url}`;
+        // if (config.url.indexOf('/sc-user-auth') !== -1) {
+        //     config.url = config.url;
+        // } else if (config.url.indexOf('/sc-message') !== -1) {
+        //     config.url = config.url;
+        // } else if (config.url.indexOf('/operation-manager') !== -1) {
+        //     config.url = config.url;
+        // } else if (config.url.indexOf('/zoniot-water') !== -1) {
+        //     config.url = config.url;
+        // } else if (config.url.indexOf('/sc-user-center') !== -1) {
+        //     config.url = config.url;
+        // } else if (config.url.indexOf('/sc-community') !== -1) {
+        //     config.url = config.url;
+        // } else if (config.url.indexOf('/sc-charge') !== -1) {
+        //     config.url = config.url;
+        // } else if (config.url.indexOf('/sc-gate-web') !== -1) {
+        //     config.url = config.url;
+        // } else if (config.url.indexOf('/card') !== -1) {
+        //     config.url = config.url;
         // }
 
         // config.headers['Accept'] = '*/*'

+ 13 - 37
accessControlSystem/src/views/accessControlCard/popups/addManagemenCard.vue

@@ -38,11 +38,6 @@
 </template>
 <script >
 import axios from 'axios';
-const CancelToken = axios.CancelToken;
-const source = CancelToken.source();
-var http = axios.create({
-    timout: 30000
-});
 export default {
     props: ['params'],
     data() {
@@ -126,39 +121,20 @@ export default {
         },
         //读卡
         getReadCard() {
-            // axios request 拦截器
-            http.interceptors.request.use(
-                (config) => {
-                    config.headers[localStorage.getItem('SC_token') && 'Authorization'] = 'Bearer ' + localStorage.getItem('SC_token');
-                    // 全局添加cancelToken
-                    config.cancelToken = source.token;
-                    return config;
-                },
-                (err) => {
-                    return Promise.reject(err);
-                }
-            );
             new Promise((resolve) => {
-                http.get('http://127.0.0.1:8099/card/load')
-                    .then((res) => {
-                        debugger;
-                        // this.callback(resolve, res);
-                    })
-                    .catch((err) => {
-                        this.reject(reject, err);
-                    });
-                // this.$http.get('/card/load').then(({ data, status, msg }) => {
-                //     if (status == 0) {
-                //         if (!!data) {
-                //             // this.$message.success(msg);
-                //             resolve && resolve(data);
-                //         } else {
-                //             this.$message.warning('没有读取到卡号');
-                //         }
-                //     } else {
-                //         this.$message.error('读取失败');
-                //     }
-                // });
+
+                this.$http.get('/card/load').then(({ data, status, msg }) => {
+                    if (status == 0) {
+                        if (!!data) {
+                            // this.$message.success(msg);
+                            resolve && resolve(data);
+                        } else {
+                            this.$message.warning('没有读取到卡号');
+                        }
+                    } else {
+                        this.$message.error('读取失败');
+                    }
+                });
             }).then((res) => {
                 this.queryBinding(res);
             });

+ 2 - 2
accessControlSystem/vue.config.js

@@ -148,13 +148,13 @@ module.exports = {
                     // "^/zoniot-water": ""
                 }
             },
-            '/card': {
+            '/cards': {
                 target: envConfig.readCard,
                 ws: true, // 代理的WebSockets
                 changeOrigin: true, // 允许websockets跨域
                 logLevel: 'debug',
                 pathRewrite: {
-                    // "^/zoniot-water": ""
+                    '^/cards': ""
                 }
             },
             '/sc-gate-web': proxyAgent