tremble 4 tahun lalu
induk
melakukan
622396f4d1

+ 2 - 1
backstage/src/pages/cultural-relic/index.vue

@@ -42,7 +42,7 @@
                 <el-image :fit="'cover'" style="width:100%;height:100%;" :src="item.pic"></el-image>
                 <!-- <div class="liulan"><span>浏览量: {{Math.round(Math.random()*100000)}}</span> 点赞数: {{Math.round(Math.random()*1000)}}</div> -->
               </div>
-              <div>{{item.timeName}} {{item.typeName}} <span @click.stop="del(item)" class="del">删除</span></div>
+              <div>{{item.timeName}} {{item.typeName}} <span v-if="authority['删除']" @click.stop="del(item)" class="del">删除</span></div>
               <p>{{item.name}}</p>
             </li>
           </ul>
@@ -122,6 +122,7 @@ export default {
         this.authority[item.name] = item.authority
       })
     }
+
     this.getPositionList()
     this.getTypeList()
     this.refresh()

+ 11 - 10
backstage/src/pages/layout/aside.vue

@@ -138,18 +138,19 @@ export default {
       this.aside = temp
 
       // let curi = ''
-      let pp = ''
-      this.aside.forEach(item => {
-        item.subItem.forEach(sub => {
-          if (this.$route.path === sub.url) {
-            pp = item
-          }
-        })
-      })
-      // (curi && pp) && this.getAsideItem(curi.name, pp)
-      window.localStorage.setItem('currentItem', JSON.stringify(pp))
+
       let initPage = this.aside[0]
       if (initPage.subItem && !initPage.id) {
+        let pp = ''
+        this.aside.forEach(item => {
+          item.subItem.forEach(sub => {
+            if (initPage.subItem[0].url === sub.url) {
+              pp = item
+            }
+          })
+        })
+        // (curi && pp) && this.getAsideItem(curi.name, pp)
+        window.localStorage.setItem('currentItem', JSON.stringify(pp))
         this.$router.replace({path: initPage.subItem[0].url})
       }
     }

+ 17 - 13
backstage/src/pages/user/index.vue

@@ -225,20 +225,24 @@ export default {
     }
   },
   mounted () {
-    if (!window.localStorage.getItem('currentItem')) {
-      return
-    } else {
-      let currentItem = JSON.parse(window.localStorage.getItem('currentItem'))
-      let auth = ''
-      if (currentItem.children) {
-        auth = currentItem.children.find(item => item.name === '用户管理')
+    console.log(window.localStorage.getItem('currentItem'))
+    this.$nextTick(() => {
+      if (!window.localStorage.getItem('currentItem')) {
+        return
+      } else {
+        let currentItem = JSON.parse(window.localStorage.getItem('currentItem'))
+        let auth = ''
+        if (currentItem.children) {
+          auth = currentItem.children.find(item => item.name === '用户管理')
+        }
+        auth && auth.children.forEach(item => {
+          this.authority[item.name] = item.authority
+        })
       }
-      auth && auth.children.forEach(item => {
-        this.authority[item.name] = item.authority
-      })
-    }
-    this.refresh()
-    this.getRole()
+
+      this.refresh()
+      this.getRole()
+    })
   },
   methods: {
     reset () {