stellar-ui-v2 1.35.3
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/common/css/common.scss +61 -0
- package/components/ste-animate/README.md +117 -0
- package/components/ste-animate/animate.scss +247 -0
- package/components/ste-animate/ste-animate.vue +200 -0
- package/components/ste-badge/README.md +171 -0
- package/components/ste-badge/ste-badge.vue +238 -0
- package/components/ste-barcode/README.md +36 -0
- package/components/ste-barcode/encode2.js +317 -0
- package/components/ste-barcode/ste-barcode.vue +213 -0
- package/components/ste-button/README.md +129 -0
- package/components/ste-button/ste-button.vue +345 -0
- package/components/ste-calendar/README.md +304 -0
- package/components/ste-calendar/self-date.js +119 -0
- package/components/ste-calendar/ste-calendar.vue +578 -0
- package/components/ste-checkbox/README.md +297 -0
- package/components/ste-checkbox/ste-checkbox.vue +305 -0
- package/components/ste-checkbox-group/ste-checkbox-group.vue +133 -0
- package/components/ste-code-input/README.md +67 -0
- package/components/ste-code-input/ste-code-input.vue +302 -0
- package/components/ste-date-picker/README.md +135 -0
- package/components/ste-date-picker/ste-date-picker.vue +407 -0
- package/components/ste-drag/README.md +103 -0
- package/components/ste-drag/ste-drag.vue +203 -0
- package/components/ste-dropdown-menu/README.md +358 -0
- package/components/ste-dropdown-menu/ste-dropdown-menu.vue +405 -0
- package/components/ste-dropdown-menu-item/ste-dropdown-menu-item.vue +176 -0
- package/components/ste-icon/README.md +90 -0
- package/components/ste-icon/iconfont.css +8 -0
- package/components/ste-icon/ste-icon.vue +147 -0
- package/components/ste-image/README.md +154 -0
- package/components/ste-image/ste-image.vue +218 -0
- package/components/ste-index-item/ste-index-item.vue +96 -0
- package/components/ste-index-list/README.md +153 -0
- package/components/ste-index-list/ste-index-list.vue +128 -0
- package/components/ste-input/README.md +146 -0
- package/components/ste-input/ste-input.vue +480 -0
- package/components/ste-loading/README.md +81 -0
- package/components/ste-loading/ste-loading.vue +166 -0
- package/components/ste-media-preview/README.md +243 -0
- package/components/ste-media-preview/TouchScaleing.js +102 -0
- package/components/ste-media-preview/ste-media-preview.vue +267 -0
- package/components/ste-message-box/README.md +217 -0
- package/components/ste-message-box/ste-message-box.js +72 -0
- package/components/ste-message-box/ste-message-box.vue +380 -0
- package/components/ste-notice-bar/README.md +129 -0
- package/components/ste-notice-bar/ste-notice-bar.vue +331 -0
- package/components/ste-number-keyboard/README.md +246 -0
- package/components/ste-number-keyboard/keyboard.vue +140 -0
- package/components/ste-number-keyboard/ste-number-keyboard.vue +240 -0
- package/components/ste-picker/ste-picker.vue +258 -0
- package/components/ste-popup/README.md +148 -0
- package/components/ste-popup/ste-popup.vue +337 -0
- package/components/ste-price/README.md +129 -0
- package/components/ste-price/ste-price.vue +258 -0
- package/components/ste-progress/README.md +87 -0
- package/components/ste-progress/ste-progress.vue +200 -0
- package/components/ste-qrcode/README.md +50 -0
- package/components/ste-qrcode/ste-qrcode.vue +164 -0
- package/components/ste-qrcode/uqrcode.js +34 -0
- package/components/ste-radio/README.md +286 -0
- package/components/ste-radio/ste-radio.vue +293 -0
- package/components/ste-radio-group/ste-radio-group.vue +128 -0
- package/components/ste-rate/README.md +115 -0
- package/components/ste-rate/ste-rate.vue +202 -0
- package/components/ste-read-more/README.md +111 -0
- package/components/ste-read-more/ste-read-more.vue +133 -0
- package/components/ste-rich-text/README.md +31 -0
- package/components/ste-rich-text/ste-rich-text.vue +70 -0
- package/components/ste-scroll-to/README.md +68 -0
- package/components/ste-scroll-to/mixin.js +173 -0
- package/components/ste-scroll-to/ste-scroll-to.vue +45 -0
- package/components/ste-scroll-to-item/ste-scroll-to-item.vue +25 -0
- package/components/ste-search/README.md +262 -0
- package/components/ste-search/ste-search.vue +547 -0
- package/components/ste-select/README.md +434 -0
- package/components/ste-select/datapager.vue +62 -0
- package/components/ste-select/datetime.vue +106 -0
- package/components/ste-select/defaultDate.js +142 -0
- package/components/ste-select/ste-select.vue +843 -0
- package/components/ste-signature/README.md +105 -0
- package/components/ste-signature/ste-signature.vue +220 -0
- package/components/ste-slider/README.md +165 -0
- package/components/ste-slider/ste-slider.vue +544 -0
- package/components/ste-step/ste-step.vue +264 -0
- package/components/ste-stepper/README.md +170 -0
- package/components/ste-stepper/ste-stepper.vue +373 -0
- package/components/ste-steps/README.md +132 -0
- package/components/ste-steps/ste-steps.vue +65 -0
- package/components/ste-sticky/README.md +52 -0
- package/components/ste-sticky/ste-sticky.vue +127 -0
- package/components/ste-swipe-action/README.md +197 -0
- package/components/ste-swipe-action/ste-swipe-action.vue +303 -0
- package/components/ste-swipe-action-group/ste-swipe-action-group.vue +104 -0
- package/components/ste-swiper/README.md +173 -0
- package/components/ste-swiper/ste-swiper.vue +462 -0
- package/components/ste-swiper-item/ste-swiper-item.vue +41 -0
- package/components/ste-switch/README.md +110 -0
- package/components/ste-switch/ste-switch.vue +144 -0
- package/components/ste-tab/ste-tab.vue +87 -0
- package/components/ste-table/README.md +785 -0
- package/components/ste-table/common.js +8 -0
- package/components/ste-table/ste-table.vue +666 -0
- package/components/ste-table/utils.js +20 -0
- package/components/ste-table-column/checkbox-icon.vue +65 -0
- package/components/ste-table-column/common.scss +65 -0
- package/components/ste-table-column/radio-icon.vue +110 -0
- package/components/ste-table-column/ste-table-column.vue +255 -0
- package/components/ste-table-column/sub-table.vue +116 -0
- package/components/ste-table-column/table-popover.vue +204 -0
- package/components/ste-table-column/var.scss +1 -0
- package/components/ste-tabs/README.md +475 -0
- package/components/ste-tabs/props.js +212 -0
- package/components/ste-tabs/ste-tabs.vue +758 -0
- package/components/ste-text/README.md +66 -0
- package/components/ste-text/ste-text.vue +72 -0
- package/components/ste-toast/README.md +243 -0
- package/components/ste-toast/ste-toast.js +69 -0
- package/components/ste-toast/ste-toast.vue +231 -0
- package/components/ste-touch-swipe/README.md +104 -0
- package/components/ste-touch-swipe/TouchEvent.js +72 -0
- package/components/ste-touch-swipe/ste-touch-swipe.vue +327 -0
- package/components/ste-touch-swipe-item/ste-touch-swipe-item.vue +33 -0
- package/components/ste-tour/README.md +194 -0
- package/components/ste-tour/ste-tour.vue +355 -0
- package/components/ste-tree/README.md +240 -0
- package/components/ste-tree/ste-tree.vue +350 -0
- package/components/ste-upload/README.md +276 -0
- package/components/ste-upload/ReadFile.js +229 -0
- package/components/ste-upload/ste-upload.vue +526 -0
- package/components/ste-video/README.md +60 -0
- package/components/ste-video/props.js +149 -0
- package/components/ste-video/ste-video.vue +647 -0
- package/config/color.js +22 -0
- package/index.js +2 -0
- package/package.json +19 -0
- package/utils/Color.js +66 -0
- package/utils/System.js +110 -0
- package/utils/dayjs.min.js +1 -0
- package/utils/mixin.js +67 -0
- package/utils/store.js +7 -0
- package/utils/utils.js +604 -0
|
@@ -0,0 +1,647 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="ste-video-root" :class="cmpRootClass" :style="[cmpRootStyleVar]">
|
|
3
|
+
<!-- #ifndef MP-ALIPAY -->
|
|
4
|
+
<video
|
|
5
|
+
class="ste-video"
|
|
6
|
+
:id="id"
|
|
7
|
+
:src="videoSrc"
|
|
8
|
+
:controls="false"
|
|
9
|
+
:show-center-play-btn="false"
|
|
10
|
+
:poster="poster"
|
|
11
|
+
:autoplay="autoplay"
|
|
12
|
+
:loop="loop"
|
|
13
|
+
:muted="isMuted"
|
|
14
|
+
:initialTime="initialTime"
|
|
15
|
+
:duration="duration"
|
|
16
|
+
:enable-play-gesture="enablePlayGesture"
|
|
17
|
+
:pageGesture="pageGesture"
|
|
18
|
+
:direction="direction"
|
|
19
|
+
:enableProgressGesture="enableProgressGesture"
|
|
20
|
+
:objectFit="objectFit"
|
|
21
|
+
:mobileNetHintType="mobileNetHintType"
|
|
22
|
+
:autoPauseIfNavigate="autoPauseIfNavigate"
|
|
23
|
+
:autoPauseIfOpenNative="autoPauseIfOpenNative"
|
|
24
|
+
:vslideGesture="vslideGesture"
|
|
25
|
+
:vslideGestureInFullscreen="vslideGestureInFullscreen"
|
|
26
|
+
:adUnitId="adUnitId"
|
|
27
|
+
:posterForCrawler="posterForCrawler"
|
|
28
|
+
:codec="codec"
|
|
29
|
+
:httpCache="httpCache"
|
|
30
|
+
:playStrategy="playStrategy"
|
|
31
|
+
:header="header"
|
|
32
|
+
:isLive="isLive"
|
|
33
|
+
@click="handleClick"
|
|
34
|
+
@play="play"
|
|
35
|
+
@pause="pause"
|
|
36
|
+
@ended="ended"
|
|
37
|
+
@timeupdate="timeupdate"
|
|
38
|
+
@fullscreenchange="fullscreenchange"
|
|
39
|
+
@waiting="waiting"
|
|
40
|
+
@error="error"
|
|
41
|
+
@progress="progress"
|
|
42
|
+
@loadeddata="loadeddata"
|
|
43
|
+
@loadstart="loadstart"
|
|
44
|
+
@seeked="seeked"
|
|
45
|
+
@seeking="seeking"
|
|
46
|
+
@loadedmetadata="loadedMetaData"
|
|
47
|
+
@fullscreenclick="fullscreenclick"
|
|
48
|
+
>
|
|
49
|
+
<!-- <view class="ste-video-custom-content"> -->
|
|
50
|
+
<!-- 图片操作提示 -->
|
|
51
|
+
<view class="overlay-box" v-if="isFull && !firstFullDone">
|
|
52
|
+
<ste-image
|
|
53
|
+
src="https://image.whzb.com/chain/StellarUI/video/overlay.png"
|
|
54
|
+
mode="widthFix"
|
|
55
|
+
width="100%"
|
|
56
|
+
/>
|
|
57
|
+
</view>
|
|
58
|
+
<!-- 顶部操作栏 -->
|
|
59
|
+
<view
|
|
60
|
+
class="cover top"
|
|
61
|
+
:style="{
|
|
62
|
+
transform: showControl ? 'translateY(0)' : 'translateY(-100%)',
|
|
63
|
+
display: isFull ? 'flex' : 'none',
|
|
64
|
+
}"
|
|
65
|
+
@click="isClickControl = true"
|
|
66
|
+
>
|
|
67
|
+
<view @click="exitFullScreen">
|
|
68
|
+
<ste-icon code="" size="40" color="#ffffff"></ste-icon>
|
|
69
|
+
</view>
|
|
70
|
+
<text class="title">{{ title }}</text>
|
|
71
|
+
</view>
|
|
72
|
+
<!-- 底部操作栏 -->
|
|
73
|
+
<view
|
|
74
|
+
class="cover bottom"
|
|
75
|
+
:style="{ transform: showControl ? 'translateY(0)' : 'translateY(100%)' }"
|
|
76
|
+
@click="isClickControl = true"
|
|
77
|
+
>
|
|
78
|
+
<!-- 播放/暂停按钮 -->
|
|
79
|
+
<view v-if="showPlayBtn">
|
|
80
|
+
<ste-icon
|
|
81
|
+
code=""
|
|
82
|
+
size="36"
|
|
83
|
+
color="#ffffff"
|
|
84
|
+
v-if="!playState"
|
|
85
|
+
@click="handlePlay(true)"
|
|
86
|
+
></ste-icon>
|
|
87
|
+
<ste-icon code="" size="36" color="#ffffff" v-else @click="handlePlay(false)"></ste-icon>
|
|
88
|
+
</view>
|
|
89
|
+
<!-- 静音按钮 -->
|
|
90
|
+
<view class="muted-box">
|
|
91
|
+
<ste-icon
|
|
92
|
+
code=""
|
|
93
|
+
size="38"
|
|
94
|
+
color="#ffffff"
|
|
95
|
+
v-if="!isMuted"
|
|
96
|
+
@click="triggerMuted"
|
|
97
|
+
></ste-icon>
|
|
98
|
+
<ste-icon code="" size="38" color="#ffffff" v-else @click="triggerMuted"></ste-icon>
|
|
99
|
+
</view>
|
|
100
|
+
<!-- 时间进度 -->
|
|
101
|
+
<view class="time-box" v-if="isFull">
|
|
102
|
+
<view class="time left">{{ formatTime(videoCurrent) }}</view>
|
|
103
|
+
<view>/</view>
|
|
104
|
+
<view class="time right">{{ formatTime(videoDuration) }}</view>
|
|
105
|
+
</view>
|
|
106
|
+
<!-- 进度条 -->
|
|
107
|
+
<view class="progress-box" v-if="reRenderFlag">
|
|
108
|
+
<ste-slider :value="playProgress" @change="handleProgressChange" barHeight="4" buttonSize="26">
|
|
109
|
+
<view class="progress-bar" slot="button" />
|
|
110
|
+
</ste-slider>
|
|
111
|
+
</view>
|
|
112
|
+
<!-- 时间进度 -->
|
|
113
|
+
<view class="time-box" v-if="!isFull">
|
|
114
|
+
<view class="time left">{{ formatTime(videoCurrent) }}</view>
|
|
115
|
+
<view>/</view>
|
|
116
|
+
<view class="time right">{{ formatTime(videoDuration) }}</view>
|
|
117
|
+
</view>
|
|
118
|
+
<template v-if="isFull">
|
|
119
|
+
<view
|
|
120
|
+
class="text-box resolution"
|
|
121
|
+
@click="handleResolutionClick"
|
|
122
|
+
v-if="resolution && resolution.length > 0"
|
|
123
|
+
>
|
|
124
|
+
{{ resolution[resolutionIndex].text }}
|
|
125
|
+
</view>
|
|
126
|
+
<view class="text-box speed" @click="handleSpeedClick">
|
|
127
|
+
{{ speedConfigArr[speedIndex] + 'X' }}
|
|
128
|
+
</view>
|
|
129
|
+
</template>
|
|
130
|
+
<!-- 全屏按钮 -->
|
|
131
|
+
<view v-if="showFullscreenBtn">
|
|
132
|
+
<ste-icon
|
|
133
|
+
code=""
|
|
134
|
+
size="36"
|
|
135
|
+
color="#ffffff"
|
|
136
|
+
v-if="!isFull"
|
|
137
|
+
@click="handleFull(true)"
|
|
138
|
+
></ste-icon>
|
|
139
|
+
<ste-icon code="" size="36" color="#ffffff" v-else @click="handleFull(false)"></ste-icon>
|
|
140
|
+
</view>
|
|
141
|
+
</view>
|
|
142
|
+
<!-- 倍速、清晰度弹窗 -->
|
|
143
|
+
<view
|
|
144
|
+
class="popup-box"
|
|
145
|
+
:style="{ transform: showPopup ? 'translateX(0)' : 'translateX(100%)' }"
|
|
146
|
+
@click="handlePopupClick"
|
|
147
|
+
>
|
|
148
|
+
<view class="item-box" :style="{ display: popupState == 1 ? 'flex' : 'none' }">
|
|
149
|
+
<view
|
|
150
|
+
class="choose-item"
|
|
151
|
+
v-for="(e, index) in speedConfigArr"
|
|
152
|
+
:key="index"
|
|
153
|
+
@click="handleChooseItem(e, index)"
|
|
154
|
+
>
|
|
155
|
+
<text class="text">{{ e + 'X' }}</text>
|
|
156
|
+
<view v-if="speedIndex == index" class="check-icon">
|
|
157
|
+
<ste-icon code="" color="#fff" size="36"></ste-icon>
|
|
158
|
+
</view>
|
|
159
|
+
</view>
|
|
160
|
+
</view>
|
|
161
|
+
<view class="item-box" :style="{ display: popupState == 2 ? 'flex' : 'none' }">
|
|
162
|
+
<view
|
|
163
|
+
class="choose-item"
|
|
164
|
+
v-for="(e, index) in resolution"
|
|
165
|
+
:key="index"
|
|
166
|
+
@click="handleChooseItem(e, index)"
|
|
167
|
+
>
|
|
168
|
+
<text class="text">{{ e.text }}</text>
|
|
169
|
+
<view v-if="resolutionIndex == index" class="check-icon">
|
|
170
|
+
<ste-icon code="" color="#fff" size="36"></ste-icon>
|
|
171
|
+
</view>
|
|
172
|
+
</view>
|
|
173
|
+
</view>
|
|
174
|
+
</view>
|
|
175
|
+
<!-- 操作提示 -->
|
|
176
|
+
<view class="tip-toast" :class="[{ show: showTip }]">
|
|
177
|
+
<view class="tip-text">{{ msg }}</view>
|
|
178
|
+
</view>
|
|
179
|
+
<!-- </view> -->
|
|
180
|
+
</video>
|
|
181
|
+
<!-- #endif -->
|
|
182
|
+
<!-- #ifdef MP-ALIPAY -->
|
|
183
|
+
<video class="ste-video" :id="id" :src="src" />
|
|
184
|
+
<!-- #endif -->
|
|
185
|
+
</view>
|
|
186
|
+
</template>
|
|
187
|
+
|
|
188
|
+
<script>
|
|
189
|
+
import utils from '../../utils/utils.js';
|
|
190
|
+
import props from './props.js';
|
|
191
|
+
export default {
|
|
192
|
+
group: '展示组件',
|
|
193
|
+
title: 'Video 视频',
|
|
194
|
+
name: 'ste-video',
|
|
195
|
+
mixins: [props],
|
|
196
|
+
data() {
|
|
197
|
+
return {
|
|
198
|
+
reRenderFlag: true,
|
|
199
|
+
id: 'video-' + utils.guid(),
|
|
200
|
+
videoSrc: '',
|
|
201
|
+
video: null, // video 上下文
|
|
202
|
+
playState: false, // 标识播放状态
|
|
203
|
+
isFull: false, // 标识是否全屏状态
|
|
204
|
+
showControl: true,
|
|
205
|
+
isClickControl: false, // 标识点击的时候是否点的操作栏
|
|
206
|
+
playProgress: 0,
|
|
207
|
+
videoDuration: 0, // 视频时长,单位s
|
|
208
|
+
videoCurrent: 0, // 当前视频播放时长,单位s
|
|
209
|
+
firstFullDone: false, // 标识是否全屏过,此时不再显示图片提示
|
|
210
|
+
isClickImgTip: false, // 标识点击的时候是否点的图片提示
|
|
211
|
+
showPopup: false,
|
|
212
|
+
popupState: 1, // 标识当前是倍速还是清晰度 1 倍速,2 清晰度
|
|
213
|
+
speedIndex: 2,
|
|
214
|
+
resolutionIndex: 0,
|
|
215
|
+
speedConfigArr: [0.5, 0.8, 1.0, 1.25, 1.5],
|
|
216
|
+
showTip: false,
|
|
217
|
+
msg: '你好',
|
|
218
|
+
isMuted: this.muted,
|
|
219
|
+
};
|
|
220
|
+
},
|
|
221
|
+
created() {
|
|
222
|
+
if (this.src) {
|
|
223
|
+
this.videoSrc = this.src;
|
|
224
|
+
} else {
|
|
225
|
+
this.videoSrc = this.resolution[this.resolutionIndex] ? this.resolution[this.resolutionIndex].url : '';
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
mounted() {
|
|
229
|
+
this.video = uni.createVideoContext(this.id, this);
|
|
230
|
+
},
|
|
231
|
+
watch: {
|
|
232
|
+
muted: {
|
|
233
|
+
handler(val) {
|
|
234
|
+
this.isMuted = val;
|
|
235
|
+
},
|
|
236
|
+
immediate: true,
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
computed: {
|
|
240
|
+
cmpRootClass() {
|
|
241
|
+
let classArr = [];
|
|
242
|
+
if (this.isFull) {
|
|
243
|
+
classArr.push('full');
|
|
244
|
+
}
|
|
245
|
+
if (this.autoHeight) {
|
|
246
|
+
classArr.push('auto-height');
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return classArr.join(' ');
|
|
250
|
+
},
|
|
251
|
+
cmpRootStyleVar() {
|
|
252
|
+
let style = {
|
|
253
|
+
'--control-height': this.isFull ? utils.formatPx(128) : utils.formatPx(88),
|
|
254
|
+
// #ifndef H5 || WEB
|
|
255
|
+
'--control-bottom-bar': utils.System.getNavbarBottom(),
|
|
256
|
+
// #endif
|
|
257
|
+
'--text-box-width': utils.formatPx(80),
|
|
258
|
+
'--progress-bar-width': utils.formatPx(28),
|
|
259
|
+
'--choose-item-font-size': utils.formatPx(28),
|
|
260
|
+
'--check-icon-left': utils.formatPx(100),
|
|
261
|
+
'--choose-item-gap': utils.formatPx(80),
|
|
262
|
+
'--cover-font-size': utils.formatPx(28),
|
|
263
|
+
'--title-padding-left': utils.formatPx(194),
|
|
264
|
+
'--rpx-to-px-20': utils.formatPx(20),
|
|
265
|
+
'--rpx-to-px-24': utils.formatPx(24),
|
|
266
|
+
'--rpx-to-px-40': utils.formatPx(40),
|
|
267
|
+
'--rpx-to-px-32': utils.formatPx(32),
|
|
268
|
+
'--rpx-to-px-46': utils.formatPx(46),
|
|
269
|
+
'--rpx-to-px-16': utils.formatPx(16),
|
|
270
|
+
'--rpx-to-px-40': utils.formatPx(40),
|
|
271
|
+
'--rpx-to-px-36': utils.formatPx(36),
|
|
272
|
+
};
|
|
273
|
+
return style;
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
methods: {
|
|
277
|
+
thro: utils.thro,
|
|
278
|
+
|
|
279
|
+
handlePlay(state) {
|
|
280
|
+
if (state) {
|
|
281
|
+
// 播放
|
|
282
|
+
this.video.play();
|
|
283
|
+
} else {
|
|
284
|
+
this.video.pause();
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
handleFull(state) {
|
|
288
|
+
if (state) {
|
|
289
|
+
this.video.requestFullScreen({ direction: 90 });
|
|
290
|
+
} else {
|
|
291
|
+
this.firstFullDone = true;
|
|
292
|
+
this.video.exitFullScreen();
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
this.reRenderFlag = false;
|
|
296
|
+
setTimeout(() => {
|
|
297
|
+
this.reRenderFlag = true;
|
|
298
|
+
}, 200);
|
|
299
|
+
},
|
|
300
|
+
exitFullScreen() {
|
|
301
|
+
this.showPopup = false;
|
|
302
|
+
this.video.exitFullScreen();
|
|
303
|
+
|
|
304
|
+
this.reRenderFlag = false;
|
|
305
|
+
setTimeout(() => {
|
|
306
|
+
this.reRenderFlag = true;
|
|
307
|
+
}, 200);
|
|
308
|
+
},
|
|
309
|
+
handleProgressChange(v) {
|
|
310
|
+
this.videoCurrent = this.videoDuration * (v / 100);
|
|
311
|
+
this.video.seek(this.videoCurrent);
|
|
312
|
+
},
|
|
313
|
+
// 由于video的点击事件会导致其他点击事件也触发,所以通过一些标识符判断来触发不同逻辑
|
|
314
|
+
handleClick() {
|
|
315
|
+
// 此时全屏并点击了图片提示
|
|
316
|
+
if (this.isFull && !this.firstFullDone) {
|
|
317
|
+
this.firstFullDone = true;
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
if (!this.isClickControl && !this.isClickImgTip) {
|
|
322
|
+
// 此时点击了视频空白区域
|
|
323
|
+
if (this.showPopup) {
|
|
324
|
+
this.showPopup = false;
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
this.showControl = !this.showControl;
|
|
328
|
+
this.$emit('controlstoggle', this.showControl);
|
|
329
|
+
} else {
|
|
330
|
+
this.isClickControl = false;
|
|
331
|
+
this.isClickImgTip = false;
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
handleSpeedClick() {
|
|
335
|
+
this.popupState = 1;
|
|
336
|
+
this.showPopup = true;
|
|
337
|
+
},
|
|
338
|
+
handleResolutionClick() {
|
|
339
|
+
this.popupState = 2;
|
|
340
|
+
this.showPopup = true;
|
|
341
|
+
},
|
|
342
|
+
handlePopupClick() {
|
|
343
|
+
this.isClickControl = true;
|
|
344
|
+
},
|
|
345
|
+
handleChooseItem(e, index) {
|
|
346
|
+
let msg = '';
|
|
347
|
+
if (this.popupState == 1) {
|
|
348
|
+
if (this.speedIndex == index) return;
|
|
349
|
+
this.speedIndex = index;
|
|
350
|
+
this.video.playbackRate(this.speedConfigArr[this.speedIndex]);
|
|
351
|
+
msg = e + 'X';
|
|
352
|
+
} else {
|
|
353
|
+
if (this.resolutionIndex == index) return;
|
|
354
|
+
this.resolutionIndex = index;
|
|
355
|
+
this.handlePlay(false);
|
|
356
|
+
this.videoSrc = this.resolution[this.resolutionIndex].url;
|
|
357
|
+
setTimeout(() => {
|
|
358
|
+
this.video.seek(this.videoCurrent);
|
|
359
|
+
this.handlePlay(true);
|
|
360
|
+
}, 200);
|
|
361
|
+
msg = `切换${e.text}成功`;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
setTimeout(() => {
|
|
365
|
+
this.showPopup = false;
|
|
366
|
+
this.tip(msg);
|
|
367
|
+
}, 20);
|
|
368
|
+
},
|
|
369
|
+
// 监听video事件
|
|
370
|
+
|
|
371
|
+
play() {
|
|
372
|
+
this.playState = true;
|
|
373
|
+
},
|
|
374
|
+
pause() {
|
|
375
|
+
this.playState = false;
|
|
376
|
+
},
|
|
377
|
+
ended(e) {
|
|
378
|
+
this.$emit('ended', e);
|
|
379
|
+
},
|
|
380
|
+
timeupdate(e) {
|
|
381
|
+
this.videoDuration = e.detail.duration;
|
|
382
|
+
this.videoCurrent = e.detail.currentTime;
|
|
383
|
+
this.playProgress = (this.videoCurrent / this.videoDuration) * 100;
|
|
384
|
+
},
|
|
385
|
+
fullscreenchange(e) {
|
|
386
|
+
this.isFull = e.detail.fullScreen;
|
|
387
|
+
if (this.isFull) {
|
|
388
|
+
this.video.hideStatusBar();
|
|
389
|
+
} else {
|
|
390
|
+
this.video.showStatusBar();
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
waiting(e) {
|
|
394
|
+
this.$emit('waiting', e);
|
|
395
|
+
},
|
|
396
|
+
error(e) {
|
|
397
|
+
this.$emit('error', e);
|
|
398
|
+
},
|
|
399
|
+
progress(e) {
|
|
400
|
+
this.$emit('progress', e);
|
|
401
|
+
},
|
|
402
|
+
loadeddata(e) {
|
|
403
|
+
this.$emit('loadeddata', e);
|
|
404
|
+
},
|
|
405
|
+
loadstart(e) {
|
|
406
|
+
this.$emit('loadstart', e);
|
|
407
|
+
},
|
|
408
|
+
seeked(e) {
|
|
409
|
+
this.$emit('seeked', e);
|
|
410
|
+
},
|
|
411
|
+
seeking(e) {
|
|
412
|
+
this.$emit('seeking', e);
|
|
413
|
+
},
|
|
414
|
+
loadedMetaData(e) {
|
|
415
|
+
this.videoDuration = e.detail.duration;
|
|
416
|
+
},
|
|
417
|
+
fullscreenclick(e) {
|
|
418
|
+
this.$emit('fullscreenclick', e);
|
|
419
|
+
},
|
|
420
|
+
// 监听video事件 end
|
|
421
|
+
//
|
|
422
|
+
// 格式化视频时间为时分秒
|
|
423
|
+
formatTime(seconds) {
|
|
424
|
+
let hours = Math.floor(seconds / 3600);
|
|
425
|
+
let minutes = Math.floor((seconds % 3600) / 60);
|
|
426
|
+
let remainingSeconds = Math.floor(seconds % 60);
|
|
427
|
+
|
|
428
|
+
let formattedHours = hours > 0 ? (hours < 10 ? '0' + hours : hours) : '';
|
|
429
|
+
let formattedMinutes = minutes < 10 ? '0' + minutes : minutes;
|
|
430
|
+
let formattedSeconds = remainingSeconds < 10 ? '0' + remainingSeconds : remainingSeconds;
|
|
431
|
+
|
|
432
|
+
if (formattedHours !== '') {
|
|
433
|
+
return formattedHours + ':' + formattedMinutes + ':' + formattedSeconds;
|
|
434
|
+
} else {
|
|
435
|
+
return formattedMinutes + ':' + formattedSeconds;
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
tip(msg) {
|
|
439
|
+
if (!msg) return;
|
|
440
|
+
this.msg = msg;
|
|
441
|
+
this.showTip = true;
|
|
442
|
+
setTimeout(() => {
|
|
443
|
+
this.showTip = false;
|
|
444
|
+
}, 1500);
|
|
445
|
+
},
|
|
446
|
+
triggerMuted() {
|
|
447
|
+
this.isMuted = !this.isMuted;
|
|
448
|
+
},
|
|
449
|
+
},
|
|
450
|
+
};
|
|
451
|
+
</script>
|
|
452
|
+
|
|
453
|
+
<style lang="scss" scoped>
|
|
454
|
+
.ste-video-root {
|
|
455
|
+
position: relative;
|
|
456
|
+
overflow: hidden;
|
|
457
|
+
width: 100%;
|
|
458
|
+
.ste-video {
|
|
459
|
+
width: 100%;
|
|
460
|
+
display: block;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.ste-video-custom-content {
|
|
464
|
+
width: 100%;
|
|
465
|
+
height: 100%;
|
|
466
|
+
pointer-events: auto;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
&.auto-height {
|
|
470
|
+
height: 100%;
|
|
471
|
+
.ste-video {
|
|
472
|
+
height: 100%;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
&.full {
|
|
477
|
+
.cover {
|
|
478
|
+
position: fixed;
|
|
479
|
+
|
|
480
|
+
padding: 0 var(--rpx-to-px-24);
|
|
481
|
+
|
|
482
|
+
&.top {
|
|
483
|
+
background: linear-gradient(0, rgba(0, 0, 0, 0) 0%, #000000 100%, #000000 100%);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
&.bottom {
|
|
487
|
+
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, #000000 100%);
|
|
488
|
+
|
|
489
|
+
padding: 0 var(--rpx-to-px-40);
|
|
490
|
+
|
|
491
|
+
.progress-box {
|
|
492
|
+
padding-left: 0;
|
|
493
|
+
padding-right: var(--rpx-to-px-32);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.text-box {
|
|
497
|
+
padding-right: var(--rpx-to-px-32);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.time-box {
|
|
501
|
+
padding-right: var(--rpx-to-px-46) !important;
|
|
502
|
+
padding-left: var(--rpx-to-px-32);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.overlay-box {
|
|
509
|
+
width: 100%;
|
|
510
|
+
position: fixed;
|
|
511
|
+
left: 0;
|
|
512
|
+
top: 50%;
|
|
513
|
+
transform: translateY(-50%);
|
|
514
|
+
z-index: 999;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.cover {
|
|
518
|
+
position: absolute;
|
|
519
|
+
line-height: 1;
|
|
520
|
+
width: 100%;
|
|
521
|
+
transition: transform 0.3s ease;
|
|
522
|
+
display: flex;
|
|
523
|
+
align-items: center;
|
|
524
|
+
padding: 0 var(--rpx-to-px-16);
|
|
525
|
+
height: var(--control-height);
|
|
526
|
+
pointer-events: auto;
|
|
527
|
+
color: #ffffff;
|
|
528
|
+
font-size: var(--cover-font-size);
|
|
529
|
+
&.top {
|
|
530
|
+
top: 0;
|
|
531
|
+
background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 5%, rgba(255, 255, 255, 0) 100%);
|
|
532
|
+
|
|
533
|
+
padding-left: var(--title-padding-left);
|
|
534
|
+
|
|
535
|
+
.title {
|
|
536
|
+
margin-left: 16rpx;
|
|
537
|
+
font-size: var(--rpx-to-px-36);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
&.bottom {
|
|
542
|
+
bottom: 0;
|
|
543
|
+
// background: linear-gradient(0, rgba(0, 0, 0, 0.5) 5%, rgba(255, 255, 255, 0) 100%);
|
|
544
|
+
background-color: rgba(0, 0, 0, 0.6);
|
|
545
|
+
|
|
546
|
+
display: flex;
|
|
547
|
+
justify-content: space-between;
|
|
548
|
+
|
|
549
|
+
.muted-box {
|
|
550
|
+
padding-left: var(--rpx-to-px-16);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
.progress-box {
|
|
554
|
+
flex: 1;
|
|
555
|
+
padding: 0 var(--rpx-to-px-32);
|
|
556
|
+
|
|
557
|
+
.progress-bar {
|
|
558
|
+
width: var(--progress-bar-width);
|
|
559
|
+
height: var(--progress-bar-width);
|
|
560
|
+
border-radius: 50%;
|
|
561
|
+
background-color: #ffffff;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
.time-box {
|
|
566
|
+
display: flex;
|
|
567
|
+
align-items: center;
|
|
568
|
+
overflow: hidden;
|
|
569
|
+
padding-right: var(--rpx-to-px-20);
|
|
570
|
+
|
|
571
|
+
.time {
|
|
572
|
+
width: var(--text-box-width);
|
|
573
|
+
overflow: hidden;
|
|
574
|
+
|
|
575
|
+
&.right {
|
|
576
|
+
text-align: right;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
.popup-box {
|
|
584
|
+
height: 100vh;
|
|
585
|
+
width: 24.6vw;
|
|
586
|
+
position: absolute;
|
|
587
|
+
pointer-events: auto;
|
|
588
|
+
right: 0;
|
|
589
|
+
top: 0;
|
|
590
|
+
transition: transform 0.3s ease;
|
|
591
|
+
background-color: rgba(0, 0, 0, 0.8);
|
|
592
|
+
|
|
593
|
+
line-height: 1;
|
|
594
|
+
.item-box {
|
|
595
|
+
line-height: 1;
|
|
596
|
+
display: flex;
|
|
597
|
+
flex-direction: column;
|
|
598
|
+
justify-content: center;
|
|
599
|
+
align-items: center;
|
|
600
|
+
gap: var(--choose-item-gap);
|
|
601
|
+
|
|
602
|
+
width: 100%;
|
|
603
|
+
height: 100%;
|
|
604
|
+
}
|
|
605
|
+
.choose-item {
|
|
606
|
+
color: #ffffff;
|
|
607
|
+
position: relative;
|
|
608
|
+
width: 100%;
|
|
609
|
+
text-align: center;
|
|
610
|
+
.text {
|
|
611
|
+
font-size: var(--choose-item-font-size);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
.check-icon {
|
|
615
|
+
display: flex;
|
|
616
|
+
position: absolute;
|
|
617
|
+
right: var(--check-icon-left);
|
|
618
|
+
top: -1px;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
.tip-toast {
|
|
624
|
+
background-color: rgba(0, 0, 0, 0.7);
|
|
625
|
+
border-radius: 16rpx;
|
|
626
|
+
padding: 10px;
|
|
627
|
+
|
|
628
|
+
position: absolute;
|
|
629
|
+
left: 50%;
|
|
630
|
+
top: 50%;
|
|
631
|
+
display: flex;
|
|
632
|
+
align-items: center;
|
|
633
|
+
justify-content: center;
|
|
634
|
+
transform: translate(-50%, -50%);
|
|
635
|
+
transition: all 0.2s;
|
|
636
|
+
visibility: hidden;
|
|
637
|
+
&.show {
|
|
638
|
+
visibility: visible;
|
|
639
|
+
}
|
|
640
|
+
.tip-text {
|
|
641
|
+
color: #ffffff;
|
|
642
|
+
font-size: 14px;
|
|
643
|
+
line-height: 1;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
</style>
|
package/config/color.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import store from '../utils/store.js';
|
|
2
|
+
import Vuex from 'vuex';
|
|
3
|
+
let $state = new Vuex.Store({
|
|
4
|
+
state: {
|
|
5
|
+
steThemeColor: '#0090FF',
|
|
6
|
+
defaultColor: '#0090FF',
|
|
7
|
+
},
|
|
8
|
+
}).state;
|
|
9
|
+
|
|
10
|
+
function useColor() {
|
|
11
|
+
return {
|
|
12
|
+
setColor(params) {
|
|
13
|
+
$state.steThemeColor = params.steThemeColor ?? $state.steThemeColor;
|
|
14
|
+
},
|
|
15
|
+
getColor() {
|
|
16
|
+
return $state;
|
|
17
|
+
},
|
|
18
|
+
/**响应式数据*/
|
|
19
|
+
$state,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export default useColor;
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "stellar-ui-v2",
|
|
3
|
+
"version": "1.35.3",
|
|
4
|
+
"description": "StellarUI组件库",
|
|
5
|
+
"main": "stellar-ui/index.js",
|
|
6
|
+
"private": false,
|
|
7
|
+
"scripts": {},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/wuhanshuzhiyun/StellarUI.git"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [],
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"g": "^2.0.1",
|
|
17
|
+
"ste-cli": "^1.0.1"
|
|
18
|
+
}
|
|
19
|
+
}
|