wui-components-v2 1.1.69 → 1.1.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/core/index.ts +74 -74
- package/api/feishu.ts +20 -20
- package/api/index.ts +4 -4
- package/api/login.ts +51 -51
- package/api/menu.ts +45 -45
- package/api/page.ts +114 -114
- package/api/sys.ts +12 -12
- package/api/tree.ts +28 -28
- package/components/action-popup/action-popup.vue +116 -116
- package/components/add-address-list/add-address-list.vue +187 -187
- package/components/add-address-page/add-address-page.vue +77 -77
- package/components/add-address-page/config.ts +297 -297
- package/components/audio-play/audio-play.vue +220 -220
- package/components/batch-upload-file/batch-upload-file.vue +75 -75
- package/components/card-botom-buttons/card-botom-buttons.vue +279 -279
- package/components/custom-date-picker/custom-date-picker.vue +106 -106
- package/components/custom-select-picker/custom-select-picker.vue +95 -95
- package/components/demo-block/demo-block.vue +63 -63
- package/components/demo-card/demo-card.vue +44 -44
- package/components/detail-popup/detail-popup.vue +99 -99
- package/components/evaluation-page/evaluation-page.vue +196 -196
- package/components/fold-card/fold-card.vue +171 -171
- package/components/form-control/form-control.vue +661 -661
- package/components/global-loading/GlobalLoading.md +366 -366
- package/components/global-loading/global-loading.vue +55 -55
- package/components/global-message/GlobalMessage.md +570 -570
- package/components/global-message/global-message.vue +68 -68
- package/components/global-toast/GlobalToast.md +261 -261
- package/components/global-toast/global-toast.vue +56 -56
- package/components/label-value/label-value.vue +144 -144
- package/components/label-value/open-value-more.vue +56 -56
- package/components/list-top-buttons/list-top-buttons.vue +19 -19
- package/components/loading/loading.vue +5 -5
- package/components/login-form/login-form.vue +126 -126
- package/components/login-form-box/login-form-box.vue +65 -65
- package/components/mulselect-picker/mulselect-picker.vue +86 -86
- package/components/phone-login-form/phone-login-form.vue +204 -204
- package/components/privacy-popup/privacy-popup.vue +191 -191
- package/components/product-card/product-card.vue +201 -201
- package/components/scan-input/scan-input.vue +406 -406
- package/components/search/search.vue +128 -128
- package/components/select-col-picker/select-col-picker.vue +168 -168
- package/components/tab-search/tab-search.vue +73 -73
- package/components/tree-select/components/TreeNode.vue +200 -200
- package/components/tree-select/components/index.vue +471 -471
- package/components/tree-select/components/tree-select.vue +56 -56
- package/components/tree-select/index.vue +93 -93
- package/components/user-choose/user-choose.vue +169 -151
- package/components/video-play/video-play.vue +56 -56
- package/components/wui-auto-update-component/wui-auto-update-component.vue +132 -132
- package/components/wui-default/wui-default.vue +49 -49
- package/components/wui-details-page/wui-details-page.vue +147 -147
- package/components/wui-edit-page/wui-edit-page-copy.vue +757 -757
- package/components/wui-edit-page/wui-edit-page.vue +793 -793
- package/components/wui-enume-select-control/wui-enume-select-control.vue +92 -92
- package/components/wui-list/wui-list.vue +235 -235
- package/components/wui-login/wui-login.vue +43 -43
- package/components/wui-login1/wui-login.vue +41 -41
- package/components/wui-menus/wui-menus-top.vue +137 -137
- package/components/wui-menus/wui-menus-top1.vue +8 -8
- package/components/wui-menus/wui-menus.vue +247 -247
- package/components/wui-menus1/components/banner-carousel.vue +320 -320
- package/components/wui-menus1/components/navbar.vue +43 -43
- package/components/wui-menus1/components/quick-panel.vue +55 -55
- package/components/wui-menus1/components/search-bar.vue +49 -49
- package/components/wui-menus1/components/section-menus.vue +208 -208
- package/components/wui-menus1/wui-menus-top.vue +718 -718
- package/components/wui-menus1/wui-menus-top1.vue +398 -398
- package/components/wui-menus1/wui-menus.vue +564 -564
- package/components/wui-notify-info/notify-handle.vue +53 -53
- package/components/wui-notify-info/wui-notify-info.vue +280 -280
- package/components/wui-scan-binding-sensor/wui-scan-binding-sensor.vue +75 -75
- package/components/wui-search-history-babbar/components/SearchBar.vue +70 -70
- package/components/wui-search-history-babbar/wui-search-history-babbar.vue +204 -204
- package/components/wui-select-list/wui-select-list.vue +310 -310
- package/components/wui-select-popup/wui-select-popup.vue +613 -612
- package/components/wui-system-settings/wui-system-settings.vue +144 -144
- package/components/wui-tabbar/wui-tabbar.vue +106 -106
- package/components/wui-tree-page/components/tree-item.vue +238 -238
- package/components/wui-tree-page/wui-tree-page.vue +297 -297
- package/components/wui-update-component/wui-update-component.vue +221 -221
- package/components/wui-user/wui-user.vue +202 -202
- package/composables/types/theme.ts +65 -65
- package/composables/types/user.ts +5 -5
- package/composables/useColorGenerator.ts +221 -221
- package/composables/useCompanyFieldFilter.ts +91 -91
- package/composables/useEnumes.ts +43 -43
- package/composables/useEventBus.ts +37 -37
- package/composables/useGlobalLoading.ts +47 -47
- package/composables/useGlobalMessage.ts +53 -53
- package/composables/useGlobalToast.ts +63 -63
- package/composables/useLocale.ts +54 -54
- package/composables/useManualTheme.ts +179 -179
- package/composables/useMenus.ts +193 -193
- package/composables/useSectionMenus.ts +120 -120
- package/composables/useTabbar.ts +50 -50
- package/composables/useTheme.ts +74 -74
- package/composables/useUser.ts +24 -24
- package/index.d.ts +90 -90
- package/index.ts +83 -83
- package/package.json +24 -24
- package/static/iconfont/iconfont.css +63 -63
- package/store/language.ts +151 -151
- package/store/manualThemeStore.ts +143 -143
- package/store/persist.ts +41 -41
- package/store/themeStore.ts +74 -74
- package/store/userStore.ts +22 -22
- package/styles/dark-mode.css +523 -523
- package/styles/dark-mode.min.css +1 -1
- package/styles/dark-mode.scss +498 -498
- package/type.ts +154 -154
- package/utils/control-tree.ts +353 -353
- package/utils/control-type-supportor.ts +148 -148
- package/utils/eventBus.ts +36 -36
- package/utils/idata-scan.ts +99 -99
- package/utils/index.ts +979 -979
- package/utils/rsaEncrypt.ts +10 -10
|
@@ -1,247 +1,247 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { PropType } from 'vue'
|
|
3
|
-
import { computed, defineOptions, defineProps, ref } from 'vue'
|
|
4
|
-
import { useRouter } from 'uni-mini-router'
|
|
5
|
-
import { onShow } from '@dcloudio/uni-app'
|
|
6
|
-
import { menu } from '../../api/menu'
|
|
7
|
-
import DemoCard from '../demo-card/demo-card.vue'
|
|
8
|
-
import { useManualTheme } from '../../composables/useManualTheme'
|
|
9
|
-
import { useGlobalToast } from '../../composables/useGlobalToast'
|
|
10
|
-
import { useColorGenerator } from '../../composables/useColorGenerator'
|
|
11
|
-
import { desaturateColor } from '../../utils'
|
|
12
|
-
import wuiMenusTop from './wui-menus-top.vue'
|
|
13
|
-
|
|
14
|
-
defineOptions({
|
|
15
|
-
name: 'WuiMenus',
|
|
16
|
-
})
|
|
17
|
-
const props = defineProps({
|
|
18
|
-
icons: {
|
|
19
|
-
type: Array as PropType<Icon[]>,
|
|
20
|
-
default: () => [],
|
|
21
|
-
},
|
|
22
|
-
load: {
|
|
23
|
-
type: Function as PropType<() => void>,
|
|
24
|
-
default: () => {},
|
|
25
|
-
},
|
|
26
|
-
menuTopType: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: '',
|
|
29
|
-
},
|
|
30
|
-
})
|
|
31
|
-
// const user = useUser().getUserInfo()
|
|
32
|
-
const router = useRouter()
|
|
33
|
-
const toast = useGlobalToast()
|
|
34
|
-
interface Icon {
|
|
35
|
-
id: string
|
|
36
|
-
path: string
|
|
37
|
-
}
|
|
38
|
-
const { currentThemeColor } = useManualTheme()
|
|
39
|
-
const { generateRandomColor } = useColorGenerator(currentThemeColor.value.primary)
|
|
40
|
-
const menuList = ref([])
|
|
41
|
-
const title = ref('')
|
|
42
|
-
const filtermenu = computed(() => {
|
|
43
|
-
let arr = []
|
|
44
|
-
if (currentThemeColor.value.primary) {
|
|
45
|
-
arr = filterHiddenTree(menuList.value, 'items', true)
|
|
46
|
-
}
|
|
47
|
-
return arr
|
|
48
|
-
})
|
|
49
|
-
const sheetShow = ref(false)
|
|
50
|
-
const actions = ref([])
|
|
51
|
-
const paging = ref()
|
|
52
|
-
// 点击菜单跳转页面
|
|
53
|
-
function gotoPage(item: any) {
|
|
54
|
-
// 跳转页面
|
|
55
|
-
if (goto(item)) return
|
|
56
|
-
// 打开动作面板
|
|
57
|
-
openSheet(item)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// 点击动作面板跳转页面
|
|
61
|
-
function sheetGotoPage(item: any) {
|
|
62
|
-
// 跳转页面
|
|
63
|
-
if (goto(item)) return
|
|
64
|
-
// 打开动作面板
|
|
65
|
-
openSheet(item, 300)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// 跳转页面
|
|
69
|
-
function goto(item: any) {
|
|
70
|
-
console.log(item.pageType)
|
|
71
|
-
switch (item.pageType) {
|
|
72
|
-
case '列表':
|
|
73
|
-
router.push(`/pages/list/index?sourceId=${item.id}&title=${item.title}`)
|
|
74
|
-
return true
|
|
75
|
-
case '树':
|
|
76
|
-
router.push(`/pages/tree-page/index?sourceId=${item.id}&title=${item.title}`)
|
|
77
|
-
return true
|
|
78
|
-
case '报表':
|
|
79
|
-
// uni.navigateTo({
|
|
80
|
-
// url: `/pages/report-table/report-table?sourceId=${item.id}&title=${item.title}`,
|
|
81
|
-
// })
|
|
82
|
-
return true
|
|
83
|
-
|
|
84
|
-
default:
|
|
85
|
-
return false
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// 打开wd-action-sheet动作面板
|
|
90
|
-
function openSheet(item: any, s = 0) {
|
|
91
|
-
if (item.items) {
|
|
92
|
-
title.value = item.title
|
|
93
|
-
actions.value = item.items
|
|
94
|
-
? item.items.map((item: any) => {
|
|
95
|
-
return {
|
|
96
|
-
name: item.title,
|
|
97
|
-
// color: '#00000073',
|
|
98
|
-
...item,
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
: []
|
|
102
|
-
|
|
103
|
-
// 设置二次打开的过渡时间
|
|
104
|
-
const id = setTimeout(() => {
|
|
105
|
-
sheetShow.value = true
|
|
106
|
-
clearTimeout(id)
|
|
107
|
-
}, s)
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* 根据 `disabled: true` 过滤树形数组(支持自定义子节点字段)
|
|
113
|
-
* @param {Array} tree 原始树形数据
|
|
114
|
-
* @param {string} [childKey] 子节点字段名
|
|
115
|
-
* @param {boolean} [deepClone] 是否深拷贝原数据
|
|
116
|
-
* @returns {Array} 过滤后的新树形数据
|
|
117
|
-
*/
|
|
118
|
-
function filterHiddenTree(tree: any, childKey = 'children', deepClone = false) {
|
|
119
|
-
// 深拷贝处理(可选)
|
|
120
|
-
const clone = (data: any) => {
|
|
121
|
-
if (!deepClone) return data
|
|
122
|
-
return JSON.parse(JSON.stringify(data))
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return clone(tree)
|
|
126
|
-
.filter((node: any) => !node.disabled) // 过滤当前层隐藏节点
|
|
127
|
-
.map((node: any) => {
|
|
128
|
-
// 递归处理子节点
|
|
129
|
-
if (Array.isArray(node[childKey])) {
|
|
130
|
-
node[childKey] = filterHiddenTree(node[childKey], childKey, deepClone)
|
|
131
|
-
}
|
|
132
|
-
const icon = props.icons.find((item: any) => {
|
|
133
|
-
return item.id === node.id
|
|
134
|
-
})
|
|
135
|
-
return {
|
|
136
|
-
...node,
|
|
137
|
-
iconPath: (icon as any)?.path,
|
|
138
|
-
color: generateRandomColor().hex,
|
|
139
|
-
}
|
|
140
|
-
})
|
|
141
|
-
}
|
|
142
|
-
onShow(() => {
|
|
143
|
-
// if (paging.value) {
|
|
144
|
-
// paging.value.reload()
|
|
145
|
-
// }
|
|
146
|
-
})
|
|
147
|
-
// @query所绑定的方法不要自己调用!!需要刷新列表数据时,只需要调用this.$refs.paging.reload()即可
|
|
148
|
-
function queryList() {
|
|
149
|
-
// 此处请求仅为演示,请替换为自己项目中的请求
|
|
150
|
-
menu()
|
|
151
|
-
.then((res: any) => {
|
|
152
|
-
// 将请求结果通过complete传给z-paging处理,同时也代表请求结束,这一行必须调用
|
|
153
|
-
if (!res?.blocks.length) {
|
|
154
|
-
toast.warning('暂无权限,请重新登录或联系管理员')
|
|
155
|
-
}
|
|
156
|
-
uni.setNavigationBarTitle({ title: res?.programName || '' }) // 设置标题
|
|
157
|
-
paging.value.complete(res?.blocks || [])
|
|
158
|
-
})
|
|
159
|
-
.catch((res: any) => {
|
|
160
|
-
// 如果请求失败写this.$refs.paging.complete(false),会自动展示错误页面
|
|
161
|
-
// 注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理
|
|
162
|
-
// 在底层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可
|
|
163
|
-
console.log(res, 'menu error')
|
|
164
|
-
paging.value.complete(false)
|
|
165
|
-
})
|
|
166
|
-
}
|
|
167
|
-
</script>
|
|
168
|
-
|
|
169
|
-
<template>
|
|
170
|
-
<z-paging ref="paging" v-model="menuList" :loading-more-enabled="false" @query="queryList" @on-refresh="props.load">
|
|
171
|
-
<template #top>
|
|
172
|
-
<slot name="top" :style="{ background: currentThemeColor.primary }" />
|
|
173
|
-
</template>
|
|
174
|
-
<view>
|
|
175
|
-
<wuiMenusTop v-if="props.menuTopType !== '自定义'" />
|
|
176
|
-
<view v-if="props.menuTopType === '自定义'" class="p-1" />
|
|
177
|
-
<DemoCard v-for="(item, index) in filtermenu" :key="index" :title="item.title">
|
|
178
|
-
<template #content>
|
|
179
|
-
<view class="border-rd-2 bg-white pa-1 dark:bg-[var(--wot-dark-background2)]">
|
|
180
|
-
<wd-grid :column="4" clickable>
|
|
181
|
-
<wd-grid-item
|
|
182
|
-
v-for="(subItem, subIndex) in item.items"
|
|
183
|
-
:key="subIndex"
|
|
184
|
-
use-text-slot
|
|
185
|
-
use-icon-slot
|
|
186
|
-
@itemclick="gotoPage(subItem)"
|
|
187
|
-
>
|
|
188
|
-
<template #icon>
|
|
189
|
-
<view
|
|
190
|
-
class="flex items-center justify-center rounded-2"
|
|
191
|
-
:style="{ backgroundColor: desaturateColor(subItem.color, 0.25), height: '80rpx', width: '80rpx' }"
|
|
192
|
-
>
|
|
193
|
-
<!-- <text class="i-carbon:chart-combo-stacked text-center text-5"
|
|
194
|
-
:class="[props.icons.find(item => item.id === subItem.id)?.path]"
|
|
195
|
-
:style="{ color:desaturateColor(subItem.color,0.5) }" /> -->
|
|
196
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8" width="80" height="80" viewBox="0 0 80 80">
|
|
197
|
-
<g fill="none" stroke-linecap="round" stroke-width="4">
|
|
198
|
-
<rect width="24" height="24" x="12" y="12" fill="#9b51e0" stroke="#9b51e0" rx="4" />
|
|
199
|
-
<rect width="24" height="24" x="44" y="12" fill="#56ccf2" stroke="#56ccf2" rx="4" />
|
|
200
|
-
<rect width="24" height="24" x="12" y="44" fill="#56ccf2" stroke="#56ccf2" rx="4" />
|
|
201
|
-
<rect width="24" height="24" x="44" y="44" fill="#9b51e0" stroke="#9b51e0" rx="4" />
|
|
202
|
-
</g>
|
|
203
|
-
</svg>
|
|
204
|
-
</view>
|
|
205
|
-
</template>
|
|
206
|
-
<template #text>
|
|
207
|
-
<view class="pa-1 text-center text-10rpx text-gray-800 dark:text-white">
|
|
208
|
-
<view class="line-clamp-1 font-medium">
|
|
209
|
-
{{ subItem.title }}
|
|
210
|
-
</view>
|
|
211
|
-
</view>
|
|
212
|
-
</template>
|
|
213
|
-
</wd-grid-item>
|
|
214
|
-
</wd-grid>
|
|
215
|
-
</view>
|
|
216
|
-
</template>
|
|
217
|
-
</DemoCard>
|
|
218
|
-
<slot name="listBottom" />
|
|
219
|
-
</view>
|
|
220
|
-
|
|
221
|
-
<template #bottom>
|
|
222
|
-
<slot name="bottom" />
|
|
223
|
-
</template>
|
|
224
|
-
</z-paging>
|
|
225
|
-
<wd-action-sheet
|
|
226
|
-
v-model="sheetShow"
|
|
227
|
-
:z-index="9999"
|
|
228
|
-
:actions="actions"
|
|
229
|
-
:title="title"
|
|
230
|
-
@select="
|
|
231
|
-
({ item }) => {
|
|
232
|
-
sheetGotoPage(item)
|
|
233
|
-
}
|
|
234
|
-
"
|
|
235
|
-
/>
|
|
236
|
-
</template>
|
|
237
|
-
|
|
238
|
-
<style scoped lang="scss">
|
|
239
|
-
//深度样式覆盖
|
|
240
|
-
:deep(.wd-grid-item__wrapper) {
|
|
241
|
-
width: 50px !important;
|
|
242
|
-
height: 40px !important;
|
|
243
|
-
display: flex;
|
|
244
|
-
align-items: center;
|
|
245
|
-
justify-content: center;
|
|
246
|
-
}
|
|
247
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { PropType } from 'vue'
|
|
3
|
+
import { computed, defineOptions, defineProps, ref } from 'vue'
|
|
4
|
+
import { useRouter } from 'uni-mini-router'
|
|
5
|
+
import { onShow } from '@dcloudio/uni-app'
|
|
6
|
+
import { menu } from '../../api/menu'
|
|
7
|
+
import DemoCard from '../demo-card/demo-card.vue'
|
|
8
|
+
import { useManualTheme } from '../../composables/useManualTheme'
|
|
9
|
+
import { useGlobalToast } from '../../composables/useGlobalToast'
|
|
10
|
+
import { useColorGenerator } from '../../composables/useColorGenerator'
|
|
11
|
+
import { desaturateColor } from '../../utils'
|
|
12
|
+
import wuiMenusTop from './wui-menus-top.vue'
|
|
13
|
+
|
|
14
|
+
defineOptions({
|
|
15
|
+
name: 'WuiMenus',
|
|
16
|
+
})
|
|
17
|
+
const props = defineProps({
|
|
18
|
+
icons: {
|
|
19
|
+
type: Array as PropType<Icon[]>,
|
|
20
|
+
default: () => [],
|
|
21
|
+
},
|
|
22
|
+
load: {
|
|
23
|
+
type: Function as PropType<() => void>,
|
|
24
|
+
default: () => {},
|
|
25
|
+
},
|
|
26
|
+
menuTopType: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: '',
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
// const user = useUser().getUserInfo()
|
|
32
|
+
const router = useRouter()
|
|
33
|
+
const toast = useGlobalToast()
|
|
34
|
+
interface Icon {
|
|
35
|
+
id: string
|
|
36
|
+
path: string
|
|
37
|
+
}
|
|
38
|
+
const { currentThemeColor } = useManualTheme()
|
|
39
|
+
const { generateRandomColor } = useColorGenerator(currentThemeColor.value.primary)
|
|
40
|
+
const menuList = ref([])
|
|
41
|
+
const title = ref('')
|
|
42
|
+
const filtermenu = computed(() => {
|
|
43
|
+
let arr = []
|
|
44
|
+
if (currentThemeColor.value.primary) {
|
|
45
|
+
arr = filterHiddenTree(menuList.value, 'items', true)
|
|
46
|
+
}
|
|
47
|
+
return arr
|
|
48
|
+
})
|
|
49
|
+
const sheetShow = ref(false)
|
|
50
|
+
const actions = ref([])
|
|
51
|
+
const paging = ref()
|
|
52
|
+
// 点击菜单跳转页面
|
|
53
|
+
function gotoPage(item: any) {
|
|
54
|
+
// 跳转页面
|
|
55
|
+
if (goto(item)) return
|
|
56
|
+
// 打开动作面板
|
|
57
|
+
openSheet(item)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// 点击动作面板跳转页面
|
|
61
|
+
function sheetGotoPage(item: any) {
|
|
62
|
+
// 跳转页面
|
|
63
|
+
if (goto(item)) return
|
|
64
|
+
// 打开动作面板
|
|
65
|
+
openSheet(item, 300)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 跳转页面
|
|
69
|
+
function goto(item: any) {
|
|
70
|
+
console.log(item.pageType)
|
|
71
|
+
switch (item.pageType) {
|
|
72
|
+
case '列表':
|
|
73
|
+
router.push(`/pages/list/index?sourceId=${item.id}&title=${item.title}`)
|
|
74
|
+
return true
|
|
75
|
+
case '树':
|
|
76
|
+
router.push(`/pages/tree-page/index?sourceId=${item.id}&title=${item.title}`)
|
|
77
|
+
return true
|
|
78
|
+
case '报表':
|
|
79
|
+
// uni.navigateTo({
|
|
80
|
+
// url: `/pages/report-table/report-table?sourceId=${item.id}&title=${item.title}`,
|
|
81
|
+
// })
|
|
82
|
+
return true
|
|
83
|
+
|
|
84
|
+
default:
|
|
85
|
+
return false
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// 打开wd-action-sheet动作面板
|
|
90
|
+
function openSheet(item: any, s = 0) {
|
|
91
|
+
if (item.items) {
|
|
92
|
+
title.value = item.title
|
|
93
|
+
actions.value = item.items
|
|
94
|
+
? item.items.map((item: any) => {
|
|
95
|
+
return {
|
|
96
|
+
name: item.title,
|
|
97
|
+
// color: '#00000073',
|
|
98
|
+
...item,
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
: []
|
|
102
|
+
|
|
103
|
+
// 设置二次打开的过渡时间
|
|
104
|
+
const id = setTimeout(() => {
|
|
105
|
+
sheetShow.value = true
|
|
106
|
+
clearTimeout(id)
|
|
107
|
+
}, s)
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 根据 `disabled: true` 过滤树形数组(支持自定义子节点字段)
|
|
113
|
+
* @param {Array} tree 原始树形数据
|
|
114
|
+
* @param {string} [childKey] 子节点字段名
|
|
115
|
+
* @param {boolean} [deepClone] 是否深拷贝原数据
|
|
116
|
+
* @returns {Array} 过滤后的新树形数据
|
|
117
|
+
*/
|
|
118
|
+
function filterHiddenTree(tree: any, childKey = 'children', deepClone = false) {
|
|
119
|
+
// 深拷贝处理(可选)
|
|
120
|
+
const clone = (data: any) => {
|
|
121
|
+
if (!deepClone) return data
|
|
122
|
+
return JSON.parse(JSON.stringify(data))
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return clone(tree)
|
|
126
|
+
.filter((node: any) => !node.disabled) // 过滤当前层隐藏节点
|
|
127
|
+
.map((node: any) => {
|
|
128
|
+
// 递归处理子节点
|
|
129
|
+
if (Array.isArray(node[childKey])) {
|
|
130
|
+
node[childKey] = filterHiddenTree(node[childKey], childKey, deepClone)
|
|
131
|
+
}
|
|
132
|
+
const icon = props.icons.find((item: any) => {
|
|
133
|
+
return item.id === node.id
|
|
134
|
+
})
|
|
135
|
+
return {
|
|
136
|
+
...node,
|
|
137
|
+
iconPath: (icon as any)?.path,
|
|
138
|
+
color: generateRandomColor().hex,
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
}
|
|
142
|
+
onShow(() => {
|
|
143
|
+
// if (paging.value) {
|
|
144
|
+
// paging.value.reload()
|
|
145
|
+
// }
|
|
146
|
+
})
|
|
147
|
+
// @query所绑定的方法不要自己调用!!需要刷新列表数据时,只需要调用this.$refs.paging.reload()即可
|
|
148
|
+
function queryList() {
|
|
149
|
+
// 此处请求仅为演示,请替换为自己项目中的请求
|
|
150
|
+
menu()
|
|
151
|
+
.then((res: any) => {
|
|
152
|
+
// 将请求结果通过complete传给z-paging处理,同时也代表请求结束,这一行必须调用
|
|
153
|
+
if (!res?.blocks.length) {
|
|
154
|
+
toast.warning('暂无权限,请重新登录或联系管理员')
|
|
155
|
+
}
|
|
156
|
+
uni.setNavigationBarTitle({ title: res?.programName || '' }) // 设置标题
|
|
157
|
+
paging.value.complete(res?.blocks || [])
|
|
158
|
+
})
|
|
159
|
+
.catch((res: any) => {
|
|
160
|
+
// 如果请求失败写this.$refs.paging.complete(false),会自动展示错误页面
|
|
161
|
+
// 注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理
|
|
162
|
+
// 在底层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可
|
|
163
|
+
console.log(res, 'menu error')
|
|
164
|
+
paging.value.complete(false)
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
</script>
|
|
168
|
+
|
|
169
|
+
<template>
|
|
170
|
+
<z-paging ref="paging" v-model="menuList" :loading-more-enabled="false" @query="queryList" @on-refresh="props.load">
|
|
171
|
+
<template #top>
|
|
172
|
+
<slot name="top" :style="{ background: currentThemeColor.primary }" />
|
|
173
|
+
</template>
|
|
174
|
+
<view>
|
|
175
|
+
<wuiMenusTop v-if="props.menuTopType !== '自定义'" />
|
|
176
|
+
<view v-if="props.menuTopType === '自定义'" class="p-1" />
|
|
177
|
+
<DemoCard v-for="(item, index) in filtermenu" :key="index" :title="item.title">
|
|
178
|
+
<template #content>
|
|
179
|
+
<view class="border-rd-2 bg-white pa-1 dark:bg-[var(--wot-dark-background2)]">
|
|
180
|
+
<wd-grid :column="4" clickable>
|
|
181
|
+
<wd-grid-item
|
|
182
|
+
v-for="(subItem, subIndex) in item.items"
|
|
183
|
+
:key="subIndex"
|
|
184
|
+
use-text-slot
|
|
185
|
+
use-icon-slot
|
|
186
|
+
@itemclick="gotoPage(subItem)"
|
|
187
|
+
>
|
|
188
|
+
<template #icon>
|
|
189
|
+
<view
|
|
190
|
+
class="flex items-center justify-center rounded-2"
|
|
191
|
+
:style="{ backgroundColor: desaturateColor(subItem.color, 0.25), height: '80rpx', width: '80rpx' }"
|
|
192
|
+
>
|
|
193
|
+
<!-- <text class="i-carbon:chart-combo-stacked text-center text-5"
|
|
194
|
+
:class="[props.icons.find(item => item.id === subItem.id)?.path]"
|
|
195
|
+
:style="{ color:desaturateColor(subItem.color,0.5) }" /> -->
|
|
196
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8" width="80" height="80" viewBox="0 0 80 80">
|
|
197
|
+
<g fill="none" stroke-linecap="round" stroke-width="4">
|
|
198
|
+
<rect width="24" height="24" x="12" y="12" fill="#9b51e0" stroke="#9b51e0" rx="4" />
|
|
199
|
+
<rect width="24" height="24" x="44" y="12" fill="#56ccf2" stroke="#56ccf2" rx="4" />
|
|
200
|
+
<rect width="24" height="24" x="12" y="44" fill="#56ccf2" stroke="#56ccf2" rx="4" />
|
|
201
|
+
<rect width="24" height="24" x="44" y="44" fill="#9b51e0" stroke="#9b51e0" rx="4" />
|
|
202
|
+
</g>
|
|
203
|
+
</svg>
|
|
204
|
+
</view>
|
|
205
|
+
</template>
|
|
206
|
+
<template #text>
|
|
207
|
+
<view class="pa-1 text-center text-10rpx text-gray-800 dark:text-white">
|
|
208
|
+
<view class="line-clamp-1 font-medium">
|
|
209
|
+
{{ subItem.title }}
|
|
210
|
+
</view>
|
|
211
|
+
</view>
|
|
212
|
+
</template>
|
|
213
|
+
</wd-grid-item>
|
|
214
|
+
</wd-grid>
|
|
215
|
+
</view>
|
|
216
|
+
</template>
|
|
217
|
+
</DemoCard>
|
|
218
|
+
<slot name="listBottom" />
|
|
219
|
+
</view>
|
|
220
|
+
|
|
221
|
+
<template #bottom>
|
|
222
|
+
<slot name="bottom" />
|
|
223
|
+
</template>
|
|
224
|
+
</z-paging>
|
|
225
|
+
<wd-action-sheet
|
|
226
|
+
v-model="sheetShow"
|
|
227
|
+
:z-index="9999"
|
|
228
|
+
:actions="actions"
|
|
229
|
+
:title="title"
|
|
230
|
+
@select="
|
|
231
|
+
({ item }) => {
|
|
232
|
+
sheetGotoPage(item)
|
|
233
|
+
}
|
|
234
|
+
"
|
|
235
|
+
/>
|
|
236
|
+
</template>
|
|
237
|
+
|
|
238
|
+
<style scoped lang="scss">
|
|
239
|
+
//深度样式覆盖
|
|
240
|
+
:deep(.wd-grid-item__wrapper) {
|
|
241
|
+
width: 50px !important;
|
|
242
|
+
height: 40px !important;
|
|
243
|
+
display: flex;
|
|
244
|
+
align-items: center;
|
|
245
|
+
justify-content: center;
|
|
246
|
+
}
|
|
247
|
+
</style>
|