w-ui-v1 1.0.31 → 1.0.33

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/index.ts CHANGED
@@ -10,8 +10,9 @@ import wAdd from './w-add/w-add.vue'
10
10
  import WSearch from './w-search/w-search.vue'
11
11
  import WUser from './w-user/w-user.vue'
12
12
  import wEdit from './w-edit/w-edit.vue'
13
- import wSelectTable from './w-table/w-selectTable.vue'
13
+ import WSelectTable from './w-table/w-selectTable.vue'
14
14
  import WFormMessageBox from './w-form-message-box/w-form-message-box.vue'
15
+ import WAudio from './w-audio/w-audio.vue'
15
16
  const coms: any[] = [
16
17
  wTest,
17
18
  wLogin,
@@ -24,8 +25,9 @@ const coms: any[] = [
24
25
  WSearch,
25
26
  WUser,
26
27
  wEdit,
27
- wSelectTable,
28
- WFormMessageBox
28
+ WSelectTable,
29
+ WFormMessageBox,
30
+ WAudio
29
31
  ]
30
32
  // 批量组件注册
31
33
  function install(Vue: App) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "w-ui-v1",
3
- "version": "1.0.31",
3
+ "version": "1.0.33",
4
4
  "description": "w-ui",
5
5
  "author": "wgxshh",
6
6
  "license": "ISC",
@@ -0,0 +1,207 @@
1
+ <template>
2
+ <view class="mini-audio-player">
3
+ <!-- 播放/暂停按钮 -->
4
+ <button class="mini-play-btn" @click="togglePlay">
5
+ <wd-icon name="pause" size="22px" color="#fff" v-if="isPlaying"></wd-icon>
6
+ <wd-icon name="play" size="22px" color="#fff" v-else></wd-icon>
7
+ </button>
8
+
9
+ <!-- 时间显示 -->
10
+ <text class="time-display">{{ formatTime(currentTime) }}</text>
11
+
12
+ <!-- 迷你进度条 -->
13
+ <view class="mini-progress">
14
+ <view class="mini-progress-bar" :style="{ width: progressPercent + '%' }"></view>
15
+ </view>
16
+
17
+ <!-- 总时间 -->
18
+ <text class="time-display">{{ formatTime(duration) }}</text>
19
+ </view>
20
+ </template>
21
+
22
+ <script setup>
23
+ import { ref, computed, watch } from 'vue'
24
+
25
+ const props = defineProps({
26
+ src: {
27
+ type: String,
28
+ required: true
29
+ },
30
+ autoplay: {
31
+ type: Boolean,
32
+ default: false
33
+ }
34
+ })
35
+
36
+ const emit = defineEmits(['play', 'pause'])
37
+
38
+ const innerAudioContext = ref(null)
39
+ const isPlaying = ref(false)
40
+ const currentTime = ref(0)
41
+ const duration = ref(0)
42
+
43
+ // 计算进度百分比
44
+ const progressPercent = computed(() => {
45
+ return duration.value > 0 ? (currentTime.value / duration.value) * 100 : 0
46
+ })
47
+
48
+ // 格式化时间显示
49
+ const formatTime = (seconds) => {
50
+ if (isNaN(seconds)) return '00:00'
51
+ const mins = Math.floor(seconds / 60)
52
+ const secs = Math.floor(seconds % 60)
53
+ return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`
54
+ }
55
+
56
+ // 初始化音频
57
+ const initAudio = () => {
58
+ innerAudioContext.value = uni.createInnerAudioContext()
59
+ innerAudioContext.value.src = props.src
60
+ innerAudioContext.value.autoplay = props.autoplay
61
+
62
+ innerAudioContext.value.onPlay(() => {
63
+ isPlaying.value = true
64
+ emit('play')
65
+ })
66
+
67
+ innerAudioContext.value.onPause(() => {
68
+ isPlaying.value = false
69
+ emit('pause')
70
+ })
71
+
72
+ innerAudioContext.value.onTimeUpdate(() => {
73
+ currentTime.value = innerAudioContext.value.currentTime
74
+ duration.value = innerAudioContext.value.duration
75
+ })
76
+
77
+ innerAudioContext.value.onError((err) => {
78
+ isPlaying.value = false
79
+ console.error('播放错误:', err)
80
+ })
81
+
82
+ innerAudioContext.value.onEnded(() => {
83
+ isPlaying.value = false; // 更新状态
84
+ currentTime.value = 0; // 重置进度
85
+ // emit('ended'); // 通知父组件
86
+ });
87
+ }
88
+
89
+
90
+
91
+ // 播放控制
92
+ const play = () => {
93
+ if (!innerAudioContext.value) initAudio()
94
+ innerAudioContext.value.play()
95
+ }
96
+
97
+ const pause = () => {
98
+ if (innerAudioContext.value) {
99
+ innerAudioContext.value.pause()
100
+ }
101
+ }
102
+
103
+ const togglePlay = () => {
104
+ isPlaying.value ? pause() : play()
105
+ }
106
+
107
+ // 监听src变化
108
+ watch(() => props.src, (newVal) => {
109
+ if (innerAudioContext.value) {
110
+ innerAudioContext.value.src = newVal
111
+ } else {
112
+ initAudio()
113
+ }
114
+ })
115
+
116
+ // 暴露方法
117
+ defineExpose({
118
+ play,
119
+ pause,
120
+ isPlaying
121
+ })
122
+
123
+ // 初始化
124
+ initAudio()
125
+ </script>
126
+
127
+ <style scoped>
128
+ .mini-audio-player {
129
+ display: flex;
130
+ align-items: center;
131
+ height: 36px;
132
+ background-color: #f5f5f5;
133
+ border-radius: 18px;
134
+ padding: 0 5px;
135
+ width: 180px;
136
+ }
137
+
138
+ .mini-play-btn {
139
+ width: 28px;
140
+ height: 28px;
141
+ border-radius: 50%;
142
+ background: #1890ff;
143
+ border: none;
144
+ padding: 0;
145
+ display: flex;
146
+ align-items: center;
147
+ justify-content: center;
148
+ margin-right: 8px;
149
+ }
150
+
151
+ .mini-icon {
152
+ width: 12px;
153
+ height: 12px;
154
+ position: relative;
155
+ margin-left: 1px;
156
+ }
157
+
158
+ .mini-icon::before {
159
+ content: '';
160
+ position: absolute;
161
+ left: 0;
162
+ top: 0;
163
+ border-top: 6px solid transparent;
164
+ border-bottom: 6px solid transparent;
165
+ border-left: 10px solid white;
166
+ }
167
+
168
+ .mini-icon.playing::before,
169
+ .mini-icon.playing::after {
170
+ content: '';
171
+ position: absolute;
172
+ width: 3px;
173
+ height: 12px;
174
+ background: white;
175
+ }
176
+
177
+ .mini-icon.playing::before {
178
+ left: 3px;
179
+ }
180
+
181
+ .mini-icon.playing::after {
182
+ left: 8px;
183
+ }
184
+
185
+ .mini-progress {
186
+ flex: 1;
187
+ height: 3px;
188
+ background: #d9d9d9;
189
+ border-radius: 2px;
190
+ overflow: hidden;
191
+ margin: 0 8px;
192
+ }
193
+
194
+ .mini-progress-bar {
195
+ height: 100%;
196
+ background: #1890ff;
197
+ transition: width 0.3s ease;
198
+ }
199
+
200
+ .time-display {
201
+ font-size: 10px;
202
+ color: #666;
203
+ min-width: 32px;
204
+ text-align: center;
205
+ font-family: monospace;
206
+ }
207
+ </style>
@@ -3,7 +3,8 @@ const token = uni.getStorageSync('token') || ''
3
3
  const baseUrl = uni.getStorageSync('baseUrl') || '/'
4
4
  // 单项数据转换
5
5
  export function getValue(content: any, title: any): any {
6
- // 判断title 是否为字符串
6
+
7
+ // 判断title 是否为字符串,是否有 '时间'字符
7
8
  if (typeof title === 'string') {
8
9
  // 判断title 是否有 '时间'字符
9
10
  if (title.includes('时间')) {
@@ -22,16 +23,6 @@ export function getValue(content: any, title: any): any {
22
23
  }
23
24
  }
24
25
 
25
- // 判断是否为数组
26
- if (Array.isArray(content)) {
27
- const newArr = content.map((item) => {
28
- return splitString(item)
29
- })
30
-
31
- // 数组转换为字符串
32
- return newArr.join(',')
33
- }
34
-
35
26
  // 判断是否为JSON字符串
36
27
  if (typeof content === 'string' && content.startsWith('{') && content.endsWith('}')) {
37
28
  // 解析JSON字符串
@@ -47,7 +38,7 @@ export function getValue(content: any, title: any): any {
47
38
  }
48
39
 
49
40
  //文件链接
50
- if (obj.base?.path && (obj.base?.type.includes('docx')|| obj.base?.type.includes('txt')|| obj.base?.type.includes('dat')|| obj.base?.type.includes('md'))) {
41
+ if (obj.base?.path && (obj.base?.type.includes('docx') || obj.base?.type.includes('txt') || obj.base?.type.includes('dat') || obj.base?.type.includes('md'))) {
51
42
 
52
43
  return {
53
44
  url: `${baseUrl}/v3/files${obj.base.path}?@token=${token}&@programToken=${hydrocarbonProgramToken}`,
@@ -62,18 +53,33 @@ export function getValue(content: any, title: any): any {
62
53
  url: `${baseUrl}/v3/files${obj.base.path}?@token=${token}&@programToken=${hydrocarbonProgramToken}`,
63
54
  name: obj.base.fileName,
64
55
  type: '音频',
65
- author:uni.getStorageSync('userInfo').name
56
+ author: uni.getStorageSync('userInfo').name
66
57
  }
67
58
  }
68
59
 
69
60
 
70
61
  }
71
62
 
72
- // 根据content中 "@R@" 分割字符串,取最后一项
63
+ // 判断是否为数组
64
+ if (Array.isArray(content)) {
65
+
66
+ const newArr = content.map((item) => {
67
+ return splitString(item)
68
+ })
69
+
70
+ //判断newArr[0] 是否为对象类型
71
+ if (newArr[0] && typeof newArr[0] === 'object') {
72
+ return newArr
73
+ }
74
+
75
+ // 数组转换为字符串
76
+ return newArr.join(',')
77
+ }
78
+
73
79
  return splitString(content)
74
80
  }
75
81
 
76
- // 根据 "@R@" 分割字符串,取最后一项
82
+ // 根据 "@R@" 分割字符串,取{key,value}/any
77
83
  function splitString(str: string) {
78
84
  // 判断是否为字符串类型
79
85
  if (typeof str !== 'string') {
@@ -81,42 +87,46 @@ function splitString(str: string) {
81
87
  return str
82
88
  }
83
89
 
84
-
85
- // 判断是否有 "@R@"
86
- if (str.includes('@R@')) {
87
- // 分割字符串
88
- const splitStr =splitStringtoArr(str).map((item:string)=>{
89
- let splitItem = item.split('@R@')
90
- return {
91
- label:splitItem[1],
92
- value:splitItem[0]
93
- }
94
- })
95
- // 返回分割后的对象数组
96
- return splitStr
97
- }
98
- else {
99
- // 返回原字符串
100
- return str
101
- }
102
-
90
+ if (str.includes('@,@')) {
91
+ let arr = splitStringtoArr(str)
92
+ return arr.map((item: any) => {
93
+ // 判断是否有 "@R@"
94
+ if (item.includes('@R@')) {
95
+ // 分割字符串
96
+ const splitStr = item.split('@R@')
97
+
98
+ return { value: splitStr[0], label: splitStr[1] }
99
+ }
100
+ else {
101
+
102
+ return item
103
+ }
104
+ })
105
+
106
+ }
107
+
108
+ // 判断是否有 "@R@"
109
+ if (str.includes('@R@')) {
110
+ // 分割字符串
111
+ const splitStr = str.split('@R@')
112
+ // 返回分割后的字符串
113
+ return { value: splitStr[0], label: splitStr[1] }
114
+ }
115
+ else {
116
+ // 返回原字符串
117
+ return str
118
+ }
119
+
103
120
  }
104
121
 
105
122
  // 根据 "@,@" 分割字符串,得到数组
106
123
  function splitStringtoArr(str: string) {
107
-
108
- // 判断是否有 "@,@" 字符串
109
- if (str.includes('@,@')) {
110
- // 分割字符串
111
- const splitStr = str.split('@,@')
112
- // 返回分割后的数组
113
- return splitStr
114
- }
115
- else {
116
- // 返回原字符串
117
- return [str]
118
- }
119
-
124
+
125
+ // 分割字符串
126
+ const splitStr = str.split('@,@')
127
+ // 返回分割后的数组
128
+ return splitStr
129
+
120
130
  }
121
131
 
122
132
  // 判断字符串中是否存在'y'字符
@@ -139,55 +149,55 @@ function formatTime(str: string) {
139
149
 
140
150
  //下载文件
141
151
  export const downloadFile = (url: any) => {
142
- uni.downloadFile({
143
- url: url, // 文件的网络地址
144
- success: (res) => {
145
- if (res.statusCode === 200) {
146
- console.log('下载成功', res.tempFilePath);
147
- // 打开文件(如PDF、Word等)
148
- uni.openDocument({
149
- filePath: res.tempFilePath,
150
- showMenu: true,
151
- success: () => console.log('打开文件成功')
152
- });
153
- // // 将临时文件保存到本地
154
- // uni.saveFile({
155
- // tempFilePath: res.tempFilePath,
156
- // success: (saveRes) => {
157
- // console.log('文件保存成功', saveRes.savedFilePath);
158
- // const savedFilePath = saveRes.savedFilePath; // 保存后的路径
159
- // // 打开文件(如PDF、Word等)
160
- // uni.openDocument({
161
- // filePath: savedFilePath,
162
- // success: () => console.log('打开文件成功')
163
- // });
164
- // uni.showToast({
165
- // title: '文件保存成功',
166
- // icon: 'success'
167
- // });
168
- // },
169
- // fail: (saveErr) => {
170
- // console.error('文件保存失败', saveErr);
171
- // uni.showToast({
172
- // title: '文件保存失败',
173
- // icon: 'none'
174
- // });
175
- // }
176
- // });
177
- } else {
178
- console.error('下载失败', res);
179
- uni.showToast({
180
- title: '下载失败',
181
- icon: 'none'
182
- });
183
- }
184
- },
185
- fail: (err) => {
186
- console.error('下载失败', err);
187
- uni.showToast({
188
- title: '下载失败',
189
- icon: 'none'
190
- });
191
- }
192
- });
152
+ uni.downloadFile({
153
+ url: url, // 文件的网络地址
154
+ success: (res) => {
155
+ if (res.statusCode === 200) {
156
+ console.log('下载成功', res.tempFilePath);
157
+ // 打开文件(如PDF、Word等)
158
+ uni.openDocument({
159
+ filePath: res.tempFilePath,
160
+ showMenu: true,
161
+ success: () => console.log('打开文件成功')
162
+ });
163
+ // // 将临时文件保存到本地
164
+ // uni.saveFile({
165
+ // tempFilePath: res.tempFilePath,
166
+ // success: (saveRes) => {
167
+ // console.log('文件保存成功', saveRes.savedFilePath);
168
+ // const savedFilePath = saveRes.savedFilePath; // 保存后的路径
169
+ // // 打开文件(如PDF、Word等)
170
+ // uni.openDocument({
171
+ // filePath: savedFilePath,
172
+ // success: () => console.log('打开文件成功')
173
+ // });
174
+ // uni.showToast({
175
+ // title: '文件保存成功',
176
+ // icon: 'success'
177
+ // });
178
+ // },
179
+ // fail: (saveErr) => {
180
+ // console.error('文件保存失败', saveErr);
181
+ // uni.showToast({
182
+ // title: '文件保存失败',
183
+ // icon: 'none'
184
+ // });
185
+ // }
186
+ // });
187
+ } else {
188
+ console.error('下载失败', res);
189
+ uni.showToast({
190
+ title: '下载失败',
191
+ icon: 'none'
192
+ });
193
+ }
194
+ },
195
+ fail: (err) => {
196
+ console.error('下载失败', err);
197
+ uni.showToast({
198
+ title: '下载失败',
199
+ icon: 'none'
200
+ });
201
+ }
202
+ });
193
203
  }
package/w-card/w-card.vue CHANGED
@@ -9,7 +9,8 @@ import {
9
9
  import { hasY, getValue, downloadFile } from './utils/utils'
10
10
  import { deletePageData } from '../utils/apis/pageConfig'
11
11
  import { useMessage, useToast } from 'wot-design-uni'
12
- const emits = defineEmits(['refresh', 'delet','edit'])
12
+ import WAudio from '../w-audio/w-audio.vue'
13
+ const emits = defineEmits(['refresh', 'delet', 'edit'])
13
14
  const toast = useToast()
14
15
  const message = useMessage()
15
16
  const props = defineProps({
@@ -110,7 +111,7 @@ function toggleExpand() {
110
111
  }
111
112
 
112
113
  // 跳转页页面
113
- function goto(type: string, item: any = {}, subItem: any) {
114
+ function goto(type: string, item: any = {}, subItem: any = {}) {
114
115
 
115
116
  switch (type) {
116
117
  case 'detail':
@@ -120,7 +121,7 @@ function goto(type: string, item: any = {}, subItem: any) {
120
121
  break
121
122
  case 'link':
122
123
  let code = subItem.value
123
-
124
+
124
125
 
125
126
  uni.navigateTo({
126
127
  url: `/pages/detail/detail?sourceId=${item.sourceId}&code=${code}`,
@@ -187,18 +188,38 @@ const moreBtnsSelect = (item: any) => {
187
188
  const actionBtn = (item: any) => {
188
189
  wFormMessageBoxRef.value.openFormMessageBox(item)
189
190
  }
191
+
192
+ //格式化title
193
+ const getTitleValue = (value: any, title: string) => {
194
+ let data=getValue(value, title)?.content
195
+ if(!data) return ' '
196
+ // 是否为数组
197
+ if(Array.isArray(data)){
198
+ return getValue(value, title).content.map((item:any)=>{
199
+ return item.label
200
+ }).join(',')
201
+ }
202
+ //是否为对象
203
+ if(typeof data === 'object'){
204
+ return data?.label?data.label:''
205
+
206
+ }
207
+ return data
208
+ }
190
209
  </script>
191
210
 
192
211
  <template>
193
212
  <wd-card
194
- :title="getValue(visibleItems.find((item) => item.id === page.primaryColumn?.id)?.content, page.primaryColumn?.title) || ' '">
213
+ :title="getTitleValue(visibleItems.find((item) => item.id === page.primaryColumn?.id), page.primaryColumn?.title) || ' '">
195
214
  <view class="table_collapse">
196
215
  <view v-for="(item, index) in visibleItems" :key="index" class="cloum">
197
216
 
217
+ <!-- // 标题 -->
198
218
  <view class="lable">
199
219
  <text>{{ item.title }}:</text>
200
220
  </view>
201
221
 
222
+ <!-- // 图片 -->
202
223
  <wd-img v-if="item.content?.type === '图片'" width="100rpx" height="100rpx" :src="item.content.url"
203
224
  :enable-preview="true" />
204
225
  <view v-else-if="item.title === '序号'">
@@ -206,25 +227,32 @@ const actionBtn = (item: any) => {
206
227
  carIndex + 1
207
228
  }}
208
229
  </view>
209
- <view v-else-if="item.buttons.includes('detail')">
210
- <view @click="goto('link', item, subItem)" class="link"
211
- v-for="(subItem, subIndex) in item.content" :key="subIndex">
212
- <text> {{ subItem.label }}</text>
213
- </view>
214
- </view>
230
+
231
+ <!-- //文件 -->
215
232
  <view v-else-if="item.content?.type === '文件'" class="value">
216
233
  <wd-text type="primary" @click="downloadFile(item.content.url)" :text="item.content?.name" />
217
234
  </view>
218
235
 
219
- <audio style="width: 50px;" v-else-if="item.content?.type === '音频'" :src="item.content?.url"
220
- :author="item.content?.author" :name="item.content?.name" controls></audio>
221
-
222
- <!-- <audio style="width: 50px;" v-else-if="item.controlType==='file'" :src="item.content"
223
- controls></audio> -->
236
+ <!-- // 音频 -->
237
+ <WAudio v-else-if="item.content?.type === '音频'" :src="item.content?.url" />
238
+ <!-- // 链接 -->
239
+ <view v-else-if="item.buttons.includes('detail')" class="link">
240
+ <view v-if="Array.isArray(item.content)" @click="goto('link', item, subItem)"
241
+ v-for="(subItem, subIndex) in item.content" :key="subIndex">
242
+ <text> {{ subItem.label }}</text>
243
+ </view>
244
+ <view v-else @click="goto('link', item, item.content)">{{ item.content?.label ? item.content?.label :
245
+ item.content }}</view>
246
+ </view>
224
247
 
248
+ <view v-else-if="Array.isArray(item.content)">
249
+ <view v-for="(subItem, subIndex) in item.content" :key="subIndex">
250
+ <text> {{ subItem.label }}</text>
251
+ </view>
252
+ </view>
225
253
 
226
254
  <view v-else class="value">
227
- {{ item.content }}
255
+ {{ item.content?.label ? item.content?.label : item.content }}
228
256
  </view>
229
257
 
230
258
  </view>
@@ -284,6 +312,7 @@ const actionBtn = (item: any) => {
284
312
  padding: 15rpx 10rpx;
285
313
 
286
314
  .lable {
315
+ white-space: nowrap;
287
316
  // font-weight: 600;
288
317
  text-align: left;
289
318
  margin-right: 20rpx;
@@ -7,6 +7,7 @@ export default {
7
7
  }
8
8
  </script>
9
9
  <script setup lang="ts">
10
+ import WAudio from '../w-audio/w-audio.vue'
10
11
  import { onLoad } from '@dcloudio/uni-app'
11
12
  import { getValue, downloadFile } from '../w-card/utils/utils'
12
13
  import {
@@ -63,14 +64,19 @@ function goto(type = '', PItem: any, item: any) {
63
64
 
64
65
  if (type == 'link') {
65
66
  uni.navigateTo({
66
- url: `/pages/detail/detail?sourceId=${item.sourceId}&code=${PItem.value}`
67
+ url: `/pages/detail/detail?sourceId=${PItem.sourceId}&code=${item.value}`
67
68
  })
68
69
  return
69
70
  }
70
71
 
71
- uni.navigateTo({
72
- url: `/pages/detail/detail?sourceId=${item.pointSourceId}&code=${PItem.code}`
73
- })
72
+ if (type == 'detail') {
73
+
74
+ uni.navigateTo({
75
+ url: `/pages/detail/detail?sourceId=${item.pointSourceId}&code=${PItem.code}`
76
+ })
77
+ }
78
+
79
+
74
80
  }
75
81
 
76
82
  </script>
@@ -91,11 +97,12 @@ function goto(type = '', PItem: any, item: any) {
91
97
  <view class="label">
92
98
  {{ subItem.title }}:
93
99
  </view>
94
-
100
+ <!-- //图片 -->
95
101
  <wd-img v-if="getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.type === '图片'"
96
102
  width="100rpx" height="100rpx"
97
103
  :src="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).url"
98
104
  :enable-preview="true" />
105
+ <!-- 文件 -->
99
106
  <view
100
107
  v-else-if="getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.type === '文件'"
101
108
  class="value">
@@ -103,22 +110,41 @@ function goto(type = '', PItem: any, item: any) {
103
110
  @click="downloadFile(getValue(pageData.fieldMap[subItem.sourceId], subItem.title).url)"
104
111
  :text="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).name" />
105
112
  </view>
106
- <audio
113
+ <!-- //音频 -->
114
+ <WAudio
107
115
  v-else-if="getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.type === '音频'"
108
- :src="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).url"
109
- :author="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).author"
110
- :name="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).name"
111
- controls></audio>
116
+ :src="getValue(pageData.fieldMap[subItem.sourceId], subItem.title).url" />
112
117
 
113
- <view v-else-if="subItem.buttons.includes('detail')">
114
- <view @click="goto('link', bItem, subItem)" class="link"
118
+ <!-- //链接 -->
119
+ <view v-else-if="subItem.buttons.includes('detail')" class="link">
120
+
121
+ <view v-if="Array.isArray(getValue(pageData.fieldMap[subItem.sourceId], subItem.title))"
122
+ @click="goto('link', subItem, bItem)"
123
+ v-for="(bItem, bIndex) in getValue(pageData.fieldMap[subItem.sourceId], subItem.title)"
124
+ :key="bIndex">
125
+ <text> {{ bItem.label }}</text>
126
+ </view>
127
+ <view v-else
128
+ @click="goto('link', subItem, getValue(pageData.fieldMap[subItem.sourceId], subItem.title))">
129
+ {{
130
+ getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.label ?
131
+ getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.label :
132
+ getValue(pageData.fieldMap[subItem.sourceId], subItem.title) }}</view>
133
+ </view>
134
+ <!-- //数组 -->
135
+ <view
136
+ v-else-if="Array.isArray(getValue(pageData.fieldMap[subItem.sourceId], subItem.title))">
137
+ <view
115
138
  v-for="(bItem, bIndex) in getValue(pageData.fieldMap[subItem.sourceId], subItem.title)"
116
139
  :key="bIndex">
117
140
  <text> {{ bItem.label }}</text>
118
141
  </view>
119
142
  </view>
120
143
  <view v-else class="value">
121
- {{ getValue(pageData.fieldMap[subItem.sourceId], subItem.title) }}
144
+ {{
145
+ getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.label ?
146
+ getValue(pageData.fieldMap[subItem.sourceId], subItem.title)?.label :
147
+ getValue(pageData.fieldMap[subItem.sourceId], subItem.title) }}
122
148
  </view>
123
149
 
124
150
  </view>
@@ -140,10 +166,12 @@ function goto(type = '', PItem: any, item: any) {
140
166
  {{ subItem.title }}:
141
167
  </view>
142
168
 
169
+ <!-- //图片 -->
143
170
  <wd-img v-if="getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.type === '图片'"
144
171
  width="100rpx" height="100rpx"
145
172
  :src="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).url"
146
173
  :enable-preview="true" />
174
+ <!-- // 文件 -->
147
175
  <view
148
176
  v-else-if="getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.type === '文件'"
149
177
  class="value">
@@ -151,28 +179,48 @@ function goto(type = '', PItem: any, item: any) {
151
179
  @click="downloadFile(getValue(PItem.fieldMap[subItem.sourceId], subItem.title).url)"
152
180
  :text="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).name" />
153
181
  </view>
154
- <audio
182
+ <!-- // 音频 -->
183
+ <WAudio
155
184
  v-else-if="getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.type === '音频'"
156
- :src="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).url"
157
- :author="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).author"
158
- :name="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).name"
159
- controls></audio>
160
- <view v-else-if="subItem.buttons.includes('detail')">
161
- <view @click="goto('link', bItem, subItem)" class="link"
162
- v-for="(bItem, bIndex) in getValue(pageData.fieldMap[subItem.sourceId], subItem.title)"
185
+ :src="getValue(PItem.fieldMap[subItem.sourceId], subItem.title).url" />
186
+ <!-- //链接 -->
187
+ <view v-else-if="subItem.buttons.includes('detail')" class="link">
188
+ <view
189
+ v-if="Array.isArray(getValue(PItem.fieldMap[subItem.sourceId], subItem.title))"
190
+ @click="goto('link', subItem, bItem)"
191
+ v-for="(bItem, bIndex) in getValue(PItem.fieldMap[subItem.sourceId], subItem.title)"
192
+ :key="bIndex">
193
+ <text> {{ bItem.label }}</text>
194
+ </view>
195
+ <view v-else
196
+ @click="goto('link', subItem, getValue(PItem.fieldMap[subItem.sourceId], subItem.title))">
197
+ {{
198
+ getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.label ?
199
+ getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.label :
200
+ getValue(PItem.fieldMap[subItem.sourceId], subItem.title) }}</view>
201
+ </view>
202
+
203
+ <!-- //数组 -->
204
+ <view
205
+ v-else-if="Array.isArray(getValue(PItem.fieldMap[subItem.sourceId], subItem.title))">
206
+ <view
207
+ v-for="(bItem, bIndex) in getValue(PItem.fieldMap[subItem.sourceId], subItem.title)"
163
208
  :key="bIndex">
164
209
  <text> {{ bItem.label }}</text>
165
210
  </view>
166
211
  </view>
167
212
  <view v-else class="value">
168
- {{ getValue(PItem.fieldMap[subItem.sourceId], subItem.title) }}
213
+ {{
214
+ getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.label ?
215
+ getValue(PItem.fieldMap[subItem.sourceId], subItem.title)?.label :
216
+ getValue(PItem.fieldMap[subItem.sourceId], subItem.title) }}
169
217
  </view>
170
218
 
171
219
  </view>
172
220
  </view>
173
221
 
174
222
  <template #footer>
175
- <wd-button @click="goto(PItem, item)" size="small" icon="view-module" type="text"
223
+ <wd-button @click="goto('detail', PItem, item)" size="small" icon="view-module" type="text"
176
224
  v-if="item.buttons.includes('detail')">详情</wd-button>
177
225
  </template>
178
226
  </wd-card>