@tplc/wot 0.1.82 → 0.1.83

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 CHANGED
@@ -2,6 +2,8 @@
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.83](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.75...v0.1.83) (2025-04-25)
6
+
5
7
  ### [0.1.82](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.4.69...v0.1.82) (2025-04-15)
6
8
 
7
9
 
@@ -7,7 +7,6 @@
7
7
  :mode="mode"
8
8
  :lazy-load="lazyLoad"
9
9
  />
10
-
11
10
  <image
12
11
  :class="`wd-img__image coverImg ${customImage}`"
13
12
  :src="wrapPhoto({ photo: src, width, type: 1 })"
@@ -35,7 +34,7 @@ export default {
35
34
 
36
35
  <script lang="ts" setup>
37
36
  import { computed, ref, watch } from 'vue'
38
- import { addUnit, isDef, objToStyle } from '../common/util'
37
+ import { addUnit, isDef, isVideoUrl, objToStyle } from '../common/util'
39
38
  import { imgProps } from './types'
40
39
 
41
40
  const props = defineProps(imgProps)
@@ -101,6 +100,14 @@ function wrapPhoto({ photo, width = 100, type = 1 }: any) {
101
100
 
102
101
  const isctyun = photo?.indexOf('.ctyun') >= 0
103
102
  const sym = photo?.indexOf('?') > 0 ? '&' : '?'
103
+ if (isVideoUrl(photo)) {
104
+ const suffix = isctyun
105
+ ? `${sym}x-amz-process=video/snapshot,t_2000,w_${finalWidth},m_lfit`
106
+ : `${sym}x-oss-process=video/snapshot,t_2000,w_${finalWidth}&imageView2/2/w/${finalWidth}`
107
+ const url = `${photo}${suffix}`
108
+ console.log(url, 'url')
109
+ return url
110
+ }
104
111
  const suffix = isctyun
105
112
  ? `${sym}x-amz-process=image/resize,w_${finalWidth},m_lfit`
106
113
  : `${sym}x-oss-process=image/resize,m_mfit,w_${finalWidth}&imageView2/2/w/${finalWidth}`
@@ -18,40 +18,39 @@
18
18
  @animationfinish="handleAnimationfinish"
19
19
  >
20
20
  <swiper-item
21
- v-for="(item, index) in list"
21
+ v-for="(item, index) in innerList"
22
22
  :key="index"
23
23
  class="wd-swiper__item"
24
24
  :style="{ paddingRight: itemPadding, paddingLeft: itemPadding }"
25
25
  @click="handleClick(index, item)"
26
26
  >
27
27
  <view
28
- :class="`wd-swiper__image overflow-hidden ${customImageClass} ${getCustomImageClass(navCurrent, index, list)}`"
28
+ :class="`wd-swiper__image relative overflow-hidden ${customImageClass} ${getCustomImageClass(navCurrent, index, list)}`"
29
29
  :style="{
30
30
  borderRadius: imageRadius,
31
31
  height: getCustomImageHeight(navCurrent, index, list),
32
-
33
32
  width: imgWidth ? addUnit(imgWidth) : undefined,
34
33
  }"
35
34
  >
36
- <lcb-action-view
37
- v-if="action && typeof item === 'object'"
38
- v-bind="item.link"
39
- customClass="w-full h-full"
40
- >
41
- <wd-img
42
- :src="isObj(item) ? item[valueKey] : item"
43
- height="100%"
44
- width="100%"
45
- :mode="imageMode"
46
- />
47
- </lcb-action-view>
48
- <wd-img
49
- v-else
50
- :src="isObj(item) ? item[valueKey] : item"
51
- height="100%"
52
- width="100%"
53
- :mode="imageMode"
54
- />
35
+ <template v-if="item.videoUrl">
36
+ <wd-img :src="item.url" height="100%" width="100%" :mode="imageMode" />
37
+ <view
38
+ class="absolute top-0 left-0 w-full h-full flex items-center justify-center bg-black/50"
39
+ @click.stop="handlePreviewVieo(item.videoUrl)"
40
+ >
41
+ <wd-icon name="play-circle-filled" size="90rpx" color="#fff"></wd-icon>
42
+ </view>
43
+ </template>
44
+ <template v-else>
45
+ <lcb-action-view
46
+ v-if="action && typeof item === 'object'"
47
+ v-bind="item.link"
48
+ customClass="w-full h-full"
49
+ >
50
+ <wd-img :src="item.url" height="100%" width="100%" :mode="imageMode" />
51
+ </lcb-action-view>
52
+ <wd-img v-else :src="item.url" height="100%" width="100%" :mode="imageMode" />
53
+ </template>
55
54
  </view>
56
55
  </swiper-item>
57
56
  </swiper>
@@ -72,20 +71,21 @@
72
71
  :customStyle="indicatorCustomStyle"
73
72
  />
74
73
  </template>
74
+ <wd-video-preview ref="videoPreview"></wd-video-preview>
75
75
  </view>
76
76
  </template>
77
77
 
78
78
  <script lang="ts" setup>
79
- import { computed, watch, ref, useSlots } from 'vue'
80
- import { addUnit, isObj } from '../common/util'
79
+ import { computed, watch, ref } from 'vue'
80
+ import { addUnit, isObj, isVideoUrl } from '../common/util'
81
81
  import { swiperProps, type SwiperList } from './types'
82
82
  import type { SwiperNavProps } from '../wd-swiper-nav/types'
83
+ import { VideoPreviewInstance } from '../wd-video-preview/types'
83
84
 
84
85
  const props = defineProps(swiperProps)
85
86
  const emit = defineEmits(['click', 'change', 'animationfinish', 'update:current'])
86
87
  const navCurrent = ref<number>(0) // 当前滑块
87
- const slots = useSlots()
88
-
88
+ const videoPreview = ref<VideoPreviewInstance>()
89
89
  watch(
90
90
  () => props.current,
91
91
  (val) => {
@@ -117,6 +117,43 @@ const swiperIndicator = computed(() => {
117
117
  return swiperIndicator
118
118
  })
119
119
 
120
+ const innerList = computed(() => {
121
+ return props.list.map((item) => {
122
+ const url = isObj(item) ? item[props.valueKey] : item
123
+ return {
124
+ url,
125
+ videoUrl: isVideoUrl(url) ? url : '',
126
+ ...(isObj(item) ? item : {}),
127
+ }
128
+ }) as SwiperList[]
129
+ })
130
+
131
+ /**
132
+ * 预览视频
133
+ * @param index
134
+ * @param lists
135
+ */
136
+ function handlePreviewVieo(url: string) {
137
+ // #ifdef MP-WEIXIN
138
+ uni.previewMedia({
139
+ sources: [
140
+ {
141
+ url,
142
+ type: 'video',
143
+ poster: '',
144
+ },
145
+ ],
146
+ })
147
+ // #endif
148
+
149
+ // #ifndef MP-WEIXIN
150
+ videoPreview.value?.open({
151
+ url,
152
+ poster: '',
153
+ })
154
+ // #endif
155
+ }
156
+
120
157
  function go(index: number) {
121
158
  navCurrent.value = index
122
159
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "@tplc/wot",
3
3
  "name": "@tplc/wot",
4
- "version": "0.1.82",
4
+ "version": "0.1.83",
5
5
  "keywords": [
6
6
  "wot-design-uni",
7
7
  "国际化",