wui-components-v2 1.2.74 → 1.2.76
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/components/audio-play/audio-play.vue +31 -28
- package/components/card-botom-buttons/card-botom-buttons.vue +2 -0
- package/components/global-message/global-message.vue +22 -18
- package/components/label-value/label-value.vue +7 -2
- package/components/report-table/report-table.vue +1 -1
- package/components/wui-list/wui-list.vue +8 -1
- package/components/wui-user/wui-user.vue +3 -6
- package/composables/useGlobalMessage.ts +32 -0
- package/package.json +1 -1
|
@@ -161,10 +161,15 @@ onMounted(() => {
|
|
|
161
161
|
<template>
|
|
162
162
|
<view class="mini-audio-player">
|
|
163
163
|
<!-- 播放/暂停按钮 -->
|
|
164
|
-
<
|
|
165
|
-
|
|
166
|
-
<
|
|
167
|
-
|
|
164
|
+
<view class="mini-play-btn" :style="{ background: primary }" @click="togglePlay">
|
|
165
|
+
<!-- 播放中:显示暂停符号(两条竖杠) -->
|
|
166
|
+
<view v-if="isPlaying" class="pause-icon">
|
|
167
|
+
<view class="pause-bar" />
|
|
168
|
+
<view class="pause-bar" />
|
|
169
|
+
</view>
|
|
170
|
+
<!-- 未播放:显示三角播放符号 -->
|
|
171
|
+
<view v-else class="play-triangle" />
|
|
172
|
+
</view>
|
|
168
173
|
|
|
169
174
|
<!-- 时间显示 -->
|
|
170
175
|
<text class="time-display">
|
|
@@ -201,44 +206,42 @@ onMounted(() => {
|
|
|
201
206
|
background: #1890ff;
|
|
202
207
|
border: none;
|
|
203
208
|
padding: 0;
|
|
209
|
+
margin: 0;
|
|
204
210
|
display: flex;
|
|
205
211
|
align-items: center;
|
|
206
212
|
justify-content: center;
|
|
207
213
|
margin-right: 8px;
|
|
214
|
+
flex-shrink: 0;
|
|
208
215
|
}
|
|
209
216
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
217
|
+
/* 播放三角:用 border 绘制,视觉居中略微右偏 */
|
|
218
|
+
.play-triangle {
|
|
219
|
+
width: 0;
|
|
220
|
+
height: 0;
|
|
221
|
+
border-style: solid;
|
|
222
|
+
border-width: 6px 0 6px 10px;
|
|
223
|
+
border-color: transparent transparent transparent #fff;
|
|
224
|
+
margin-left: 3px;
|
|
225
|
+
flex-shrink: 0;
|
|
215
226
|
}
|
|
216
227
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
border-bottom: 6px solid transparent;
|
|
224
|
-
border-left: 10px solid white;
|
|
228
|
+
/* 暂停符号:两条独立竖杠,用 margin 控制间距(小程序 gap 兼容性差) */
|
|
229
|
+
.pause-icon {
|
|
230
|
+
display: flex;
|
|
231
|
+
align-items: center;
|
|
232
|
+
justify-content: center;
|
|
233
|
+
flex-shrink: 0;
|
|
225
234
|
}
|
|
226
235
|
|
|
227
|
-
.
|
|
228
|
-
.mini-icon.playing::after {
|
|
229
|
-
content: '';
|
|
230
|
-
position: absolute;
|
|
236
|
+
.pause-bar {
|
|
231
237
|
width: 3px;
|
|
232
238
|
height: 12px;
|
|
233
|
-
background:
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
.mini-icon.playing::before {
|
|
237
|
-
left: 3px;
|
|
239
|
+
background-color: #fff;
|
|
240
|
+
border-radius: 1px;
|
|
238
241
|
}
|
|
239
242
|
|
|
240
|
-
.
|
|
241
|
-
left:
|
|
243
|
+
.pause-bar + .pause-bar {
|
|
244
|
+
margin-left: 3px;
|
|
242
245
|
}
|
|
243
246
|
|
|
244
247
|
.mini-progress {
|
|
@@ -405,6 +405,8 @@ async function select({ item }: { item: any }) {
|
|
|
405
405
|
msg: `确定${item.title}操作吗?`,
|
|
406
406
|
title: '提示',
|
|
407
407
|
success: () => {
|
|
408
|
+
// 消费完立即清空,避免 messageOptions 残留(与 del() 的处理保持一致)
|
|
409
|
+
message.close()
|
|
408
410
|
if (item.actionType === 'ractions') {
|
|
409
411
|
raction(item)
|
|
410
412
|
}
|
|
@@ -9,7 +9,8 @@ defineOptions({
|
|
|
9
9
|
name: 'GlobalMessage',
|
|
10
10
|
})
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const messageStore = useGlobalMessage()
|
|
13
|
+
const { messageOptions } = storeToRefs(messageStore)
|
|
13
14
|
|
|
14
15
|
const dialog = useDialog()
|
|
15
16
|
const currentPath = getCurrentPath()
|
|
@@ -24,23 +25,26 @@ nextTick(() => {
|
|
|
24
25
|
|
|
25
26
|
watch(() => messageOptions.value, (newVal) => {
|
|
26
27
|
if (newVal) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
28
|
+
// 抢占消费权:页面上若存在多个 GlobalMessage 实例(tabbar 布局一份 + wui-list 内一份),
|
|
29
|
+
// 只有第一个能取到 option,其余拿到 null 直接跳过,避免弹窗重复弹出、success 重复执行。
|
|
30
|
+
const claimed = messageStore.claim(currentPath)
|
|
31
|
+
if (!claimed)
|
|
32
|
+
return
|
|
33
|
+
const option = CommonUtil.deepClone(claimed)
|
|
34
|
+
const method = option.type === 'confirm'
|
|
35
|
+
? 'confirm'
|
|
36
|
+
: option.type === 'prompt'
|
|
37
|
+
? 'prompt'
|
|
38
|
+
: 'alert'
|
|
39
|
+
dialog[method](option).then((res) => {
|
|
40
|
+
if (CommonUtil.isFunction(option.success)) {
|
|
41
|
+
option.success(res)
|
|
42
|
+
}
|
|
43
|
+
}).catch((err) => {
|
|
44
|
+
if (CommonUtil.isFunction(option.fail)) {
|
|
45
|
+
option.fail(err)
|
|
46
|
+
}
|
|
47
|
+
})
|
|
44
48
|
}
|
|
45
49
|
else {
|
|
46
50
|
dialog.close()
|
|
@@ -102,9 +102,14 @@ function goDetail(item: Columns) {
|
|
|
102
102
|
})
|
|
103
103
|
.join('&')
|
|
104
104
|
const sep = params ? (fieldJump.mobilePath.includes('?') ? '&' : '?') : ''
|
|
105
|
-
//
|
|
105
|
+
// 只对 mobilePath 中未编码的非 ASCII 做编码,避免 encodeURI 二次编码已编码的 % 导致 App 端乱码
|
|
106
|
+
let safePath = String(fieldJump.mobilePath).replace(/[^\x00-\x7F]+/g, s => encodeURIComponent(s))
|
|
107
|
+
// 绝对路径补前导斜杠(相对路径不受影响)
|
|
108
|
+
if (!safePath.startsWith('/') && !safePath.startsWith('./') && !safePath.startsWith('../')) {
|
|
109
|
+
safePath = `/${safePath}`
|
|
110
|
+
}
|
|
106
111
|
uni.navigateTo({
|
|
107
|
-
url:
|
|
112
|
+
url: `${safePath}${sep}${params}`,
|
|
108
113
|
})
|
|
109
114
|
return
|
|
110
115
|
}
|
|
@@ -15,6 +15,7 @@ import tabSearch from '../tab-search/tab-search.vue'
|
|
|
15
15
|
import { useEnums } from '../../composables/useEnumes'
|
|
16
16
|
import { useGlobalToast } from '../../composables/useGlobalToast'
|
|
17
17
|
import { useGlobalMessage } from '../../composables/useGlobalMessage'
|
|
18
|
+
import GlobalMessage from '../global-message/global-message.vue'
|
|
18
19
|
|
|
19
20
|
defineOptions({
|
|
20
21
|
name: 'WuiList',
|
|
@@ -375,6 +376,8 @@ async function batchAction(item: rowActions) {
|
|
|
375
376
|
msg: `确定对选中的 ${codes.length} 条记录执行「${item.title}」操作吗?`,
|
|
376
377
|
title: '提示',
|
|
377
378
|
success: async () => {
|
|
379
|
+
// 消费完立即清空,避免 messageOptions 残留
|
|
380
|
+
message.close()
|
|
378
381
|
try {
|
|
379
382
|
await actionDataSave(item.id, codes.join(','), {})
|
|
380
383
|
toast.success({ msg: '操作成功!' })
|
|
@@ -537,7 +540,6 @@ function tabSearchClick(data: any) {
|
|
|
537
540
|
:show-loading-more-when-reload="true"
|
|
538
541
|
@query="queryList"
|
|
539
542
|
>
|
|
540
|
-
<GlobalMessage />
|
|
541
543
|
<template #top>
|
|
542
544
|
<slot name="top" />
|
|
543
545
|
<Search
|
|
@@ -721,6 +723,11 @@ function tabSearchClick(data: any) {
|
|
|
721
723
|
<slot name="bottom" />
|
|
722
724
|
</template>
|
|
723
725
|
</z-paging>
|
|
726
|
+
|
|
727
|
+
<!-- 非 tabBar 页面没有 wui-tabbar 挂载 global-message,
|
|
728
|
+
列表页自包含挂载一份(必须在 z-paging 外层,避免滚动容器裁剪弹层),
|
|
729
|
+
确保卡片底部操作按钮的 confirm/alert 弹窗可正常弹出。 -->
|
|
730
|
+
<GlobalMessage />
|
|
724
731
|
</template>
|
|
725
732
|
|
|
726
733
|
<style scoped>
|
|
@@ -121,7 +121,7 @@ async function fetchUserInfo() {
|
|
|
121
121
|
const sourceId = 'x4u6aJ6IQQ'
|
|
122
122
|
if (user.id) {
|
|
123
123
|
const entityRes = await req({
|
|
124
|
-
url: `/v3/mstruc/data?sourceId=${sourceId}&depth=1&pageNo=1&pageSize=1&
|
|
124
|
+
url: `/v3/mstruc/data?sourceId=${sourceId}&depth=1&pageNo=1&pageSize=1&c_唯一编码_equals=${user.id}&c_标记删除_equals=否`,
|
|
125
125
|
method: 'GET',
|
|
126
126
|
})
|
|
127
127
|
const list = entityRes?.entities || entityRes?.data?.entities || []
|
|
@@ -227,12 +227,10 @@ async function clearCache() {
|
|
|
227
227
|
if (res.status === 'success') {
|
|
228
228
|
toast.success({ msg: '清除成功!' })
|
|
229
229
|
uni.setStorageSync('userInfo', res.user)
|
|
230
|
-
}
|
|
231
|
-
else {
|
|
230
|
+
} else {
|
|
232
231
|
toast.error({ msg: res.message || res.msg || '清除失败,请重试' })
|
|
233
232
|
}
|
|
234
|
-
}
|
|
235
|
-
catch (error: any) {
|
|
233
|
+
} catch (error: any) {
|
|
236
234
|
console.error('清除缓存失败:', error)
|
|
237
235
|
toast.error({ msg: error?.data?.message || '清除失败,请检查登录状态' })
|
|
238
236
|
}
|
|
@@ -264,7 +262,6 @@ function saveSensorConfig() {
|
|
|
264
262
|
toast.success({ msg: '传感器配置保存成功' })
|
|
265
263
|
showSensorConfig.value = false
|
|
266
264
|
}
|
|
267
|
-
|
|
268
265
|
</script>
|
|
269
266
|
|
|
270
267
|
<template>
|
|
@@ -12,6 +12,19 @@ interface GlobalMessage {
|
|
|
12
12
|
currentPage: string
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* 消费锁。
|
|
17
|
+
*
|
|
18
|
+
* 页面上可能同时存在多个 GlobalMessage 实例(例如 tabbar 布局挂一份,
|
|
19
|
+
* wui-list 内部又自包含挂一份)。这些实例都 watch 同一个 store 的 messageOptions,
|
|
20
|
+
* 一次 confirm 会被多个实例同时消费 —— 弹窗被反复弹出,success 回调执行多次,
|
|
21
|
+
* 表现为「列表项操作弹窗触发两次」「接口重复提交」。
|
|
22
|
+
*
|
|
23
|
+
* 多个实例的 watch 回调会在同一个 tick 内同步依次执行,
|
|
24
|
+
* 这里用「先到先得」的消费锁保证同一次消息只被真正消费一次。
|
|
25
|
+
*/
|
|
26
|
+
let consumedTicket: symbol | null = null
|
|
27
|
+
|
|
15
28
|
export const useGlobalMessage = defineStore('global-message', {
|
|
16
29
|
state: (): GlobalMessage => ({
|
|
17
30
|
messageOptions: null,
|
|
@@ -20,6 +33,8 @@ export const useGlobalMessage = defineStore('global-message', {
|
|
|
20
33
|
actions: {
|
|
21
34
|
show(option: GlobalMessageOptions | string) {
|
|
22
35
|
this.currentPage = getCurrentPath()
|
|
36
|
+
// 新消息入队,释放上一次的消费锁
|
|
37
|
+
consumedTicket = null
|
|
23
38
|
this.messageOptions = {
|
|
24
39
|
...(CommonUtil.isString(option) ? { title: option } : option),
|
|
25
40
|
cancelButtonProps: {
|
|
@@ -45,7 +60,24 @@ export const useGlobalMessage = defineStore('global-message', {
|
|
|
45
60
|
messageOptions.showCancelButton = true
|
|
46
61
|
this.show(messageOptions)
|
|
47
62
|
},
|
|
63
|
+
/**
|
|
64
|
+
* 尝试消费当前消息。
|
|
65
|
+
*
|
|
66
|
+
* 同一条消息只允许被一个 GlobalMessage 实例取走,重复实例拿到 null 后直接跳过,
|
|
67
|
+
* 从而避免弹窗被弹出多次、success 回调被执行多次。
|
|
68
|
+
*
|
|
69
|
+
* currentPath 不匹配的实例不会占用锁,避免消息被错误实例吞掉后无人弹出。
|
|
70
|
+
*/
|
|
71
|
+
claim(currentPath: string): GlobalMessageOptions | null {
|
|
72
|
+
if (!this.messageOptions || consumedTicket !== null)
|
|
73
|
+
return null
|
|
74
|
+
if (this.currentPage !== currentPath)
|
|
75
|
+
return null
|
|
76
|
+
consumedTicket = Symbol('global-message-consumed')
|
|
77
|
+
return this.messageOptions
|
|
78
|
+
},
|
|
48
79
|
close() {
|
|
80
|
+
consumedTicket = null
|
|
49
81
|
this.messageOptions = null
|
|
50
82
|
this.currentPage = ''
|
|
51
83
|
},
|