@cmstops/pro-compo 0.3.43 → 0.3.44
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 +38 -2
- package/dist/index.min.css +1 -1
- package/es/hooks/useAttachement.d.ts +5 -0
- package/es/hooks/useLocalStorage.d.ts +8 -0
- package/es/hooks/useUpload.d.ts +2 -1
- package/es/hooks/useUpload.js +42 -9
- package/es/index.css +38 -2
- package/es/selectResourceModal/components/ListCardWrapper/index.js +9 -7
- package/es/selectResourceModal/components/ListContentLocal/index.js +15 -9
- package/es/selectResourceModal/components/ListSelected/index.js +19 -6
- package/es/selectResourceModal/components/Main/index.js +1 -1
- package/es/selectResourceModal/style/index.css +30 -1
- package/es/selectResourceModal/style/listCardWrapper.less +25 -1
- package/es/selectResourceModal/style/listSelected.less +9 -0
- package/es/thumbCard/component.js +21 -13
- package/es/thumbCard/style/index.css +8 -1
- package/es/thumbCard/style/index.less +8 -1
- package/es/utils/transcodeMedia.d.ts +13 -0
- package/es/utils/transcodeMedia.js +46 -0
- package/lib/hooks/useUpload.js +42 -9
- package/lib/index.css +38 -2
- package/lib/selectResourceModal/components/ListCardWrapper/index.js +9 -7
- package/lib/selectResourceModal/components/ListContentLocal/index.js +14 -8
- package/lib/selectResourceModal/components/ListSelected/index.js +18 -5
- package/lib/selectResourceModal/components/Main/index.js +1 -1
- package/lib/selectResourceModal/style/index.css +30 -1
- package/lib/selectResourceModal/style/listCardWrapper.less +25 -1
- package/lib/selectResourceModal/style/listSelected.less +9 -0
- package/lib/thumbCard/component.js +19 -11
- package/lib/thumbCard/style/index.css +8 -1
- package/lib/thumbCard/style/index.less +8 -1
- package/lib/utils/transcodeMedia.js +49 -0
- package/package.json +2 -2
package/es/hooks/useUpload.js
CHANGED
|
@@ -2,6 +2,7 @@ import { ref } from "vue";
|
|
|
2
2
|
import { generateUUID } from "../utils/index.js";
|
|
3
3
|
import { TusUploadTask } from "../utils/tusUpload.js";
|
|
4
4
|
import request from "../utils/request.js";
|
|
5
|
+
import { TranscodingTask } from "../utils/transcodeMedia.js";
|
|
5
6
|
function addMedia(BASE_API, params) {
|
|
6
7
|
return request(BASE_API, {
|
|
7
8
|
url: "/poplar/v2/media/add",
|
|
@@ -21,13 +22,15 @@ function useUpload() {
|
|
|
21
22
|
list.value = originList;
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
|
-
function recordTaskStatusChange(file, progress) {
|
|
25
|
+
function recordTaskStatusChange(file, progress, isTrans) {
|
|
25
26
|
const originList = list.value;
|
|
26
27
|
const taskIndex = originList.findIndex((task) => task.id === file.id);
|
|
27
28
|
if (taskIndex !== -1) {
|
|
28
|
-
progress !== -1 && (originList[taskIndex].progress = progress);
|
|
29
|
+
progress !== -1 && (originList[taskIndex].progress = Math.round(progress));
|
|
29
30
|
file.status != null && (originList[taskIndex].status = file.status);
|
|
30
31
|
file.msg != null && (originList[taskIndex].msg = file.msg);
|
|
32
|
+
if (isTrans)
|
|
33
|
+
originList[taskIndex].isTrans = true;
|
|
31
34
|
originList[taskIndex].url = file.url;
|
|
32
35
|
} else {
|
|
33
36
|
file.created_at = new Date().getTime();
|
|
@@ -64,24 +67,54 @@ function useUpload() {
|
|
|
64
67
|
});
|
|
65
68
|
if (code !== 0) {
|
|
66
69
|
console.log("\u{1F525}\u{1F525}\u{1F525}\u{1F525}\u{1F525} \u4E0A\u4F20\u5931\u8D25\uFF1A", newFile.name, code, message);
|
|
67
|
-
recordTaskStatusChange({ ...newFile, status: 2, msg: "\
|
|
70
|
+
recordTaskStatusChange({ ...newFile, status: 2, msg: "\u4E0A\u4F20\u5931\u8D25" }, -1);
|
|
68
71
|
return;
|
|
69
72
|
}
|
|
70
|
-
console.log("\u{1F680}\u{1F680}\u{1F680}\u{1F680}\u{1F680}\u{1F680} \u4E0A\u4F20\u6210\u529F\uFF1A", url);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
uploadSuccess({ ...message, sig_id: newFile.sig_id });
|
|
74
|
-
}
|
|
73
|
+
console.log("\u{1F680}\u{1F680}\u{1F680}\u{1F680}\u{1F680}\u{1F680} \u4E0A\u4F20\u6210\u529F\uFF1A", url, message);
|
|
74
|
+
if (!["video", "audio"].includes(message.catalog)) {
|
|
75
|
+
recordTaskStatusChange({ ...newFile, url: message.url, status: 0 }, 1);
|
|
76
|
+
setTimeout(() => uploadSuccess({ ...message, sig_id: newFile.sig_id }), 200);
|
|
77
|
+
} else {
|
|
78
|
+
recordTaskStatusChange(newFile, 0);
|
|
79
|
+
}
|
|
75
80
|
callback && callback({ ...message, sig_id: newFile.sig_id }, "success");
|
|
76
81
|
}).catch((e) => {
|
|
77
82
|
console.log("\u{1F525}\u{1F525}\u{1F525}\u{1F525}\u{1F525} \u4E0A\u4F20\u5931\u8D25\uFF1A", e);
|
|
78
|
-
recordTaskStatusChange({ ...newFile, status: 2, msg: "\
|
|
83
|
+
recordTaskStatusChange({ ...newFile, status: 2, msg: "\u5931\u8D25" }, -1);
|
|
79
84
|
callback && callback(newFile, "fail");
|
|
80
85
|
});
|
|
81
86
|
};
|
|
87
|
+
const transcodingFile = (BASE_API, file) => {
|
|
88
|
+
if (!["video", "audio"].includes(file.catalog))
|
|
89
|
+
return;
|
|
90
|
+
const task = new TranscodingTask(file);
|
|
91
|
+
const idx = list.value.findIndex(
|
|
92
|
+
(item2) => item2.sig_id === file.sig_id
|
|
93
|
+
);
|
|
94
|
+
if (idx === -1)
|
|
95
|
+
return;
|
|
96
|
+
const item = list.value[idx];
|
|
97
|
+
recordTaskStatusChange(item, 0, true);
|
|
98
|
+
const progress = (progress2) => recordTaskStatusChange(item, progress2);
|
|
99
|
+
const transing = task.start(BASE_API, progress);
|
|
100
|
+
transing.then((res) => {
|
|
101
|
+
if (res) {
|
|
102
|
+
console.log("\u{1F680}\u{1F680}\u{1F680}\u{1F680}\u{1F680}\u{1F680} \u8F6C\u7801\u6210\u529F");
|
|
103
|
+
recordTaskStatusChange({ ...item, status: 0 }, 1);
|
|
104
|
+
setTimeout(() => uploadSuccess(file), 200);
|
|
105
|
+
} else {
|
|
106
|
+
console.log("\u{1F525}\u{1F525}\u{1F525}\u{1F525}\u{1F525} \u8F6C\u7801\u5931\u8D25\uFF1A", item);
|
|
107
|
+
recordTaskStatusChange({ ...item, status: 2, msg: "\u8F6C\u7801\u5931\u8D25" }, -1);
|
|
108
|
+
}
|
|
109
|
+
}).catch((e) => {
|
|
110
|
+
console.log("\u{1F525}\u{1F525}\u{1F525}\u{1F525}\u{1F525} \u8F6C\u7801\u5931\u8D25", e);
|
|
111
|
+
recordTaskStatusChange({ ...item, status: 2, msg: "\u8F6C\u7801\u5931\u8D25" }, -1);
|
|
112
|
+
});
|
|
113
|
+
};
|
|
82
114
|
return {
|
|
83
115
|
list,
|
|
84
116
|
uploadFile,
|
|
117
|
+
transcodingFile,
|
|
85
118
|
recordTaskStatusChange
|
|
86
119
|
};
|
|
87
120
|
}
|
package/es/index.css
CHANGED
|
@@ -4256,6 +4256,7 @@
|
|
|
4256
4256
|
}
|
|
4257
4257
|
.thumb-select-wrapper .thumb-upload-loading {
|
|
4258
4258
|
display: flex;
|
|
4259
|
+
flex-direction: column;
|
|
4259
4260
|
align-items: center;
|
|
4260
4261
|
justify-content: center;
|
|
4261
4262
|
width: 100%;
|
|
@@ -4274,6 +4275,8 @@
|
|
|
4274
4275
|
.thumb-select-wrapper .thumb-image img {
|
|
4275
4276
|
width: 100%;
|
|
4276
4277
|
height: 100%;
|
|
4278
|
+
user-select: none;
|
|
4279
|
+
-webkit-user-drag: none;
|
|
4277
4280
|
}
|
|
4278
4281
|
.thumb-select-wrapper .thumb-handler-list {
|
|
4279
4282
|
position: absolute;
|
|
@@ -4313,9 +4316,13 @@
|
|
|
4313
4316
|
position: absolute;
|
|
4314
4317
|
right: 5px;
|
|
4315
4318
|
bottom: 5px;
|
|
4316
|
-
|
|
4319
|
+
display: flex;
|
|
4320
|
+
gap: 2px;
|
|
4321
|
+
align-items: center;
|
|
4322
|
+
padding: 2px 5px;
|
|
4317
4323
|
color: #fff;
|
|
4318
4324
|
font-size: 12px;
|
|
4325
|
+
line-height: 14px;
|
|
4319
4326
|
background-color: rgba(0, 0, 0, 0.5);
|
|
4320
4327
|
border-radius: 16px;
|
|
4321
4328
|
opacity: 1;
|
|
@@ -4400,10 +4407,18 @@
|
|
|
4400
4407
|
overflow: hidden;
|
|
4401
4408
|
}
|
|
4402
4409
|
.list-panel-wrapper .list-selected-record .list-selected-item .item-thumb {
|
|
4410
|
+
position: relative;
|
|
4403
4411
|
width: 50px;
|
|
4404
4412
|
height: 38px;
|
|
4405
4413
|
overflow: hidden;
|
|
4406
4414
|
}
|
|
4415
|
+
.list-panel-wrapper .list-selected-record .list-selected-item .item-thumb .item-tag {
|
|
4416
|
+
position: absolute;
|
|
4417
|
+
top: 50%;
|
|
4418
|
+
left: 50%;
|
|
4419
|
+
color: white;
|
|
4420
|
+
transform: translate(-50%, -50%);
|
|
4421
|
+
}
|
|
4407
4422
|
.list-panel-wrapper .list-selected-record .list-selected-item .item-alias {
|
|
4408
4423
|
flex: 1;
|
|
4409
4424
|
overflow: hidden;
|
|
@@ -4433,13 +4448,31 @@
|
|
|
4433
4448
|
.card-wrapper-image {
|
|
4434
4449
|
position: relative;
|
|
4435
4450
|
overflow: hidden;
|
|
4436
|
-
cursor: pointer;
|
|
4437
4451
|
}
|
|
4438
4452
|
.card-wrapper-image .card-wrapper {
|
|
4439
4453
|
position: relative;
|
|
4440
4454
|
overflow: hidden;
|
|
4455
|
+
border-radius: 2px;
|
|
4456
|
+
transition: all 0.3s ease-in-out;
|
|
4441
4457
|
aspect-ratio: 4 / 3;
|
|
4442
4458
|
}
|
|
4459
|
+
.card-wrapper-image .card-wrapper.disable:not(.active) {
|
|
4460
|
+
opacity: 0.4;
|
|
4461
|
+
}
|
|
4462
|
+
.card-wrapper-image .card-wrapper .mask {
|
|
4463
|
+
position: absolute;
|
|
4464
|
+
top: 0;
|
|
4465
|
+
z-index: 9;
|
|
4466
|
+
display: none;
|
|
4467
|
+
width: 100%;
|
|
4468
|
+
height: 100%;
|
|
4469
|
+
font-size: 18px;
|
|
4470
|
+
background: rgba(0, 0, 0, 0.3);
|
|
4471
|
+
cursor: pointer;
|
|
4472
|
+
}
|
|
4473
|
+
.card-wrapper-image .card-wrapper.active .mask {
|
|
4474
|
+
display: block;
|
|
4475
|
+
}
|
|
4443
4476
|
.card-wrapper-image .card-alias {
|
|
4444
4477
|
width: 100%;
|
|
4445
4478
|
margin-top: 6px;
|
|
@@ -4449,6 +4482,8 @@
|
|
|
4449
4482
|
line-height: 22px;
|
|
4450
4483
|
white-space: nowrap;
|
|
4451
4484
|
text-overflow: ellipsis;
|
|
4485
|
+
user-select: none;
|
|
4486
|
+
-webkit-user-drag: none;
|
|
4452
4487
|
}
|
|
4453
4488
|
.card-wrapper-image:hover .check-box-wrapper .check-box,
|
|
4454
4489
|
.card-wrapper-image .check-box-wrapper .check-box.active {
|
|
@@ -4458,6 +4493,7 @@
|
|
|
4458
4493
|
position: absolute;
|
|
4459
4494
|
top: 8px;
|
|
4460
4495
|
left: 8px;
|
|
4496
|
+
z-index: 10;
|
|
4461
4497
|
cursor: pointer;
|
|
4462
4498
|
}
|
|
4463
4499
|
.card-wrapper-image .check-box-wrapper .check-box {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { defineComponent, computed, openBlock, createElementBlock, withModifiers, createElementVNode, normalizeClass, renderSlot, toDisplayString, createCommentVNode } from "vue";
|
|
2
|
-
const _hoisted_1 = { class: "
|
|
3
|
-
const _hoisted_2 = {
|
|
2
|
+
const _hoisted_1 = /* @__PURE__ */ createElementVNode("div", { class: "mask" }, null, -1);
|
|
3
|
+
const _hoisted_2 = { class: "card-alias" };
|
|
4
|
+
const _hoisted_3 = {
|
|
4
5
|
key: 0,
|
|
5
6
|
class: "check-box active"
|
|
6
7
|
};
|
|
7
|
-
const
|
|
8
|
+
const _hoisted_4 = {
|
|
8
9
|
key: 1,
|
|
9
10
|
class: "check-box"
|
|
10
11
|
};
|
|
@@ -38,16 +39,17 @@ const _sfc_main = defineComponent({
|
|
|
38
39
|
onClick: withModifiers(handleCheck, ["stop"])
|
|
39
40
|
}, [
|
|
40
41
|
createElementVNode("div", {
|
|
41
|
-
class: normalizeClass(["card-wrapper", { active: selectedOrder.value[_ctx.item.id] }])
|
|
42
|
+
class: normalizeClass(["card-wrapper", { disable: _ctx.disable, active: selectedOrder.value[_ctx.item.id] }])
|
|
42
43
|
}, [
|
|
43
|
-
renderSlot(_ctx.$slots, "default")
|
|
44
|
+
renderSlot(_ctx.$slots, "default"),
|
|
45
|
+
_hoisted_1
|
|
44
46
|
], 2),
|
|
45
|
-
createElementVNode("div",
|
|
47
|
+
createElementVNode("div", _hoisted_2, toDisplayString(_ctx.item.alias), 1),
|
|
46
48
|
createElementVNode("div", {
|
|
47
49
|
class: "check-box-wrapper",
|
|
48
50
|
onClick: withModifiers(handleCheck, ["stop"])
|
|
49
51
|
}, [
|
|
50
|
-
selectedOrder.value[_ctx.item.id] ? (openBlock(), createElementBlock("div",
|
|
52
|
+
selectedOrder.value[_ctx.item.id] ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(selectedOrder.value[_ctx.item.id]), 1)) : !_ctx.disable ? (openBlock(), createElementBlock("div", _hoisted_4)) : createCommentVNode("v-if", true)
|
|
51
53
|
])
|
|
52
54
|
]);
|
|
53
55
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, inject, computed, openBlock, createElementBlock, createCommentVNode, createElementVNode, createVNode, unref, toDisplayString, Fragment, renderList, createBlock, withCtx } from "vue";
|
|
2
2
|
import _sfc_main$1 from "./components/Upload.js";
|
|
3
3
|
import useUpload from "../../../hooks/useUpload.js";
|
|
4
4
|
import thumbCard from "../../../thumbCard/index.js";
|
|
@@ -21,6 +21,12 @@ const _sfc_main = defineComponent({
|
|
|
21
21
|
setup(__props, { emit: __emit }) {
|
|
22
22
|
const props = __props;
|
|
23
23
|
const emits = __emit;
|
|
24
|
+
const userInfo = inject("userInfo");
|
|
25
|
+
const baseAPI = inject("baseAPI");
|
|
26
|
+
const repoId = computed(() => {
|
|
27
|
+
var _a;
|
|
28
|
+
return (_a = userInfo == null ? void 0 : userInfo.value) == null ? void 0 : _a.repository_id;
|
|
29
|
+
});
|
|
24
30
|
const handlersKey = computed(() => {
|
|
25
31
|
var _a;
|
|
26
32
|
if (((_a = props.selectKeys) == null ? void 0 : _a.length) > 0 || props.disable)
|
|
@@ -33,17 +39,17 @@ const _sfc_main = defineComponent({
|
|
|
33
39
|
emits("select-one", item);
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
|
-
const { list, uploadFile } = useUpload();
|
|
37
|
-
const userInfo = inject("userInfo");
|
|
38
|
-
const baseAPI = inject("baseAPI");
|
|
39
|
-
const repoId = computed(() => {
|
|
40
|
-
var _a;
|
|
41
|
-
return (_a = userInfo == null ? void 0 : userInfo.value) == null ? void 0 : _a.repository_id;
|
|
42
|
-
});
|
|
42
|
+
const { list, uploadFile, transcodingFile } = useUpload();
|
|
43
43
|
function handleChange(file) {
|
|
44
44
|
if (!baseAPI || !repoId.value)
|
|
45
45
|
return;
|
|
46
|
-
uploadFile(
|
|
46
|
+
uploadFile(
|
|
47
|
+
baseAPI,
|
|
48
|
+
file.file,
|
|
49
|
+
0,
|
|
50
|
+
repoId.value,
|
|
51
|
+
(media) => transcodingFile(baseAPI, media)
|
|
52
|
+
);
|
|
47
53
|
}
|
|
48
54
|
return (_ctx, _cache) => {
|
|
49
55
|
var _a, _b;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { defineComponent, ref, openBlock, createElementBlock, toDisplayString, createCommentVNode, createVNode, unref, withCtx, createElementVNode, Fragment, renderList, createBlock, createTextVNode } from "vue";
|
|
1
|
+
import { defineComponent, inject, computed, ref, openBlock, createElementBlock, toDisplayString, createCommentVNode, createVNode, unref, withCtx, createElementVNode, Fragment, renderList, createBlock, createTextVNode } from "vue";
|
|
2
2
|
import { Popover, Image, Button, Link } from "@arco-design/web-vue";
|
|
3
3
|
import { IconClose } from "@arco-design/web-vue/es/icon";
|
|
4
|
+
import { IconVideoTag } from "@arco-iconbox/vue-cmstop-icons";
|
|
4
5
|
const _hoisted_1 = { class: "list-selected-wrapper" };
|
|
5
6
|
const _hoisted_2 = { key: 0 };
|
|
6
7
|
const _hoisted_3 = { class: "list-panel-header" };
|
|
7
8
|
const _hoisted_4 = { class: "header-options" };
|
|
8
9
|
const _hoisted_5 = { class: "list-selected-record" };
|
|
9
10
|
const _hoisted_6 = { class: "item-thumb" };
|
|
10
|
-
const _hoisted_7 = { class: "item-
|
|
11
|
+
const _hoisted_7 = { class: "item-tag" };
|
|
12
|
+
const _hoisted_8 = { class: "item-alias" };
|
|
11
13
|
const _sfc_main = defineComponent({
|
|
12
14
|
__name: "index",
|
|
13
15
|
props: {
|
|
@@ -17,6 +19,10 @@ const _sfc_main = defineComponent({
|
|
|
17
19
|
emits: ["remove", "clear"],
|
|
18
20
|
setup(__props, { emit: __emit }) {
|
|
19
21
|
const emits = __emit;
|
|
22
|
+
const baseAPI = inject("baseAPI");
|
|
23
|
+
const audioThumb = computed(() => {
|
|
24
|
+
return `${baseAPI}/static/img/music.2ee269c.png`;
|
|
25
|
+
});
|
|
20
26
|
const visible = ref(false);
|
|
21
27
|
return (_ctx, _cache) => {
|
|
22
28
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
@@ -56,11 +62,18 @@ const _sfc_main = defineComponent({
|
|
|
56
62
|
height: "100%",
|
|
57
63
|
src: item.thumb || item.url
|
|
58
64
|
}, null, 8, ["src"])) : createCommentVNode("v-if", true),
|
|
59
|
-
["audio"].includes(item.catalog) ? (openBlock(),
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
["audio"].includes(item.catalog) ? (openBlock(), createBlock(unref(Image), {
|
|
66
|
+
key: 1,
|
|
67
|
+
width: "100%",
|
|
68
|
+
height: "100%",
|
|
69
|
+
fit: "cover",
|
|
70
|
+
src: audioThumb.value
|
|
71
|
+
}, null, 8, ["src"])) : createCommentVNode("v-if", true),
|
|
72
|
+
createElementVNode("div", _hoisted_7, [
|
|
73
|
+
item.catalog === "video" ? (openBlock(), createBlock(unref(IconVideoTag), { key: 0 })) : createCommentVNode("v-if", true)
|
|
74
|
+
])
|
|
62
75
|
]),
|
|
63
|
-
createElementVNode("div",
|
|
76
|
+
createElementVNode("div", _hoisted_8, toDisplayString(item.alias), 1),
|
|
64
77
|
createVNode(unref(Button), {
|
|
65
78
|
type: "text",
|
|
66
79
|
onClick: ($event) => emits("remove", item)
|
|
@@ -129,7 +129,7 @@ const _sfc_main = defineComponent({
|
|
|
129
129
|
createCommentVNode(" \u7B5B\u9009 "),
|
|
130
130
|
activeKey.value !== "local" ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
131
131
|
createVNode(_sfc_main$1, {
|
|
132
|
-
"disable-upload-by":
|
|
132
|
+
"disable-upload-by": !["all", "remind"].includes(activeKey.value),
|
|
133
133
|
filterOptions: _ctx.filterOptions,
|
|
134
134
|
onChange: unref(changeFilter),
|
|
135
135
|
onUpload: handleToUpload
|
|
@@ -71,10 +71,18 @@
|
|
|
71
71
|
overflow: hidden;
|
|
72
72
|
}
|
|
73
73
|
.list-panel-wrapper .list-selected-record .list-selected-item .item-thumb {
|
|
74
|
+
position: relative;
|
|
74
75
|
width: 50px;
|
|
75
76
|
height: 38px;
|
|
76
77
|
overflow: hidden;
|
|
77
78
|
}
|
|
79
|
+
.list-panel-wrapper .list-selected-record .list-selected-item .item-thumb .item-tag {
|
|
80
|
+
position: absolute;
|
|
81
|
+
top: 50%;
|
|
82
|
+
left: 50%;
|
|
83
|
+
color: white;
|
|
84
|
+
transform: translate(-50%, -50%);
|
|
85
|
+
}
|
|
78
86
|
.list-panel-wrapper .list-selected-record .list-selected-item .item-alias {
|
|
79
87
|
flex: 1;
|
|
80
88
|
overflow: hidden;
|
|
@@ -104,13 +112,31 @@
|
|
|
104
112
|
.card-wrapper-image {
|
|
105
113
|
position: relative;
|
|
106
114
|
overflow: hidden;
|
|
107
|
-
cursor: pointer;
|
|
108
115
|
}
|
|
109
116
|
.card-wrapper-image .card-wrapper {
|
|
110
117
|
position: relative;
|
|
111
118
|
overflow: hidden;
|
|
119
|
+
border-radius: 2px;
|
|
120
|
+
transition: all 0.3s ease-in-out;
|
|
112
121
|
aspect-ratio: 4 / 3;
|
|
113
122
|
}
|
|
123
|
+
.card-wrapper-image .card-wrapper.disable:not(.active) {
|
|
124
|
+
opacity: 0.4;
|
|
125
|
+
}
|
|
126
|
+
.card-wrapper-image .card-wrapper .mask {
|
|
127
|
+
position: absolute;
|
|
128
|
+
top: 0;
|
|
129
|
+
z-index: 9;
|
|
130
|
+
display: none;
|
|
131
|
+
width: 100%;
|
|
132
|
+
height: 100%;
|
|
133
|
+
font-size: 18px;
|
|
134
|
+
background: rgba(0, 0, 0, 0.3);
|
|
135
|
+
cursor: pointer;
|
|
136
|
+
}
|
|
137
|
+
.card-wrapper-image .card-wrapper.active .mask {
|
|
138
|
+
display: block;
|
|
139
|
+
}
|
|
114
140
|
.card-wrapper-image .card-alias {
|
|
115
141
|
width: 100%;
|
|
116
142
|
margin-top: 6px;
|
|
@@ -120,6 +146,8 @@
|
|
|
120
146
|
line-height: 22px;
|
|
121
147
|
white-space: nowrap;
|
|
122
148
|
text-overflow: ellipsis;
|
|
149
|
+
user-select: none;
|
|
150
|
+
-webkit-user-drag: none;
|
|
123
151
|
}
|
|
124
152
|
.card-wrapper-image:hover .check-box-wrapper .check-box,
|
|
125
153
|
.card-wrapper-image .check-box-wrapper .check-box.active {
|
|
@@ -129,6 +157,7 @@
|
|
|
129
157
|
position: absolute;
|
|
130
158
|
top: 8px;
|
|
131
159
|
left: 8px;
|
|
160
|
+
z-index: 10;
|
|
132
161
|
cursor: pointer;
|
|
133
162
|
}
|
|
134
163
|
.card-wrapper-image .check-box-wrapper .check-box {
|
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
.card-wrapper-image {
|
|
2
2
|
position: relative;
|
|
3
3
|
overflow: hidden;
|
|
4
|
-
cursor: pointer;
|
|
5
4
|
|
|
6
5
|
.card-wrapper {
|
|
7
6
|
position: relative;
|
|
8
7
|
overflow: hidden;
|
|
8
|
+
border-radius: 2px;
|
|
9
|
+
transition: all 0.3s ease-in-out;
|
|
9
10
|
// 宽高:43
|
|
10
11
|
aspect-ratio: 4 / 3;
|
|
12
|
+
|
|
13
|
+
&.disable:not(.active) {
|
|
14
|
+
opacity: 0.4;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.mask {
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: 0;
|
|
20
|
+
z-index: 9;
|
|
21
|
+
display: none;
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
font-size: 18px;
|
|
25
|
+
background: rgba(0, 0, 0, 0.3);
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.active .mask {
|
|
30
|
+
display: block;
|
|
31
|
+
}
|
|
11
32
|
}
|
|
12
33
|
|
|
13
34
|
.card-alias {
|
|
@@ -19,6 +40,8 @@
|
|
|
19
40
|
line-height: 22px;
|
|
20
41
|
white-space: nowrap;
|
|
21
42
|
text-overflow: ellipsis;
|
|
43
|
+
user-select: none;
|
|
44
|
+
-webkit-user-drag: none;
|
|
22
45
|
}
|
|
23
46
|
|
|
24
47
|
&:hover .check-box-wrapper .check-box,
|
|
@@ -30,6 +53,7 @@
|
|
|
30
53
|
position: absolute;
|
|
31
54
|
top: 8px;
|
|
32
55
|
left: 8px;
|
|
56
|
+
z-index: 10;
|
|
33
57
|
cursor: pointer;
|
|
34
58
|
|
|
35
59
|
.check-box {
|
|
@@ -59,9 +59,18 @@
|
|
|
59
59
|
overflow: hidden;
|
|
60
60
|
|
|
61
61
|
.item-thumb {
|
|
62
|
+
position: relative;
|
|
62
63
|
width: 50px;
|
|
63
64
|
height: 38px;
|
|
64
65
|
overflow: hidden;
|
|
66
|
+
|
|
67
|
+
.item-tag {
|
|
68
|
+
position: absolute;
|
|
69
|
+
top: 50%;
|
|
70
|
+
left: 50%;
|
|
71
|
+
color: white;
|
|
72
|
+
transform: translate(-50%, -50%);
|
|
73
|
+
}
|
|
65
74
|
}
|
|
66
75
|
|
|
67
76
|
.item-alias {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, normalizeStyle, createVNode, unref,
|
|
1
|
+
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, normalizeStyle, createVNode, unref, createCommentVNode, Fragment, withCtx, createTextVNode, createElementVNode, createBlock, mergeProps, renderList, withModifiers, toDisplayString } from "vue";
|
|
2
2
|
import { IconPlus } from "@arco-design/web-vue/es/icon";
|
|
3
|
-
import { IconResource, IconComputer } from "@arco-iconbox/vue-cmstop-icons";
|
|
3
|
+
import { IconResource, IconComputer, IconVideoTag, IconAudioTag } from "@arco-iconbox/vue-cmstop-icons";
|
|
4
4
|
import { Progress, Dropdown, Doption, Image } from "@arco-design/web-vue";
|
|
5
5
|
import magic from "./assets/magic.js";
|
|
6
6
|
import { DEFAULT_BASE_API } from "../config.js";
|
|
@@ -9,9 +9,13 @@ const _hoisted_1 = {
|
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "thumb-upload-loading"
|
|
11
11
|
};
|
|
12
|
-
const _hoisted_2 = {
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const _hoisted_2 = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "thumb-upload-text"
|
|
15
|
+
};
|
|
16
|
+
const _hoisted_3 = { class: "thumb-handler-list" };
|
|
17
|
+
const _hoisted_4 = ["onClick"];
|
|
18
|
+
const _hoisted_5 = {
|
|
15
19
|
key: 3,
|
|
16
20
|
class: "thumb-select-tag"
|
|
17
21
|
};
|
|
@@ -39,7 +43,7 @@ const _sfc_main = defineComponent({
|
|
|
39
43
|
var _a;
|
|
40
44
|
return ((_a = props.meta) == null ? void 0 : _a.progress) != null;
|
|
41
45
|
});
|
|
42
|
-
const
|
|
46
|
+
const realThumb = computed(() => {
|
|
43
47
|
if (["image", "video"].includes(props.catalog || "")) {
|
|
44
48
|
return props.thumb || props.url || "";
|
|
45
49
|
}
|
|
@@ -75,7 +79,7 @@ const _sfc_main = defineComponent({
|
|
|
75
79
|
emits("edit", { key });
|
|
76
80
|
}
|
|
77
81
|
return (_ctx, _cache) => {
|
|
78
|
-
var _a, _b;
|
|
82
|
+
var _a, _b, _c;
|
|
79
83
|
return openBlock(), createElementBlock("div", {
|
|
80
84
|
class: normalizeClass(["thumb-select-wrapper", classList.value]),
|
|
81
85
|
style: normalizeStyle(styleObject.value)
|
|
@@ -83,8 +87,9 @@ const _sfc_main = defineComponent({
|
|
|
83
87
|
isUploading.value ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
84
88
|
createVNode(unref(Progress), {
|
|
85
89
|
type: "circle",
|
|
86
|
-
percent: (
|
|
87
|
-
}, null, 8, ["percent"])
|
|
90
|
+
percent: (_a = _ctx.meta) == null ? void 0 : _a.progress
|
|
91
|
+
}, null, 8, ["percent"]),
|
|
92
|
+
((_b = _ctx.meta) == null ? void 0 : _b.isTrans) ? (openBlock(), createElementBlock("div", _hoisted_2, "\u8F6C\u7801\u4E2D...")) : createCommentVNode("v-if", true)
|
|
88
93
|
])) : _ctx.isEdit && !_ctx.url ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
89
94
|
createCommentVNode(" \u7F16\u8F91\u6A21\u5F0F\u4E0B\u53EF\u4F7F\u7528\u60AC\u6D6E\u6846\u5FEB\u901F\u63D2\u5165\u7D20\u6750 "),
|
|
90
95
|
createVNode(unref(Dropdown), {
|
|
@@ -123,20 +128,23 @@ const _sfc_main = defineComponent({
|
|
|
123
128
|
_ctx.catalog ? (openBlock(), createBlock(unref(Image), mergeProps({
|
|
124
129
|
key: 0,
|
|
125
130
|
class: "thumb-image",
|
|
126
|
-
src:
|
|
131
|
+
src: realThumb.value
|
|
127
132
|
}, aImageAttr.value), null, 16, ["src"])) : createCommentVNode("v-if", true),
|
|
128
133
|
createCommentVNode(" \u5C55\u793A\u6A21\u5F0F "),
|
|
129
|
-
createElementVNode("div",
|
|
134
|
+
createElementVNode("div", _hoisted_3, [
|
|
130
135
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.handlersKey, (item) => {
|
|
131
136
|
return openBlock(), createElementBlock("div", {
|
|
132
137
|
key: item.key,
|
|
133
138
|
class: "handler-item",
|
|
134
139
|
onClick: withModifiers(() => handleOption(item.key), ["stop"])
|
|
135
|
-
}, toDisplayString(item.label), 9,
|
|
140
|
+
}, toDisplayString(item.label), 9, _hoisted_4);
|
|
136
141
|
}), 128))
|
|
137
142
|
])
|
|
138
143
|
], 64)) : createCommentVNode("v-if", true),
|
|
139
|
-
["video", "audio"].includes(_ctx.catalog) && _ctx.meta ? (openBlock(), createElementBlock("div",
|
|
144
|
+
["video", "audio"].includes(_ctx.catalog) && _ctx.meta ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
145
|
+
_ctx.catalog === "video" ? (openBlock(), createBlock(unref(IconVideoTag), { key: 0 })) : (openBlock(), createBlock(unref(IconAudioTag), { key: 1 })),
|
|
146
|
+
createTextVNode(" " + toDisplayString(unref(mediaTime)((_c = _ctx.meta) == null ? void 0 : _c.length)), 1)
|
|
147
|
+
])) : createCommentVNode("v-if", true)
|
|
140
148
|
], 6);
|
|
141
149
|
};
|
|
142
150
|
}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
.thumb-select-wrapper .thumb-upload-loading {
|
|
13
13
|
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
14
15
|
align-items: center;
|
|
15
16
|
justify-content: center;
|
|
16
17
|
width: 100%;
|
|
@@ -29,6 +30,8 @@
|
|
|
29
30
|
.thumb-select-wrapper .thumb-image img {
|
|
30
31
|
width: 100%;
|
|
31
32
|
height: 100%;
|
|
33
|
+
user-select: none;
|
|
34
|
+
-webkit-user-drag: none;
|
|
32
35
|
}
|
|
33
36
|
.thumb-select-wrapper .thumb-handler-list {
|
|
34
37
|
position: absolute;
|
|
@@ -68,9 +71,13 @@
|
|
|
68
71
|
position: absolute;
|
|
69
72
|
right: 5px;
|
|
70
73
|
bottom: 5px;
|
|
71
|
-
|
|
74
|
+
display: flex;
|
|
75
|
+
gap: 2px;
|
|
76
|
+
align-items: center;
|
|
77
|
+
padding: 2px 5px;
|
|
72
78
|
color: #fff;
|
|
73
79
|
font-size: 12px;
|
|
80
|
+
line-height: 14px;
|
|
74
81
|
background-color: rgba(0, 0, 0, 0.5);
|
|
75
82
|
border-radius: 16px;
|
|
76
83
|
opacity: 1;
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
// loading 模式
|
|
14
14
|
.thumb-upload-loading {
|
|
15
15
|
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
16
17
|
align-items: center;
|
|
17
18
|
justify-content: center;
|
|
18
19
|
width: 100%;
|
|
@@ -37,6 +38,8 @@
|
|
|
37
38
|
img {
|
|
38
39
|
width: 100%;
|
|
39
40
|
height: 100%;
|
|
41
|
+
user-select: none;
|
|
42
|
+
-webkit-user-drag: none;
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
45
|
|
|
@@ -89,9 +92,13 @@
|
|
|
89
92
|
position: absolute;
|
|
90
93
|
right: 5px;
|
|
91
94
|
bottom: 5px;
|
|
92
|
-
|
|
95
|
+
display: flex;
|
|
96
|
+
gap: 2px;
|
|
97
|
+
align-items: center;
|
|
98
|
+
padding: 2px 5px;
|
|
93
99
|
color: #fff;
|
|
94
100
|
font-size: 12px;
|
|
101
|
+
line-height: 14px;
|
|
95
102
|
background-color: rgba(0, 0, 0, 0.5);
|
|
96
103
|
border-radius: 16px;
|
|
97
104
|
opacity: 1;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function getTranscodingProgress(BASE_API: string, id: number): import("axios").AxiosPromise<any>;
|
|
2
|
+
/**
|
|
3
|
+
* 转码逻辑
|
|
4
|
+
* @description 转码逻辑抽离,后期所有涉及到转码的地方都可用该方法
|
|
5
|
+
*/
|
|
6
|
+
export declare class TranscodingTask {
|
|
7
|
+
file: any;
|
|
8
|
+
pollCount: number;
|
|
9
|
+
taskInterval: any;
|
|
10
|
+
constructor(file: any);
|
|
11
|
+
start(BASE_API: string, callback: (progress: number) => any): Promise<unknown>;
|
|
12
|
+
abort(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import request from "./request.js";
|
|
2
|
+
function getTranscodingProgress(BASE_API, id) {
|
|
3
|
+
return request(BASE_API, {
|
|
4
|
+
url: `/poplar/v2/transcoding/progress?id=${id}`,
|
|
5
|
+
method: "get"
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
class TranscodingTask {
|
|
9
|
+
constructor(file) {
|
|
10
|
+
this.file = file;
|
|
11
|
+
this.pollCount = 0;
|
|
12
|
+
}
|
|
13
|
+
start(BASE_API, callback) {
|
|
14
|
+
if (!this.file.id)
|
|
15
|
+
return Promise.reject(new Error("file error"));
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
const handleTranscoding = async () => {
|
|
18
|
+
const { code, message } = await getTranscodingProgress(
|
|
19
|
+
BASE_API,
|
|
20
|
+
this.file.id
|
|
21
|
+
);
|
|
22
|
+
if (code !== 0)
|
|
23
|
+
reject(new Error(message));
|
|
24
|
+
if (message.state === 1) {
|
|
25
|
+
callback(message.progress);
|
|
26
|
+
if (message.progress === 1 && ++this.pollCount === 3) {
|
|
27
|
+
this.abort();
|
|
28
|
+
resolve(false);
|
|
29
|
+
}
|
|
30
|
+
} else if (message.state === 2) {
|
|
31
|
+
this.abort();
|
|
32
|
+
resolve(false);
|
|
33
|
+
} else if (message.state === 3) {
|
|
34
|
+
this.abort();
|
|
35
|
+
resolve(true);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
this.taskInterval = setInterval(handleTranscoding, 5e3);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
abort() {
|
|
42
|
+
clearInterval(this.taskInterval);
|
|
43
|
+
this.taskInterval = null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export { TranscodingTask, getTranscodingProgress };
|