#
whycq
2024-11-28 248ef3ba3de9994dc83d2b36690542893f9fb6e6
pages/home/menuHome.vue
@@ -90,13 +90,16 @@
               },
            ],
            menu: [],
            colorList: ['cyan','blue','purple','mauve','pink','brown','red','orange','yellow','olive','olive','grey' ]
         };
      },
      onShow() {
         this.baseUrl = uni.getStorageSync('baseUrl');
         this.token = uni.getStorageSync('token');
         this.getAuth()
         this.menu = uni.getStorageSync('menu');
         // console.log(this.menu);
         this.getAuth2()
         // this.backGroundRepeat()
      },
      methods: {
@@ -111,6 +114,27 @@
               i++
            }
         },
         getAuth2() {
            this.elements = []
            for (let i in this.menu) {
               this.getIcon(this.menu[i].title)
               this.elements.unshift({
                  title: this.menu[i].name,
                  name: this.menu[i].title,
                  color: this.colorList[i],
                  cuIcon: this.icon,
                  id: this.menu[i].id,
                  url: `${this.menu[i].code}`
               })
            }
            this.elements.push({
               title: '退出登录',
               name: 'logOut',
               color: 'grey',
               cuIcon: 'exit',
               url: '/login/logOut'
            })
         },
         getAuth() {
            let that = this
            uni.request({
@@ -122,10 +146,10 @@
                  res = res.data
                  that.elements = []
                  if (res.code === 200) {
                     if (res.data == undefined || res.data == null || res.data == "") {
                        that.elements = that.elements2
                        return
                     }
                     // if (res.data == undefined || res.data == null || res.data == "") {
                     //    that.elements = that.elements2
                     //    return
                     // }
                     for (var i = 0; i < res.data.length; i++) {
                        if (res.data.length < 0) {
                           break;