zhaobao 3 vuotta sitten
vanhempi
commit
bac342b210

+ 18 - 0
src/permission.js

@@ -27,6 +27,15 @@ router.beforeEach(async(to, from, next) => {
     } else {
       const hasPermits = store.getters.permits && store.getters.permits.length > 0
       if (hasPermits) {
+        // 跳转首页但是没有首页
+        if (from.path === '/' && to.path === '/404' || from.path === '/login' && to.path === '/404') {
+          next({
+            path: store.state.permission.addRoutes[0].path,
+            replace: true
+          })
+          NProgress.done()
+          return
+        }
         next()
       } else {
         // 如果没有获取到vuex中到name
@@ -44,6 +53,15 @@ router.beforeEach(async(to, from, next) => {
           const accessRoutes = await store.dispatch('permission/generateRoutes', permits)
           // dynamically add accessible routes
           router.addRoutes(accessRoutes)
+          // 跳转首页但是没有首页
+          if (from.path === '/' && to.path === '/404' || from.path === '/login' && to.path === '/404') {
+            next({
+              path: accessRoutes[0].path,
+              replace: true
+            })
+            NProgress.done()
+            return
+          }
           next({
             ...to,
             replace: true

+ 6 - 6
src/router/modules/aqpt.js

@@ -127,16 +127,16 @@ const aqptRouter = [
         component: () => import('@/views/aqpt/projectWork/index'),
         name: 'projectWork',
         meta: { title: '工作项目管理', noCache: true, permit: 'aqpt_scene_riskpoint' }
-      },
-      {
-        path: 'VisualEditor',
-        component: () => import('@/views/aqpt/visualEditor/index'),
-        name: 'VisualEditor',
-        meta: { title: '可视化编辑', noCache: true, permit: 'aqpt_scene_riskpoint' }
       }
     ]
   },
   {
+    path: '/VisualEditor',
+    component: () => import('@/views/aqpt/visualEditor/index'),
+    name: 'VisualEditor',
+    meta: { title: '作业活动可视化配置', noCache: true, permit: 'jyprj_setting' }
+  },
+  {
     path: '/aqpt/check',
     component: Layout,
     name: 'AqptCheck',

+ 6 - 7
src/views/aqpt/visualEditor/index.vue

@@ -82,7 +82,7 @@ export default {
       },
       dragstartMarker: undefined,
       map: undefined,
-      markerGroup: [],
+      markerGroup: null,
       mapList: [],
       mapId: undefined,
       mapRasterLayer: require('./images/layout_cont.png'),
@@ -149,7 +149,6 @@ export default {
           this.saveForm.name = ''
           this.$message.success('修改成功!')
           this.dragstartMarker = undefined
-          this.markerGroup.clearLayers()
           this.getLayers()
         })
       } else {
@@ -167,8 +166,6 @@ export default {
           this.saveForm.icon = ''
           this.saveForm.name = ''
           this.$message.success('新增成功!')
-
-          this.markerGroup.clearLayers()
           this.getLayers()
         })
       }
@@ -200,8 +197,6 @@ export default {
           this.map.removeLayer(this.map._layers[this.markerId])
         }
         this.$message.success('删除成功!')
-
-        this.markerGroup.clearLayers()
         this.getLayers()
       })
     },
@@ -232,6 +227,9 @@ export default {
     },
     getLayers() {
       getLayersApi().then((res) => {
+        if (this.markerGroup !== null) {
+          this.markerGroup?.clearLayers()
+        }
         this.initMarkers(res.data)
       })
     },
@@ -360,7 +358,8 @@ export default {
 </script>
 <style lang="scss" scoped>
 .conatiner{
-    height: calc(100vh - 74px);
+    height: 100%;
+    height: 100vh;
     min-width: 1000px;
     margin: 0 auto;
     padding: 0 16px;

+ 1 - 0
src/views/login/auth-redirect.vue

@@ -2,6 +2,7 @@
 export default {
   name: 'AuthRedirect',
   created() {
+    alert(1)
     const hash = window.location.search.slice(1)
     if (window.localStorage) {
       window.localStorage.setItem('x-admin-oauth-code', hash)

+ 9 - 2
src/views/login/index.vue

@@ -67,6 +67,7 @@
 </template>
 
 <script>
+import { mapGetters } from 'vuex'
 export default {
   name: 'Login',
   data() {
@@ -102,6 +103,12 @@ export default {
       otherQuery: {}
     }
   },
+  computed: {
+    ...mapGetters([
+      'permission_routes',
+      'permits'
+    ])
+  },
   watch: {
     $route: {
       handler: function(route) {
@@ -140,9 +147,9 @@ export default {
       this.$refs.loginForm.validate(valid => {
         if (valid) {
           this.loading = true
-          this.$store.dispatch('user/login', this.loginForm).then(() => {
-            this.$router.push({ path: '/', query: this.otherQuery })
+          this.$store.dispatch('user/login', this.loginForm).then(async(res) => {
             this.loading = false
+            this.$router.push({ path: '/', query: this.otherQuery })
           }).catch(() => {
             this.loading = false
           })