ccj 2 年之前
父节点
当前提交
3a3e229971

+ 1 - 1
.env.production

@@ -2,6 +2,6 @@
 ENV = 'production'
 
 # base api
-VUE_APP_BASE_API = 'https://apitest.eliangeyun.com'
+VUE_APP_BASE_API = 'https://api.changyuntong56.com'
 # VUE_APP_BASE_API = 'http://192.168.1.114:8091'
 

+ 1 - 1
public/index.html

@@ -4,7 +4,7 @@
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
-    
+    <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
   <meta http-equiv="Content-Security-Policy" >
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
     <title><%= webpackConfig.name %></title>

+ 14 - 1
src/api/user.js

@@ -15,7 +15,20 @@ export function getInfo() {
     // params: { token }
   })
 }
-
+export function isLandBased() {
+  return request({
+    url: '/system/query/isLandBased',
+    method: 'get'
+    // params: { token }
+  })
+}
+export function companyInfo() {
+  return request({
+    url: '/company/query/companyInfo',
+    method: 'get'
+    // params: { token }
+  })
+}
 export function logout() {
   return request({
     url: '/auth/api/logout',

+ 1 - 1
src/global/directive.js

@@ -180,7 +180,7 @@ const loadmore = {
   }
 }
 const permission = (el, binding, vnode) => {
-  debugger
+  // debugger
   const roles = vnode.context.$store.getters.roles;
   if (!roles) {
     return;

+ 1 - 1
src/global/index.js

@@ -2,7 +2,7 @@
 import directive from './directive'
 import Vue from 'vue'
 // import filters from '@/global/filters';
-debugger
+// debugger
 Object.values(directive).forEach(value => Vue.use(value))
 // const install = () => {
 

+ 3 - 3
src/permission.js

@@ -41,9 +41,9 @@ router.beforeEach(async (to, from, next) => {
           // get user info
           const accessRoutes = await store.dispatch('permission/generateRoutes');
           router.addRoutes(accessRoutes);
-          const {
-            roles
-          } = await store.dispatch('user/getInfo')
+          // const {
+          //   roles
+          // } = await store.dispatch('user/getInfo')
 
           next()
         } catch (error) {

+ 10 - 3
src/store/modules/permission.js

@@ -7,7 +7,8 @@ import {
   getRoule
 } from '@/api/user'
 import {
-  clearStorage
+  clearStorage,
+  removeToken
 } from '../../utils/auth'
 /**
  * 递归过滤异步路由表,返回符合用户角色权限的路由表
@@ -130,7 +131,7 @@ const actions = {
       getRoule().then(response => {
         const roles = []
         handleRoles(response.data, roles, '')
-        console.log("roles", roles)
+        console.log('roles', roles)
         const accessedRoutes = filterAsyncRoutes(constantRoutes, roles)
 
         commit('user/SET_ROLES', roles, {
@@ -138,7 +139,13 @@ const actions = {
         })
         commit('SET_ROUTES', accessedRoutes)
         resolve(accessedRoutes)
-      })
+      }).catch((err) => {
+        console.error('获取角色错误')
+        clearStorage()
+        resetRouter()
+        removeToken()
+        window.location.href='https://admin.changyuntong56.com/#/login'
+      })
     })
   }
 }

+ 4 - 0
src/utils/auth.js

@@ -13,3 +13,7 @@ export function setToken(token) {
 export function removeToken() {
   return Cookies.remove(TokenKey)
 }
+
+export function clearStorage() {
+  return localStorage.clear();
+}

+ 35 - 35
src/views/permissionSetting/permissionSetting.vue

@@ -83,11 +83,11 @@
     getRoleInfo,
     getTenantlist,
     bindResources
-  } from "@/api/permissionSettingManagement";
+  } from '@/api/permissionSettingManagement';
   export default {
     components: {
-      "el-image-viewer": () =>
-        import("element-ui/packages/image/src/image-viewer"),
+      'el-image-viewer': () =>
+        import('element-ui/packages/image/src/image-viewer'),
     },
     data() {
       return {
@@ -121,8 +121,8 @@
       async initDict() {
         // 获取部门
         const resp2 = await getDeptPageByCompId({
-          compId: localStorage.getItem("enterprise-front-companyId"),
-          vesselBankFlag: "V"
+          compId: localStorage.getItem('enterprise-front-companyId'),
+          vesselBankFlag: 'V'
         });
         this.deptList = resp2.records;
         await this.getList();
@@ -173,13 +173,13 @@
                 _defaultOpeneds.push(value2.serviceId);
                 _defaultOpeneds.push(value.pluginId);
               }
-              this.$set(value2, "featureCheckeds", _featureCheckeds);
+              this.$set(value2, 'featureCheckeds', _featureCheckeds);
             });
           });
-          this.$set(this, "defaultOpeneds", _defaultOpeneds);
+          this.$set(this, 'defaultOpeneds', _defaultOpeneds);
           this.loadingRoleRan = false;
         } catch (error) {
-          if (error.code && error.code !== "200") this.$message(error.message);
+          if (error.code && error.code !== '200') this.$message(error.message);
         }
       },
       // 初始化插件树
@@ -196,11 +196,11 @@
                 value2.featureCheckeds = [];
               });
             });
-            this.$set(this, "queryList", resp4.data);
+            this.$set(this, 'queryList', resp4.data);
             console.log('lsit', this.queryList)
           }
         } catch (error) {
-          if (error.code && error.code !== "200") this.$message(error.message);
+          if (error.code && error.code !== '200') this.$message(error.message);
         }
       },
       submit() {
@@ -211,18 +211,18 @@
 
         if (this.deptTitle == '添加') {
           let _obj = {
-            compId: "2710b21efc1e4393930c5dc800010dc4",
-            deptId: "3d7dbdc962ca4a96a48522c9ee528bc3",
+            compId: '2710b21efc1e4393930c5dc800010dc4',
+            deptId: '3d7dbdc962ca4a96a48522c9ee528bc3',
             roleName: this.Info.newsTitle,
-            underCompId: "2710b21efc1e4393930c5dc800010dc4",
-            underCompName: "黑龙江中天昊元贸易有限公司",
-            vesselBankFlag: "B"
+            underCompId: '2710b21efc1e4393930c5dc800010dc4',
+            underCompName: '黑龙江中天昊元贸易有限公司',
+            vesselBankFlag: 'B'
           }
           create(_obj).then((response) => {
               this.$notify({
-                title: "成功",
-                message: "添加成功!",
-                type: "success",
+                title: '成功',
+                message: '添加成功!',
+                type: 'success',
               });
               this.sendInfoClose();
               this.listLoading = false;
@@ -230,9 +230,9 @@
             })
             .catch((error) => {
               this.$notify({
-                title: "失败",
+                title: '失败',
                 message: error,
-                type: "error",
+                type: 'error',
               });
               this.sendInfoClose();
             });
@@ -240,9 +240,9 @@
           this.selectRow.roleName = this.Info.newsTitle
           changeInfo(this.selectRow).then((response) => {
               this.$notify({
-                title: "成功",
-                message: "编辑成功!",
-                type: "success",
+                title: '成功',
+                message: '编辑成功!',
+                type: 'success',
               });
               this.sendInfoClose();
               this.listLoading = false;
@@ -250,9 +250,9 @@
             })
             .catch((error) => {
               this.$notify({
-                title: "失败",
+                title: '失败',
                 message: error,
-                type: "error",
+                type: 'error',
               });
               this.sendInfoClose();
             });
@@ -275,10 +275,10 @@
       },
       getList() {
         let _data = {
-          compId: "2710b21efc1e4393930c5dc800010dc4",
+          compId: '2710b21efc1e4393930c5dc800010dc4',
           pageSize: 10,
           currentPage: 1,
-          vesselBankFlag: "B"
+          vesselBankFlag: 'B'
         }
         getList(_data)
           .then((res) => {
@@ -289,18 +289,18 @@
           });
       },
       addJump() {
-        this.deptTitle = "添加";
+        this.deptTitle = '添加';
         this.sendInfo = true
       },
       editInfo(val) {
-        this.deptTitle = "编辑";
+        this.deptTitle = '编辑';
         this.Info.newsTitle = val.roleName
         this.sendInfo = true
         this.selectRow = val
 
       },
       setInfo(val) {
-        debugger
+        // debugger
         this.showRoleRan(val)
       },
       // 保存权限范围
@@ -326,13 +326,13 @@
           };
           await bindResources(data);
           this.$message({
-            message: "保存成功!",
-            type: "success"
+            message: '保存成功!',
+            type: 'success'
           });
           this.addRoleRanFlag = false;
           this.getList();
         } catch (error) {
-          if (error.code && error.code !== "200") this.$message(error.message);
+          if (error.code && error.code !== '200') this.$message(error.message);
         }
       },
       allSelect(data) {
@@ -343,9 +343,9 @@
           sour.forEach((value, index) => {
             _selected.push(value.featureId);
           });
-          this.$set(data, "featureCheckeds", _selected);
+          this.$set(data, 'featureCheckeds', _selected);
         } else {
-          this.$set(data, "featureCheckeds", []);
+          this.$set(data, 'featureCheckeds', []);
         }
       }
     },

+ 2 - 2
vue.config.js

@@ -55,8 +55,8 @@ module.exports = {
         },
         proxy: {
             '/pb': {
-                // target: 'http://192.168.110.67:8099/', 
-                target: 'http://192.168.110.9:8099/',       
+                target: 'http://192.168.110.67:8999/', 
+                // target: 'http://192.168.110.9:8099/',       
                 // target: 'https://apitest.eliangeyun.com',
                 changeOrigin: true, // 开启代理:在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题
                 pathRewrite: {