Browse Source

修复切换账号,角色所对应的订单刷新不及时bug

李书文 1 year ago
parent
commit
d8ee8e7a45
2 changed files with 6 additions and 2 deletions
  1. 5 2
      pages/index/index.vue
  2. 1 0
      pages/login/login.vue

+ 5 - 2
pages/index/index.vue

@@ -91,9 +91,12 @@ export default {
 		};
 	},
 	onLoad() {
-		this.getMenu();
 		this.getBannerList();
 		this.getNewsList();
+		this.getMenu();
+		uni.$on('getMenu', res => {
+			this.getMenu();
+		});
 	},
 	onShow() {
 		this.keyword = '';
@@ -108,7 +111,7 @@ export default {
 				loading: 'false',
 				success: res => {
 					if (res.data.data) {
-						this.order=res.data.data;
+						this.order = res.data.data;
 						this.show = true;
 					}
 				}

+ 1 - 0
pages/login/login.vue

@@ -83,6 +83,7 @@ export default {
 					uni.setStorageSync('menu', data.per_list);
 					uni.showToast({ title: '登录成功' });
 					setTimeout(() => {
+						uni.$emit('getMenu');
 						uni.switchTab({ url: '/pages/index/index' });
 					}, 1000);
 				}