From f015ecea67a1e322374c422f6661366f93341556 Mon Sep 17 00:00:00 2001
From: kongdeqiang <123456>
Date: 星期四, 08 六月 2023 09:32:04 +0800
Subject: [PATCH] 修改前端页面

---
 src/components/common/Header.vue  |    5 
 package-lock.json                 |    5 
 src/store/index.js                |   15 +
 src/components/common/Sidebar.vue |  122 +----------
 src/store/state.js                |  105 ++++++++++
 src/components/page/Login.vue     |   21 +
 App.vue                           |   14 +
 src/utils/mappingData.js          |    2 
 src/store/mutations.js            |   46 ++++
 src/main.js                       |   14 +
 index.html                        |   19 +
 src/store/actions.js              |   17 +
 package.json                      |    1 
 main.js                           |  159 +++++++++++++++
 src/store/getters.js              |    5 
 15 files changed, 440 insertions(+), 110 deletions(-)

diff --git a/App.vue b/App.vue
new file mode 100644
index 0000000..e6031f0
--- /dev/null
+++ b/App.vue
@@ -0,0 +1,14 @@
+<template>
+    <div id="app">
+        <router-view></router-view>
+    </div>
+</template>
+<style>
+    @import "./assets/css/main.css";
+    @import "./assets/css/color-dark.css";     /*娣辫壊涓婚*/
+    /*@import "./assets/css/theme-green/color-green.css";   娴呯豢鑹蹭富棰�*/
+    /* 瑙e喅element-ui鐨則able琛ㄦ牸鎺т欢琛ㄥご涓庡唴瀹瑰垪涓嶅榻愰棶棰� */
+    .el-table th.gutter{
+        display: table-cell!important;
+    }
+</style>
\ No newline at end of file
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..54a8ed2
--- /dev/null
+++ b/index.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
+    <title>宄板嘲鐭垮尯缁煎悎琛屾斂鎵ф硶灞�</title>
+    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=tuVbv4tLIzoX7IWdeKeTwojDqPILFoe5"></script>
+    <!--<script src="//mapv.baidu.com/build/mapv.min.js"></script>
+    <script src="https://code.bdstatic.com/npm/mapvgl@1.0.0-beta.127/dist/mapvgl.min.js"></script>-->
+    <script type="text/javascript" src="http://api.map.baidu.com/library/Heatmap/2.0/src/Heatmap_min.js"></script>
+    <script src="./static/iconfont.js"></script>
+
+    <title>宄板嘲鏅烘収娉婅溅绯荤粺</title>
+  </head>
+  <body>
+    <div id="app"></div>
+  </body>
+</html>
diff --git a/main.js b/main.js
new file mode 100644
index 0000000..1230d2b
--- /dev/null
+++ b/main.js
@@ -0,0 +1,159 @@
+import Vue from 'vue'
+import App from './App.vue'
+import router from './router'
+import axios from 'axios';
+import qs from 'qs'
+import ElementUI from 'element-ui';
+import 'element-ui/lib/theme-chalk/index.css'; // 榛樿涓婚
+import './assets/css/fonts/iconfont.css'
+// import '../static/css/theme-green/index.css';       // 娴呯豢鑹蹭富棰�
+import './assets/css/icon.css';
+import './components/common/directives';
+import "babel-polyfill";
+import ByUtils, {byUtils} from './assets/js/ByUtils'
+import StringUtil from './assets/js/StringUtil'
+import TscPrintUtil from './assets/js/TscPrintUtil'
+import Print from './assets/js/print'
+import moment from 'moment'
+import store from './store/index' // 寮曞叆vuex
+Vue.prototype.$moment = moment;
+Vue.use(Print) // 娉ㄥ唽
+import ViewUI from 'view-design';
+
+import 'lib-flexible'
+
+// import style
+import 'view-design/dist/styles/iview.css';
+import preview from 'vue-photo-preview'
+//preview鐨勫弬鏁�
+var option = {
+    minZoom:0.3,
+    maxSpreadZoom: 20, // 鎺у埗棰勮鍥炬渶澶х殑鍊嶆暟锛岄粯璁ゆ槸2鍊嶏紝鎴戣繖閲屾敼鎴愪簡鍘熷浘
+    fullscreenEl: false, //鎺у埗鏄惁鏄剧ず鍙充笂瑙掑叏灞忔寜閽�
+    closeEl: true, //鎺у埗鏄惁鏄剧ず鍙充笂瑙掑叧闂寜閽�
+    tapToClose: true, //鐐瑰嚮婊戝姩鍖哄煙搴斿叧闂浘搴�
+    shareEl: false, //鎺у埗鏄惁鏄剧ず鍒嗕韩鎸夐挳
+    zoomEl: true, //鎺у埗鏄惁鏄剧ず鏀惧ぇ缂╁皬鎸夐挳
+    counterEl: true, //鎺у埗鏄惁鏄剧ず宸︿笂瑙掑浘鐗囨暟閲忔寜閽�
+    arrowEl: true,  //鎺у埗濡傚浘鐨勫乏鍙崇澶达紙pc娴忚鍣ㄦā鎷熸墜鏈烘椂锛�
+    tapToToggleControls: true, //鐐瑰嚮搴斿垏鎹㈡帶浠剁殑鍙鎬�
+    allowPanToNext:true, //褰撳墠椤圭洰缂╂斁鏃讹紝鍏佽婊戝姩鍒颁笅涓�涓�/涓婁竴涓」鐩�
+    clickToCloseNonZoomable: false,//鐐瑰嚮鍥剧墖搴斿叧闂浘搴擄紝浠呭綋鍥惧儚灏忎簬瑙嗗彛鐨勫ぇ灏忔椂
+    closeOnVerticalDrag:false,//鍨傜洿鎷栧姩鍜屾湭缂╂斁鍥惧儚鏃讹紝璇峰叧闂浘搴�
+    pinchToClose:false,//鎹忎互鍏抽棴鐢诲粖鎵嬪娍
+    getDoubleTapZoom:()=>1 //鍑芥暟搴旇繑鍥炵缉鏀剧骇鍒紝鍦ㄥ弻鍑绘墜鍔垮悗锛岀敤鎴峰崟鍑荤缉鏀惧浘鏍囨垨榧犳爣鍗曞嚮鍥惧儚鏈韩鏃讹紝鍥惧儚灏嗙缉鏀惧埌璇ョ骇鍒�
+}
+Vue.use(preview,option)
+
+Vue.use(ViewUI);
+Vue.config.productionTip = false
+Vue.use(ElementUI, {
+    size: 'small'
+});
+
+import echarts from 'echarts'
+Vue.prototype.$echarts = echarts;
+
+import '@/utils/lib-fiexible'
+
+import {getStore,setStore,removeStore} from "./libs/store";
+
+Vue.prototype.getStore = getStore
+Vue.prototype.setStore = setStore
+Vue.prototype.removeStore = removeStore
+
+Vue.prototype.$axios = axios;
+axios.defaults.withCredentials = true
+// 瀵规彁浜ょ殑鏁版嵁杩涜json搴忓垪鍖�,鍙兘瀛樺湪闂,鏆傛椂鏈彂鐜颁粈涔堥棶棰�
+axios.interceptors.request.use((config) => {
+    if (config.method === 'post') {
+        config.data = qs.stringify(config.data)
+    }
+    if (config.method === 'get') {
+        config.data = qs.stringify(config.data)
+    }
+    console.log(config.data)
+    return config
+})
+// 閰嶇疆鏂囦欢
+Vue.prototype.$systemconfig = {
+// 鏈嶅姟绔矾寰�
+    basePath: 'http://183.196.93.178:8089',
+    //basePath:'http://127.0.0.1:8089'
+}
+Vue.prototype.$byutil = byUtils
+Vue.prototype.$stringUtil = StringUtil
+Vue.prototype.$tscPrintUtil = TscPrintUtil
+// const rolesList = JSON.parse(localStorage.getItem('userRouters')) 
+//浣跨敤閽╁瓙鍑芥暟瀵硅矾鐢辫繘琛屾潈闄愯烦杞�
+// router.beforeEach((to, from, next) => {
+//     let user = byUtils.getUser()
+//     if (!user && to.path!== '/') {
+//         next('/');
+//     }
+
+//    console.log(to,"瑙﹀彂浜�",router.options.routes);
+//    // type 2 : all admin
+//    // type 0 :  娉婅溅 id:2
+//    // type 1 :  鎵ф硶 id:3 
+
+  
+
+//    next();
+//         //
+//     // if (to.path==='/login') {
+//     //     byUtils.setUser(null)
+//     // }
+//     // let user = byUtils.getUser()
+//     // console.log(user)
+//     // if (!user && to.path !== '/login') {
+//     //     next('/login');
+//     // } else if (to.meta.permission) {
+//     //     // 濡傛灉鏄鐞嗗憳鏉冮檺鍒欏彲杩涘叆锛岃繖閲屽彧鏄畝鍗曠殑妯℃嫙绠$悊鍛樻潈闄愯�屽凡
+//     //     role === 'admin' ? next() : next('/403');
+//     // } else {
+//         // 绠�鍗曠殑鍒ゆ柇IE10鍙婁互涓嬩笉杩涘叆瀵屾枃鏈紪杈戝櫒锛岃缁勪欢涓嶅吋瀹�
+//         if (navigator.userAgent.indexOf('MSIE') > -1 && to.path === '/editor') {
+//             Vue.prototype.$alert('vue-quill-editor缁勪欢涓嶅吋瀹笽E10鍙婁互涓嬫祻瑙堝櫒锛岃浣跨敤鏇撮珮鐗堟湰鐨勬祻瑙堝櫒鏌ョ湅', '娴忚鍣ㄤ笉鍏煎閫氱煡', {
+//                 confirmButtonText: '纭畾'
+//             });
+//         } else {
+//             next();
+//         }
+
+//     // }
+// })
+// router.beforeEach((to, from, next) => {
+//     if(!sessionStorage.accessToken){
+//         router.push({'path': '/'});
+//     }
+// })
+
+// router.beforeEach((to, from, next) => {
+//     if (to.path === '/login') {
+//         next();
+//     } else {
+//         //sessionStorage.accessToken
+//         let token = localStorage.getItem('userId');
+//         if(token){
+//             if (token==null) {
+//                 next('/login');
+//             } else {
+//                 if(token == ''){
+//                     next('/login');
+//                 }else{
+//                     next();
+//                 }
+//             }
+//         }else{
+//             next('/login');
+//         }
+//     }
+// });
+
+
+new Vue({
+    router,
+    store,
+    render: h => h(App)
+}).$mount('#app')
diff --git a/package-lock.json b/package-lock.json
index 1dedce2..2a3b22c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -15803,6 +15803,11 @@
         "sortablejs": "^1.10.1"
       }
     },
+    "vuex": {
+      "version": "3.6.2",
+      "resolved": "https://registry.npmmirror.com/vuex/-/vuex-3.6.2.tgz",
+      "integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw=="
+    },
     "watchpack": {
       "version": "1.6.1",
       "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.1.tgz",
diff --git a/package.json b/package.json
index 77e6fa9..126f2c0 100644
--- a/package.json
+++ b/package.json
@@ -35,6 +35,7 @@
     "vue-router": "^3.0.1",
     "vue-schart": "^1.0.0",
     "vuedraggable": "^2.17.0",
+    "vuex": "^3.6.2",
     "webpack-dev-server": "^2.9.1"
   },
   "devDependencies": {
diff --git a/src/components/common/Header.vue b/src/components/common/Header.vue
index 8e0f955..29132c2 100644
--- a/src/components/common/Header.vue
+++ b/src/components/common/Header.vue
@@ -71,6 +71,7 @@
     </div>
 </template>
 <script>
+import {mapMutations} from 'vuex'
     import bus from '../common/bus';
     export default {
         data() {
@@ -101,6 +102,9 @@
       },
 
       methods:{
+        ...mapMutations([
+        'CLEAR_ROLELIST'
+        ]),
             // 鐢ㄦ埛鍚嶄笅鎷夎彍鍗曢�夋嫨浜嬩欢
             handleCommand(command) {
                 if(command == 'loginout'){
@@ -108,6 +112,7 @@
                     sessionStorage.userRoleNames = ''
                     sessionStorage.userGuid = ''
                     sessionStorage.userName = ''
+                    this.CLEAR_ROLELIST(); //娓呯┖鏈湴鏉冮檺缂撳瓨
                     this.$router.push('/login');
                     // this.$confirm("鏄惁閫�鍑虹櫥褰�?", "鎻愮ず", {
                     //     confirmButtonText: "纭畾",
diff --git a/src/components/common/Sidebar.vue b/src/components/common/Sidebar.vue
index 17ede75..ecf7436 100644
--- a/src/components/common/Sidebar.vue
+++ b/src/components/common/Sidebar.vue
@@ -1,14 +1,16 @@
 <template>
     <div class="sidebar">
         <el-menu class="sidebar-el-menu" :default-active="onRoutes" :collapse="collapse" background-color="#324157"
-            text-color="#bfcbd9" active-text-color="#20a0ff" unique-opened router>
+            text-color="#bfcbd9" active-text-color="#20a0ff" unique-opened router
+            >
             <template v-for="item in items">
                 <template v-if="item.children">
-                    <el-submenu :index="item.indexUrl" :key="item.indexUrl">
+                    <el-submenu :index="item.indexUrl" :key="item.indexUrl"
+                    >
                         <template slot="title">
                             <i :class="item.icon"></i><span slot="title">{{ item.name }}</span>
                         </template>
-                        <template v-for="subItem in item.children">
+                        <div v-for="subItem in item.children" :key="subItem.indexUrl">
                             <!--<el-submenu v-if="subItem.children" :index="subItem.indexUrl" :key="subItem.indexUrl">-->
                                 <!--<template slot="title">-->
                                     <!--<i :class="subItem.icon"></i><span slot="title">{{ subItem.name }}</span>-->
@@ -19,12 +21,12 @@
                                     <!--</template>-->
                                 <!--</el-menu-item>-->
                             <!--</el-submenu>-->
-                            <el-menu-item :index="subItem.indexUrl" :key="subItem.indexUrl">
+                            <el-menu-item :index="subItem.indexUrl">
                                 <template slot="title">
                                     <i :class="subItem.icon"></i><span slot="title">{{ subItem.name }}</span>
                                 </template>
                             </el-menu-item>
-                        </template>
+                        </div>
                     </el-submenu>
                 </template>
                 <template v-else>
@@ -41,112 +43,18 @@
 
 <script>
     import bus from '../common/bus';
+    import {mapState} from 'vuex';
     export default {
         data() {
             return {
                 collapse: false,
-                items: [
-                  {
-                    id:1,
-                    icon: 'el-icon-folder-opened',
-                    indexUrl: '1',
-                    name: '绯荤粺绠$悊',
-                    children:[
-                      {
-                        id:1,
-                        icon: 'el-icon-user-solid',
-                        name: '浜哄憳绠$悊',
-                        parentId: 1,
-                        indexUrl: 'user'
-                      }
-                    ]
-                  },
-                  {
-                      id:2,
-                      icon: 'el-icon-folder-opened',
-                      indexUrl: '2',
-                      name: '鏅烘収娉婅溅绠$悊',
-                      children:[
-                          {
-                              icon: 'el-icon-document',
-                              name: '鍋滆溅鍦虹鐞�',
-                              parentId: 2,
-                              indexUrl: "park"
-                          },
-                          {
-                              icon: 'el-icon-document',
-                              name: '鏀惰垂瑙勫垯绠$悊',
-                              parentId: 2,
-                              indexUrl: "costRule"
-                          },
-                          {
-                            icon: 'el-icon-document',
-                            name: '杞﹁締鍏ュ満绠$悊',
-                            parentId: 2,
-                            indexUrl: "enterPark"
-                          },
-                          {
-                            icon: 'el-icon-document',
-                            name: '杞﹁締鍑哄満绠$悊',
-                            parentId: 2,
-                            indexUrl: "outPark"
-                          },
-                          {
-                            icon: 'el-icon-document',
-                            name: '鐧藉悕鍗曠鐞�',
-                            parentId: 2,
-                            indexUrl: "whiteList"
-                          },
-                          {
-                            icon: 'el-icon-document',
-                            name: '娉婅溅鍙戠エ绠$悊',
-                            parentId: 2,
-                            indexUrl: "parkticket"
-                          },
-                          {
-                            icon: 'el-icon-document',
-                            name: '璁㈠崟缁熻',
-                            parentId: 2,
-                            indexUrl: "orderRecord"
-                          },
-                      ]
-                  },
-                  {
-                    id:3,
-                    icon: 'el-icon-folder-opened',
-                    indexUrl: '3',
-                    name: '鏅烘収缃氭病绠$悊',
-                    children:[
-                      {
-                        icon: 'el-icon-document',
-                        name: '杩濈珷绫诲瀷绠$悊',
-                        parentId: 3,
-                        indexUrl: "violationType"
-                      },
-                      {
-                        icon: 'el-icon-document',
-                        name: '琛楅亾绠$悊',
-                        parentId: 3,
-                        indexUrl: "street"
-                      },
-                      {
-                        icon: 'el-icon-document',
-                        name: '缃氬崟绠$悊',
-                        parentId: 3,
-                        indexUrl: "ticket"
-                      },
-                      {
-                        icon: 'el-icon-document',
-                        name: '缃氭病鍙戠エ绠$悊',
-                        parentId: 3,
-                        indexUrl: "zfticket"
-                      },
-                    ]
-                  },
-                ]
+
             }
         },
         computed:{
+          ...mapState({
+             items:'resultAsyncRoutes'
+            }),
             onRoutes(){
                 return this.$route.path.replace('/','');
             }
@@ -158,11 +66,15 @@
             })
         },
         mounted(){
+            // type 2 : all
+            // type 0 :  娉婅溅 id:2
+            // type 1 :  鎵ф硶 id:3
             // var url = this.$systemconfig.basePath + '/menuList';
             // this.$byutil.postData(this,url,{},res=>{
             //     this.items = res.obj.menuList;
             // })
-        }
+        },
+
     }
 </script>
 
diff --git a/src/components/page/Login.vue b/src/components/page/Login.vue
index 2ecaa84..be8da3c 100644
--- a/src/components/page/Login.vue
+++ b/src/components/page/Login.vue
@@ -23,9 +23,11 @@
 </template>
 
 <script>
+   import {mapMutations,mapState} from 'vuex';
     export default {
         data: function(){
             return {
+               // 鏉冮檺鑿滃崟
                 ruleForm: {
                     loginName: '',
                     password: '',
@@ -43,8 +45,15 @@
         created(){
             //this.$router.push({'path': '/home'});
         },
+        computed:{
+            ...mapState(['resultAsyncRoutes'])
 
+        },
         methods: {
+            ...mapMutations([
+            'SET_ROLELISt',
+            'SET_ROLES'
+       ]),
             submitForm(formName) {
                 this.$refs[formName].validate((valid) => {
                     if (valid) {
@@ -52,10 +61,14 @@
                         this.$byutil.postData(this,url,this.ruleForm,res=>{
                             let data = res.data;
                           if (data) {
-                            localStorage.userId = data.id
-                            localStorage.name = data.name
-                            localStorage.type = data.type
-                            this.$router.push({'path': '/home'});
+                            localStorage.userId = data.id;
+                            localStorage.name = data.name;
+                            localStorage.type = data.type;
+                            // localStorage.userRouters = JSON.stringify(this.items) ;
+                            this.SET_ROLES(data.type)
+                            this.SET_ROLELISt();  // 绛涢�夊乏渚ц彍鍗曟爮
+                            this.$router.push({'path': this.resultAsyncRoutes[0].children[0].indexUrl || '/home'});
+                             // 鑷姩璺宠浆褰撳墠鏉冮檺璺敱鐨勭涓�涓〉闈� 锛屽鏋滄壘涓嶅埌灏卞幓璺砲ome
                             // if (this._isMobile()) {
                             //     this.$router.push({'path': '/index4'});
                             // } else {
diff --git a/src/main.js b/src/main.js
index 42298d2..1230d2b 100644
--- a/src/main.js
+++ b/src/main.js
@@ -15,6 +15,7 @@
 import TscPrintUtil from './assets/js/TscPrintUtil'
 import Print from './assets/js/print'
 import moment from 'moment'
+import store from './store/index' // 寮曞叆vuex
 Vue.prototype.$moment = moment;
 Vue.use(Print) // 娉ㄥ唽
 import ViewUI from 'view-design';
@@ -83,13 +84,22 @@
 Vue.prototype.$byutil = byUtils
 Vue.prototype.$stringUtil = StringUtil
 Vue.prototype.$tscPrintUtil = TscPrintUtil
-
+// const rolesList = JSON.parse(localStorage.getItem('userRouters')) 
 //浣跨敤閽╁瓙鍑芥暟瀵硅矾鐢辫繘琛屾潈闄愯烦杞�
 // router.beforeEach((to, from, next) => {
 //     let user = byUtils.getUser()
 //     if (!user && to.path!== '/') {
 //         next('/');
 //     }
+
+//    console.log(to,"瑙﹀彂浜�",router.options.routes);
+//    // type 2 : all admin
+//    // type 0 :  娉婅溅 id:2
+//    // type 1 :  鎵ф硶 id:3 
+
+  
+
+//    next();
 //         //
 //     // if (to.path==='/login') {
 //     //     byUtils.setUser(null)
@@ -110,6 +120,7 @@
 //         } else {
 //             next();
 //         }
+
 //     // }
 // })
 // router.beforeEach((to, from, next) => {
@@ -143,5 +154,6 @@
 
 new Vue({
     router,
+    store,
     render: h => h(App)
 }).$mount('#app')
diff --git a/src/store/actions.js b/src/store/actions.js
new file mode 100644
index 0000000..601bd4b
--- /dev/null
+++ b/src/store/actions.js
@@ -0,0 +1,17 @@
+export default {
+    setResNameAsync:(context,payload)=>{
+      //寮傛淇敼鍊硷紙寮傛涓皟鐢ㄥ悓姝ワ級
+      //context鎸囩殑鏄疺uex涓婁笅鏂囷紝鐩稿綋浜巘his.$store
+     //鍏鍚庢墽琛屼唬鐮�
+      setTimeout(function(){
+      comtext.commit("setResName",payload);
+      },6000);
+      let _this = payload._this;
+      let url = _this.axios.url.SYSTEM_MENU_TREE;
+      _this.axios.post(url,{}).then(r=>{
+        console.log(r);
+      }).catch(e=>{
+   
+      });
+    }
+  }
\ No newline at end of file
diff --git a/src/store/getters.js b/src/store/getters.js
new file mode 100644
index 0000000..0a12a80
--- /dev/null
+++ b/src/store/getters.js
@@ -0,0 +1,5 @@
+export default{
+    getResName:(state)=>{
+      return state.resName;
+    }
+  }
\ No newline at end of file
diff --git a/src/store/index.js b/src/store/index.js
new file mode 100644
index 0000000..754639b
--- /dev/null
+++ b/src/store/index.js
@@ -0,0 +1,15 @@
+import Vue from 'vue'
+import Vuex from 'vuex'
+import state from './state'
+import getters from './getters'
+import actions from './actions'
+import mutations from './mutations'
+ 
+Vue.use(Vuex)
+const store = new Vuex.Store({
+  state,
+  getters,
+  actions,
+  mutations
+})
+ export default store
\ No newline at end of file
diff --git a/src/store/mutations.js b/src/store/mutations.js
new file mode 100644
index 0000000..a5c6d1b
--- /dev/null
+++ b/src/store/mutations.js
@@ -0,0 +1,46 @@
+export default {
+    setResName:(state,payload)=>{
+      //state瀵硅薄灏卞搴斾簡state.js涓殑瀵硅薄
+      //payload杞借嵎 瀵瑰簲鐨� 浼犻�掔殑 json瀵硅薄鍙傛暟{name锛歺x锛宎ge锛�12}
+      state.resName = payload.resName
+    },
+    SET_ROLES:(state,payload) =>{
+    state.roles = payload;
+    },
+    SET_ROLELISt:(state,payload)=>{
+        console.log('瑙﹀彂')
+        //澶勭悊宸︿晶鑿滃崟鏍忛�昏緫   
+            // type 2 : all admin
+            // type 0 :  娉婅溅 id:2
+            // type 1 :  鎵ф硶 id:3 
+            // state.roles  // 鐢ㄦ埛鏉冮檺瀛楁
+            // state.resultAsyncRoutes // 鐢ㄦ埛鏉冮檺璺敱
+            switch (state.roles) {
+                case 0:
+                    state.resultAsyncRoutes = state.items.filter((item)=>item.id == 2);
+                    localStorage.setItem('userRouters',JSON.stringify(state.resultAsyncRoutes));
+                    console.log(state.resultAsyncRoutes,state.roles,'0娉婅溅') 
+                    break;
+                case 1:
+                    state.resultAsyncRoutes =state.items.filter((item)=>item.id == 3);
+                    localStorage.setItem('userRouters',JSON.stringify(state.resultAsyncRoutes));
+                  console.log(state.resultAsyncRoutes,state.roles,'1鎵ф硶')
+                  break;
+                  case 2:
+                    state.resultAsyncRoutes = state.items;
+                    localStorage.setItem('userRouters',JSON.stringify(state.resultAsyncRoutes));
+                      console.log(state.resultAsyncRoutes,state.roles,' 鍏ㄩ儴')//  涓嶇敤淇敼
+                  break;
+                
+                default:
+                    break;
+            }
+
+    },
+    CLEAR_ROLELIST:(state,payload)=>{
+        state.resultAsyncRoutes =  [];
+        localStorage.setItem('userRouters',JSON.stringify(state.resultAsyncRoutes));
+
+    }
+
+  }
\ No newline at end of file
diff --git a/src/store/state.js b/src/store/state.js
new file mode 100644
index 0000000..3cda72c
--- /dev/null
+++ b/src/store/state.js
@@ -0,0 +1,105 @@
+
+export default {
+    resName:'dxy',
+    roles:JSON.parse(localStorage.getItem('type')) || "",
+    resultAsyncRoutes:JSON.parse(localStorage.getItem('userRouters')) || [] ,// 鏍规嵁鏉冮檺绛涢�夎矾鐢�
+    items: [
+        {
+          id:1,
+          icon: 'el-icon-folder-opened',
+          indexUrl: '1',
+          name: '绯荤粺绠$悊',
+          children:[
+            {
+              id:1,
+              icon: 'el-icon-user-solid',
+              name: '浜哄憳绠$悊',
+              parentId: 1,
+              indexUrl: 'user'
+            }
+          ]
+        },
+        {
+            id:2,
+            icon: 'el-icon-folder-opened',
+            indexUrl: '2',
+            name: '鏅烘収娉婅溅绠$悊',
+            children:[
+                {
+                    icon: 'el-icon-document',
+                    name: '鍋滆溅鍦虹鐞�',
+                    parentId: 2,
+                    indexUrl: "park"
+                },
+                {
+                    icon: 'el-icon-document',
+                    name: '鏀惰垂瑙勫垯绠$悊',
+                    parentId: 2,
+                    indexUrl: "costRule"
+                },
+                {
+                  icon: 'el-icon-document',
+                  name: '杞﹁締鍏ュ満绠$悊',
+                  parentId: 2,
+                  indexUrl: "enterPark"
+                },
+                {
+                  icon: 'el-icon-document',
+                  name: '杞﹁締鍑哄満绠$悊',
+                  parentId: 2,
+                  indexUrl: "outPark"
+                },
+                {
+                  icon: 'el-icon-document',
+                  name: '鐧藉悕鍗曠鐞�',
+                  parentId: 2,
+                  indexUrl: "whiteList"
+                },
+                {
+                  icon: 'el-icon-document',
+                  name: '娉婅溅鍙戠エ绠$悊',
+                  parentId: 2,
+                  indexUrl: "parkticket"
+                },
+                {
+                  icon: 'el-icon-document',
+                  name: '璁㈠崟缁熻',
+                  parentId: 2,
+                  indexUrl: "orderRecord"
+                },
+            ]
+        },
+        {
+          id:3,
+          icon: 'el-icon-folder-opened',
+          indexUrl: '3',
+          name: '鏅烘収缃氭病绠$悊',
+          children:[
+            {
+              icon: 'el-icon-document',
+              name: '杩濈珷绫诲瀷绠$悊',
+              parentId: 3,
+              indexUrl: "violationType"
+            },
+            {
+              icon: 'el-icon-document',
+              name: '琛楅亾绠$悊',
+              parentId: 3,
+              indexUrl: "street"
+            },
+            {
+              icon: 'el-icon-document',
+              name: '缃氬崟绠$悊',
+              parentId: 3,
+              indexUrl: "ticket"
+            },
+            {
+              icon: 'el-icon-document',
+              name: '缃氭病鍙戠エ绠$悊',
+              parentId: 3,
+              indexUrl: "zfticket"
+            },
+          ]
+        },
+      ], 
+ }
\ No newline at end of file
diff --git a/src/utils/mappingData.js b/src/utils/mappingData.js
new file mode 100644
index 0000000..2d73da9
--- /dev/null
+++ b/src/utils/mappingData.js
@@ -0,0 +1,2 @@
+export const USER_TYPEUSER_ASYNCROUTES = 'userRouters'; // 鐢ㄦ埛鏉冮檺鏁扮粍
+export const USER_TYPE = 'userRouters'; // 鐢ㄦ埛鏉冮檺瀛楁
\ No newline at end of file

--
Gitblit v1.9.1