Browse Source

;;;;

Shannon_mu 3 years ago
parent
commit
2e689dc8da

+ 4 - 2
accessControlSystem/src/utils/http.js

@@ -33,8 +33,10 @@ http.interceptors.request.use(
         // } else if (config.url.indexOf('/card') !== -1) {
         //     config.url = config.url;
         // }
-        if (config.url.indexOf('/cards') !== -1) {
-            // config.baseURL = 'http://127.0.0.1:8099'
+        if (config.url.indexOf('/card') !== -1) {
+            config.baseURL = 'http://127.0.0.1:8099';
+            // config.withCredentials = true;
+            // config.headers['Access-Control-Allow-Origin'] = 'http://127.0.0.1:8099';
         }
         // config.headers['Accept'] = '*/*'
         config.headers[localStorage.getItem('SC_token') && 'Authorization'] = 'Bearer ' + localStorage.getItem('SC_token');

+ 20 - 3
accessControlSystem/src/views/accessControlCard/popups/addManagemenCard.vue

@@ -119,14 +119,31 @@ export default {
                 }
             });
         },
+        getBinary(url, args, success) {
+            var xmlhttp = new XMLHttpRequest();
+            var data = eval(args);
+            var i = 0;
+            for (var key in data) {
+                if (i++ === 0) {
+                    url += '?' + key + '=' + data[key];
+                } else {
+                    url += '&' + key + '=' + data[key];
+                }
+            }
+            xmlhttp.open('GET', url, true);
+            xmlhttp.setRequestHeader('Access-Control-Allow-Origin', '*');
+
+            xmlhttp.onload = function () {
+                success(this.response);
+            };
+            xmlhttp.send();
+        },
         //读卡
         getReadCard() {
             new Promise((resolve) => {
-
-                this.$http.get('/cards/card/load').then(({ data, status, msg }) => {
+                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('没有读取到卡号');

+ 3 - 3
accessControlSystem/vue.config.js

@@ -80,7 +80,7 @@ module.exports = {
     //     }
     // },
     devServer: {
-        host: '0.0.0.0', // can be overwritten by process.env.HOST
+        host: '192.168.110.157', // can be overwritten by process.env.HOST
         port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
         https: false, // https:{type:Boolean}
         open: false, // 配置自动启动浏览器  open: 'Google Chrome'-默认启动谷歌
@@ -148,13 +148,13 @@ module.exports = {
                     // "^/zoniot-water": ""
                 }
             },
-            '/cards': {
+            '/card': {
                 target: envConfig.readCard,
                 ws: true, // 代理的WebSockets
                 changeOrigin: true, // 允许websockets跨域
                 logLevel: 'debug',
                 pathRewrite: {
-                    '^/cards': ""
+                    // '^/card': ""
                 }
             },
             '/sc-gate-web': proxyAgent