Hwt пре 2 година
родитељ
комит
c323715119

+ 2 - 2
commandCenter/src/components/common/Header.vue

@@ -119,14 +119,14 @@ export default {
     },
     // 退出登录
     logOut () {
-      var access_token = localStorage.getItem('SC_token');
+      var access_token = localStorage.getItem('CZC_token');
       this.$http.postForm('/czc-user-auth/user/logout', { access_token: access_token }).then(({ status, data, msg }) => {
         if (0 === status) {
           this.$message({
             type: 'success',
             message: '您已退出登录'
           });
-          localStorage.removeItem('SC_token');
+          localStorage.removeItem('CZC_token');
           sessionStorage.removeItem('SC_listMuen');
           this.$store.commit('setloginInfo', '');
           this.$store.dispatch('tags', []);

+ 5 - 5
commandCenter/src/utils/http.js

@@ -39,7 +39,7 @@ http.interceptors.request.use(
             // 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');
+        config.headers[localStorage.getItem('CZC_token') && 'Authorization'] = 'Bearer ' + localStorage.getItem('CZC_token');
         // 全局添加cancelToken
         config.cancelToken = source.token;
         return config;
@@ -56,7 +56,7 @@ http.interceptors.response.use(
     (err) => {
         if (err.response.status == 401) {
             axios({
-                url: '/czc-user-auth/user/getUserStatus?accessToken=' + localStorage.getItem('SC_token'),
+                url: '/czc-user-auth/user/getUserStatus?accessToken=' + localStorage.getItem('CZC_token'),
                 method: 'get'
             }).then((response) => {
                 if (window.relogin) return false;
@@ -73,7 +73,7 @@ http.interceptors.response.use(
                         .then(() => {
                             window.open(config.loginUrl, '_self');
                             window.relogin = false;
-                            localStorage.removeItem('SC_token');
+                            localStorage.removeItem('CZC_token');
                         })
                         .catch(() => {});
                 } else if (data == 1) {
@@ -87,7 +87,7 @@ http.interceptors.response.use(
                         .then(() => {
                             window.open(config.loginUrl, '_self');
                             window.relogin = false;
-                            localStorage.removeItem('SC_token');
+                            localStorage.removeItem('CZC_token');
                         })
                         .catch(() => {});
                 } else {
@@ -101,7 +101,7 @@ http.interceptors.response.use(
                         .then(() => {
                             window.open(config.loginUrl, '_self');
                             window.relogin = false;
-                            localStorage.removeItem('SC_token');
+                            localStorage.removeItem('CZC_token');
                         })
                         .catch(() => {});
                 }

+ 87 - 91
commandCenter/src/utils/utils.js

@@ -6,7 +6,7 @@
  * @Description: In User Settings Edit
  * @FilePath: \vue-manage-system-master\src\utils\utils.js
  */
-import Vue from 'vue'
+import Vue from 'vue';
 import newValidate from './newValidate.js';
 import MsgBoxCom from '../components/msgBox';
 Vue.prototype.$valid = newValidate;
@@ -14,21 +14,21 @@ Vue.prototype.$valid = newValidate;
 //全局混入
 //mix_path为权限前缀
 Vue.mixin({
-  computed: {
-    $add() {
-      return this.$store.getters["hasPermission"](this.mix_path + ":add")
-    },
-    $del() {
-      return this.$store.getters["hasPermission"](this.mix_path + ":del")
-    },
-    $edit() {
-      return this.$store.getters["hasPermission"](this.mix_path + ":edit")
-    },
-    $query() {
-      return this.$store.getters["hasPermission"](this.mix_path + ":query")
-    },
-  }
-})
+    computed: {
+        $add() {
+            return this.$store.getters['hasPermission'](this.mix_path + ':add');
+        },
+        $del() {
+            return this.$store.getters['hasPermission'](this.mix_path + ':del');
+        },
+        $edit() {
+            return this.$store.getters['hasPermission'](this.mix_path + ':edit');
+        },
+        $query() {
+            return this.$store.getters['hasPermission'](this.mix_path + ':query');
+        }
+    }
+});
 /**
  * @description: 弹出确认提示框
  * @param {String} msg: 主消息
@@ -37,95 +37,91 @@ Vue.mixin({
  * @param {Object} params: 扩展参数
  * @return {type}: null
  */
-Vue.prototype.$msgBox = (msg = '', tipMsg = '删除后将无法恢复,是否继续?', type = 'error', params = {}) => new Promise((resolve, reject) => {
-  const config = {
-    width: '374px',
-    showCancelButton: true,
-    confirmButtonText: '确认',
-    showClose: true,
-    resolve: resolve,
-    reject: reject,
-  }
-  Object.assign(config, params)
+Vue.prototype.$msgBox = (msg = '', tipMsg = '删除后将无法恢复,是否继续?', type = 'error', params = {}) =>
+    new Promise((resolve, reject) => {
+        const config = {
+            width: '374px',
+            showCancelButton: true,
+            confirmButtonText: '确认',
+            showClose: true,
+            resolve: resolve,
+            reject: reject
+        };
+        Object.assign(config, params);
 
-  const MsgBox = Vue.extend(MsgBoxCom)
-  const dom = new MsgBox().$mount()
-  document.getElementById('app').appendChild(dom.$el)
-  dom.config = config
-  dom.msg = msg
-  dom.tipMsg = tipMsg
-  dom.type = type
-})
+        const MsgBox = Vue.extend(MsgBoxCom);
+        const dom = new MsgBox().$mount();
+        document.getElementById('app').appendChild(dom.$el);
+        dom.config = config;
+        dom.msg = msg;
+        dom.tipMsg = tipMsg;
+        dom.type = type;
+    });
 /**
-   * @description: 遍历节点是否存在当前值
-   * @param {Array} dataArr 数组对象
-   * @param {String|Number} val 比对值
-   * @param {String} valStr  比对字段
-   * @return {Boolean}  返回存在或不存在
-   */
+ * @description: 遍历节点是否存在当前值
+ * @param {Array} dataArr 数组对象
+ * @param {String|Number} val 比对值
+ * @param {String} valStr  比对字段
+ * @return {Boolean}  返回存在或不存在
+ */
 Vue.prototype.__calleArr = function (dataArr, val, valStr) {
-  for (let i in dataArr) {
-    var data = dataArr[i];
-    if (data[valStr] === val) {
-      return true;
-    } else {
-      if (data.children) {
-        this.__calleArr(data.children, val, valStr)
-      }
+    for (let i in dataArr) {
+        var data = dataArr[i];
+        if (data[valStr] === val) {
+            return true;
+        } else {
+            if (data.children) {
+                this.__calleArr(data.children, val, valStr);
+            }
+        }
     }
-  }
-}
+};
 
 // 确认提示框
 Vue.prototype.__confirm = function (msg = '确认要删除该数据?', title = '提示', settings) {
-  let sets = Object.assign(settings || {}, {
-    cancelButtonClass: 'el-button--medium',
-    confirmButtonClass: 'el-button--medium',
-    dangerouslyUseHTMLString: true,
-  })
-  return this.$confirm(`<p class="text_normal bold">${msg}</p>`, title, sets);
-}
+    let sets = Object.assign(settings || {}, {
+        cancelButtonClass: 'el-button--medium',
+        confirmButtonClass: 'el-button--medium',
+        dangerouslyUseHTMLString: true
+    });
+    return this.$confirm(`<p class="text_normal bold">${msg}</p>`, title, sets);
+};
 
 /*
 设置弹出组件 datakey 集合下各字段的值,根据params.data
 */
 Vue.prototype.__setValue = function (datakey) {
-  let obj = this[datakey];
-  for (let item in obj) {
-    const str = this.params.data[item];
-    obj[item] = str ? str : _.isNumber(str) ? str : ''
-  }
-}
+    let obj = this[datakey];
+    for (let item in obj) {
+        const str = this.params.data[item];
+        obj[item] = str ? str : _.isNumber(str) ? str : '';
+    }
+};
 
 // Excel表格下载
-Vue.prototype.__exportExcel = (
-  url = "Abnormal/getAllAbnormalExcel",
-  params = {},
-  token = localStorage.getItem("SC_token")
-) => {
-  // eslint-disable-next-line no-param-reassign
-  delete params.pageNum;
-  // eslint-disable-next-line no-param-reassign
-  delete params.pageSize;
-  let link;
-  if (document.getElementById("exportATag")) {
-    link = document.getElementById("exportATag");
-  } else {
-    link = document.createElement("a");
-    link.setAttribute("id", "exportATag");
-    link.style.display = "none";
-  }
-  const httpReg = /(http|https):\/\/([\w.]+\/?)\S*/;
-  let urlStr = httpReg.test(url) ? `${url}&` : `${url}?`;
-  _.mapKeys(params, (val, key) => {
-
-    if (!_.isEmpty(String(val)) && val) {
-      urlStr += `${key}=${val}&`;
+Vue.prototype.__exportExcel = (url = 'Abnormal/getAllAbnormalExcel', params = {}, token = localStorage.getItem('CZC_token')) => {
+    // eslint-disable-next-line no-param-reassign
+    delete params.pageNum;
+    // eslint-disable-next-line no-param-reassign
+    delete params.pageSize;
+    let link;
+    if (document.getElementById('exportATag')) {
+        link = document.getElementById('exportATag');
+    } else {
+        link = document.createElement('a');
+        link.setAttribute('id', 'exportATag');
+        link.style.display = 'none';
     }
-  });
+    const httpReg = /(http|https):\/\/([\w.]+\/?)\S*/;
+    let urlStr = httpReg.test(url) ? `${url}&` : `${url}?`;
+    _.mapKeys(params, (val, key) => {
+        if (!_.isEmpty(String(val)) && val) {
+            urlStr += `${key}=${val}&`;
+        }
+    });
 
-  link.href = `${urlStr}access_token=${token}`;
+    link.href = `${urlStr}access_token=${token}`;
 
-  document.body.appendChild(link);
-  link.click();
-};
+    document.body.appendChild(link);
+    link.click();
+};