zhulizhen hace 5 años
padre
commit
a10d2eab55
Se han modificado 2 ficheros con 31 adiciones y 6 borrados
  1. 29 4
      config/index.js
  2. 2 2
      src/store/index.js

+ 29 - 4
config/index.js

@@ -11,15 +11,40 @@ module.exports = {
     assetsSubDirectory: 'static',
     assetsPublicPath: '/',
     proxyTable: {
-      '/info-mng-backend': {
-        target:"http://mng.sagacloud.cn",//设备设施代理
-        // target: "http://58.251.20.250:8080",
+      '/server': {
+        target: 'http://mng.sagacloud.cn',
+        //target: 'http://192.168.20.102:8082/',
         changeOrigin: true,
         pathRewrite: {
-          '^/info-mng-backend': '/' // 这里理解成用‘/api’代替target里面的地址,后面组件中我们掉接口时直接用api代替 比如我要调用'http://40.00.100.100:3002/user/add',直接写‘/api/user/add’即可
+            // "^/apis": ""
         }
+    },
+    '/duoduo-service': {
+      target: 'http://mng.sagacloud.cn',
+      //target: 'http://192.168.20.102:8082/',
+      changeOrigin: true,
+      pathRewrite: {
+          // "^/apis": ""
       }
   },
+  '/image-service': {
+      target: 'http://api.sagacloud.cn/dp-auxiliary',
+      changeOrigin: true,
+      pathRewrite: {
+          // "^/apis": ""
+      }
+  },
+  '/graphy-service': {
+      target: 'http://192.168.20.225:8080/',
+      // target: 'http://api.sagacloud.cn/',
+      pathRewrite: {
+          '^/graphy-service': '/dp-auxiliary'
+      },
+      ws: true,
+      // 将主机标头的原点更改为目标URL
+      changeOrigin: false
+  }
+  },
 
     // Various Dev Server settings
     host: 'localhost', // can be overwritten by process.env.HOST

+ 2 - 2
src/store/index.js

@@ -56,7 +56,7 @@ const store = new Vuex.Store({
   },
   actions: {
     async loadUserInfo(context,{token}){
-      let res = await axios.get('/info-mng-backend/user/login', {params: {token: token}})
+      let res = await axios.get('/server/userInfo', {params: {token: token, _t: +new Date()}})
       console.log(res)
         if(res.data.result == 'success') {
           // commit 到vuex, 供全局使用
@@ -65,7 +65,7 @@ const store = new Vuex.Store({
           sessionStorage.setItem('token', token)
         } else {
           let ssoServer = 'http://sso.sagacloud.cn'
-          let redirectUrl = window.location.protocol + '//' + window.location.host +'/home/main'
+          let redirectUrl = window.location.protocol + '//' + window.location.host +'/strategy'
           window.location.href = `${ssoServer}/login?redirectUrl=${redirectUrl}`
         }
     }