wui-components-v2 1.0.96 → 1.0.97
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.
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, defineOptions, defineProps, ref } from 'vue'
|
|
3
3
|
import type { Columns, Entities } from '../../type'
|
|
4
|
-
import { formatItemData } from '../../utils'
|
|
4
|
+
import { downloadFile, formatItemData } from '../../utils'
|
|
5
5
|
import ControlTypeSupportor from '../../utils/control-type-supportor'
|
|
6
6
|
import VideoPlay from '../video-play/video-play.vue'
|
|
7
|
+
import { useManualTheme } from '../../composables/useManualTheme'
|
|
7
8
|
|
|
8
9
|
defineOptions({
|
|
9
10
|
name: 'LabelValue',
|
|
@@ -12,20 +13,11 @@ const props = defineProps<{
|
|
|
12
13
|
exhibitData: Columns[]
|
|
13
14
|
data: Entities
|
|
14
15
|
}>()
|
|
16
|
+
const { primary } = useManualTheme()
|
|
15
17
|
const clums = computed(() => {
|
|
16
18
|
return props.exhibitData.filter(item => !item.title?.includes('y'))
|
|
17
19
|
})
|
|
18
20
|
const videoPlayRef = ref()
|
|
19
|
-
// function splitUrlStr(str: string) {
|
|
20
|
-
// if (str) {
|
|
21
|
-
// const strarr = str.split('&')
|
|
22
|
-
// return strarr[strarr.length - 1].split('=')[1] || ''
|
|
23
|
-
// }
|
|
24
|
-
// else {
|
|
25
|
-
// return '暂无文件'
|
|
26
|
-
// }
|
|
27
|
-
// }
|
|
28
|
-
|
|
29
21
|
function openVideo(uitem: any) {
|
|
30
22
|
videoPlayRef.value.open(uitem.url)
|
|
31
23
|
}
|
|
@@ -42,23 +34,19 @@ function isControlType(item: Columns): string {
|
|
|
42
34
|
</view>
|
|
43
35
|
<view
|
|
44
36
|
v-if="isControlType(item) === 'file' || isControlType(item) === 'relfile'"
|
|
45
|
-
class="flex-1 text-gray-800 dark:text-white"
|
|
37
|
+
class="flex flex-1 items-center text-gray-800 dark:text-white"
|
|
46
38
|
>
|
|
47
39
|
<view v-if="data.fieldMap[item.sourceId]">
|
|
48
40
|
<view
|
|
49
41
|
v-for="(uitem, uindex) in formatItemData(data.fieldMap[item.sourceId], isControlType(item))"
|
|
50
42
|
:key="uindex"
|
|
51
43
|
>
|
|
44
|
+
<!-- 图片 -->
|
|
52
45
|
<wd-img
|
|
53
46
|
v-if="['png', 'jpg', 'jpeg'].includes(uitem.type)" enable-preview :width="100" :height="100"
|
|
54
47
|
:src="uitem.url"
|
|
55
48
|
>
|
|
56
49
|
<template #error>
|
|
57
|
-
<!-- <view class="error-wrap">
|
|
58
|
-
<wd-button type="text" @click="downloadFile(url)">
|
|
59
|
-
{{ splitUrlStr(url) || '' }}
|
|
60
|
-
</wd-button>
|
|
61
|
-
</view> -->
|
|
62
50
|
无图片
|
|
63
51
|
</template>
|
|
64
52
|
<template #loading>
|
|
@@ -67,6 +55,7 @@ function isControlType(item: Columns): string {
|
|
|
67
55
|
</view>
|
|
68
56
|
</template>
|
|
69
57
|
</wd-img>
|
|
58
|
+
<!-- 视频 -->
|
|
70
59
|
<view
|
|
71
60
|
v-else-if="['mp4', 'mov', 'wmv', 'avi', 'rmvb', 'flv', 'mkv'].includes(uitem.type)"
|
|
72
61
|
style="width: 70px;height: 70px;display: flex;align-items: center;justify-content: center;border: 1px solid #ccc;border-radius: 4px;"
|
|
@@ -74,6 +63,12 @@ function isControlType(item: Columns): string {
|
|
|
74
63
|
>
|
|
75
64
|
<wd-icon name="play-circle-filled" size="22px" />
|
|
76
65
|
</view>
|
|
66
|
+
<!-- 文件 -->
|
|
67
|
+
<view v-else-if="['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'pdf', 'txt', 'zip', 'rar', '7z', 'gz', 'bz2', 'tar', 'iso', 'exe', 'dmg', 'apk', 'apk', 'apk', 'apk', 'apk', 'apk', 'apk', 'apk'].includes(uitem.type)">
|
|
68
|
+
<span :style="{ color: primary }" @click="downloadFile(uitem.url)">
|
|
69
|
+
{{ uitem.name }}
|
|
70
|
+
</span>
|
|
71
|
+
</view>
|
|
77
72
|
</view>
|
|
78
73
|
</view>
|
|
79
74
|
</view>
|
|
@@ -146,6 +146,7 @@ export function useManualTheme() {
|
|
|
146
146
|
return {
|
|
147
147
|
// 状态
|
|
148
148
|
theme: computed(() => store.theme),
|
|
149
|
+
// 主题色
|
|
149
150
|
primary: computed(() => store.themeVars.colorTheme),
|
|
150
151
|
isDark: computed(() => store.isDark),
|
|
151
152
|
followSystem: computed(() => store.followSystem),
|
package/package.json
CHANGED
package/utils/index.ts
CHANGED
|
@@ -44,7 +44,7 @@ export function formatItemData(data: any, type: string) {
|
|
|
44
44
|
const a = JSON.parse(data)
|
|
45
45
|
return [{
|
|
46
46
|
url: `${baseUrl}/v3/files${a.base.path}?@token=${token}&@programToken=${hydrocarbonProgramToken}&name=${a.base.fileName || ''}`,
|
|
47
|
-
name: a.base.
|
|
47
|
+
name: a.base.fileName,
|
|
48
48
|
type: a.base.type,
|
|
49
49
|
}]
|
|
50
50
|
}
|
|
@@ -54,7 +54,7 @@ export function formatItemData(data: any, type: string) {
|
|
|
54
54
|
const a = JSON.parse(item.split('@R@')[1])
|
|
55
55
|
return [{
|
|
56
56
|
url: `${baseUrl}/v3/files${a.base.path}?@token=${token}&@programToken=${hydrocarbonProgramToken}&name=${a.base.fileName || ''}`,
|
|
57
|
-
name: a.base.
|
|
57
|
+
name: a.base.fileName,
|
|
58
58
|
type: a.base.type,
|
|
59
59
|
}]
|
|
60
60
|
}
|
|
@@ -62,7 +62,7 @@ export function formatItemData(data: any, type: string) {
|
|
|
62
62
|
const a = JSON.parse(item)
|
|
63
63
|
return [{
|
|
64
64
|
url: `${baseUrl}/v3/files${a.base.path}?@token=${token}&@programToken=${hydrocarbonProgramToken}&name=${a.base.fileName || ''}`,
|
|
65
|
-
name: a.base.
|
|
65
|
+
name: a.base.fileName,
|
|
66
66
|
type: a.base.type,
|
|
67
67
|
}]
|
|
68
68
|
}
|
|
@@ -95,7 +95,7 @@ export function generateHighResolutionID(): string {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
// 下载文件
|
|
98
|
-
export function downloadFile(url:
|
|
98
|
+
export function downloadFile(url: string) {
|
|
99
99
|
console.log('下载', url)
|
|
100
100
|
uni.downloadFile({
|
|
101
101
|
url, // 文件的网络地址
|