| | |
| | | }, |
| | | |
| | | ], |
| | | 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.menu = uni.getStorageSync('menu'); |
| | | // console.log(this.menu); |
| | | this.getAuth() |
| | | // this.backGroundRepeat() |
| | | }, |
| | |
| | | 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({ |
| | |
| | | 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; |
| | |
| | | url: `${res.data[i].code}` |
| | | }) |
| | | } |
| | | console.log(that.elements); |
| | | that.elements.push({ |
| | | title: '退出登录', |
| | | name: 'logOut', |