|
|
@@ -56,7 +56,7 @@
|
|
|
<view class="functionbox">
|
|
|
|
|
|
<view class="functionbox_text">
|
|
|
- <view class="functionbox_text_item" @click="tabfunction(0,item)" v-if="index < 9" v-for="(item,index) in menuList" :key="index">
|
|
|
+ <view class="functionbox_text_item" @click="tabfunction(0,item)" v-for="(item,index) in menuTop9" :key="index">
|
|
|
<image :src="item.app_menu_icon" mode="" class="itemimg">
|
|
|
</image>
|
|
|
<view class="icon_text"> {{ getSlice(item.purview_name) }} </view>
|
|
|
@@ -211,7 +211,12 @@
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
- methods: {
|
|
|
+ computed: {
|
|
|
+ menuTop9() {
|
|
|
+ return (this.menuList || []).slice(0, 9);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
handlePopupClose(){
|
|
|
console.log('弹窗已关闭')
|
|
|
},
|
|
|
@@ -267,8 +272,20 @@
|
|
|
data: JSON.stringify(myuid),
|
|
|
});
|
|
|
this.menuList = menuList || [];
|
|
|
+ uni.setStorage({
|
|
|
+ key: 'menuList',
|
|
|
+ data: JSON.stringify(menuList || []),
|
|
|
+ });
|
|
|
},
|
|
|
- tabfunction(index,item) {
|
|
|
+ loadMenuFromCache() {
|
|
|
+ try {
|
|
|
+ const cached = uni.getStorageSync('menuList');
|
|
|
+ if (cached) this.menuList = JSON.parse(cached) || [];
|
|
|
+ } catch (e) {
|
|
|
+ console.error('读取 menuList 缓存失败:', e);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ tabfunction(index,item) {
|
|
|
const purId = item?.pur_id || '';
|
|
|
if (purId == 25) {
|
|
|
uni.navigateTo({
|
|
|
@@ -411,20 +428,15 @@
|
|
|
} else {
|
|
|
this.hello = '下午好!';
|
|
|
}
|
|
|
- Debounce(() => {
|
|
|
- this.getUserlogin();
|
|
|
- }, 500)();
|
|
|
this.checkLocationPermission(true); // 首次加载弹框提醒
|
|
|
},
|
|
|
- created() {
|
|
|
- Debounce(() => {
|
|
|
- this.getUserlogin();
|
|
|
- }, 500)();
|
|
|
- },
|
|
|
onShow() {
|
|
|
this.loadTF = false;
|
|
|
Debounce(() => {
|
|
|
- this.getUserlogin();
|
|
|
+ this.getUserlogin().catch(e => {
|
|
|
+ console.error('getUserlogin 失败:', e);
|
|
|
+ this.loadMenuFromCache();
|
|
|
+ });
|
|
|
}, 500)();
|
|
|
this.checkLocationPermission();
|
|
|
},
|