Commit 47f32d5c38fdd47bc6277d3a582ba6c072271b15

Authored by 杨泽宇
1 parent dc89eaa4

修复物业代理

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