Browse Source

localStorage存储皮肤模式,集团首页creatd时,优先使用存储的皮肤

yunxing 4 years ago
parent
commit
f761807203
2 changed files with 20 additions and 2 deletions
  1. 3 0
      src/store/index.js
  2. 17 2
      src/views/statistics/index.vue

+ 3 - 0
src/store/index.js

@@ -9,6 +9,8 @@ Vue.use(Vuex)
 export default new Vuex.Store({
     state: {
         // 阿里云环境,开发环境使用 admin:liujiandong ,测试环境,生产环境使用null
+        // ssoToken: ['aly_dev', 'serve'].includes(process.env.NODE_ENV) ?  window.location.href.includes('ct')? 'admin:chentao22' :'admin:liujiandong' : null,
+        // ssoToken: ['aly_dev', 'serve'].includes(process.env.NODE_ENV) ?  window.location.href.includes('zy')? 'admin:zhangyang12' :'admin:liujiandong' : null,
         ssoToken: ['aly_dev', 'serve'].includes(process.env.NODE_ENV) ? 'admin:liujiandong' : null,
         // ssoToken: '',
         // ssoToken: null,
@@ -70,6 +72,7 @@ export default new Vuex.Store({
         isrequestAuth: (state) => state.isrequestAuth,
         permissions: (state) => state.permissions,
         floorObj: (state) => state.floorObj,
+        userInfo: (state) => state.userInfo,
     },
     mutations: {
         SETPLAZENAME(state, data) {

+ 17 - 2
src/views/statistics/index.vue

@@ -504,12 +504,27 @@ export default {
     };
   },
   computed: {
-    ...mapGetters(["plazas", "plazaId", "accessLevel"]),
+    ...mapGetters(["plazas", "plazaId", "accessLevel", "userInfo"]),
+  },
+  watch: {
+      /**
+       * 监听皮肤模式
+       * 皮肤模式切换后,存储用户名,皮肤模式
+       */
+    skinMode(newV){
+      localStorage.setItem(`${this.userInfo.username}__skinMode`, newV)
+    },
   },
-  watch: {},
   components: { Tabs, Dialog },
   created() {
     this.currentTime();
+    /**
+     * 使用localStorage中储存的, 当前用户的皮肤模式
+     */
+    let skinMode = localStorage.getItem(`${this.userInfo.username}__skinMode`)
+    if(skinMode){
+        this.skinMode = skinMode
+    }
   },
   mounted() {
     this.getFrameworkTreeData();