Commit 47f32d5c38fdd47bc6277d3a582ba6c072271b15
1 parent
dc89eaa4
修复物业代理
Showing
5 changed files
with
16 additions
and
32 deletions
src/layout/menu.vue
| ... | ... | @@ -16,7 +16,7 @@ let asyncData = reactive({ |
| 16 | 16 | isCollapse: null |
| 17 | 17 | }) |
| 18 | 18 | onMounted(() => { |
| 19 | - asyncData.menuData = store.family.menuStore().menuList | |
| 19 | + asyncData.menuData = store.family.loginStore().menuList | |
| 20 | 20 | asyncData.isCollapse = computed(() => { |
| 21 | 21 | return store.family.appStore().isCollapse |
| 22 | 22 | }) | ... | ... |
src/pinia/modules/login.ts
| ... | ... | @@ -13,7 +13,8 @@ interface LoginUser { |
| 13 | 13 | oName?: string, |
| 14 | 14 | oLogo?: string, |
| 15 | 15 | userId?: number, |
| 16 | - oType?: number | |
| 16 | + oType?: number, | |
| 17 | + menuList?: any[], | |
| 17 | 18 | } |
| 18 | 19 | const id: string = 'login' |
| 19 | 20 | const state: Function = () => ({ |
| ... | ... | @@ -23,7 +24,8 @@ const state: Function = () => ({ |
| 23 | 24 | userName: '', |
| 24 | 25 | organizationType: null, |
| 25 | 26 | organizationName: '', |
| 26 | - organizationLogo: '' | |
| 27 | + organizationLogo: '', | |
| 28 | + menuList: [] | |
| 27 | 29 | }) |
| 28 | 30 | const getters = { |
| 29 | 31 | getToken() { |
| ... | ... | @@ -53,6 +55,9 @@ const getters = { |
| 53 | 55 | getOlogo () { |
| 54 | 56 | // 当前登陆的组织logo |
| 55 | 57 | return this.organizationLogo |
| 58 | + }, | |
| 59 | + getMenuList () { | |
| 60 | + return this.menuList | |
| 56 | 61 | } |
| 57 | 62 | } |
| 58 | 63 | const actions = { |
| ... | ... | @@ -65,10 +70,13 @@ const actions = { |
| 65 | 70 | this.organizationType = obj.organizationType? obj.organizationType: obj.oType |
| 66 | 71 | this.organizationLogo = obj.organizationLogo? obj.organizationLogo: obj.oLogo |
| 67 | 72 | }, |
| 73 | + setMenuList (data: any[]) { | |
| 74 | + this.menuList = data | |
| 75 | + }, | |
| 68 | 76 | removeToken(msg: string | null) { |
| 69 | 77 | logout() |
| 70 | 78 | this.token = '' |
| 71 | - window.localStorage.removeItem('store-data') | |
| 79 | + window.localStorage.clear() | |
| 72 | 80 | ElMessage.success(msg || '已退出登录'); |
| 73 | 81 | setTimeout(() => { |
| 74 | 82 | router.replace('/login') | ... | ... |
src/pinia/modules/menu.ts deleted
100644 → 0
| 1 | -const id: string = 'menu' | |
| 2 | -const state: Function = () => ({ | |
| 3 | - menuList: [] | |
| 4 | -}) | |
| 5 | -const getters = { | |
| 6 | - getMenuList() { | |
| 7 | - return this.menuList | |
| 8 | - } | |
| 9 | -} | |
| 10 | -const actions = { | |
| 11 | - setMenuList (data) { | |
| 12 | - this.menuList = data | |
| 13 | - } | |
| 14 | -} | |
| 15 | - | |
| 16 | -export default { | |
| 17 | - namespace: true, | |
| 18 | - actions, | |
| 19 | - getters, | |
| 20 | - state, | |
| 21 | - id | |
| 22 | -} | |
| 23 | 0 | \ No newline at end of file |
src/views/property/index.vue
| ... | ... | @@ -92,15 +92,13 @@ const handleStatus = async (obj) => { |
| 92 | 92 | */ |
| 93 | 93 | const handleProxy = (obj) => { |
| 94 | 94 | userProxy({ oId: obj.id }).then((res) => { |
| 95 | - console.log('代理回调') | |
| 96 | - console.log(res) | |
| 97 | 95 | if (res?.data) { |
| 98 | 96 | store.family.loginStore().setUserInfo(res?.data?.data); |
| 99 | 97 | globalProperties.$message.success("代理成功"); |
| 100 | 98 | getMenu().then(() => { |
| 101 | 99 | setTimeout(() => { |
| 102 | - // location.href = "/"; | |
| 103 | - }, 2000); | |
| 100 | + location.href = "/"; | |
| 101 | + }, 500); | |
| 104 | 102 | }); |
| 105 | 103 | } else { |
| 106 | 104 | globalProperties.$message.error("代理失败"); |
| ... | ... | @@ -113,7 +111,7 @@ const handleProxy = (obj) => { |
| 113 | 111 | const getMenu = async () => { |
| 114 | 112 | try { |
| 115 | 113 | let res = await menuData(); |
| 116 | - store.family.menuStore().setMenuList(res?.data?.data); | |
| 114 | + store.family.loginStore().setMenuList(res?.data?.data); | |
| 117 | 115 | } catch (e) { |
| 118 | 116 | console.log(e); |
| 119 | 117 | } | ... | ... |
src/views/user/login.vue
| ... | ... | @@ -56,7 +56,7 @@ const submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { |
| 56 | 56 | const getMenu = async () => { |
| 57 | 57 | try { |
| 58 | 58 | let res = await menuData(); |
| 59 | - store.family.menuStore().setMenuList(res?.data?.data); | |
| 59 | + store.family.loginStore().setMenuList(res?.data?.data); | |
| 60 | 60 | } catch (e) { |
| 61 | 61 | console.log(e); |
| 62 | 62 | } | ... | ... |