|
|
@@ -40,11 +40,24 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import { postJ } from '@/utils/api.js'
|
|
|
- import { login, usName } from '@/api/common.js'
|
|
|
- import { getResourcesTree } from '@/api/pda/common.js'
|
|
|
+ import {
|
|
|
+ postJ
|
|
|
+ } from '@/utils/api.js'
|
|
|
+ import {
|
|
|
+ login,
|
|
|
+ usName
|
|
|
+ } from '@/api/common.js'
|
|
|
+ import {
|
|
|
+ getResourcesTree
|
|
|
+ } from '@/api/pda/common.js'
|
|
|
|
|
|
- import { setMemo, isMemo, removeMemo, setPassword, getPassword } from '@/utils/passwordMemo.js'
|
|
|
+ import {
|
|
|
+ setMemo,
|
|
|
+ isMemo,
|
|
|
+ removeMemo,
|
|
|
+ setPassword,
|
|
|
+ getPassword
|
|
|
+ } from '@/utils/passwordMemo.js'
|
|
|
import ServerSetting from '@/components/ServerSetting/index'
|
|
|
|
|
|
export default {
|
|
|
@@ -158,7 +171,7 @@
|
|
|
|
|
|
let data = res.data
|
|
|
uni.setStorageSync('token', data.token)
|
|
|
- uni.setStorageSync("userInfo", data);
|
|
|
+ uni.setStorageSync("userInfo", data);
|
|
|
uni.showToast({
|
|
|
title: '登录成功',
|
|
|
icon: 'success',
|
|
|
@@ -190,7 +203,33 @@
|
|
|
removeMemo()
|
|
|
}
|
|
|
},
|
|
|
+ formatRouter(list) {
|
|
|
+ let authorities = [];
|
|
|
|
|
|
+ const fn = (list) => {
|
|
|
+ let arr = [];
|
|
|
+ for (const p of list) {
|
|
|
+ if (p.menuType === 2) {
|
|
|
+ // p.children = [];
|
|
|
+ authorities.push(p);
|
|
|
+ }
|
|
|
+ // else {
|
|
|
+ if (p.children?.length) {
|
|
|
+ p.children = fn(p.children);
|
|
|
+ } else {
|
|
|
+ p.children = [];
|
|
|
+ }
|
|
|
+ arr.push(p);
|
|
|
+ // }
|
|
|
+ }
|
|
|
+
|
|
|
+ return arr;
|
|
|
+ };
|
|
|
+
|
|
|
+ fn(list);
|
|
|
+
|
|
|
+ return authorities
|
|
|
+ },
|
|
|
getTree() {
|
|
|
getResourcesTree().then(res => {
|
|
|
console.log(res)
|
|
|
@@ -201,7 +240,9 @@
|
|
|
})
|
|
|
}
|
|
|
let List = JSON.stringify(res || [])
|
|
|
+ let authorities =this.formatRouter(res[0].children)
|
|
|
uni.setStorageSync('treeList', List)
|
|
|
+ uni.setStorageSync('authorities', JSON.stringify(authorities)) //按钮
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
@@ -210,4 +251,4 @@
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
@import 'login.scss';
|
|
|
-</style>
|
|
|
+</style>
|