@tplc/wot 0.1.82 → 0.1.84
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/CHANGELOG.md +9 -0
- package/components/wd-img/wd-img.vue +22 -2
- package/components/wd-swiper/wd-swiper.vue +71 -28
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.1.84](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.109...v0.1.84) (2025-05-11)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ✨ Features | 新功能
|
|
9
|
+
|
|
10
|
+
* 新增骨架屏 ([6f837dd](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/6f837ddb1c1db52b25ec2155461a4cade58bfc09))
|
|
11
|
+
|
|
12
|
+
### [0.1.83](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.75...v0.1.83) (2025-04-25)
|
|
13
|
+
|
|
5
14
|
### [0.1.82](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.69...v0.1.82) (2025-04-15)
|
|
6
15
|
|
|
7
16
|
|
|
@@ -7,8 +7,20 @@
|
|
|
7
7
|
:mode="mode"
|
|
8
8
|
:lazy-load="lazyLoad"
|
|
9
9
|
/>
|
|
10
|
-
|
|
10
|
+
<img
|
|
11
|
+
v-if="height === 'auto' && isH5"
|
|
12
|
+
:class="`wd-img__image coverImg ${customImage}`"
|
|
13
|
+
:src="wrapPhoto({ photo: src, width, type: 1 })"
|
|
14
|
+
:lazy-load="lazyLoad"
|
|
15
|
+
@load="handleLoad"
|
|
16
|
+
@error="handleError"
|
|
17
|
+
:style="{
|
|
18
|
+
display: status === 'success' ? 'block' : 'none',
|
|
19
|
+
objectFit: 'cover',
|
|
20
|
+
}"
|
|
21
|
+
/>
|
|
11
22
|
<image
|
|
23
|
+
v-else
|
|
12
24
|
:class="`wd-img__image coverImg ${customImage}`"
|
|
13
25
|
:src="wrapPhoto({ photo: src, width, type: 1 })"
|
|
14
26
|
:mode="mode"
|
|
@@ -35,7 +47,7 @@ export default {
|
|
|
35
47
|
|
|
36
48
|
<script lang="ts" setup>
|
|
37
49
|
import { computed, ref, watch } from 'vue'
|
|
38
|
-
import { addUnit, isDef, objToStyle } from '../common/util'
|
|
50
|
+
import { addUnit, isDef, isH5, isVideoUrl, objToStyle } from '../common/util'
|
|
39
51
|
import { imgProps } from './types'
|
|
40
52
|
|
|
41
53
|
const props = defineProps(imgProps)
|
|
@@ -101,6 +113,14 @@ function wrapPhoto({ photo, width = 100, type = 1 }: any) {
|
|
|
101
113
|
|
|
102
114
|
const isctyun = photo?.indexOf('.ctyun') >= 0
|
|
103
115
|
const sym = photo?.indexOf('?') > 0 ? '&' : '?'
|
|
116
|
+
if (isVideoUrl(photo)) {
|
|
117
|
+
const suffix = isctyun
|
|
118
|
+
? `${sym}x-amz-process=video/snapshot,t_2000,w_${finalWidth},m_lfit`
|
|
119
|
+
: `${sym}x-oss-process=video/snapshot,t_2000,w_${finalWidth}&imageView2/2/w/${finalWidth}`
|
|
120
|
+
const url = `${photo}${suffix}`
|
|
121
|
+
console.log(url, 'url')
|
|
122
|
+
return url
|
|
123
|
+
}
|
|
104
124
|
const suffix = isctyun
|
|
105
125
|
? `${sym}x-amz-process=image/resize,w_${finalWidth},m_lfit`
|
|
106
126
|
: `${sym}x-oss-process=image/resize,m_mfit,w_${finalWidth}&imageView2/2/w/${finalWidth}`
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view
|
|
2
|
+
<view
|
|
3
|
+
:class="`wd-swiper ${customClass}`"
|
|
4
|
+
:style="`${customStyle};--swiper-item-padding:${itemPadding}`"
|
|
5
|
+
>
|
|
3
6
|
<swiper
|
|
4
7
|
class="wd-swiper__track"
|
|
5
8
|
:autoplay="autoplay"
|
|
@@ -18,40 +21,38 @@
|
|
|
18
21
|
@animationfinish="handleAnimationfinish"
|
|
19
22
|
>
|
|
20
23
|
<swiper-item
|
|
21
|
-
v-for="(item, index) in
|
|
24
|
+
v-for="(item, index) in innerList"
|
|
22
25
|
:key="index"
|
|
23
26
|
class="wd-swiper__item"
|
|
24
|
-
:style="{ paddingRight: itemPadding, paddingLeft: itemPadding }"
|
|
25
27
|
@click="handleClick(index, item)"
|
|
26
28
|
>
|
|
27
29
|
<view
|
|
28
|
-
:class="`wd-swiper__image overflow-hidden ${customImageClass} ${getCustomImageClass(navCurrent, index, list)}`"
|
|
30
|
+
:class="`wd-swiper__image relative overflow-hidden ${customImageClass} ${getCustomImageClass(navCurrent, index, list)}`"
|
|
29
31
|
:style="{
|
|
30
32
|
borderRadius: imageRadius,
|
|
31
33
|
height: getCustomImageHeight(navCurrent, index, list),
|
|
32
|
-
|
|
33
34
|
width: imgWidth ? addUnit(imgWidth) : undefined,
|
|
34
35
|
}"
|
|
35
36
|
>
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
:mode="imageMode"
|
|
54
|
-
|
|
37
|
+
<template v-if="item.videoUrl">
|
|
38
|
+
<wd-img :src="item.url" height="100%" width="100%" :mode="imageMode" />
|
|
39
|
+
<view
|
|
40
|
+
class="absolute top-0 left-0 w-full h-full flex items-center justify-center bg-black/50"
|
|
41
|
+
@click.stop="handlePreviewVieo(item.videoUrl)"
|
|
42
|
+
>
|
|
43
|
+
<wd-icon name="play-circle-filled" size="90rpx" color="#fff"></wd-icon>
|
|
44
|
+
</view>
|
|
45
|
+
</template>
|
|
46
|
+
<template v-else>
|
|
47
|
+
<lcb-action-view
|
|
48
|
+
v-if="action && typeof item === 'object'"
|
|
49
|
+
v-bind="item.link"
|
|
50
|
+
customClass="w-full h-full"
|
|
51
|
+
>
|
|
52
|
+
<wd-img :src="item.url" height="100%" width="100%" :mode="imageMode" />
|
|
53
|
+
</lcb-action-view>
|
|
54
|
+
<wd-img v-else :src="item.url" height="100%" width="100%" :mode="imageMode" />
|
|
55
|
+
</template>
|
|
55
56
|
</view>
|
|
56
57
|
</swiper-item>
|
|
57
58
|
</swiper>
|
|
@@ -72,20 +73,21 @@
|
|
|
72
73
|
:customStyle="indicatorCustomStyle"
|
|
73
74
|
/>
|
|
74
75
|
</template>
|
|
76
|
+
<wd-video-preview ref="videoPreview"></wd-video-preview>
|
|
75
77
|
</view>
|
|
76
78
|
</template>
|
|
77
79
|
|
|
78
80
|
<script lang="ts" setup>
|
|
79
|
-
import { computed, watch, ref
|
|
80
|
-
import { addUnit, isObj } from '../common/util'
|
|
81
|
+
import { computed, watch, ref } from 'vue'
|
|
82
|
+
import { addUnit, isObj, isVideoUrl } from '../common/util'
|
|
81
83
|
import { swiperProps, type SwiperList } from './types'
|
|
82
84
|
import type { SwiperNavProps } from '../wd-swiper-nav/types'
|
|
85
|
+
import { VideoPreviewInstance } from '../wd-video-preview/types'
|
|
83
86
|
|
|
84
87
|
const props = defineProps(swiperProps)
|
|
85
88
|
const emit = defineEmits(['click', 'change', 'animationfinish', 'update:current'])
|
|
86
89
|
const navCurrent = ref<number>(0) // 当前滑块
|
|
87
|
-
const
|
|
88
|
-
|
|
90
|
+
const videoPreview = ref<VideoPreviewInstance>()
|
|
89
91
|
watch(
|
|
90
92
|
() => props.current,
|
|
91
93
|
(val) => {
|
|
@@ -117,6 +119,43 @@ const swiperIndicator = computed(() => {
|
|
|
117
119
|
return swiperIndicator
|
|
118
120
|
})
|
|
119
121
|
|
|
122
|
+
const innerList = computed(() => {
|
|
123
|
+
return props.list.map((item) => {
|
|
124
|
+
const url = isObj(item) ? item[props.valueKey] : item
|
|
125
|
+
return {
|
|
126
|
+
url,
|
|
127
|
+
videoUrl: isVideoUrl(url) ? url : '',
|
|
128
|
+
...(isObj(item) ? item : {}),
|
|
129
|
+
}
|
|
130
|
+
}) as SwiperList[]
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* 预览视频
|
|
135
|
+
* @param index
|
|
136
|
+
* @param lists
|
|
137
|
+
*/
|
|
138
|
+
function handlePreviewVieo(url: string) {
|
|
139
|
+
// #ifdef MP-WEIXIN
|
|
140
|
+
uni.previewMedia({
|
|
141
|
+
sources: [
|
|
142
|
+
{
|
|
143
|
+
url,
|
|
144
|
+
type: 'video',
|
|
145
|
+
poster: '',
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
})
|
|
149
|
+
// #endif
|
|
150
|
+
|
|
151
|
+
// #ifndef MP-WEIXIN
|
|
152
|
+
videoPreview.value?.open({
|
|
153
|
+
url,
|
|
154
|
+
poster: '',
|
|
155
|
+
})
|
|
156
|
+
// #endif
|
|
157
|
+
}
|
|
158
|
+
|
|
120
159
|
function go(index: number) {
|
|
121
160
|
navCurrent.value = index
|
|
122
161
|
}
|
|
@@ -235,4 +274,8 @@ function doIndicatorBtnChange(dir: string, source: string) {
|
|
|
235
274
|
|
|
236
275
|
<style lang="scss" scoped>
|
|
237
276
|
@import './index';
|
|
277
|
+
.wd-swiper__item {
|
|
278
|
+
padding-right: var(--swiper-item-padding);
|
|
279
|
+
padding-left: var(--swiper-item-padding);
|
|
280
|
+
}
|
|
238
281
|
</style>
|