Browse Source

修改动态菜单

Shannon_mu 3 years ago
parent
commit
b18666940e

+ 35 - 35
operationSupport/package-lock.json

@@ -1,6 +1,6 @@
 {
   "name": "vue-manage-operation",
-  "version": "1.0.0",
+  "version": "1.0.1",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
@@ -63,7 +63,7 @@
         },
         "ms": {
           "version": "2.1.2",
-          "resolved": "https://registry.npm.taobao.org/ms/download/ms-2.1.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fms%2Fdownload%2Fms-2.1.2.tgz",
+          "resolved": "https://registry.npmmirror.com/ms/download/ms-2.1.2.tgz",
           "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=",
           "dev": true
         },
@@ -983,7 +983,7 @@
         },
         "ms": {
           "version": "2.1.2",
-          "resolved": "https://registry.npm.taobao.org/ms/download/ms-2.1.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fms%2Fdownload%2Fms-2.1.2.tgz",
+          "resolved": "https://registry.npmmirror.com/ms/download/ms-2.1.2.tgz",
           "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=",
           "dev": true
         }
@@ -2083,7 +2083,7 @@
       "dependencies": {
         "source-map": {
           "version": "0.6.1",
-          "resolved": "https://registry.npm.taobao.org/source-map/download/source-map-0.6.1.tgz",
+          "resolved": "https://registry.nlark.com/source-map/download/source-map-0.6.1.tgz",
           "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=",
           "dev": true
         }
@@ -3456,7 +3456,7 @@
       "dependencies": {
         "source-map": {
           "version": "0.6.1",
-          "resolved": "https://registry.npm.taobao.org/source-map/download/source-map-0.6.1.tgz",
+          "resolved": "https://registry.nlark.com/source-map/download/source-map-0.6.1.tgz",
           "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=",
           "dev": true
         }
@@ -3493,7 +3493,7 @@
         },
         "ansi-styles": {
           "version": "4.3.0",
-          "resolved": "https://registry.npm.taobao.org/ansi-styles/download/ansi-styles-4.3.0.tgz?cache=0&sync_timestamp=1601839122515&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fansi-styles%2Fdownload%2Fansi-styles-4.3.0.tgz",
+          "resolved": "https://registry.nlark.com/ansi-styles/download/ansi-styles-4.3.0.tgz",
           "integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=",
           "dev": true,
           "requires": {
@@ -3523,7 +3523,7 @@
         },
         "color-convert": {
           "version": "2.0.1",
-          "resolved": "https://registry.npm.taobao.org/color-convert/download/color-convert-2.0.1.tgz?cache=0&sync_timestamp=1566248870121&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcolor-convert%2Fdownload%2Fcolor-convert-2.0.1.tgz",
+          "resolved": "https://registry.npm.taobao.org/color-convert/download/color-convert-2.0.1.tgz",
           "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=",
           "dev": true,
           "requires": {
@@ -3544,7 +3544,7 @@
         },
         "has-flag": {
           "version": "4.0.0",
-          "resolved": "https://registry.npm.taobao.org/has-flag/download/has-flag-4.0.0.tgz",
+          "resolved": "https://registry.nlark.com/has-flag/download/has-flag-4.0.0.tgz",
           "integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=",
           "dev": true
         },
@@ -3576,7 +3576,7 @@
         },
         "supports-color": {
           "version": "7.2.0",
-          "resolved": "https://registry.npm.taobao.org/supports-color/download/supports-color-7.2.0.tgz?cache=0&sync_timestamp=1598611709087&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-7.2.0.tgz",
+          "resolved": "https://registry.npmmirror.com/supports-color/download/supports-color-7.2.0.tgz",
           "integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=",
           "dev": true,
           "requires": {
@@ -4431,7 +4431,7 @@
         },
         "source-map": {
           "version": "0.6.1",
-          "resolved": "https://registry.npm.taobao.org/source-map/download/source-map-0.6.1.tgz",
+          "resolved": "https://registry.nlark.com/source-map/download/source-map-0.6.1.tgz",
           "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=",
           "dev": true
         }
@@ -5087,7 +5087,7 @@
       "dependencies": {
         "memory-fs": {
           "version": "0.5.0",
-          "resolved": "https://registry.npm.taobao.org/memory-fs/download/memory-fs-0.5.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmemory-fs%2Fdownload%2Fmemory-fs-0.5.0.tgz",
+          "resolved": "https://registry.nlark.com/memory-fs/download/memory-fs-0.5.0.tgz",
           "integrity": "sha1-MkwBKIuIZSlm0WHbd4OHIIRajjw=",
           "dev": true,
           "requires": {
@@ -8966,7 +8966,7 @@
         },
         "source-map": {
           "version": "0.6.1",
-          "resolved": "https://registry.npm.taobao.org/source-map/download/source-map-0.6.1.tgz",
+          "resolved": "https://registry.nlark.com/source-map/download/source-map-0.6.1.tgz",
           "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=",
           "dev": true
         }
@@ -9722,7 +9722,7 @@
       "dependencies": {
         "postcss-value-parser": {
           "version": "3.3.1",
-          "resolved": "https://registry.npm.taobao.org/postcss-value-parser/download/postcss-value-parser-3.3.1.tgz",
+          "resolved": "https://registry.npmmirror.com/postcss-value-parser/download/postcss-value-parser-3.3.1.tgz",
           "integrity": "sha1-n/giVH4okyE88cMO+lGsX9G6goE=",
           "dev": true
         }
@@ -10114,7 +10114,7 @@
       "dependencies": {
         "jsesc": {
           "version": "0.5.0",
-          "resolved": "https://registry.npm.taobao.org/jsesc/download/jsesc-0.5.0.tgz",
+          "resolved": "https://registry.nlark.com/jsesc/download/jsesc-0.5.0.tgz",
           "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=",
           "dev": true
         }
@@ -10985,7 +10985,7 @@
       "dependencies": {
         "source-map": {
           "version": "0.6.1",
-          "resolved": "https://registry.npm.taobao.org/source-map/download/source-map-0.6.1.tgz",
+          "resolved": "https://registry.nlark.com/source-map/download/source-map-0.6.1.tgz",
           "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=",
           "dev": true
         }
@@ -12496,7 +12496,7 @@
       "dependencies": {
         "anymatch": {
           "version": "2.0.0",
-          "resolved": "https://registry.npm.taobao.org/anymatch/download/anymatch-2.0.0.tgz",
+          "resolved": "https://registry.nlark.com/anymatch/download/anymatch-2.0.0.tgz",
           "integrity": "sha1-vLJLTzeTTZqnrBe0ra+J58du8us=",
           "dev": true,
           "optional": true,
@@ -12519,7 +12519,7 @@
         },
         "binary-extensions": {
           "version": "1.13.1",
-          "resolved": "https://registry.npm.taobao.org/binary-extensions/download/binary-extensions-1.13.1.tgz",
+          "resolved": "https://registry.nlark.com/binary-extensions/download/binary-extensions-1.13.1.tgz",
           "integrity": "sha1-WYr+VHVbKGilMw0q/51Ou1Mgm2U=",
           "dev": true,
           "optional": true
@@ -12557,7 +12557,7 @@
         },
         "chokidar": {
           "version": "2.1.8",
-          "resolved": "https://registry.npm.taobao.org/chokidar/download/chokidar-2.1.8.tgz?cache=0&sync_timestamp=1602585381749&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchokidar%2Fdownload%2Fchokidar-2.1.8.tgz",
+          "resolved": "https://registry.npmmirror.com/chokidar/download/chokidar-2.1.8.tgz",
           "integrity": "sha1-gEs6e2qZNYw8XGHnHYco8EHP+Rc=",
           "dev": true,
           "optional": true,
@@ -12613,7 +12613,7 @@
         },
         "glob-parent": {
           "version": "3.1.0",
-          "resolved": "https://registry.npm.taobao.org/glob-parent/download/glob-parent-3.1.0.tgz",
+          "resolved": "https://registry.npmmirror.com/glob-parent/download/glob-parent-3.1.0.tgz?cache=0&sync_timestamp=1632953697891&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fglob-parent%2Fdownload%2Fglob-parent-3.1.0.tgz",
           "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=",
           "dev": true,
           "optional": true,
@@ -12624,7 +12624,7 @@
           "dependencies": {
             "is-glob": {
               "version": "3.1.0",
-              "resolved": "https://registry.npm.taobao.org/is-glob/download/is-glob-3.1.0.tgz",
+              "resolved": "https://registry.npmmirror.com/is-glob/download/is-glob-3.1.0.tgz",
               "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=",
               "dev": true,
               "optional": true,
@@ -12636,7 +12636,7 @@
         },
         "is-binary-path": {
           "version": "1.0.1",
-          "resolved": "https://registry.npm.taobao.org/is-binary-path/download/is-binary-path-1.0.1.tgz",
+          "resolved": "https://registry.nlark.com/is-binary-path/download/is-binary-path-1.0.1.tgz",
           "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=",
           "dev": true,
           "optional": true,
@@ -12697,7 +12697,7 @@
         },
         "readdirp": {
           "version": "2.2.1",
-          "resolved": "https://registry.npm.taobao.org/readdirp/download/readdirp-2.2.1.tgz?cache=0&sync_timestamp=1602584331621&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Freaddirp%2Fdownload%2Freaddirp-2.2.1.tgz",
+          "resolved": "https://registry.nlark.com/readdirp/download/readdirp-2.2.1.tgz",
           "integrity": "sha1-DodiKjMlqjPokihcr4tOhGUppSU=",
           "dev": true,
           "optional": true,
@@ -12890,7 +12890,7 @@
         },
         "schema-utils": {
           "version": "1.0.0",
-          "resolved": "https://registry.npm.taobao.org/schema-utils/download/schema-utils-1.0.0.tgz",
+          "resolved": "https://registry.npmmirror.com/schema-utils/download/schema-utils-1.0.0.tgz?cache=0&sync_timestamp=1637075997986&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fschema-utils%2Fdownload%2Fschema-utils-1.0.0.tgz",
           "integrity": "sha1-C3mpMgTXtgDUsoUNH2bCo0lRx3A=",
           "dev": true,
           "requires": {
@@ -13041,7 +13041,7 @@
       "dependencies": {
         "anymatch": {
           "version": "2.0.0",
-          "resolved": "https://registry.npm.taobao.org/anymatch/download/anymatch-2.0.0.tgz",
+          "resolved": "https://registry.nlark.com/anymatch/download/anymatch-2.0.0.tgz",
           "integrity": "sha1-vLJLTzeTTZqnrBe0ra+J58du8us=",
           "dev": true,
           "requires": {
@@ -13062,7 +13062,7 @@
         },
         "binary-extensions": {
           "version": "1.13.1",
-          "resolved": "https://registry.npm.taobao.org/binary-extensions/download/binary-extensions-1.13.1.tgz",
+          "resolved": "https://registry.nlark.com/binary-extensions/download/binary-extensions-1.13.1.tgz",
           "integrity": "sha1-WYr+VHVbKGilMw0q/51Ou1Mgm2U=",
           "dev": true
         },
@@ -13097,7 +13097,7 @@
         },
         "chokidar": {
           "version": "2.1.8",
-          "resolved": "https://registry.npm.taobao.org/chokidar/download/chokidar-2.1.8.tgz?cache=0&sync_timestamp=1602585381749&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchokidar%2Fdownload%2Fchokidar-2.1.8.tgz",
+          "resolved": "https://registry.npmmirror.com/chokidar/download/chokidar-2.1.8.tgz",
           "integrity": "sha1-gEs6e2qZNYw8XGHnHYco8EHP+Rc=",
           "dev": true,
           "requires": {
@@ -13159,7 +13159,7 @@
         },
         "glob-parent": {
           "version": "3.1.0",
-          "resolved": "https://registry.npm.taobao.org/glob-parent/download/glob-parent-3.1.0.tgz",
+          "resolved": "https://registry.npmmirror.com/glob-parent/download/glob-parent-3.1.0.tgz?cache=0&sync_timestamp=1632953697891&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fglob-parent%2Fdownload%2Fglob-parent-3.1.0.tgz",
           "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=",
           "dev": true,
           "requires": {
@@ -13169,7 +13169,7 @@
           "dependencies": {
             "is-glob": {
               "version": "3.1.0",
-              "resolved": "https://registry.npm.taobao.org/is-glob/download/is-glob-3.1.0.tgz",
+              "resolved": "https://registry.npmmirror.com/is-glob/download/is-glob-3.1.0.tgz",
               "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=",
               "dev": true,
               "requires": {
@@ -13180,13 +13180,13 @@
         },
         "is-absolute-url": {
           "version": "3.0.3",
-          "resolved": "https://registry.npm.taobao.org/is-absolute-url/download/is-absolute-url-3.0.3.tgz?cache=0&sync_timestamp=1569736493122&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-absolute-url%2Fdownload%2Fis-absolute-url-3.0.3.tgz",
+          "resolved": "https://registry.nlark.com/is-absolute-url/download/is-absolute-url-3.0.3.tgz?cache=0&sync_timestamp=1628691761253&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fis-absolute-url%2Fdownload%2Fis-absolute-url-3.0.3.tgz",
           "integrity": "sha1-lsaiK2ojkpsR6gr7GDbDatSl1pg=",
           "dev": true
         },
         "is-binary-path": {
           "version": "1.0.1",
-          "resolved": "https://registry.npm.taobao.org/is-binary-path/download/is-binary-path-1.0.1.tgz",
+          "resolved": "https://registry.nlark.com/is-binary-path/download/is-binary-path-1.0.1.tgz",
           "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=",
           "dev": true,
           "requires": {
@@ -13242,13 +13242,13 @@
         },
         "ms": {
           "version": "2.1.2",
-          "resolved": "https://registry.npm.taobao.org/ms/download/ms-2.1.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fms%2Fdownload%2Fms-2.1.2.tgz",
+          "resolved": "https://registry.npmmirror.com/ms/download/ms-2.1.2.tgz",
           "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=",
           "dev": true
         },
         "readdirp": {
           "version": "2.2.1",
-          "resolved": "https://registry.npm.taobao.org/readdirp/download/readdirp-2.2.1.tgz?cache=0&sync_timestamp=1602584331621&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Freaddirp%2Fdownload%2Freaddirp-2.2.1.tgz",
+          "resolved": "https://registry.nlark.com/readdirp/download/readdirp-2.2.1.tgz",
           "integrity": "sha1-DodiKjMlqjPokihcr4tOhGUppSU=",
           "dev": true,
           "requires": {
@@ -13259,7 +13259,7 @@
         },
         "schema-utils": {
           "version": "1.0.0",
-          "resolved": "https://registry.npm.taobao.org/schema-utils/download/schema-utils-1.0.0.tgz",
+          "resolved": "https://registry.npmmirror.com/schema-utils/download/schema-utils-1.0.0.tgz?cache=0&sync_timestamp=1637075997986&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fschema-utils%2Fdownload%2Fschema-utils-1.0.0.tgz",
           "integrity": "sha1-C3mpMgTXtgDUsoUNH2bCo0lRx3A=",
           "dev": true,
           "requires": {
@@ -13270,13 +13270,13 @@
         },
         "semver": {
           "version": "6.3.0",
-          "resolved": "https://registry.npm.taobao.org/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1589682805026&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz",
+          "resolved": "https://registry.nlark.com/semver/download/semver-6.3.0.tgz?cache=0&sync_timestamp=1622604551741&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsemver%2Fdownload%2Fsemver-6.3.0.tgz",
           "integrity": "sha1-7gpkyK9ejO6mdoexM3YeG+y9HT0=",
           "dev": true
         },
         "supports-color": {
           "version": "6.1.0",
-          "resolved": "https://registry.npm.taobao.org/supports-color/download/supports-color-6.1.0.tgz?cache=0&sync_timestamp=1598611709087&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-6.1.0.tgz",
+          "resolved": "https://registry.npmmirror.com/supports-color/download/supports-color-6.1.0.tgz",
           "integrity": "sha1-B2Srxpxj1ayELdSGfo0CXogN+PM=",
           "dev": true,
           "requires": {

+ 27 - 14
operationSupport/src/components/common/Header.vue

@@ -28,7 +28,8 @@
                         <p>消息通知</p>
                         <ul>
                             <li v-for="(items, index) in messageList" :key="index" @click="toUrl(items.typeId)" style="cursor: pointer">
-                                <img :src="imgList[items.typeId - 1]" style="width: 30px; height: 30px" />
+                                <img :src="imgList[items.typeId]" style="width: 30px; height: 30px" />
+                                <!-- <img :src="imgList[items.typeId - 1]" style="width: 30px; height: 30px" /> -->
                                 <div>
                                     <span class="cont">【{{ items.shortName }}】{{ items.messageContent }}</span>
                                     <span class="time">{{ items.dateCreate }}</span>
@@ -66,18 +67,27 @@ export default {
         return {
             name: '',
             envConfig: envConfig,
-            imgList: [
-                require('@/assets/img/icon_msg1.png'),
-                require('@/assets/img/icon_msg2.png'),
-                require('@/assets/img/icon_msg3.png'),
-                require('@/assets/img/icon_msg4.png'),
-                require('@/assets/img/icon_msg5.png'),
-                require('@/assets/img/icon_msg6.png'),
-                require('@/assets/img/icon_msg7.png'),
-                require('@/assets/img/icon_msg8.png'),
-                require('@/assets/img/icon_msg9.png'),
-                require('@/assets/img/icon_msg9.png')
-            ]
+            imgList: {
+                1: require('@/assets/img/icon_msg1.png'),
+                2: require('@/assets/img/icon_msg7.png'),
+                10: require('@/assets/img/icon_msg9.png'),
+                11: require('@/assets/img/icon_msg9.png'),
+                13: require('@/assets/img/icon_msg9.png')
+
+                //     [
+                //     require('@/assets/img/icon_msg1.png'),
+                //     require('@/assets/img/icon_msg2.png'),
+                //     require('@/assets/img/icon_msg3.png'),
+                //     require('@/assets/img/icon_msg4.png'),
+                //     require('@/assets/img/icon_msg5.png'),
+                //     require('@/assets/img/icon_msg6.png'),
+                //     require('@/assets/img/icon_msg7.png'),
+                //     require('@/assets/img/icon_msg8.png'),
+                //     require('@/assets/img/icon_msg9.png'),
+                //     require('@/assets/img/icon_msg9.png'),
+                //     require('@/assets/img/icon_msg9.png')
+                // ]
+            }
         };
     },
     components: {
@@ -109,8 +119,10 @@ export default {
                         message: '您已退出登录'
                     });
                     localStorage.removeItem('SC_token');
+                    sessionStorage.removeItem('SC_listMuen');
                     this.$store.commit('setloginInfo', '');
                     this.$store.dispatch('tags', []);
+
                     sessionStorage.removeItem('tabs');
                     location.href = this.envConfig.loginUrl;
                 } else {
@@ -205,7 +217,8 @@ export default {
             this.websocket.onmessage = function (event) {
                 try {
                     let msg = JSON.parse(event.data);
-                    let i = msg.typeId - 1;
+                    // let i = msg.typeId - 1;
+                    let i = msg.typeId;
                     if (msg.userId) {
                         that.$notify({
                             dangerouslyUseHTMLString: true,

+ 1 - 0
operationSupport/src/components/common/Home.vue

@@ -77,6 +77,7 @@ export default {
         vTags
     },
     created() {
+        this.$store.dispatch('SET_MENU_LIST');
         this.getElement();
         this.$store.dispatch('tags', JSON.parse(sessionStorage.getItem('tabs')) || []);
     },

+ 52 - 56
operationSupport/src/main.js

@@ -73,16 +73,6 @@ Vue.prototype.routerLoad = {
     },
     findMen(arrList, arr, indexPath) {
         arr.map((v) => {
-            // if ('/' + v.linkPath !== indexPath) {
-            //     if (!!v.children) {
-            //         this.findMen(arrList, item.children, indexPath);
-            //     } else {
-            //         arrList.push(true)
-            //     }
-            // } else {
-
-            // }
-
             if (v.children) {
                 this.findMen(arrList, v.children, indexPath);
             } else {
@@ -124,63 +114,69 @@ Vue.prototype.routerLoad = {
     }
 };
 //使用钩子函数对路由进行权限跳转
-// router.beforeEach((to, from, next) => {
-//     debugger;
-//     if (localStorage.getItem("SC_token")) {
-//         let menuList = window.sessionStorage.getItem("operationMuen")
-//         let newAr = [];
-//         if (menuList === null || menuList === undefined) {
-//             http.get('/sc-user-center/user/findUserMenu', { appId: '1002' }).then(({ status, data, msg }) => {
-//                 if (0 == status) {
-//                     let datas = data[0].children
-//                     window.sessionStorage.setItem('operationMuen', JSON.stringify(datas))
-
-//                     // funcRouter(newAr, datas, router)
-//                     // next({ ...to, replace: true })
-//                 } else {
-//                     this.$message.error(msg);
-//                 }
-//             })
-//         } else {
-//             if (router.options.routes[0].children.length === 0) {
-//                 // funcRouter(newAr, JSON.parse(menuList), router)
-//                 next({ ...to, replace: true })
-//             } else {
-//                 next()
-//             }
-
-//         }
-//     } else {
-//         next();
-//     }
-// });
 router.beforeEach((to, from, next) => {
-    if (to.path !== '/404') {
-        // console.log()
-        let newa = [];
-        console.log()
-        Vue.prototype.routerLoad.findMen(newa, store.getters.getMenuList, to.fullPath);
-        if (newa.length) {
-            next();
+    if (localStorage.getItem("SC_token")) {
+        let menuList = window.sessionStorage.getItem("SC_listMuen")
+        let newAr = [];
+        if (menuList == null || menuList == undefined) {
+            http.get('/sc-user-center/user/findUserMenu', { appId: '1002' }).then(({ status, data, msg }) => {
+                if (0 == status) {
+                    let datas = data[0].children
+                    window.sessionStorage.setItem('SC_listMuen', JSON.stringify(datas))
+                    funcRouter(newAr, datas, router)
+                    next({ ...to, replace: true })
+                } else {
+                    this.$message.error(msg);
+                }
+            })
         } else {
-            next({ path: '404' });
+            if (router.options.routes[0].children.length == 0) {
+                funcRouter(newAr, JSON.parse(menuList), router)
+                next({ ...to, replace: true })
+            } else {
+                debugger;
+                let thisAll = JSON.parse(menuList)[0];
+                if (to.path == '/') {
+                    if (!!thisAll.children) {
+                        next({ path: `/${thisAll.children[0].linkPath}` })
+                    } else {
+                        next({ path: `/${thisAll.linkPath}` })
+                    }
+                } else {
+                    next()
+                }
+            }
         }
-        next();
-        // 跳转时存储路由
-        localStorage.setItem('path', to.fullPath);
     } else {
         next();
     }
 });
+// router.beforeEach((to, from, next) => {
+//     if (to.path !== '/404') {
+//         let newa = [];
+//         console.log()
+//         Vue.prototype.routerLoad.findMen(newa, store.getters.getMenuList, to.fullPath);
+//         if (newa.length) {
+//             next();
+//         } else {
+//             next({ path: '404' });
+//         }
+//         next();
+//         // 跳转时存储路由
+//         localStorage.setItem('path', to.fullPath);
+//     } else {
+//         next();
+//     }
+// });
 new Vue({
     router,
     store,
     render: (h) => h(App),
-    created() {
-        if (localStorage.getItem('SC_token')) {
-            this.routerLoad.loadMenus();
-        }
-    }
+    // created() {
+    //     if (localStorage.getItem('SC_token')) {
+    //         this.routerLoad.loadMenus();
+    //     }
+    // }
 }).$mount('#app');
 Vue.prototype.$http = http;
 Vue.prototype.$api = apiService(http);

+ 42 - 33
operationSupport/src/router/dynamicMuen.js

@@ -1,10 +1,5 @@
 import store from '../store/store.js';
 const staticMuen = [
-    {
-        path: '/workbench/index',
-        meta: { title: '工作台' },
-        component: () => import('@views/workbench/index.vue')
-    },
     {
         path: '/msg',
         component: () => import(/* webpackChunkName: "messages" */ '@views/messages'),
@@ -21,38 +16,48 @@ const staticMuen = [
         meta: { title: '404' }
     },
     {
-        path: '/communityManagement',
-        component: () => import(/* webpackChunkName: "404" */ '@views/communityManagement'),
-        meta: { title: '区管理' }
+        path: '/parkingLotAdministration/pageJump/partitionManagement',
+        component: () => import(/* webpackChunkName: "404" */ '@views/parkingLotAdministration/pageJump/partitionManagement.vue'),
+        meta: { title: '车库分区管理' }
     },
     {
-        path: '/communityManagement/pageJump/AddOrEdit',
-        meta: { title: '添加社区' },
-        component: () => import(/* webpackChunkName: "404" */ '@views/communityManagement/pageJump/AddOrEdit.vue')
+        path: '/ownerManagement/details',
+        component: () => import(/* webpackChunkName: "404" */ '@views/ownerManagement/details.vue'),
+        meta: { title: '住户详情' }
     },
-
     {
-        path: '/buildingManagement/pageJump/addoredit',
-        component: () => import(/* webpackChunkName: "404" */ '@views/buildingManagement/pageJump/addoredit.vue'),
-        meta: { title: '添加编辑楼栋管理' }
+        path: '/housingManagement/details',
+        component: () => import(/* webpackChunkName: "404" */ '@views/assetManagement/housingManagement/details.vue'),
+        meta: { title: '房屋详情' },
+        name: 'housingManagementDetails'
     },
-
-    ,
     {
-        path: '/parkingLotAdministration/pageJump/partitionManagement',
-        component: () => import(/* webpackChunkName: "404" */ '@views/parkingLotAdministration/pageJump/partitionManagement.vue'),
-        meta: { title: '车库分区管理' }
+        path: '/shopManagement/details',
+        component: () => import(/* webpackChunkName: "404" */ '@views/assetManagement/shopManagement/details.vue'),
+        meta: { title: '商铺详情' },
+        name: 'shopManagementDetails'
     },
 
     {
-        path: '/ownerManagement/add',
-        component: () => import(/* webpackChunkName: "404" */ '@views/ownerManagement/stepPage/add.vue'),
-        meta: { title: '编辑住户' }
+        path: '/invoiceManagement/index',
+        component: () => import(/* webpackChunkName: "404" */ '@views/payService/invoiceManagement/index.vue'),
+        meta: { title: '发票管理' }
     },
     {
-        path: '/ownerManagement/details',
-        component: () => import(/* webpackChunkName: "404" */ '@views/ownerManagement/details.vue'),
-        meta: { title: '住户详情' }
+        path: '/expenseReport/index',
+        component: () => import(/* webpackChunkName: "404" */ '@views/payService/expenseReport/index.vue'),
+        meta: { title: '费用报表' },
+        name: 'expenseReport'
+    },
+    {
+        path: '/shannon-transfer',
+        component: () => import(/* webpackChunkName: "404" */ '@views/patrolManagement/components/shannon-transfer.vue'),
+        meta: { title: '测试' },
+        name: 'shannon-transfer'
+    },
+    {
+        path: '*',
+        redirect: '/404'
     }
 ];
 //路由格式
@@ -69,12 +74,17 @@ const setListMunt = (arrList, item) => {
 const dimension = (arrList, arr) => {
     arr.forEach((item, index) => {
         //默认去掉第一个添加路由
-        if (item.linkPath !== 'workbench/index') {
-            if (!!item.children) {
-                dimension(arrList, item.children);
-            } else {
-                setListMunt(arrList, item);
-            }
+        // if (item.linkPath !== 'workbench/index') {
+        //     if (!!item.children) {
+        //         dimension(arrList, item.children);
+        //     } else {
+        //         setListMunt(arrList, item);
+        //     }
+        // }
+        if (!!item.children) {
+            dimension(arrList, item.children);
+        } else {
+            setListMunt(arrList, item);
         }
     });
 };
@@ -85,7 +95,6 @@ const AddRt = (router, dynamicMuenList) => {
         NEWdynamicMuenList.forEach((item) => {
             router.options.routes[0].children.push(item);
         });
-        router.options.routes[0].redirect = router.options.routes[0].children[0].path;
         router.addRoutes(router.options.routes);
     }
 };

+ 2 - 322
operationSupport/src/router/index.js

@@ -6,333 +6,13 @@ Router.prototype.push = function push(location) {
     return original.call(this, location).catch((err) => err);
 };
 Vue.use(Router);
-
-const zRoute = [
-    {
-        path: '/workbench/index',
-        meta: { title: '工作台' },
-        component: () => import('@views/workbench/index.vue')
-    },
-    {
-        path: '/ownerManagement/index',
-        meta: { title: '住户管理' },
-        component: () => import('@views/ownerManagement/index.vue')
-    },
-    {
-        path: '/ownerManagement/ownerReview/index',
-        meta: { title: '业主审核' },
-        component: () => import('@views/ownerManagement/ownerReview/index.vue')
-    },
-    {
-        path: '/alarmManagement/index',
-        meta: { title: '告警管理' },
-        component: () => import('@views/alarmManagement/index.vue')
-    },
-    {
-        path: '/alarmManagement/details',
-        meta: { title: '告警详情' },
-        component: () => import('@views/alarmManagement/details.vue')
-    },
-    {
-        path: '/deviceManagement/index',
-        meta: { title: '设备管理' },
-        component: () => import('@views/deviceManagement/index.vue')
-    },
-
-    {
-        path: '/deviceManagement/indexFacilities',
-        meta: { title: '设施管理' },
-        component: () => import('@views/deviceManagement/indexFacilities.vue')
-    },
-    {
-        path: '/deviceManagement/indexType',
-        meta: { title: '设施类型' },
-        component: () => import('@views/deviceManagement/indexType.vue')
-    },
-    {
-        path: '/ownerManagement/add',
-        component: () => import(/* webpackChunkName: "404" */ '@views/ownerManagement/stepPage/add.vue'),
-        meta: { title: '编辑住户' },
-        name: 'ownerManagementAdd'
-    },
-    {
-        path: '/ownerManagement/details',
-        component: () => import(/* webpackChunkName: "404" */ '@views/ownerManagement/details.vue'),
-        meta: { title: '住户详情' },
-        name: 'ownerManagementDetails'
-    },
-
-    {
-        path: '/billingRules/index',
-        component: () => import(/* webpackChunkName: "404" */ '@views/payService/billingRules/index.vue'),
-        meta: { title: '计费规则' },
-        name: 'billingRules'
-    },
-    {
-        path: '/call/index',
-        component: () => import(/* webpackChunkName: "404" */ '@views/payService/call/index.vue'),
-        meta: { title: '催缴' },
-        name: 'call'
-    },
-    {
-        path: '/chargeSetting/index',
-        component: () => import(/* webpackChunkName: "404" */ '@views/payService/chargeSetting/index.vue'),
-        meta: { title: '收费设置' },
-        name: 'chargeSetting'
-    },
-    {
-        path: '/collection/index',
-        component: () => import(/* webpackChunkName: "404" */ '@views/payService/collection/index.vue'),
-        meta: { title: '收款账号' },
-        name: 'collection'
-    },
-    {
-        path: '/electricManagement/index',
-        component: () => import(/* webpackChunkName: "404" */ '@views/payService/electricManagement/index.vue'),
-        meta: { title: '电费管理' },
-        name: 'electricManagement'
-    },
-    {
-        path: '/waterManagement/index',
-        component: () => import(/* webpackChunkName: "404" */ '@views/payService/waterManagement/index.vue'),
-        meta: { title: '水费管理' },
-        name: 'waterManagement'
-    },
-    {
-        path: '/RechargeRecord',
-        component: () => import(/* webpackChunkName: "404" */ '@views/payService/RechargeRecord.vue'),
-        meta: { title: '充值记录' },
-        name: 'RechargeRecord'
-    },
-    {
-        path: '/ChargebackRecord',
-        component: () => import(/* webpackChunkName: "404" */ '@views/payService/ChargebackRecord.vue'),
-        meta: { title: '扣费记录' },
-        name: 'ChargebackRecord'
-    },
-    {
-        path: '/expenseReport/index',
-        component: () => import(/* webpackChunkName: "404" */ '@views/payService/expenseReport/index.vue'),
-        meta: { title: '费用报表' },
-        name: 'expenseReport'
-    },
-    {
-        path: '/waterChargeDetails/index',
-        component: () => import(/* webpackChunkName: "404" */ '@views/payService/statisticalReport/waterChargeDetails.vue'),
-        meta: { title: '水费明细' },
-        name: 'waterChargeDetails'
-    },
-    {
-        path: '/electricityBillDetails/index',
-        component: () => import(/* webpackChunkName: "404" */ '@views/payService/statisticalReport/electricityBillDetails.vue'),
-        meta: { title: '电费明细' },
-        name: 'electricityBillDetails'
-    },
-    {
-        path: '/propertyFeeStatistics/index',
-        component: () => import(/* webpackChunkName: "404" */ '@views/payService/statisticalReport/propertyFeeStatistics.vue'),
-        meta: { title: '物业费统计' },
-        name: 'propertyFeeStatistics'
-    },
-    {
-        path: '/chargeStatistics/index',
-        component: () => import(/* webpackChunkName: "404" */ '@views/payService/statisticalReport/chargeStatistics.vue'),
-        meta: { title: '收费统计' },
-        name: 'chargeStatistics'
-    },
-
-    // {
-    //     path: '/invoiceManagement/index',
-    //     component: () => import(/* webpackChunkName: "404" */ '@views/payService/invoiceManagement/index.vue'),
-    //     meta: { title: '发票管理' }
-    // },
-    // {
-    //     path: '/shannon-transfer',
-    //     component: () => import(/* webpackChunkName: "404" */ '@views/patrolManagement/components/shannon-transfer.vue'),
-    //     meta: { title: '测试' },
-    //     name: 'shannon-transfer'
-    // },
-
-    {
-        path: '/propertyFee/index',
-        component: () => import(/* webpackChunkName: "404" */ '@views/payService/propertyFee/index.vue'),
-        meta: { title: '物业费账单' },
-        name: 'propertyFee'
-    },
-    {
-        path: '/systemSetup/index',
-        component: () => import(/* webpackChunkName: "404" */ '@views/payService/systemSetup/index.vue'),
-        meta: { title: '系统设置' },
-        name: 'systemSetup'
-    },
-    {
-        path: '/propertyManagement/index',
-        meta: { title: '投诉建议' },
-        component: () => import('@views/propertyManagement/index.vue')
-    },
-    {
-        path: '/propertyManagement/phone',
-        meta: { title: '物业电话' },
-        component: () => import('@views/propertyManagement/phone.vue')
-    },
-    {
-        path: '/propertyManagement/inform',
-        meta: { title: '通知公告' },
-        component: () => import('@views/propertyManagement/inform.vue')
-    },
-    {
-        path: '/propertyManagement/neighbor',
-        meta: { title: '社区邻里' },
-        component: () => import('@views/propertyManagement/neighbor.vue')
-    },
-
-    {
-        path: '/flowManagement',
-        component: () => import(/* webpackChunkName: "404" */ '@views/flow/index.vue'),
-        meta: { title: '流程管理' },
-        name: 'flowManagement'
-    },
-
-    {
-        path: '/workOrdersManagement',
-        component: () => import(/* webpackChunkName: "404" */ '@views/workOrders/index.vue'),
-        meta: { title: '工单管理' },
-        name: 'workOrdersManagement'
-    },
-    {
-        path: '/workOrdersRecords',
-        component: () => import(/* webpackChunkName: "404" */ '@views/workOrders/records.vue'),
-        meta: { title: '工单记录' },
-        name: 'workOrdersRecords'
-
-    },
-    {
-        path: '/facilityInspections',
-        component: () => import(/* webpackChunkName: "404" */ '@views/facilityInspections/index.vue'),
-        meta: { title: '巡检计划' },
-        name: "facilityInspections",
-    },
-    {
-        path: '/inspectionsRecords',
-        component: () => import(/* webpackChunkName: "404" */ '@views/facilityInspections/inspectionsRecords.vue'),
-        meta: { title: '巡检记录' },
-        name: "inspectionsRecords",
-    },
-    {
-        path: '/patrolManagement',
-        component: () => import(/* webpackChunkName: "404" */ '@views/patrolManagement/index.vue'),
-        meta: { title: '巡更点位' },
-        name: "patrolManagement",
-    },
-    {
-        path: '/patrolRoute',
-        component: () => import(/* webpackChunkName: "404" */ '@views/patrolManagement/patrolRoute.vue'),
-        meta: { title: '巡更路线' },
-        name: "patrolRoute",
-    },
-    {
-        path: '/patrolRecords',
-        component: () => import(/* webpackChunkName: "404" */ '@views/patrolManagement/patrolRecords.vue'),
-        meta: { title: '巡更记录' },
-        name: "patrolRecords",
-    }
-];
-
 const quietRoute = [
     {
         path: '/',
         component: () => import(/* webpackChunkName: "home" */ '@/components/common/Home.vue'),
-        children: [
-            {
-                path: '/msg',
-                component: () => import(/* webpackChunkName: "messages" */ '@views/messages'),
-                meta: { title: '消息中心' }
-            },
-            {
-                path: '/403',
-                component: () => import(/* webpackChunkName: "404" */ '@views/403'),
-                meta: { title: '403' }
-            },
-            {
-                path: '/404',
-                component: () => import(/* webpackChunkName: "404" */ '@views/404'),
-                meta: { title: '404' }
-            },
-            {
-                path: '/communityManagement',
-                component: () => import(/* webpackChunkName: "404" */ '@views/communityManagement'),
-                meta: { title: '社区管理' },
-                name: 'communityManagement'
-            },
-            {
-                path: '/communityManagement/pageJump/AddOrEdit',
-                meta: { title: '添加社区' },
-                name: 'communityManagementAddOrEdit',
-                component: () => import(/* webpackChunkName: "404" */ '@views/communityManagement/pageJump/AddOrEdit.vue')
-            },
-            {
-                path: '/buildingManagement',
-                component: () => import(/* webpackChunkName: "404" */ '@views/buildingManagement'),
-                meta: { title: '楼栋管理' },
-                name: 'buildingManagement'
-            },
-            {
-                path: '/buildingManagement/pageJump/addoredit',
-                component: () => import(/* webpackChunkName: "404" */ '@views/buildingManagement/pageJump/addoredit.vue'),
-                meta: { title: '编辑楼栋' },
-                name: 'editBuilding'
-            },
-            {
-                path: '/buildingManagement/pageJump/batchAddoredit',
-                component: () => import(/* webpackChunkName: "404" */ '@views/buildingManagement/pageJump/batchAddoredit.vue'),
-                meta: { title: '批量添加楼栋' }
-            },
-            {
-                path: '/housingManagement',
-                component: () => import(/* webpackChunkName: "404" */ '@views/assetManagement/housingManagement'),
-                meta: { title: '房屋管理' },
-                name: 'housingManagement'
-            },
-            {
-                path: '/housingManagement/details',
-                component: () => import(/* webpackChunkName: "404" */ '@views/assetManagement/housingManagement/details.vue'),
-                meta: { title: '房屋详情' },
-                name: 'housingManagementDetails'
-            },
-            {
-                path: '/shopManagement',
-                component: () => import(/* webpackChunkName: "404" */ '@views/assetManagement/shopManagement'),
-                meta: { title: '商铺管理' },
-                name: 'shopManagement'
-            },
-            {
-                path: '/shopManagement/details',
-                component: () => import(/* webpackChunkName: "404" */ '@views/assetManagement/shopManagement/details.vue'),
-                meta: { title: '商铺详情' },
-                name: 'shopManagementDetails'
-            },
-            {
-                path: '/parkingLotAdministration',
-                component: () => import(/* webpackChunkName: "404" */ '@views/parkingLotAdministration'),
-                meta: { title: '车位管理' },
-                name: 'parkingLot'
-            },
-            {
-                path: '/parkingLotAdministration/pageJump/partitionManagement',
-                component: () => import(/* webpackChunkName: "404" */ '@views/parkingLotAdministration/pageJump/partitionManagement.vue'),
-                meta: { title: '车库分区管理' },
-                name: 'zoningManagement'
-            },
-            ...zRoute
-        ],
-        // redirect: '/workbench/index'
+        children: [],
     },
-    {
-        path: '*',
-        redirect: '/404'
-    }
-];
-
+]
 const route = new Router({
     mode: 'history',
     base: process.env.BASE_URL,

+ 15 - 1
operationSupport/src/store/store.js

@@ -8,7 +8,7 @@
  */
 import Vue from 'vue';
 import Vuex from 'vuex';
-import router from '../router';
+import http from '@utils/http.js';
 
 Vue.use(Vuex);
 
@@ -244,6 +244,20 @@ const store = new Vuex.Store({
         },
         closeModal(ctx) {
             ctx.commit('setModalParams', { show: false });
+        },
+        SET_MENU_LIST(ctx) {
+            let value = ctx.getters['getMenuList'] || [];
+            if (!value.length) {
+                http.get('/sc-user-center/user/findUserMenu', { appId: '1002' }).then(({ status, data, msg }) => {
+                    if (0 === status) {
+                        ctx.commit('setMenuList', data[0].children);
+                        ctx.commit('setThisDetai', data[0]);
+                        window.localStorage.setItem('SC_listMuen', JSON.stringify(data[0].children))
+                    } else {
+                        this.$message.error(msg)
+                    }
+                });
+            }
         }
     }
 });