1217310848@qq.com 3 vuotta sitten
vanhempi
commit
906f3f9927
5 muutettua tiedostoa jossa 56 lisäystä ja 22 poistoa
  1. 3 3
      public/index.html
  2. 40 13
      src/components/p-header.vue
  3. 3 0
      src/http/index.js
  4. 9 5
      src/router/index.js
  5. 1 1
      vue.config.js

+ 3 - 3
public/index.html

@@ -8,7 +8,7 @@
   <link rel="icon" href="<%= BASE_URL %>favicon.ico">
   <title>业务服务工作台</title>
   <script src="static/js/crypoto-js.js"></script>
-  
+
   <script src="/static/js/luckysheet/plugins/js/plugin.js"></script>
   <script src="/static/js/luckysheet/luckysheet.umd.js"></script>
   <link rel='stylesheet' href='/static/js/luckysheet/plugins/css/pluginsCss.css' />
@@ -25,8 +25,8 @@
   <div id="app"></div>
   <!-- built files will be auto injected -->
   <script type="text/javascript">
-    // window.staticHost = 'http://10.230.26.15:8000/spfm';
-    window.staticHost = 'http://192.168.0.103:9600/';
+    window.staticHost = 'http://10.230.26.15:8000/spfm';
+    // window.staticHost = 'http://192.168.0.156:9600/';
   </script>
 </body>
 

+ 40 - 13
src/components/p-header.vue

@@ -99,20 +99,47 @@ export default {
       })
         .then((res) => {
           if (res === "confirm") {
-            //TODO先执行退出登录
-            this.$store.commit("setUserInfo", undefined);
-            this.$store.commit("setToken", undefined);
-            this.$store.commit("setMenus", undefined);
-            this.$store.commit("setTabList", []);
-            this.$cookie.delete("userInfo");
-            this.$cookie.delete("menus");
-            this.$cookie.delete("token");
-            window.sessionStorage.agileauthtoken = undefined;
-            window.sessionStorage.menus = undefined;
-            window.sessionStorage.userInfo = undefined;
-            window.sessionStorage.childrenMenus = undefined
+              this.$store.commit("setUserInfo", undefined);
+              this.$store.commit("setToken", undefined);
+              this.$store.commit("setMenus", undefined);
+              this.$store.commit("setTabList", []);
+              this.$cookie.delete("userInfo");
+              this.$cookie.delete("menus");
+              this.$cookie.delete("token");
+              window.sessionStorage.agileauthtoken = undefined;
+              window.sessionStorage.menus = undefined;
+              window.sessionStorage.userInfo = undefined;
+              window.sessionStorage.childrenMenus = undefined;
+              window.opener=null;
+              window.open('','_self');
+              window.close();
+              // window.parent.close();
             //返回到登录页面
-            this.$router.push("/login");
+            // this.$router.push("/login");
+            //   this.$http({
+            //       url: "http://cas.hl.cmcc/cas/logout",
+            //       method: "get",
+            //       headers: {
+            //           "Access-Control-Allow-Origin": "http://cas.hl.cmcc/cas/logout",
+            //       },
+            //   }).then((res) => {
+            //       //TODO先执行退出登录
+            //       this.$store.commit("setUserInfo", undefined);
+            //       this.$store.commit("setToken", undefined);
+            //       this.$store.commit("setMenus", undefined);
+            //       this.$store.commit("setTabList", []);
+            //       this.$cookie.delete("userInfo");
+            //       this.$cookie.delete("menus");
+            //       this.$cookie.delete("token");
+            //       window.sessionStorage.agileauthtoken = undefined;
+            //       window.sessionStorage.menus = undefined;
+            //       window.sessionStorage.userInfo = undefined;
+            //       window.sessionStorage.childrenMenus = undefined;
+            //
+            //       window.location.href = " http://cas.hl.cmcc/cas/login?service=http%3A%2F%2F10.230.26.15%3A8000%2Fspfm%2Fsysmgr%2FssLogin%3FsysFlag%3D0";
+            //   });
+
+
           }
         })
         .catch((err) => {

+ 3 - 0
src/http/index.js

@@ -10,6 +10,9 @@ axios.defaults.transformRequest = [function (data) {
 }],
     // 添加请求拦截器
     axios.interceptors.request.use(function (config) {
+        if (config.url.startsWith("http")) {
+            return config;
+        }
         let localhost = ''
         if (process.env.NODE_ENV == "production") {
             localhost = window.staticHost ? window.staticHost : "/spfm/"

+ 9 - 5
src/router/index.js

@@ -1661,12 +1661,14 @@ const router = new VueRouter({
 })
 let menuList = [];
 router.beforeEach((to, from, next) => {
-    console.log("====token===="+window.sessionStorage.agileauthtoken)
     if (to.name == 'login') {
-
-        window.location.href = "http://cas.hl.cmcc/cas/login?service=?service=http%3A%2F%2F10.230.26.15%3A8000%2Fspfm%2Fsysmgr%2FssLogin%3FsysFlag%3D0"
-
-        // next()
+        //window.location.href = "http://cas.hl.cmcc/cas/login?service=?service=http%3A%2F%2F10.230.26.15%3A8000%2Fspfm%2Fsysmgr%2FssLogin%3FsysFlag%3D0"
+        if (window.location.href.indexOf('?agileauthtoken=') == -1) {
+            window.location.href = "http://10.230.26.15:8000/spfm/sysmgr/ssLogin?sysFlag=0";
+            //  next()
+        } else {
+            next()
+        }
     } else {
         if (window.sessionStorage.agileauthtoken == undefined) {
              router.push('/login')
@@ -1708,6 +1710,8 @@ function callmenus(v) {
         }
     }
 }
+
+
 const originalReplace = VueRouter.prototype.replace
 VueRouter.prototype.replace = function replace(location) {
     return originalReplace.call(this, location).catch(err => err)

+ 1 - 1
vue.config.js

@@ -96,7 +96,7 @@ module.exports = {
                 // target: 'http://114.215.71.182:29600',
                 target: 'http://10.230.26.15:8000/spfm',
                 // target: 'http://127.0.0.1:9600/',
-                // target: 'http://192.168.0.103:9600/',
+                // target: 'http://192.168.0.156:9600/',
                 // target: 'http://192.168.2.170:9600/',
                 // target: 'http://192.168.2.169:9600/',
                 changeOrigin: true