Browse Source

Merge branch 'master' of https://git.agilestar.cn/spfm-group/spfm-market-front

daiqisheng 3 years ago
parent
commit
b39bede91b
4 changed files with 60 additions and 22 deletions
  1. 40 13
      src/components/p-header.vue
  2. 3 0
      src/http/index.js
  3. 16 8
      src/router/index.js
  4. 1 1
      vue.config.js

+ 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/"

+ 16 - 8
src/router/index.js

@@ -1661,18 +1661,23 @@ 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"
+        next()
     } else {
+        // if (window.location.href.indexOf('?agileauthtoken=') == -1) {
         if (window.sessionStorage.agileauthtoken == undefined) {
-             router.push('/login')
-            next()
+            window.location.href = "http://10.230.26.15:8000/spfm/sysmgr/ssLogin?sysFlag=0";
+            //window.location.href = "http://cas.hl.cmcc/cas/login?service=?service=http%3A%2F%2F10.230.26.15%3A8000%2Fspfm%2Fsysmgr%2FssLogin%3FsysFlag%3D0"
         } else {
             next()
+        }
+
+        // if (window.sessionStorage.agileauthtoken == undefined) {
+        //      router.push('/login')
+        //     next()
+        // } else {
+        //     next()
             //权限控制 过于霸道暂时注释
             // let toNext = false;
             // let Menus = JSON.parse(window.sessionStorage.childrenMenus);
@@ -1687,7 +1692,7 @@ router.beforeEach((to, from, next) => {
             // } else {
             //     alert('暂无使用权限');
             // }
-        }
+        // }
     }
     // let menus = JSON.parse(window.sessionStorage.menus);
     // menuList = [];
@@ -1698,6 +1703,7 @@ router.beforeEach((to, from, next) => {
     //     }
     // }
 });
+
 function callmenus(v) {
     for (let i = 0; i < v.length; i++) {
         if (v[i].rountPath) {
@@ -1708,6 +1714,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://192.168.1.9:9600/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