index.vue
3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<template>
<view class="workbench">
<CustomNavBar :title="t('app.menu.allToolsPage')" :is-tab="true">
<!-- #ifdef MP-WEIXIN -->
<!-- <template v-slot:left>
<uv-icon name="grid" color="#fff" size="20px" @tap="goSetting"></uv-icon>
</template> -->
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<!-- <template v-slot:right>
<uv-icon name="grid" color="#fff" size="20px" @tap="goSetting"></uv-icon>
</template> -->
<!-- #endif -->
</CustomNavBar>
<view class="w-b-list">
<view v-for="appItem in computedDisplayList" :key="appItem.sectionKey" class="m-block">
<!-- <view class="m_b_title">{{ t(appItem.displayName) }}</view> -->
<uv-text bold :text="t(appItem.displayName)" align="left" size="28rpx" color="#202328" :lines="1"></uv-text>
<view class="m_b_list">
<view class="menu-item" v-for="menuItem in appItem.items" :key="menuItem.itemKey"
@tap="()=>handleLinkTo(menuItem)">
<image :src="getImgSrc(menuItem)" mode="" style="width: 88rpx;height: 88rpx;"></image>
<view>{{ t(menuItem.displayName) }}</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
APP_MENU
} from './data'
import {
getStageObj
} from '@/utils'
import {
onShow,
onLoad
} from '@dcloudio/uni-app'
import {
computed,
ref
} from 'vue'
import CustomNavBar from '@/components/CustomNav.nvue'
import {
t,
updateTabBarText
} from '@/plugins/index.js'
onLoad(()=>{
updateTabBarText()
})
const displayList = ref(APP_MENU)
onShow(() => {
const workbenchInfo = getStageObj('workbenchInfo')
if (workbenchInfo) {
displayList.value = workbenchInfo.displayList
}
})
// 只展示显示的数据
const computedDisplayList = computed(() => {
return displayList.value.filter(item => item.items.length > 0)
})
const goSetting = () => {
uni.navigateTo({
url: '/pages/workbench/setting'
})
}
const getImgSrc = (menuItem) => {
return `/static/workbench/${menuItem.icon}.png`
}
// 跳转
const handleLinkTo = (menuItem) => {
console.log('menuItem', menuItem)
if (menuItem.tab) {
uni.switchTab({
url: menuItem.tab
})
return false
}
// 子集itemKey
const subKeys = [
'customerPortrait',
'stayDuration',
'conversionAnalysis',
'storeRanking',
'storeHeatmap',
'areaStatistics',
'areaHeatmap',
'inspectionRecords',
'pendingTasks',
'GroupStats',
'StoreStats'
]
if (subKeys.includes(menuItem.itemKey)) {
const url = `/subPackages/accountGroup${menuItem.path.includes('/inspection')?'':'/pages'}${menuItem.path}${menuItem.path.includes('/inspection')?'':'/index'}`
uni.navigateTo({url})
} else {
console.log('跳转111', menuItem.path);
uni.navigateTo({
url: `${menuItem.path}/index`,
})
}
}
</script>
<style lang="scss" scoped>
.w-b-list {
padding: 20rpx;
}
.workbench {
min-height: 100vh;
background-color: #F2F3F6;
.m-block {
background-color: #FFFFFF;
border-radius: 16rpx;
margin-bottom: 20rpx;
padding: 28rpx 24rpx 0;
&:last-child {
margin-bottom: 0;
}
.m_b_title {
font-weight: bold;
font-size: 28rpx;
color: #202328;
}
.m_b_list {
display: flex;
flex-wrap: wrap;
margin-top: 32rpx;
.menu-item {
width: 25%;
text-align: center;
font-size: 24rpx;
color: #202328;
margin-bottom: 32rpx;
image {
margin-bottom: 6rpx;
}
view{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
}
}
</style>