@cmstops/pro-compo 0.3.43 → 0.3.45

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.
Files changed (43) hide show
  1. package/dist/index.css +38 -2
  2. package/dist/index.min.css +1 -1
  3. package/es/hooks/useAttachement.d.ts +5 -0
  4. package/es/hooks/useLocalStorage.d.ts +8 -0
  5. package/es/hooks/useLocalStorage.js +31 -0
  6. package/es/hooks/useUpload.d.ts +2 -1
  7. package/es/hooks/useUpload.js +48 -11
  8. package/es/index.css +38 -2
  9. package/es/selectResourceModal/component.js +176 -43
  10. package/es/selectResourceModal/components/ListCardWrapper/index.js +9 -7
  11. package/es/selectResourceModal/components/ListContentLocal/index.js +15 -9
  12. package/es/selectResourceModal/components/ListSelected/index.js +19 -6
  13. package/es/selectResourceModal/components/ListTabs/index.js +61 -0
  14. package/es/selectResourceModal/scripts/useResourceSelect.d.ts +7 -0
  15. package/es/selectResourceModal/scripts/useResourceSelect.js +25 -0
  16. package/es/selectResourceModal/style/index.css +30 -1
  17. package/es/selectResourceModal/style/listCardWrapper.less +25 -1
  18. package/es/selectResourceModal/style/listSelected.less +9 -0
  19. package/es/thumbCard/component.js +21 -13
  20. package/es/thumbCard/style/index.css +8 -1
  21. package/es/thumbCard/style/index.less +8 -1
  22. package/es/utils/transcodeMedia.d.ts +13 -0
  23. package/es/utils/transcodeMedia.js +46 -0
  24. package/lib/hooks/useLocalStorage.js +34 -0
  25. package/lib/hooks/useUpload.js +47 -10
  26. package/lib/index.css +38 -2
  27. package/lib/selectResourceModal/component.js +174 -41
  28. package/lib/selectResourceModal/components/ListCardWrapper/index.js +9 -7
  29. package/lib/selectResourceModal/components/ListContentLocal/index.js +14 -8
  30. package/lib/selectResourceModal/components/ListSelected/index.js +18 -5
  31. package/lib/selectResourceModal/components/ListTabs/index.js +62 -0
  32. package/lib/selectResourceModal/scripts/useResourceSelect.js +27 -0
  33. package/lib/selectResourceModal/style/index.css +30 -1
  34. package/lib/selectResourceModal/style/listCardWrapper.less +25 -1
  35. package/lib/selectResourceModal/style/listSelected.less +9 -0
  36. package/lib/thumbCard/component.js +19 -11
  37. package/lib/thumbCard/style/index.css +8 -1
  38. package/lib/thumbCard/style/index.less +8 -1
  39. package/lib/utils/transcodeMedia.js +49 -0
  40. package/package.json +2 -2
  41. package/es/selectResourceModal/components/Main/index.js +0 -215
  42. package/lib/selectResourceModal/components/Main/index.js +0 -216
  43. /package/es/selectResourceModal/components/{Main → ListTabs}/index.d.ts +0 -0
@@ -11,5 +11,6 @@ export declare function addMedia(BASE_API: string, params: TypeAddMediaParam): i
11
11
  export default function useUpload(): {
12
12
  list: import("vue").Ref<any[]>;
13
13
  uploadFile: (BASE_API: string, file: any, dir: number | undefined, repoId: number, callback?: CallbackFunc | undefined) => void;
14
- recordTaskStatusChange: (file: any, progress: number) => void;
14
+ transcodingFile: (BASE_API: string, file: any) => void;
15
+ recordTaskStatusChange: (file: any, progress: number, isTrans?: boolean | undefined) => void;
15
16
  };
@@ -1,7 +1,9 @@
1
- import { ref } from "vue";
1
+ import { ref, watch } 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";
6
+ import useLocalstorage from "./useLocalStorage.js";
5
7
  function addMedia(BASE_API, params) {
6
8
  return request(BASE_API, {
7
9
  url: "/poplar/v2/media/add",
@@ -10,7 +12,8 @@ function addMedia(BASE_API, params) {
10
12
  });
11
13
  }
12
14
  function useUpload() {
13
- const list = ref([]);
15
+ const { get, set, remove } = useLocalstorage("LOCAL_RESOURCES");
16
+ const list = ref(get() || []);
14
17
  function uploadSuccess(file) {
15
18
  const originList = list.value;
16
19
  const taskIndex = originList.findIndex(
@@ -21,13 +24,15 @@ function useUpload() {
21
24
  list.value = originList;
22
25
  }
23
26
  }
24
- function recordTaskStatusChange(file, progress) {
27
+ function recordTaskStatusChange(file, progress, isTrans) {
25
28
  const originList = list.value;
26
29
  const taskIndex = originList.findIndex((task) => task.id === file.id);
27
30
  if (taskIndex !== -1) {
28
- progress !== -1 && (originList[taskIndex].progress = progress);
31
+ progress !== -1 && (originList[taskIndex].progress = Math.round(progress));
29
32
  file.status != null && (originList[taskIndex].status = file.status);
30
33
  file.msg != null && (originList[taskIndex].msg = file.msg);
34
+ if (isTrans)
35
+ originList[taskIndex].isTrans = true;
31
36
  originList[taskIndex].url = file.url;
32
37
  } else {
33
38
  file.created_at = new Date().getTime();
@@ -64,24 +69,56 @@ function useUpload() {
64
69
  });
65
70
  if (code !== 0) {
66
71
  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: "\u6DFB\u52A0\u5230\u7D20\u6750\u5E93\u5931\u8D25" }, -1);
72
+ recordTaskStatusChange({ ...newFile, status: 2, msg: "\u4E0A\u4F20\u5931\u8D25" }, -1);
68
73
  return;
69
74
  }
70
- console.log("\u{1F680}\u{1F680}\u{1F680}\u{1F680}\u{1F680}\u{1F680} \u4E0A\u4F20\u6210\u529F\uFF1A", url);
71
- recordTaskStatusChange({ ...newFile, url: message.url, status: 0 }, 1);
72
- setTimeout(() => {
73
- uploadSuccess({ ...message, sig_id: newFile.sig_id });
74
- }, 200);
75
+ console.log("\u{1F680}\u{1F680}\u{1F680}\u{1F680}\u{1F680}\u{1F680} \u4E0A\u4F20\u6210\u529F\uFF1A", url, message);
76
+ if (!["video", "audio"].includes(message.catalog)) {
77
+ recordTaskStatusChange({ ...newFile, url: message.url, status: 0 }, 1);
78
+ setTimeout(() => uploadSuccess({ ...message, sig_id: newFile.sig_id }), 200);
79
+ } else {
80
+ recordTaskStatusChange(newFile, 0);
81
+ }
75
82
  callback && callback({ ...message, sig_id: newFile.sig_id }, "success");
76
83
  }).catch((e) => {
77
84
  console.log("\u{1F525}\u{1F525}\u{1F525}\u{1F525}\u{1F525} \u4E0A\u4F20\u5931\u8D25\uFF1A", e);
78
- recordTaskStatusChange({ ...newFile, status: 2, msg: "\u4E0A\u4F20\u4E2D\u65AD" }, -1);
85
+ recordTaskStatusChange({ ...newFile, status: 2, msg: "\u5931\u8D25" }, -1);
79
86
  callback && callback(newFile, "fail");
80
87
  });
81
88
  };
89
+ const transcodingFile = (BASE_API, file) => {
90
+ if (!["video", "audio"].includes(file.catalog))
91
+ return;
92
+ const task = new TranscodingTask(file);
93
+ const idx = list.value.findIndex(
94
+ (item2) => item2.sig_id === file.sig_id
95
+ );
96
+ if (idx === -1)
97
+ return;
98
+ const item = list.value[idx];
99
+ recordTaskStatusChange(item, 0, true);
100
+ const progress = (progress2) => recordTaskStatusChange(item, progress2);
101
+ const transing = task.start(BASE_API, progress);
102
+ transing.then((res) => {
103
+ if (res) {
104
+ console.log("\u{1F680}\u{1F680}\u{1F680}\u{1F680}\u{1F680}\u{1F680} \u8F6C\u7801\u6210\u529F");
105
+ recordTaskStatusChange({ ...item, status: 0 }, 1);
106
+ setTimeout(() => uploadSuccess(file), 200);
107
+ } else {
108
+ console.log("\u{1F525}\u{1F525}\u{1F525}\u{1F525}\u{1F525} \u8F6C\u7801\u5931\u8D25\uFF1A", item);
109
+ recordTaskStatusChange({ ...item, status: 2, msg: "\u8F6C\u7801\u5931\u8D25" }, -1);
110
+ }
111
+ }).catch((e) => {
112
+ console.log("\u{1F525}\u{1F525}\u{1F525}\u{1F525}\u{1F525} \u8F6C\u7801\u5931\u8D25", e);
113
+ recordTaskStatusChange({ ...item, status: 2, msg: "\u8F6C\u7801\u5931\u8D25" }, -1);
114
+ });
115
+ };
116
+ watch(() => list.value, set, { deep: true });
117
+ window.onbeforeunload = remove;
82
118
  return {
83
119
  list,
84
120
  uploadFile,
121
+ transcodingFile,
85
122
  recordTaskStatusChange
86
123
  };
87
124
  }
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
- padding: 2px 10px;
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,7 +1,31 @@
1
- import { defineComponent, ref, openBlock, createElementBlock, createBlock, unref, withCtx, createVNode, createCommentVNode } from "vue";
2
- import { Drawer, Modal } from "@arco-design/web-vue";
3
- import _sfc_main$1 from "./components/Main/index.js";
1
+ import { defineComponent, computed, ref, provide, openBlock, createElementBlock, createBlock, resolveDynamicComponent, unref, mergeProps, withCtx, createElementVNode, createCommentVNode, createVNode, withDirectives, vShow, createTextVNode } from "vue";
2
+ import { Drawer, Modal, Scrollbar, Pagination, Button } from "@arco-design/web-vue";
3
+ import emptyData from "../emptyData/index.js";
4
+ import _sfc_main$1 from "./components/ListTabs/index.js";
5
+ import _sfc_main$2 from "./components/ListFilter/index.js";
6
+ import _sfc_main$3 from "./components/ListContent/index.js";
7
+ import _sfc_main$5 from "./components/ListSelected/index.js";
8
+ import _sfc_main$4 from "./components/ListContentLocal/index.js";
9
+ import useAttachement from "../hooks/useAttachement.js";
10
+ import { DEFAULT_BASE_API } from "../config.js";
11
+ import { useResourceSelect } from "./scripts/useResourceSelect.js";
4
12
  const _hoisted_1 = { class: "resource-select-wrap" };
13
+ const _hoisted_2 = { class: "resource-select-main" };
14
+ const _hoisted_3 = {
15
+ key: 0,
16
+ class: "resource-select-container"
17
+ };
18
+ const _hoisted_4 = {
19
+ key: 0,
20
+ class: "resource-select-filter"
21
+ };
22
+ const _hoisted_5 = { class: "resource-select-content" };
23
+ const _hoisted_6 = { class: "resource-select-footer" };
24
+ const _hoisted_7 = { class: "footer-left" };
25
+ const _hoisted_8 = {
26
+ key: 0,
27
+ class: "footer-right"
28
+ };
5
29
  const _sfc_main = defineComponent({
6
30
  ...{ name: "selectResourceModal" },
7
31
  __name: "component",
@@ -17,55 +41,164 @@ const _sfc_main = defineComponent({
17
41
  setup(__props, { emit: __emit }) {
18
42
  const props = __props;
19
43
  const emits = __emit;
20
- const wrapMode = ref(props.wrap || "modal");
21
- const handleClose = () => {
44
+ const BASE_API = props.BASE_API || DEFAULT_BASE_API;
45
+ const wrapProps = computed(() => {
46
+ if (props.wrap === "drawer") {
47
+ return {
48
+ class: "resource-select-drawer",
49
+ header: false,
50
+ width: "1024px",
51
+ footer: false
52
+ };
53
+ }
54
+ return {
55
+ bodyClass: "resource-select-modal-body",
56
+ width: "986px",
57
+ closable: false,
58
+ hideTitle: false,
59
+ footer: false
60
+ };
61
+ });
62
+ const activeKey = ref("all");
63
+ provide("userInfo", computed(() => props.userInfo));
64
+ provide("baseAPI", BASE_API);
65
+ const {
66
+ list,
67
+ total,
68
+ limit,
69
+ loading,
70
+ changeKey,
71
+ changeFilter,
72
+ changePage,
73
+ changeSize
74
+ } = useAttachement({ key: "all", BASE_API });
75
+ const {
76
+ selected,
77
+ selectedKeys,
78
+ disableSelect,
79
+ handleSelect,
80
+ handleClear
81
+ } = useResourceSelect(props);
82
+ function handleClose() {
83
+ handleClear();
22
84
  emits("update:visible", false);
23
- };
85
+ }
24
86
  const handleSubmit = (data) => {
25
87
  emits("submit", JSON.parse(JSON.stringify(data)));
26
88
  };
89
+ const handleSelectOne = (params) => {
90
+ if (Array.isArray(params))
91
+ handleSubmit(params);
92
+ else
93
+ handleSubmit([params]);
94
+ handleClose();
95
+ };
96
+ function handleConfirm() {
97
+ handleSelectOne(selected.value);
98
+ }
99
+ function handleToUpload() {
100
+ changeKey("local");
101
+ activeKey.value = "local";
102
+ }
27
103
  return (_ctx, _cache) => {
28
104
  return openBlock(), createElementBlock("div", _hoisted_1, [
29
- wrapMode.value === "drawer" ? (openBlock(), createBlock(unref(Drawer), {
30
- key: 0,
31
- visible: _ctx.visible,
32
- width: "1024px",
33
- header: false,
34
- footer: false,
35
- class: "resource-select-drawer"
36
- }, {
37
- default: withCtx(() => [
38
- createVNode(_sfc_main$1, {
39
- BASE_API: _ctx.BASE_API,
40
- userInfo: _ctx.userInfo,
41
- maxcount: _ctx.maxcount,
42
- filterOptions: _ctx.filterOptions,
43
- onClose: handleClose,
44
- onSubmit: handleSubmit
45
- }, null, 8, ["BASE_API", "userInfo", "maxcount", "filterOptions"])
46
- ]),
47
- _: 1
48
- }, 8, ["visible"])) : wrapMode.value === "modal" ? (openBlock(), createBlock(unref(Modal), {
49
- key: 1,
50
- visible: _ctx.visible,
51
- width: "986px",
52
- "body-class": "resource-select-modal-body",
53
- "hide-title": false,
54
- closable: false,
55
- footer: false
56
- }, {
105
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.wrap === "drawer" ? unref(Drawer) : unref(Modal)), mergeProps({ visible: _ctx.visible }, wrapProps.value), {
57
106
  default: withCtx(() => [
58
- createVNode(_sfc_main$1, {
59
- BASE_API: _ctx.BASE_API,
60
- userInfo: _ctx.userInfo,
61
- maxcount: _ctx.maxcount,
62
- filterOptions: _ctx.filterOptions,
63
- onClose: handleClose,
64
- onSubmit: handleSubmit
65
- }, null, 8, ["BASE_API", "userInfo", "maxcount", "filterOptions"])
107
+ createElementVNode("div", _hoisted_2, [
108
+ _ctx.userInfo ? (openBlock(), createElementBlock("div", _hoisted_3, [
109
+ createCommentVNode(" \u5934\u90E8 "),
110
+ createVNode(_sfc_main$1, {
111
+ "model-value": activeKey.value,
112
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeKey.value = $event),
113
+ onChange: unref(changeKey),
114
+ onClose: handleClose
115
+ }, null, 8, ["model-value", "onChange"]),
116
+ createCommentVNode(" \u7B5B\u9009 "),
117
+ activeKey.value !== "local" ? (openBlock(), createElementBlock("div", _hoisted_4, [
118
+ createVNode(_sfc_main$2, {
119
+ "disable-upload-by": !["all", "remind"].includes(activeKey.value),
120
+ filterOptions: _ctx.filterOptions,
121
+ onChange: unref(changeFilter),
122
+ onUpload: handleToUpload
123
+ }, null, 8, ["disable-upload-by", "filterOptions", "onChange"])
124
+ ])) : createCommentVNode("v-if", true),
125
+ createCommentVNode(" \u5217\u8868\u90E8\u5206 "),
126
+ createElementVNode("div", _hoisted_5, [
127
+ createVNode(unref(Scrollbar), {
128
+ "outer-style": { height: "100%" },
129
+ style: { "height": "100%", "overflow": "auto" }
130
+ }, {
131
+ default: withCtx(() => [
132
+ withDirectives(createVNode(_sfc_main$3, {
133
+ loading: unref(loading),
134
+ list: unref(list),
135
+ disable: unref(disableSelect),
136
+ "select-keys": unref(selectedKeys),
137
+ onSelect: unref(handleSelect),
138
+ onSelectOne: handleSelectOne
139
+ }, null, 8, ["loading", "list", "disable", "select-keys", "onSelect"]), [
140
+ [vShow, activeKey.value !== "local"]
141
+ ]),
142
+ withDirectives(createVNode(_sfc_main$4, {
143
+ disable: unref(disableSelect),
144
+ "select-keys": unref(selectedKeys),
145
+ onSelect: unref(handleSelect),
146
+ onSelectOne: handleSelectOne
147
+ }, null, 8, ["disable", "select-keys", "onSelect"]), [
148
+ [vShow, activeKey.value === "local"]
149
+ ])
150
+ ]),
151
+ _: 1
152
+ })
153
+ ]),
154
+ createCommentVNode(" \u5E95\u90E8 "),
155
+ createElementVNode("div", _hoisted_6, [
156
+ createElementVNode("div", _hoisted_7, [
157
+ activeKey.value !== "local" ? (openBlock(), createBlock(unref(Pagination), {
158
+ key: 0,
159
+ total: unref(total),
160
+ "page-size": unref(limit),
161
+ "show-total": "",
162
+ "show-page-size": "",
163
+ "base-size": 3,
164
+ "buffer-size": 1,
165
+ onChange: _cache[1] || (_cache[1] = (e) => unref(changePage)((e - 1) * unref(limit))),
166
+ onPageSizeChange: unref(changeSize)
167
+ }, null, 8, ["total", "page-size", "onPageSizeChange"])) : createCommentVNode("v-if", true)
168
+ ]),
169
+ unref(selected).length ? (openBlock(), createElementBlock("div", _hoisted_8, [
170
+ createVNode(_sfc_main$5, {
171
+ maxcount: _ctx.maxcount,
172
+ selected: unref(selected),
173
+ onRemove: unref(handleSelect),
174
+ onClear: unref(handleClear)
175
+ }, null, 8, ["maxcount", "selected", "onRemove", "onClear"]),
176
+ createVNode(unref(Button), { onClick: handleClose }, {
177
+ default: withCtx(() => [
178
+ createTextVNode("\u53D6\u6D88")
179
+ ]),
180
+ _: 1
181
+ }),
182
+ createVNode(unref(Button), {
183
+ type: "primary",
184
+ onClick: handleConfirm
185
+ }, {
186
+ default: withCtx(() => [
187
+ createTextVNode("\u786E\u5B9A")
188
+ ]),
189
+ _: 1
190
+ })
191
+ ])) : createCommentVNode("v-if", true)
192
+ ])
193
+ ])) : (openBlock(), createBlock(unref(emptyData), {
194
+ key: 1,
195
+ type: "empty",
196
+ customTip: "\u6682\u65E0\u6743\u9650"
197
+ }))
198
+ ])
66
199
  ]),
67
200
  _: 1
68
- }, 8, ["visible"])) : createCommentVNode("v-if", true)
201
+ }, 16, ["visible"]))
69
202
  ]);
70
203
  };
71
204
  }
@@ -1,10 +1,11 @@
1
1
  import { defineComponent, computed, openBlock, createElementBlock, withModifiers, createElementVNode, normalizeClass, renderSlot, toDisplayString, createCommentVNode } from "vue";
2
- const _hoisted_1 = { class: "card-alias" };
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 _hoisted_3 = {
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", _hoisted_1, toDisplayString(_ctx.item.alias), 1),
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", _hoisted_2, toDisplayString(selectedOrder.value[_ctx.item.id]), 1)) : !_ctx.disable ? (openBlock(), createElementBlock("div", _hoisted_3)) : createCommentVNode("v-if", true)
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, computed, inject, openBlock, createElementBlock, createCommentVNode, createElementVNode, createVNode, unref, toDisplayString, Fragment, renderList, createBlock, withCtx } from "vue";
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(baseAPI, file.file, 0, repoId.value);
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-alias" };
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(), createElementBlock(Fragment, { key: 1 }, [
60
- createTextVNode(" \u97F3\u9891 ")
61
- ], 64)) : createCommentVNode("v-if", true)
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", _hoisted_7, toDisplayString(item.alias), 1),
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)
@@ -0,0 +1,61 @@
1
+ import { defineComponent, computed, openBlock, createElementBlock, createVNode, unref, withCtx } from "vue";
2
+ import { IconClose } from "@arco-design/web-vue/es/icon";
3
+ import { Tabs, Button, TabPane } from "@arco-design/web-vue";
4
+ const _hoisted_1 = { class: "resource-select-header" };
5
+ const _sfc_main = defineComponent({
6
+ __name: "index",
7
+ props: {
8
+ modelValue: {}
9
+ },
10
+ emits: ["update:model-value", "change", "close"],
11
+ setup(__props, { emit: __emit }) {
12
+ const props = __props;
13
+ const emits = __emit;
14
+ const activeKey = computed({
15
+ get: () => props.modelValue,
16
+ set: (value) => emits("update:model-value", value)
17
+ });
18
+ return (_ctx, _cache) => {
19
+ return openBlock(), createElementBlock("div", _hoisted_1, [
20
+ createVNode(unref(Tabs), {
21
+ "active-key": activeKey.value,
22
+ "onUpdate:activeKey": _cache[1] || (_cache[1] = ($event) => activeKey.value = $event),
23
+ onChange: _cache[2] || (_cache[2] = (e) => emits("change", e))
24
+ }, {
25
+ extra: withCtx(() => [
26
+ createVNode(unref(Button), {
27
+ type: "secondary",
28
+ shape: "round",
29
+ onClick: _cache[0] || (_cache[0] = ($event) => emits("close"))
30
+ }, {
31
+ icon: withCtx(() => [
32
+ createVNode(unref(IconClose))
33
+ ]),
34
+ _: 1
35
+ })
36
+ ]),
37
+ default: withCtx(() => [
38
+ createVNode(unref(TabPane), {
39
+ key: "all",
40
+ title: "\u5168\u90E8\u7D20\u6750"
41
+ }),
42
+ createVNode(unref(TabPane), {
43
+ key: "my",
44
+ title: "\u6211\u7684\u7D20\u6750"
45
+ }),
46
+ createVNode(unref(TabPane), {
47
+ key: "remind",
48
+ title: "\u63D0\u9192\u6211\u7684"
49
+ }),
50
+ createVNode(unref(TabPane), {
51
+ key: "local",
52
+ title: "\u672C\u5730\u7D20\u6750"
53
+ })
54
+ ]),
55
+ _: 1
56
+ }, 8, ["active-key"])
57
+ ]);
58
+ };
59
+ }
60
+ });
61
+ export { _sfc_main as default };
@@ -0,0 +1,7 @@
1
+ export declare function useResourceSelect(props: any): {
2
+ selected: import("vue").Ref<any[]>;
3
+ selectedKeys: import("vue").ComputedRef<any[]>;
4
+ disableSelect: import("vue").ComputedRef<any>;
5
+ handleSelect: (params: any) => void;
6
+ handleClear: () => void;
7
+ };