@cmstops/pro-compo 0.3.40 → 0.3.42
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/dist/index.css +49 -0
- package/dist/index.min.css +1 -1
- package/es/contentModal/components/ViewAllColumn/MediaFilter/index.js +45 -51
- package/es/hooks/useMediaContext.d.ts +12 -0
- package/es/index.css +49 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/index.less +1 -0
- package/es/utils/request.js +2 -0
- package/es/videoThumb/component.d.ts +0 -0
- package/es/videoThumb/component.js +103 -0
- package/es/videoThumb/index.d.ts +2 -0
- package/es/videoThumb/index.js +7 -0
- package/es/videoThumb/scripts/api.d.ts +9 -0
- package/es/videoThumb/scripts/api.js +11 -0
- package/es/videoThumb/scripts/useVideoThumbs.d.ts +7 -0
- package/es/videoThumb/scripts/useVideoThumbs.js +48 -0
- package/es/videoThumb/style/css.js +1 -0
- package/es/videoThumb/style/index.css +49 -0
- package/es/videoThumb/style/index.d.ts +1 -0
- package/es/videoThumb/style/index.js +1 -0
- package/es/videoThumb/style/index.less +61 -0
- package/lib/contentModal/components/ViewAllColumn/MediaFilter/index.js +44 -50
- package/lib/index.css +49 -0
- package/lib/index.js +2 -0
- package/lib/index.less +1 -0
- package/lib/utils/request.js +2 -0
- package/lib/videoThumb/component.js +104 -0
- package/lib/videoThumb/index.js +8 -0
- package/lib/videoThumb/scripts/api.js +13 -0
- package/lib/videoThumb/scripts/useVideoThumbs.js +50 -0
- package/lib/videoThumb/style/css.js +2 -0
- package/lib/videoThumb/style/index.css +49 -0
- package/lib/videoThumb/style/index.js +2 -0
- package/lib/videoThumb/style/index.less +61 -0
- package/package.json +6 -6
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, watch, openBlock, createElementBlock, createVNode, unref, withCtx,
|
|
1
|
+
import { defineComponent, ref, computed, watch, openBlock, createElementBlock, createVNode, unref, withCtx, Fragment, renderList, createElementVNode, toDisplayString, createBlock, withDirectives, createTextVNode, vShow } from "vue";
|
|
2
2
|
import { Space, Input, Select, Option, Tooltip, Button } from "@arco-design/web-vue";
|
|
3
3
|
import { IconInfoCircle, IconRefresh } from "@arco-design/web-vue/es/icon";
|
|
4
4
|
import { docSeries, docThumbMap } from "../../../../utils/doc.js";
|
|
5
5
|
import _sfc_main$1 from "../columnTree/index.js";
|
|
6
6
|
const _hoisted_1 = { class: "media-filter-container" };
|
|
7
7
|
const _hoisted_2 = { style: { "display": "flex", "align-items": "center", "gap": "5px" } };
|
|
8
|
-
const _hoisted_3 =
|
|
9
|
-
const _hoisted_4 = { style: { "display": "flex", "align-items": "center", "gap": "5px" } };
|
|
10
|
-
const _hoisted_5 = /* @__PURE__ */ createElementVNode("span", null, "\u6A21\u7CCA\u641C", -1);
|
|
11
|
-
const _hoisted_6 = { class: "sort-button" };
|
|
8
|
+
const _hoisted_3 = { class: "sort-button" };
|
|
12
9
|
const _sfc_main = defineComponent({
|
|
13
10
|
...{ name: "MediaFilter" },
|
|
14
11
|
__name: "index",
|
|
@@ -23,7 +20,7 @@ const _sfc_main = defineComponent({
|
|
|
23
20
|
emits: ["update:group_id", "search"],
|
|
24
21
|
setup(__props, { emit: __emit }) {
|
|
25
22
|
const props = __props;
|
|
26
|
-
const column_id = ref(
|
|
23
|
+
const column_id = ref("all");
|
|
27
24
|
const emit = __emit;
|
|
28
25
|
const filter = ref({
|
|
29
26
|
keywords: "",
|
|
@@ -34,6 +31,18 @@ const _sfc_main = defineComponent({
|
|
|
34
31
|
order: "create_time",
|
|
35
32
|
wordState: "precision"
|
|
36
33
|
});
|
|
34
|
+
const wordStateOptions = [
|
|
35
|
+
{
|
|
36
|
+
value: "precision",
|
|
37
|
+
label: "\u7CBE\u51C6\u641C",
|
|
38
|
+
desc: "\u4F1A\u4EE5\u8F93\u5165\u7684\u5B8C\u6574\u5173\u952E\u8BCD\u201C\u6210\u957F\u201D\u8FDB\u884C\u641C\u7D22\uFF0C\u641C\u7D22\u7ED3\u679C\u5173\u8054\u6027\u66F4\u9AD8\uFF0C\u4F46\u641C\u7D22\u7ED3\u679C\u66F4\u5C11"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
value: "blur",
|
|
42
|
+
label: "\u6A21\u7CCA\u641C",
|
|
43
|
+
desc: "\u4F1A\u5C06\u8F93\u5165\u5185\u5BB9\u5206\u8BCD\uFF0C\u4F8B\u5982\u201C\u6210\u957F\u201D\u4F1A\u5206\u4E3A\u201C\u6210\u201D\u3001\u201C\u957F\u201D\u3001\u201C\u6210\u957F\u201D\uFF0C\u5185\u5BB9\u5305\u542B\u4E09\u4E2A\u8BCD\u4E2D\u4EFB\u610F\u4E00\u4E2A\u5747\u4F1A\u663E\u793A\u51FA\u6765\uFF0C\u641C\u7D22\u5185\u5BB9\u66F4\u52A0\u4E30\u5BCC"
|
|
44
|
+
}
|
|
45
|
+
];
|
|
37
46
|
const bannerOptions = computed(() => {
|
|
38
47
|
const options = [
|
|
39
48
|
{
|
|
@@ -91,22 +100,24 @@ const _sfc_main = defineComponent({
|
|
|
91
100
|
return filter.value.keywords || series || filter.value.cover_type || banner || filter.value.sort !== -1;
|
|
92
101
|
});
|
|
93
102
|
const reset = () => {
|
|
94
|
-
|
|
103
|
+
const _set = {
|
|
95
104
|
keywords: "",
|
|
96
105
|
cover_type: "",
|
|
97
106
|
sort: -1,
|
|
98
107
|
order: "create_time"
|
|
99
108
|
};
|
|
109
|
+
Object.assign(filter.value, _set);
|
|
100
110
|
if (props.banner !== "all") {
|
|
101
111
|
filter.value.banner = props.banner;
|
|
102
112
|
} else {
|
|
103
113
|
filter.value.banner = "";
|
|
104
114
|
}
|
|
105
|
-
if (props.series !== "all") {
|
|
115
|
+
if (props.series !== "all" && props.series.split(",").length === 1) {
|
|
106
116
|
filter.value.type = props.series;
|
|
107
117
|
} else {
|
|
108
118
|
filter.value.type = "";
|
|
109
119
|
}
|
|
120
|
+
column_id.value = "all";
|
|
110
121
|
};
|
|
111
122
|
const checkout = (type) => {
|
|
112
123
|
filter.value.wordState = type;
|
|
@@ -156,6 +167,7 @@ const _sfc_main = defineComponent({
|
|
|
156
167
|
"allow-clear": "",
|
|
157
168
|
class: "filter-item keyword",
|
|
158
169
|
placeholder: "\u8BF7\u8F93\u5165\u5185\u5BB9\u6807\u9898",
|
|
170
|
+
style: { width: "240px" },
|
|
159
171
|
onPressEnter: handleSearch
|
|
160
172
|
}, {
|
|
161
173
|
prepend: withCtx(() => [
|
|
@@ -166,48 +178,30 @@ const _sfc_main = defineComponent({
|
|
|
166
178
|
onSelect: checkout
|
|
167
179
|
}, {
|
|
168
180
|
default: withCtx(() => [
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
value
|
|
192
|
-
|
|
193
|
-
}, {
|
|
194
|
-
default: withCtx(() => [
|
|
195
|
-
createElementVNode("div", _hoisted_4, [
|
|
196
|
-
_hoisted_5,
|
|
197
|
-
createVNode(unref(Tooltip), {
|
|
198
|
-
effect: "dark",
|
|
199
|
-
content: "\u4F1A\u5C06\u8F93\u5165\u5185\u5BB9\u5206\u8BCD\uFF0C\u4F8B\u5982\u201C\u6210\u957F\u201D\u4F1A\u5206\u4E3A\u201C\u6210\u201D\u3001\u201C\u957F\u201D\u3001\u201C\u6210\u957F\u201D\uFF0C\u5185\u5BB9\u5305\u542B\u4E09\u4E2A\u8BCD\u4E2D\u4EFB\u610F\u4E00\u4E2A\u5747\u4F1A\u663E\u793A\u51FA\u6765\uFF0C\u641C\u7D22\u5185\u5BB9\u66F4\u52A0\u4E30\u5BCC",
|
|
200
|
-
position: "right"
|
|
201
|
-
}, {
|
|
202
|
-
default: withCtx(() => [
|
|
203
|
-
createVNode(unref(IconInfoCircle))
|
|
204
|
-
]),
|
|
205
|
-
_: 1
|
|
206
|
-
})
|
|
207
|
-
])
|
|
208
|
-
]),
|
|
209
|
-
_: 1
|
|
210
|
-
})
|
|
181
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(wordStateOptions, (item, index) => {
|
|
182
|
+
return createVNode(unref(Option), {
|
|
183
|
+
key: index,
|
|
184
|
+
value: item.value,
|
|
185
|
+
label: item.label
|
|
186
|
+
}, {
|
|
187
|
+
default: withCtx(() => [
|
|
188
|
+
createElementVNode("div", _hoisted_2, [
|
|
189
|
+
createElementVNode("span", null, toDisplayString(item.label), 1),
|
|
190
|
+
createVNode(unref(Tooltip), {
|
|
191
|
+
effect: "dark",
|
|
192
|
+
content: item.desc,
|
|
193
|
+
position: "right"
|
|
194
|
+
}, {
|
|
195
|
+
default: withCtx(() => [
|
|
196
|
+
createVNode(unref(IconInfoCircle))
|
|
197
|
+
]),
|
|
198
|
+
_: 2
|
|
199
|
+
}, 1032, ["content"])
|
|
200
|
+
])
|
|
201
|
+
]),
|
|
202
|
+
_: 2
|
|
203
|
+
}, 1032, ["value", "label"]);
|
|
204
|
+
}), 64))
|
|
211
205
|
]),
|
|
212
206
|
_: 1
|
|
213
207
|
}, 8, ["modelValue"])
|
|
@@ -299,7 +293,7 @@ const _sfc_main = defineComponent({
|
|
|
299
293
|
]),
|
|
300
294
|
_: 1
|
|
301
295
|
}),
|
|
302
|
-
createElementVNode("div",
|
|
296
|
+
createElementVNode("div", _hoisted_3, [
|
|
303
297
|
createVNode(unref(Select), {
|
|
304
298
|
modelValue: filter.value.order,
|
|
305
299
|
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => filter.value.order = $event),
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function useVideoContext(callback: (data?: any) => any): {
|
|
2
|
+
options: import("vue").Ref<any[]>;
|
|
3
|
+
videoContext: import("vue").Ref<HTMLVideoElement | null>;
|
|
4
|
+
loading: import("vue").Ref<boolean>;
|
|
5
|
+
playing: import("vue").Ref<boolean>;
|
|
6
|
+
currentTime: import("vue").Ref<number>;
|
|
7
|
+
handleOption: (key: string, value: number) => void;
|
|
8
|
+
togglePlay: () => void;
|
|
9
|
+
initVideoContext: (selector: string) => void;
|
|
10
|
+
seekVideo: (time: number) => void;
|
|
11
|
+
handleOnCanPlay: () => void;
|
|
12
|
+
};
|
package/es/index.css
CHANGED
|
@@ -4746,3 +4746,52 @@
|
|
|
4746
4746
|
.doc-history-drawer .arco-drawer-body {
|
|
4747
4747
|
padding: 0;
|
|
4748
4748
|
}
|
|
4749
|
+
.video-thumb {
|
|
4750
|
+
display: flex;
|
|
4751
|
+
flex-direction: column;
|
|
4752
|
+
gap: 10px;
|
|
4753
|
+
box-sizing: border-box;
|
|
4754
|
+
width: 100%;
|
|
4755
|
+
height: 100%;
|
|
4756
|
+
padding: 10px;
|
|
4757
|
+
overflow: hidden;
|
|
4758
|
+
}
|
|
4759
|
+
.video-thumb .video-player-container {
|
|
4760
|
+
display: flex;
|
|
4761
|
+
flex: 1;
|
|
4762
|
+
flex-direction: column;
|
|
4763
|
+
overflow: hidden;
|
|
4764
|
+
}
|
|
4765
|
+
.video-thumb .video-player-container video {
|
|
4766
|
+
height: 100%;
|
|
4767
|
+
}
|
|
4768
|
+
.video-thumb .video-thumb-list {
|
|
4769
|
+
position: relative;
|
|
4770
|
+
display: flex;
|
|
4771
|
+
height: 80px;
|
|
4772
|
+
padding: 20px 0;
|
|
4773
|
+
}
|
|
4774
|
+
.video-thumb .video-thumb-list .video-thumb-list-item {
|
|
4775
|
+
flex: 1;
|
|
4776
|
+
cursor: pointer;
|
|
4777
|
+
user-select: none;
|
|
4778
|
+
}
|
|
4779
|
+
.video-thumb .video-thumb-list .video-thumb-list-item img {
|
|
4780
|
+
width: 100%;
|
|
4781
|
+
height: 100%;
|
|
4782
|
+
object-fit: cover;
|
|
4783
|
+
transition: all 0.1s ease-in-out;
|
|
4784
|
+
pointer-events: none;
|
|
4785
|
+
}
|
|
4786
|
+
.video-thumb .video-thumb-list .video-thumb-list-item:hover:not(.active) img {
|
|
4787
|
+
transform: scale(1.05);
|
|
4788
|
+
}
|
|
4789
|
+
.video-thumb .video-thumb-list .video-thumb-list-drager {
|
|
4790
|
+
position: absolute;
|
|
4791
|
+
top: 20px;
|
|
4792
|
+
left: 0;
|
|
4793
|
+
width: 6px;
|
|
4794
|
+
height: calc(100% - 40px);
|
|
4795
|
+
background-color: rgb(var(--primary-5));
|
|
4796
|
+
cursor: pointer;
|
|
4797
|
+
}
|
package/es/index.d.ts
CHANGED
|
@@ -26,3 +26,4 @@ export { default as thumbCard } from './thumbCard';
|
|
|
26
26
|
export { default as selectResourceModal } from './selectResourceModal';
|
|
27
27
|
export { default as docPreview } from './docPreview';
|
|
28
28
|
export { default as docHistory } from './docHistory';
|
|
29
|
+
export { default as videoThumb } from './videoThumb';
|
package/es/index.js
CHANGED
|
@@ -26,3 +26,4 @@ export { default as thumbCard } from "./thumbCard/index.js";
|
|
|
26
26
|
export { default as selectResourceModal } from "./selectResourceModal/index.js";
|
|
27
27
|
export { default as docPreview } from "./docPreview/index.js";
|
|
28
28
|
export { default as docHistory } from "./docHistory/index.js";
|
|
29
|
+
export { default as videoThumb } from "./videoThumb/index.js";
|
package/es/index.less
CHANGED
package/es/utils/request.js
CHANGED
|
@@ -21,6 +21,8 @@ function request(BASE_API, options) {
|
|
|
21
21
|
service.interceptors.response.use(
|
|
22
22
|
(response) => {
|
|
23
23
|
const res = response.data;
|
|
24
|
+
if (res.Code != null && res.Code === 200)
|
|
25
|
+
res.code = 0;
|
|
24
26
|
if ((res == null ? void 0 : res.code) !== 0) {
|
|
25
27
|
if (res == null ? void 0 : res.real_error) {
|
|
26
28
|
Message.warning({ content: res.real_error });
|
|
File without changes
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, watch, onMounted, openBlock, createElementBlock, createElementVNode, unref, createCommentVNode, Fragment, renderList, normalizeClass } from "vue";
|
|
2
|
+
import { DEFAULT_BASE_API } from "../config.js";
|
|
3
|
+
import { useVideoThumbs } from "./scripts/useVideoThumbs.js";
|
|
4
|
+
const _hoisted_1 = { class: "video-thumb" };
|
|
5
|
+
const _hoisted_2 = { class: "video-player-container" };
|
|
6
|
+
const _hoisted_3 = ["src"];
|
|
7
|
+
const _hoisted_4 = ["onClick"];
|
|
8
|
+
const _hoisted_5 = ["src"];
|
|
9
|
+
const _sfc_main = defineComponent({
|
|
10
|
+
...{ name: "videoThumb" },
|
|
11
|
+
__name: "component",
|
|
12
|
+
props: {
|
|
13
|
+
BASE_API: {},
|
|
14
|
+
src: {},
|
|
15
|
+
duration: {}
|
|
16
|
+
},
|
|
17
|
+
emits: ["select"],
|
|
18
|
+
setup(__props, { emit: __emit }) {
|
|
19
|
+
const props = __props;
|
|
20
|
+
const emit = __emit;
|
|
21
|
+
const BASE_API = props.BASE_API || DEFAULT_BASE_API;
|
|
22
|
+
const { thumbs, curThumb, getVideoThumbs, handleSelectThumb } = useVideoThumbs();
|
|
23
|
+
const videoThumbRef = ref();
|
|
24
|
+
const videoThumbDrager = ref();
|
|
25
|
+
const isDrag = ref(false);
|
|
26
|
+
const width = computed(() => {
|
|
27
|
+
if (!videoThumbRef.value)
|
|
28
|
+
return 0;
|
|
29
|
+
const rect = videoThumbRef.value.getBoundingClientRect();
|
|
30
|
+
return parseInt((rect.width / thumbs.value.length).toFixed(0), 10);
|
|
31
|
+
});
|
|
32
|
+
function moveDragger(moveX) {
|
|
33
|
+
if (!videoThumbDrager.value || !videoThumbRef.value)
|
|
34
|
+
return;
|
|
35
|
+
const rect = videoThumbRef.value.getBoundingClientRect();
|
|
36
|
+
if (moveX < 0 || moveX > rect.width)
|
|
37
|
+
return;
|
|
38
|
+
videoThumbDrager.value.style.left = `${moveX}px`;
|
|
39
|
+
const index = Math.floor(moveX / width.value);
|
|
40
|
+
curThumb.value = thumbs.value[index];
|
|
41
|
+
}
|
|
42
|
+
const handleMousedown = () => {
|
|
43
|
+
isDrag.value = true;
|
|
44
|
+
window.onmouseup = handleMouseup;
|
|
45
|
+
window.onmousemove = handleMousemove;
|
|
46
|
+
};
|
|
47
|
+
const handleMouseup = () => {
|
|
48
|
+
isDrag.value = false;
|
|
49
|
+
window.onmouseup = null;
|
|
50
|
+
window.onmousemove = null;
|
|
51
|
+
};
|
|
52
|
+
const handleMousemove = (e) => {
|
|
53
|
+
if (!isDrag.value)
|
|
54
|
+
return;
|
|
55
|
+
const moveX = e.x - 30;
|
|
56
|
+
moveDragger(moveX);
|
|
57
|
+
};
|
|
58
|
+
function handleSelect(idx) {
|
|
59
|
+
handleSelectThumb(idx);
|
|
60
|
+
moveDragger(idx * width.value + width.value / 2);
|
|
61
|
+
}
|
|
62
|
+
watch(
|
|
63
|
+
() => curThumb.value,
|
|
64
|
+
() => emit("select", curThumb.value)
|
|
65
|
+
);
|
|
66
|
+
onMounted(() => {
|
|
67
|
+
getVideoThumbs(BASE_API, props.src, props.duration);
|
|
68
|
+
});
|
|
69
|
+
return (_ctx, _cache) => {
|
|
70
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
71
|
+
createElementVNode("div", _hoisted_2, [
|
|
72
|
+
createElementVNode("img", { src: unref(curThumb) }, null, 8, _hoisted_3)
|
|
73
|
+
]),
|
|
74
|
+
createCommentVNode(" \u5C01\u9762\u56FE "),
|
|
75
|
+
createElementVNode("div", {
|
|
76
|
+
ref_key: "videoThumbRef",
|
|
77
|
+
ref: videoThumbRef,
|
|
78
|
+
class: "video-thumb-list"
|
|
79
|
+
}, [
|
|
80
|
+
createElementVNode("div", {
|
|
81
|
+
ref_key: "videoThumbDrager",
|
|
82
|
+
ref: videoThumbDrager,
|
|
83
|
+
class: "video-thumb-list-drager",
|
|
84
|
+
onMousedown: handleMousedown
|
|
85
|
+
}, null, 544),
|
|
86
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(thumbs), (thumb, idx) => {
|
|
87
|
+
return openBlock(), createElementBlock("div", {
|
|
88
|
+
key: thumb,
|
|
89
|
+
class: normalizeClass(["video-thumb-list-item", { active: unref(curThumb) === thumb }]),
|
|
90
|
+
onClick: ($event) => handleSelect(idx)
|
|
91
|
+
}, [
|
|
92
|
+
createElementVNode("img", {
|
|
93
|
+
src: thumb,
|
|
94
|
+
alt: ""
|
|
95
|
+
}, null, 8, _hoisted_5)
|
|
96
|
+
], 10, _hoisted_4);
|
|
97
|
+
}), 128))
|
|
98
|
+
], 512)
|
|
99
|
+
]);
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import request from "../../utils/request.js";
|
|
2
|
+
function editthumb(BASE_URL, params) {
|
|
3
|
+
const { url, count, start, end, search } = params;
|
|
4
|
+
const src = encodeURIComponent(url);
|
|
5
|
+
const n = count > 50 ? 50 : count;
|
|
6
|
+
return request(BASE_URL, {
|
|
7
|
+
url: `/poplar/v2/editthumb?src=${src}&n=${n}&starttime=${start}&endtime=${end}${search}`,
|
|
8
|
+
method: "get"
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export { editthumb };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function getHMSF(time: string): string;
|
|
2
|
+
export declare function useVideoThumbs(): {
|
|
3
|
+
thumbs: import("vue").Ref<any[]>;
|
|
4
|
+
curThumb: import("vue").Ref<string | undefined>;
|
|
5
|
+
getVideoThumbs: (BASE_API: string, url: string, duration: number) => Promise<void>;
|
|
6
|
+
handleSelectThumb: (idx: number) => void;
|
|
7
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import { editthumb } from "./api.js";
|
|
3
|
+
function calculateFrameCoverCount(videoDuration) {
|
|
4
|
+
const base = 5;
|
|
5
|
+
const coefficient = 10;
|
|
6
|
+
const maxCount = 50;
|
|
7
|
+
let count = Math.log(videoDuration / base) * coefficient;
|
|
8
|
+
count = Math.min(count, maxCount);
|
|
9
|
+
return Math.ceil(count);
|
|
10
|
+
}
|
|
11
|
+
function useVideoThumbs() {
|
|
12
|
+
const thumbs = ref([]);
|
|
13
|
+
const loading = ref(true);
|
|
14
|
+
const curThumb = ref();
|
|
15
|
+
async function getVideoThumbs(BASE_API, url, duration) {
|
|
16
|
+
loading.value = true;
|
|
17
|
+
try {
|
|
18
|
+
const { Code, Msg } = await editthumb(BASE_API, {
|
|
19
|
+
url,
|
|
20
|
+
count: calculateFrameCoverCount(duration),
|
|
21
|
+
start: 0,
|
|
22
|
+
end: duration,
|
|
23
|
+
search: "&cover=true"
|
|
24
|
+
});
|
|
25
|
+
if (Code !== 200)
|
|
26
|
+
return;
|
|
27
|
+
const { Domain, Frames } = Msg;
|
|
28
|
+
thumbs.value = Frames.map((item) => {
|
|
29
|
+
return `${Domain}/${item}`;
|
|
30
|
+
});
|
|
31
|
+
[curThumb.value] = thumbs.value;
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.log("\u52A0\u8F7D\u5C01\u9762\u56FE\u5931\u8D25", e);
|
|
34
|
+
} finally {
|
|
35
|
+
loading.value = false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function handleSelectThumb(idx) {
|
|
39
|
+
curThumb.value = thumbs.value[idx];
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
thumbs,
|
|
43
|
+
curThumb,
|
|
44
|
+
getVideoThumbs,
|
|
45
|
+
handleSelectThumb
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export { useVideoThumbs };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index.css";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
.video-thumb {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 10px;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
padding: 10px;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
}
|
|
11
|
+
.video-thumb .video-player-container {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex: 1;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
}
|
|
17
|
+
.video-thumb .video-player-container video {
|
|
18
|
+
height: 100%;
|
|
19
|
+
}
|
|
20
|
+
.video-thumb .video-thumb-list {
|
|
21
|
+
position: relative;
|
|
22
|
+
display: flex;
|
|
23
|
+
height: 80px;
|
|
24
|
+
padding: 20px 0;
|
|
25
|
+
}
|
|
26
|
+
.video-thumb .video-thumb-list .video-thumb-list-item {
|
|
27
|
+
flex: 1;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
user-select: none;
|
|
30
|
+
}
|
|
31
|
+
.video-thumb .video-thumb-list .video-thumb-list-item img {
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: 100%;
|
|
34
|
+
object-fit: cover;
|
|
35
|
+
transition: all 0.1s ease-in-out;
|
|
36
|
+
pointer-events: none;
|
|
37
|
+
}
|
|
38
|
+
.video-thumb .video-thumb-list .video-thumb-list-item:hover:not(.active) img {
|
|
39
|
+
transform: scale(1.05);
|
|
40
|
+
}
|
|
41
|
+
.video-thumb .video-thumb-list .video-thumb-list-drager {
|
|
42
|
+
position: absolute;
|
|
43
|
+
top: 20px;
|
|
44
|
+
left: 0;
|
|
45
|
+
width: 6px;
|
|
46
|
+
height: calc(100% - 40px);
|
|
47
|
+
background-color: rgb(var(--primary-5));
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index.less";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
.video-thumb {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 10px;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
padding: 10px;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
|
|
11
|
+
// 播放器
|
|
12
|
+
.video-player-container {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex: 1;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
|
|
18
|
+
video {
|
|
19
|
+
height: 100%;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// 视频封面列表
|
|
24
|
+
.video-thumb-list {
|
|
25
|
+
position: relative;
|
|
26
|
+
display: flex;
|
|
27
|
+
height: 80px;
|
|
28
|
+
padding: 20px 0;
|
|
29
|
+
|
|
30
|
+
.video-thumb-list-item {
|
|
31
|
+
flex: 1;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
user-select: none;
|
|
34
|
+
|
|
35
|
+
img {
|
|
36
|
+
width: 100%;
|
|
37
|
+
height: 100%;
|
|
38
|
+
object-fit: cover;
|
|
39
|
+
transition: all 0.1s ease-in-out;
|
|
40
|
+
// 不允许拖动
|
|
41
|
+
pointer-events: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:hover:not(.active) {
|
|
45
|
+
img {
|
|
46
|
+
transform: scale(1.05);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.video-thumb-list-drager {
|
|
52
|
+
position: absolute;
|
|
53
|
+
top: 20px;
|
|
54
|
+
left: 0;
|
|
55
|
+
width: 6px;
|
|
56
|
+
height: calc(100% - 40px);
|
|
57
|
+
background-color: rgb(var(--primary-5));
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|