w-ui-v1 1.1.23 → 1.1.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "w-ui-v1",
3
- "version": "1.1.23",
3
+ "version": "1.1.25",
4
4
  "description": "w-ui",
5
5
  "author": "wgxshh",
6
6
  "license": "ISC",
@@ -100,9 +100,9 @@
100
100
 
101
101
  <template>
102
102
  <view class="login">
103
+ <WSwitchLang v-if="props.langSwitch" />
103
104
  <image class="footer-img" src="./footerImg.png"></image>
104
105
  <view class="form-box">
105
- <WSwitchLang v-if="props.langSwitch" />
106
106
  <view v-if="props.loginImge" class="avatar">
107
107
  <wd-img width="200rpx" height="200rpx" :src="props.loginImge">
108
108
  <template #error>
package/w-menu/w-menu.vue CHANGED
@@ -1,262 +1,279 @@
1
1
  <script lang="ts">
2
- //在自定义组件中使用 Wot Design Uni 组件时,需开启styleIsolation: 'shared'选项覆盖样式
3
- export default {
4
- options: {
5
- styleIsolation: 'shared'//使css :deep()生效
6
- }
7
- }
2
+ //在自定义组件中使用 Wot Design Uni 组件时,需开启styleIsolation: 'shared'选项覆盖样式
3
+ export default {
4
+ options: {
5
+ styleIsolation: 'shared'//使css :deep()生效
6
+ }
7
+ }
8
8
  </script>
9
9
  <script setup lang="ts">
10
- import { cloneDeep } from 'lodash-es'
11
- import {
12
- computed,
13
- onMounted,
14
- ref,
15
- } from 'vue'
16
- import { menu } from '../utils/apis/menu'
17
-
18
- defineOptions({
19
- name: 'WMenu',
20
- })
21
- const menuList = ref([])
22
- const title = ref('')
23
- const filtermenu = computed(() => {
24
- return filterHiddenTree(menuList.value, 'items', true)
25
- })
26
- const sheetShow = ref(false)
27
- const actions = ref([])
28
- const paging = ref()
29
- onMounted(() => {
30
-
31
- })
32
-
33
-
34
- // 点击菜单跳转页面
35
- function gotoPage(item: any) {
36
- // 跳转页面
37
- if (goto(item))
38
- return
39
- // 打开动作面板
40
- openSheet(item)
41
- }
42
-
43
- // 点击动作面板跳转页面
44
- function sheetGotoPage(item: any) {
45
-
46
- // 跳转页面
47
- if (goto(item))
48
- return
49
- // 打开动作面板
50
- openSheet(item, 300)
51
- }
52
-
53
- // 跳转页面
54
- function goto(item: any) {
55
- console.log(item.pageType)
56
- switch (item.pageType) {
57
- case "列表":
58
- if(item.customPath){
59
- uni.navigateTo({
60
- url: `/${item.customPath}`,
61
- })
62
- }else{
63
- uni.navigateTo({
64
- url: `/pages/table/table?sourceId=${item.id}&pageTitle=${item.title}`,
10
+ import { cloneDeep } from 'lodash-es'
11
+ import {
12
+ computed,
13
+ onMounted,
14
+ ref,
15
+ defineProps
16
+ } from 'vue'
17
+ import { menu } from '../utils/apis/menu'
18
+
19
+ defineOptions({
20
+ name: 'WMenu',
21
+ })
22
+ const props = defineProps({
23
+ icon: {
24
+ type: Object,
25
+ default: {
26
+
27
+ }
28
+ }
29
+ })
30
+ const menuList = ref([])
31
+ const title = ref('')
32
+ const filtermenu = computed(() => {
33
+ return filterHiddenTree(menuList.value, 'items', true)
34
+ })
35
+ const sheetShow = ref(false)
36
+ const actions = ref([])
37
+ const paging = ref()
38
+ onMounted(() => {
39
+
40
+ })
41
+
42
+
43
+ // 点击菜单跳转页面
44
+ function gotoPage(item : any) {
45
+ // 跳转页面
46
+ if (goto(item))
47
+ return
48
+ // 打开动作面板
49
+ openSheet(item)
50
+ }
51
+
52
+ // 点击动作面板跳转页面
53
+ function sheetGotoPage(item : any) {
54
+
55
+ // 跳转页面
56
+ if (goto(item))
57
+ return
58
+ // 打开动作面板
59
+ openSheet(item, 300)
60
+ }
61
+
62
+ // 跳转页面
63
+ function goto(item : any) {
64
+ console.log(item.pageType)
65
+ switch (item.pageType) {
66
+ case "列表":
67
+ if (item.customPath) {
68
+ uni.navigateTo({
69
+ url: `/${item.customPath}`,
70
+ })
71
+ } else {
72
+ uni.navigateTo({
73
+ url: `/pages/table/table?sourceId=${item.id}&pageTitle=${item.title}`,
74
+ })
75
+ }
76
+
77
+ return true
78
+
79
+ case "报表":
80
+ uni.navigateTo({
81
+ url: `/pages/report-table/report-table?sourceId=${item.id}&pageTitle=${item.title}`,
82
+ })
83
+ return true
84
+
85
+
86
+ default:
87
+
88
+ return false
89
+
90
+ }
91
+ }
92
+
93
+ // 打开wd-action-sheet动作面板
94
+ function openSheet(item : any, s = 0) {
95
+ if (item.items) {
96
+ title.value = item.title
97
+ actions.value = item.items
98
+ ? item.items.map((item : any) => {
99
+ return {
100
+ name: item.title,
101
+ // color: '#00000073',
102
+ ...cloneDeep(item),
103
+ }
104
+ })
105
+ : []
106
+
107
+ // 设置二次打开的过渡时间
108
+ const id = setTimeout(() => {
109
+ sheetShow.value = true
110
+ clearTimeout(id)
111
+ }, s)
112
+ }
113
+ }
114
+
115
+ /**
116
+ * 根据 `disabled: true` 过滤树形数组(支持自定义子节点字段)
117
+ * @param {Array} tree 原始树形数据
118
+ * @param {string} [childKey] 子节点字段名
119
+ * @param {boolean} [deepClone] 是否深拷贝原数据
120
+ * @returns {Array} 过滤后的新树形数据
121
+ */
122
+ function filterHiddenTree(tree : any, childKey = 'children', deepClone = false) {
123
+ // 深拷贝处理(可选)
124
+ const clone = (data : any) => {
125
+ if (!deepClone)
126
+ return data
127
+ return JSON.parse(JSON.stringify(data))
128
+ }
129
+
130
+ return clone(tree)
131
+ .filter((node : any) => !node.disabled) // 过滤当前层隐藏节点
132
+ .map((node : any) => {
133
+ // 递归处理子节点
134
+ if (Array.isArray(node[childKey])) {
135
+ node[childKey] = filterHiddenTree(node[childKey], childKey, deepClone)
136
+ }
137
+ return node
138
+ })
139
+ }
140
+
141
+ // @query所绑定的方法不要自己调用!!需要刷新列表数据时,只需要调用this.$refs.paging.reload()即可
142
+ function queryList() {
143
+ // 此处请求仅为演示,请替换为自己项目中的请求
144
+ menu().then(res => {
145
+ // 将请求结果通过complete传给z-paging处理,同时也代表请求结束,这一行必须调用
146
+ paging.value.complete(res.data?.blocks || []);
147
+ uni.setNavigationBarTitle({ title: res.data?.programName || '' })
148
+ }).catch(res => {
149
+ // 如果请求失败写this.$refs.paging.complete(false),会自动展示错误页面
150
+ // 注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理
151
+ // 在底层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可
152
+ paging.value.complete(false);
65
153
  })
66
154
  }
67
-
68
- return true
69
-
70
- case "报表":
71
- uni.navigateTo({
72
- url: `/pages/report-table/report-table?sourceId=${item.id}&pageTitle=${item.title}`,
73
- })
74
- return true
75
-
76
-
77
- default:
78
-
79
- return false
80
-
81
- }
82
- }
83
-
84
- // 打开wd-action-sheet动作面板
85
- function openSheet(item: any, s = 0) {
86
- if (item.items) {
87
- title.value = item.title
88
- actions.value = item.items
89
- ? item.items.map((item: any) => {
90
- return {
91
- name: item.title,
92
- // color: '#00000073',
93
- ...cloneDeep(item),
94
- }
95
- })
96
- : []
97
-
98
- // 设置二次打开的过渡时间
99
- const id = setTimeout(() => {
100
- sheetShow.value = true
101
- clearTimeout(id)
102
- }, s)
103
- }
104
- }
105
-
106
- /**
107
- * 根据 `disabled: true` 过滤树形数组(支持自定义子节点字段)
108
- * @param {Array} tree 原始树形数据
109
- * @param {string} [childKey] 子节点字段名
110
- * @param {boolean} [deepClone] 是否深拷贝原数据
111
- * @returns {Array} 过滤后的新树形数据
112
- */
113
- function filterHiddenTree(tree: any, childKey = 'children', deepClone = false) {
114
- // 深拷贝处理(可选)
115
- const clone = (data: any) => {
116
- if (!deepClone)
117
- return data
118
- return JSON.parse(JSON.stringify(data))
119
- }
120
-
121
- return clone(tree)
122
- .filter((node: any) => !node.disabled) // 过滤当前层隐藏节点
123
- .map((node: any) => {
124
- // 递归处理子节点
125
- if (Array.isArray(node[childKey])) {
126
- node[childKey] = filterHiddenTree(node[childKey], childKey, deepClone)
127
- }
128
- return node
129
- })
130
- }
131
-
132
- // @query所绑定的方法不要自己调用!!需要刷新列表数据时,只需要调用this.$refs.paging.reload()即可
133
- function queryList() {
134
- // 此处请求仅为演示,请替换为自己项目中的请求
135
- menu().then(res => {
136
- // 将请求结果通过complete传给z-paging处理,同时也代表请求结束,这一行必须调用
137
- paging.value.complete(res.data?.blocks || []);
138
- uni.setNavigationBarTitle({ title: res.data?.programName || '' })
139
- }).catch(res => {
140
- // 如果请求失败写this.$refs.paging.complete(false),会自动展示错误页面
141
- // 注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理
142
- // 在底层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可
143
- paging.value.complete(false);
144
- })
145
- }
146
155
  </script>
147
156
 
148
157
  <template>
149
- <z-paging ref="paging" v-model="menuList" @query="queryList">
150
- <template #top>
151
- <slot name="top"></slot>
152
- </template>
153
- <view>
154
- <view v-if="filtermenu.length > 0" class="menu-list">
155
- <slot name="topImg"></slot>
156
- <wd-card v-for="(item, index) in filtermenu" :key="index"
157
- >
158
- <template #title>
159
- <view class="menu-title-class">
160
- <view class="title-icon"></view> {{item.title}}
161
- </view>
162
- </template>
163
- <template #default>
164
- <wd-grid :column="4" :clickable="true">
165
- <wd-grid-item use-slot v-for="(subItem, subIndex) in item.items" :key="subIndex"
166
- @itemclick="gotoPage(subItem)" use-text-slot>
167
- <template #default>
168
- <view class="grid-item">
169
- <text class="grid-item-icon">{{ subItem.title }}</text>
170
- <view class="grid-item-title">{{subItem.title}}</view>
171
- </view>
172
-
173
- </template>
174
- </wd-grid-item>
175
- </wd-grid>
176
- </template>
177
- </wd-card>
178
- </view>
179
-
180
- <wd-action-sheet v-model="sheetShow" :actions="actions" :title="title"
181
- @select="({ item }) => { sheetGotoPage(item) }" />
182
- </view>
183
- <template #bottom>
184
- <slot name="bottom"></slot>
185
- </template>
186
- </z-paging>
158
+ <z-paging :loading-more-enabled="false" ref="paging" v-model="menuList" @query="queryList">
159
+ <template #top>
160
+ <slot name="top"></slot>
161
+ </template>
162
+ <view>
163
+ <view v-if="filtermenu.length > 0" class="menu-list">
164
+ <slot name="topImg"></slot>
165
+ <wd-card v-for="(item, index) in filtermenu" :key="index">
166
+ <template #title>
167
+ <view class="menu-title-class">
168
+ <view class="title-icon"></view> {{item.title}}
169
+ </view>
170
+ </template>
171
+ <template #default>
172
+ <wd-grid :column="4" :clickable="true">
173
+ <wd-grid-item use-slot v-for="(subItem, subIndex) in item.items" :key="subIndex"
174
+ @itemclick="gotoPage(subItem)" use-text-slot>
175
+ <template #default>
176
+ <view class="grid-item">
177
+ <view v-if="props.icon.id" class="grid-item-icon"
178
+ style="display: flex;justify-content: center;align-items: center;">
179
+ <image style="height: 30px;width: 30px;" src="/static/home.png" mode="">
180
+ </image>
181
+ </view>
182
+ <text v-else class="grid-item-icon">
183
+ <text>{{ subItem.title }}</text>
184
+ </text>
185
+ <view class="grid-item-title">{{subItem.title}}</view>
186
+ </view>
187
+
188
+ </template>
189
+ </wd-grid-item>
190
+ </wd-grid>
191
+ </template>
192
+ </wd-card>
193
+ </view>
194
+
195
+ <wd-action-sheet v-model="sheetShow" :actions="actions" :title="title"
196
+ @select="({ item }) => { sheetGotoPage(item) }" />
197
+ </view>
198
+ <template #bottom>
199
+ <slot name="bottom"></slot>
200
+ </template>
201
+ </z-paging>
187
202
  </template>
188
203
 
189
204
  <style lang="scss" scoped>
190
- .img_box {
191
- padding: 25rpx;
192
- }
193
-
194
- .loading_box {
195
- display: flex;
196
- justify-content: center;
197
- }
198
-
199
- .grid-item {
200
- position: relative;
201
- display: flex;
202
- flex-direction: column;
203
- justify-content: center;
204
- align-items: center;
205
- //实现...
206
- overflow: hidden;
207
- text-overflow: ellipsis;
208
- white-space: nowrap;
209
-
210
- .grid-item-icon {
211
- margin-bottom: 5px;
212
- width: 42px;
213
- height: 42px;
214
- line-height: 40px;
215
- color: #4D81F1;
216
- font-size: 18px;
217
- font-weight: 700;
218
- text-indent: 12px;
219
- border-radius: 8px;
220
- display: block;
221
- float: left;
222
- overflow: hidden;
223
- background-color: #E6F4FF;
224
- letter-spacing: 20px;
225
- // margin-right: 15px;
226
- }
227
- .grid-item-title{
228
- color: #4D81F1;
229
- width: 55px;
230
- overflow: hidden;
231
- // text-overflow: ellipsis;
232
- white-space: pre-wrap;
233
- // white-space: pre-wrap;
234
- // text-align: left;
235
- }
236
-
237
- }
238
-
239
- .menu-title-class {
240
- display: flex;
241
- align-items: center;
242
- gap: 4px;
243
- font-weight: 700;
244
- }
245
- .title-icon{
246
- width: 3px;
247
- height: 15px;
248
- background-color: #4D81F1;
249
- }
250
-
251
- .menu-list {
252
- padding: 12px 0 1px 0;
253
- // background-color: #F6F7FB;
254
- background: linear-gradient(to top, #F6F7FB 0%, #2c5def 100%);
255
- }
256
-
257
- :deep(.wd-grid){
258
- float: unset;
259
- display: flex;
260
- flex-wrap: wrap;
261
- }
262
- </style>
205
+ .img_box {
206
+ padding: 25rpx;
207
+ }
208
+
209
+ .loading_box {
210
+ display: flex;
211
+ justify-content: center;
212
+ }
213
+
214
+ .grid-item {
215
+ position: relative;
216
+ display: flex;
217
+ flex-direction: column;
218
+ justify-content: center;
219
+ align-items: center;
220
+ //实现...
221
+ overflow: hidden;
222
+ text-overflow: ellipsis;
223
+ white-space: nowrap;
224
+
225
+ .grid-item-icon {
226
+ margin-bottom: 5px;
227
+ width: 42px;
228
+ height: 42px;
229
+ line-height: 40px;
230
+ color: #4D81F1;
231
+ font-size: 18px;
232
+ font-weight: 700;
233
+ text-indent: 12px;
234
+ border-radius: 8px;
235
+ display: block;
236
+ float: left;
237
+ overflow: hidden;
238
+ background-color: #E6F4FF;
239
+ letter-spacing: 20px;
240
+ // margin-right: 15px;
241
+ }
242
+
243
+ .grid-item-title {
244
+ color: #4D81F1;
245
+ width: 55px;
246
+ overflow: hidden;
247
+ // text-overflow: ellipsis;
248
+ white-space: pre-wrap;
249
+ // white-space: pre-wrap;
250
+ // text-align: left;
251
+ }
252
+
253
+ }
254
+
255
+ .menu-title-class {
256
+ display: flex;
257
+ align-items: center;
258
+ gap: 4px;
259
+ font-weight: 700;
260
+ }
261
+
262
+ .title-icon {
263
+ width: 3px;
264
+ height: 15px;
265
+ background-color: #4D81F1;
266
+ }
267
+
268
+ .menu-list {
269
+ padding: 12px 0 1px 0;
270
+ // background-color: #F6F7FB;
271
+ background: linear-gradient(to top, #F6F7FB 0%, #2c5def 100%);
272
+ }
273
+
274
+ :deep(.wd-grid) {
275
+ float: unset;
276
+ display: flex;
277
+ flex-wrap: wrap;
278
+ }
279
+ </style>
@@ -25,8 +25,8 @@ function confirm() {
25
25
 
26
26
  <template>
27
27
  <view class="lang">
28
- <view style="min-width: 300rpx;">
29
- <wd-picker v-model="lang" label-width="40px" label="语言" size="mini" :columns="columns" @confirm="confirm" />
28
+ <view style="min-width: 100rpx;">
29
+ <wd-picker v-model="lang" label-width="40px" size="mini" :columns="columns" @confirm="confirm" />
30
30
  </view>
31
31
  </view>
32
32
  </template>