scorpio 3 years ago
parent
commit
286c4a14b9
3 changed files with 11 additions and 16 deletions
  1. 6 11
      src/layout/top.vue
  2. 2 2
      src/page/login.vue
  3. 3 3
      src/views/home/component/dash.vue

+ 6 - 11
src/layout/top.vue

@@ -47,17 +47,7 @@ export default {
     const permission = permissionStore()
     return { nav, user, permission }
   },
-  created () {
-    this.getPermission()
-  },
   methods: {
-    getPermission () {
-      this.$api.login.getPermission().then(res => {
-        if (res.code === 200) {
-          this.permission.addPermission(res.data)
-        }
-      })
-    },
     dropDown (res) {
       if (res === 'info') {
         this.$router.push('/user')
@@ -65,7 +55,12 @@ export default {
         this.$api.login.logout().then(res => {
           if (res.success === 'true') {
             this.nav.cleanMenu()
-            this.permission.cleanPermission()
+            try {
+              // this.permission.cleanPermission()
+            } catch (err) {
+              console.log(err)
+            }
+
             this.$message.success('退出登录')
             this.$router.replace('/login')
           } else {

+ 2 - 2
src/page/login.vue

@@ -198,7 +198,6 @@ export default {
             } else {
               setToken(res.access_token)
               this.getInfo()
-              this.$router.replace('/')
             }
           })
         } else {
@@ -211,7 +210,6 @@ export default {
       this.form.pass = 'wtkj@123'
     },
     getInfo () {
-      this.getPermission()
       this.$api.login.getUserInfo().then(res => {
         if (res.code === 200) {
           // 保存信息
@@ -221,6 +219,7 @@ export default {
             res.data.typeName = '服务商'
           }
           this.user.setUserInfo(res.data)
+          this.getPermission()
         }
       })
     },
@@ -228,6 +227,7 @@ export default {
       this.$api.login.getPermission().then(res => {
         if (res.code === 200) {
           this.permission.addPermission(res.data)
+          this.$router.replace('/')
         }
       })
     },

+ 3 - 3
src/views/home/component/dash.vue

@@ -8,15 +8,15 @@
         <span class="ml-5">项目总投资额<span
             class="main-color bold">{{ Number.parseFloat(num).toLocaleString() }}</span>万元</span>
       </div>
-      <div class="flex ml-20 hide-scrollbar" style="overflow-x: scroll;width: 86vw" v-show='stage.length > 0'>
+      <div class="flex ml-20 hide-scrollbar" style="overflow-x: scroll;width: 86vw" v-show='stage && stage.length > 0'>
         <div v-for="(item,index) in stage" :key='item.id' :class="active === index ? 'total-s' : 'total'"
-             class="flex flex-col  flex-center mt-20 bold font-16 pointer"
+             class="flex flex-col  flex-center mt-20 bold font-16 pointer" @click='switchTab(item,index)'
              >
           <span class=" sp">{{ item.name }}</span>
           <span class=" sp1 mt-5">{{ item.projectNumber }}<span class="grey font-14 ml-5">个</span></span>
         </div>
       </div>
-      <base-button v-if='permissions.permissions.projectAdd' class="ml-20 mt-20" icon="Plus" title="新增"
+      <base-button v-if='permissions.permissions?.projectAdd' class="ml-20 mt-20" icon="Plus" title="新增"
                    @click="showAdd = true"/>
     </div>
     <avue-crud ref="crud"