@cmstops/pro-compo 0.1.14 → 0.1.15

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 (150) hide show
  1. package/dist/gif.worker.js +3 -0
  2. package/dist/index.css +469 -1
  3. package/dist/index.min.css +1 -1
  4. package/es/contentDetailList/component.js +1 -2
  5. package/es/contentDetailList/components/Content/CompoItem/index.js +1 -2
  6. package/es/contentDetailList/components/Content/ContentListItem/index.js +1 -2
  7. package/es/contentDetailList/components/Content/DocItem/ApprovalStateMap/index.js +1 -2
  8. package/es/contentDetailList/components/Content/DocItem/index.js +1 -2
  9. package/es/contentDetailList/components/Content/KongoNavItem/index.js +1 -2
  10. package/es/contentDetailList/components/Content/LiveItem/index.js +1 -2
  11. package/es/contentDetailList/components/Content/MaccountItem/index.js +1 -2
  12. package/es/contentDetailList/components/Content/index.js +1 -2
  13. package/es/contentDetailList/components/Doc/index.js +1 -2
  14. package/es/contentModal/component.js +1 -2
  15. package/es/contentModal/components/CompoList/CompoFilter/index.js +2 -3
  16. package/es/contentModal/components/CompoList/index.js +2 -3
  17. package/es/contentModal/components/ViewAllColumn/MediaFilter/index.js +1 -2
  18. package/es/contentModal/components/ViewAllColumn/columnTree/index.js +1 -2
  19. package/es/contentModal/components/ViewAllColumn/index.js +1 -2
  20. package/es/contentModal/components/storeBox/index.js +1 -2
  21. package/es/gif.worker.js +3 -0
  22. package/es/hooks/assets.d.ts +1 -0
  23. package/es/hooks/assets.js +9 -0
  24. package/es/hooks/user.d.ts +1 -3
  25. package/es/imageCrop/component.d.ts +0 -0
  26. package/es/imageCrop/component.js +472 -0
  27. package/es/imageCrop/index.d.ts +2 -0
  28. package/es/imageCrop/index.js +7 -0
  29. package/es/imageCrop/script/api.d.ts +1 -0
  30. package/es/imageCrop/script/api.js +11 -0
  31. package/es/imageCrop/style/cropper.less +291 -0
  32. package/es/imageCrop/style/css.js +1 -0
  33. package/es/imageCrop/style/imageCropper.less +133 -0
  34. package/es/imageCrop/style/index.css +366 -0
  35. package/es/imageCrop/style/index.d.ts +1 -0
  36. package/es/imageCrop/style/index.js +1 -0
  37. package/es/imageCrop/style/index.less +2 -0
  38. package/es/index.css +469 -1
  39. package/es/index.d.ts +2 -0
  40. package/es/index.js +2 -0
  41. package/es/index.less +2 -0
  42. package/es/mediaFilter/component.js +1 -2
  43. package/es/mediaFilter/components/DocFilter.js +1 -2
  44. package/es/messageBox/list.js +1 -2
  45. package/es/previousVersion/component.js +1 -2
  46. package/es/resourceModal/component.js +4 -7
  47. package/es/resourceModal/components/MediaPreviewer/index.js +1 -2
  48. package/es/resourceModal/components/MediaSelection/DocAiMediaSelected/index.js +10 -19
  49. package/es/resourceModal/components/MediaSelection/MainContent/FileTypeThumb/index.js +4 -9
  50. package/es/resourceModal/components/MediaSelection/MainContent/index.js +7 -15
  51. package/es/resourceModal/components/MediaSelection/ToolbarSearch/index.js +1 -2
  52. package/es/resourceModal/components/MediaSelection/index.js +8 -12
  53. package/es/selectAvatarList/component.js +1 -2
  54. package/es/selectGategory/component.js +1 -2
  55. package/es/selectGategory/components/ColumnSelection/index.js +1 -2
  56. package/es/selectThumb/component.d.ts +0 -0
  57. package/es/selectThumb/component.js +410 -0
  58. package/es/selectThumb/components/card.d.ts +0 -0
  59. package/es/selectThumb/components/card.js +86 -0
  60. package/es/selectThumb/components/colorPalette.d.ts +0 -0
  61. package/es/selectThumb/components/colorPalette.js +75 -0
  62. package/es/selectThumb/index.d.ts +2 -0
  63. package/es/selectThumb/index.js +7 -0
  64. package/es/selectThumb/style/card.less +79 -0
  65. package/es/selectThumb/style/colorPalette.less +0 -0
  66. package/es/selectThumb/style/css.js +1 -0
  67. package/es/selectThumb/style/index.css +101 -0
  68. package/es/selectThumb/style/index.d.ts +1 -0
  69. package/es/selectThumb/style/index.js +1 -0
  70. package/es/selectThumb/style/index.less +27 -0
  71. package/es/uploadBefore/component.js +2 -3
  72. package/es/uploadBefore/components/UploadBefore.js +1 -2
  73. package/es/uploadBefore/components/UploadForClick.js +1 -2
  74. package/es/uploadStep/component.js +2 -3
  75. package/es/userDirector/component.js +1 -2
  76. package/es/userDirector/components/userTree.js +1 -2
  77. package/es/userDirector/style/index.css +2 -1
  78. package/es/userDirector/style/index.less +2 -1
  79. package/es/utils/doc.js +30 -7
  80. package/es/utils/index.d.ts +1 -0
  81. package/es/utils/index.js +6 -1
  82. package/es/utils/tusUpload.d.ts +1 -1
  83. package/es/utils/tusUpload.js +1 -1
  84. package/es/utils/uploadCatalog.d.ts +1 -0
  85. package/lib/contentDetailList/component.js +1 -2
  86. package/lib/contentDetailList/components/Content/CompoItem/index.js +1 -2
  87. package/lib/contentDetailList/components/Content/ContentListItem/index.js +1 -2
  88. package/lib/contentDetailList/components/Content/DocItem/ApprovalStateMap/index.js +1 -2
  89. package/lib/contentDetailList/components/Content/DocItem/index.js +1 -2
  90. package/lib/contentDetailList/components/Content/KongoNavItem/index.js +1 -2
  91. package/lib/contentDetailList/components/Content/LiveItem/index.js +1 -2
  92. package/lib/contentDetailList/components/Content/MaccountItem/index.js +1 -2
  93. package/lib/contentDetailList/components/Content/index.js +1 -2
  94. package/lib/contentDetailList/components/Doc/index.js +1 -2
  95. package/lib/contentModal/component.js +1 -2
  96. package/lib/contentModal/components/CompoList/CompoFilter/index.js +2 -3
  97. package/lib/contentModal/components/CompoList/index.js +2 -3
  98. package/lib/contentModal/components/ViewAllColumn/MediaFilter/index.js +1 -2
  99. package/lib/contentModal/components/ViewAllColumn/columnTree/index.js +1 -2
  100. package/lib/contentModal/components/ViewAllColumn/index.js +1 -2
  101. package/lib/contentModal/components/storeBox/index.js +1 -2
  102. package/lib/hooks/assets.js +11 -0
  103. package/lib/imageCrop/component.js +479 -0
  104. package/lib/imageCrop/index.js +8 -0
  105. package/lib/imageCrop/script/api.js +13 -0
  106. package/lib/imageCrop/style/cropper.less +291 -0
  107. package/lib/imageCrop/style/css.js +2 -0
  108. package/lib/imageCrop/style/imageCropper.less +133 -0
  109. package/lib/imageCrop/style/index.css +366 -0
  110. package/lib/imageCrop/style/index.js +2 -0
  111. package/lib/imageCrop/style/index.less +2 -0
  112. package/lib/index.css +469 -1
  113. package/lib/index.js +16 -12
  114. package/lib/index.less +2 -0
  115. package/lib/mediaFilter/component.js +1 -2
  116. package/lib/mediaFilter/components/DocFilter.js +1 -2
  117. package/lib/messageBox/list.js +1 -2
  118. package/lib/previousVersion/component.js +1 -2
  119. package/lib/resourceModal/component.js +4 -7
  120. package/lib/resourceModal/components/MediaPreviewer/index.js +1 -2
  121. package/lib/resourceModal/components/MediaSelection/DocAiMediaSelected/index.js +10 -19
  122. package/lib/resourceModal/components/MediaSelection/MainContent/FileTypeThumb/index.js +4 -9
  123. package/lib/resourceModal/components/MediaSelection/MainContent/index.js +7 -15
  124. package/lib/resourceModal/components/MediaSelection/ToolbarSearch/index.js +1 -2
  125. package/lib/resourceModal/components/MediaSelection/index.js +8 -12
  126. package/lib/selectAvatarList/component.js +1 -2
  127. package/lib/selectGategory/component.js +1 -2
  128. package/lib/selectGategory/components/ColumnSelection/index.js +1 -2
  129. package/lib/selectThumb/component.js +411 -0
  130. package/lib/selectThumb/components/card.js +87 -0
  131. package/lib/selectThumb/components/colorPalette.js +76 -0
  132. package/lib/selectThumb/index.js +8 -0
  133. package/lib/selectThumb/style/card.less +79 -0
  134. package/lib/selectThumb/style/colorPalette.less +0 -0
  135. package/lib/selectThumb/style/css.js +2 -0
  136. package/lib/selectThumb/style/index.css +101 -0
  137. package/lib/selectThumb/style/index.js +2 -0
  138. package/lib/selectThumb/style/index.less +27 -0
  139. package/lib/uploadBefore/component.js +2 -3
  140. package/lib/uploadBefore/components/UploadBefore.js +1 -2
  141. package/lib/uploadBefore/components/UploadForClick.js +1 -2
  142. package/lib/uploadStep/component.js +2 -3
  143. package/lib/userDirector/component.js +1 -2
  144. package/lib/userDirector/components/userTree.js +1 -2
  145. package/lib/userDirector/style/index.css +2 -1
  146. package/lib/userDirector/style/index.less +2 -1
  147. package/lib/utils/doc.js +31 -6
  148. package/lib/utils/index.js +6 -0
  149. package/lib/utils/tusUpload.js +1 -1
  150. package/package.json +11 -2
@@ -14,23 +14,18 @@ const _sfc_main = defineComponent({
14
14
  __name: "index",
15
15
  props: {
16
16
  itemData: {},
17
- preview: { type: Boolean },
18
- addType: {}
17
+ preview: { type: Boolean }
19
18
  },
20
- emits: ["add"],
21
- setup(__props, { emit: __emit }) {
19
+ emits: ["confirm"],
20
+ setup(__props, { emit }) {
22
21
  const props = __props;
23
- const emit = __emit;
24
22
  const visible = ref(false);
25
23
  const previewType = computed(() => props.itemData.catalog);
26
24
  const previewUrl = computed(() => props.itemData.url || "");
27
25
  const openPreview = () => visible.value = true;
28
26
  const closePreviewer = (val) => visible.value = val;
29
27
  const add = () => {
30
- if (props.addType === "copper" && props.itemData.catalog === "image") {
31
- console.log("copper");
32
- }
33
- emit("add", props.itemData);
28
+ emit("confirm", props.itemData);
34
29
  };
35
30
  return (_ctx, _cache) => {
36
31
  return openBlock(), createElementBlock(Fragment, null, [
@@ -43,21 +43,14 @@ const _sfc_main = defineComponent({
43
43
  fileListCount: {},
44
44
  isOver: { type: Boolean },
45
45
  preview: { type: Boolean },
46
- addType: {},
47
46
  changeDirectory: { type: Function },
48
47
  loadFileMore: { type: Function }
49
48
  },
50
- emits: ["add"],
51
- setup(__props, { emit: __emit }) {
52
- const emit = __emit;
53
- const add = (itemData) => {
54
- if (selectedData.value.includes(itemData)) {
55
- selectedData.value = [];
56
- emit("add", null);
57
- } else {
58
- selectedData.value = [itemData];
59
- emit("add", itemData);
60
- }
49
+ emits: ["confirm"],
50
+ setup(__props, { emit }) {
51
+ const confirm = (itemData) => {
52
+ selectedData.value = [itemData];
53
+ emit("confirm", selectedData.value);
61
54
  };
62
55
  const selectedData = ref([]);
63
56
  return (_ctx, _cache) => {
@@ -106,10 +99,9 @@ const _sfc_main = defineComponent({
106
99
  createElementVNode("div", _hoisted_7, [
107
100
  createVNode(_sfc_main$1, {
108
101
  preview: _ctx.preview,
109
- "add-type": _ctx.addType,
110
102
  "item-data": item,
111
- onAdd: add
112
- }, null, 8, ["preview", "add-type", "item-data"])
103
+ onConfirm: confirm
104
+ }, null, 8, ["preview", "item-data"])
113
105
  ]),
114
106
  createElementVNode("h4", null, [
115
107
  createVNode(_sfc_main$2, {
@@ -18,7 +18,7 @@ const _sfc_main = defineComponent({
18
18
  base_api: {}
19
19
  },
20
20
  emits: ["search"],
21
- setup(__props, { expose: __expose, emit: __emit }) {
21
+ setup(__props, { expose: __expose, emit }) {
22
22
  const props = __props;
23
23
  const filter = ref({
24
24
  keyword: "",
@@ -58,7 +58,6 @@ const _sfc_main = defineComponent({
58
58
  () => contentSearch(),
59
59
  { deep: true }
60
60
  );
61
- const emit = __emit;
62
61
  const contentSearch = () => {
63
62
  if (filter.value.keyword === "" && filter.value.upload_by === "" && filter.value.sf === "" && filter.value.wh_rate === "" && filter.value.uploadTime === null) {
64
63
  emit("search", null);
@@ -20,16 +20,14 @@ const _sfc_main = defineComponent({
20
20
  base_api: {},
21
21
  catalogProps: {},
22
22
  preview: { type: Boolean },
23
- addType: {},
24
23
  ai_static_covers: {},
25
24
  ai_gif_covers: {}
26
25
  },
27
- emits: ["add"],
28
- setup(__props, { emit: __emit }) {
26
+ emits: ["confirm"],
27
+ setup(__props, { emit }) {
29
28
  const props = __props;
30
- const emit = __emit;
31
- const add = (itemData) => {
32
- emit("add", itemData);
29
+ const confirm = (itemData) => {
30
+ emit("confirm", itemData);
33
31
  };
34
32
  const breadCrumbs = ref([
35
33
  { directory_id: 0, alias: "\u6839\u76EE\u5F55" }
@@ -196,9 +194,8 @@ const _sfc_main = defineComponent({
196
194
  ai_gif_covers: _ctx.ai_gif_covers,
197
195
  "selected-max": _ctx.selectedMax,
198
196
  preview: _ctx.preview,
199
- "add-type": _ctx.addType,
200
- onAdd: add
201
- }, null, 8, ["ai_static_covers", "ai_gif_covers", "selected-max", "preview", "add-type"])) : createCommentVNode("v-if", true),
197
+ onConfirm: confirm
198
+ }, null, 8, ["ai_static_covers", "ai_gif_covers", "selected-max", "preview"])) : createCommentVNode("v-if", true),
202
199
  createCommentVNode(" \u7D20\u6750\u5E93\u7D20\u6750 "),
203
200
  createCommentVNode(" \u7EC4\u7EC7\u3001\u6587\u4EF6\u5939\u9762\u5305\u5C51 "),
204
201
  withDirectives(createElementVNode("div", _hoisted_4, [
@@ -256,11 +253,10 @@ const _sfc_main = defineComponent({
256
253
  "file-list-count": fileListCount.value,
257
254
  "is-over": isOver.value,
258
255
  preview: _ctx.preview,
259
- "add-type": _ctx.addType,
260
256
  "change-directory": changeDirectory,
261
257
  "load-file-more": loadFileMore,
262
- onAdd: add
263
- }, null, 8, ["folder-list", "file-list", "file-list-count", "is-over", "preview", "add-type"])
258
+ onConfirm: confirm
259
+ }, null, 8, ["folder-list", "file-list", "file-list-count", "is-over", "preview"])
264
260
  ], 512), [
265
261
  [vShow, ["all", "my"].includes(activeMediaType.value)]
266
262
  ])
@@ -13,10 +13,9 @@ const _sfc_main = defineComponent({
13
13
  repositoryId: {}
14
14
  },
15
15
  emits: ["update:list"],
16
- setup(__props, { emit: __emit }) {
16
+ setup(__props, { emit }) {
17
17
  const props = __props;
18
18
  const BASE_API = props.BASE_API || DEFAULT_BASE_API;
19
- const emit = __emit;
20
19
  const visible = ref(false);
21
20
  const list = computed({
22
21
  get() {
@@ -15,9 +15,8 @@ const _sfc_main = defineComponent({
15
15
  columnWithData: {}
16
16
  },
17
17
  emits: ["update:visible", "submit"],
18
- setup(__props, { emit: __emit }) {
18
+ setup(__props, { emit }) {
19
19
  const props = __props;
20
- const emit = __emit;
21
20
  const BASE_API = props.base_api || DEFAULT_BASE_API;
22
21
  const selectColumnData = ref(props.columnData || []);
23
22
  const selectColumnWithData = ref(props.columnWithData || []);
@@ -31,9 +31,8 @@ const _sfc_main = defineComponent({
31
31
  "update:selectColumnData",
32
32
  "update:selectColumnWithData"
33
33
  ],
34
- setup(__props, { emit: __emit }) {
34
+ setup(__props, { emit }) {
35
35
  const props = __props;
36
- const emit = __emit;
37
36
  const popoverShow = ref(false);
38
37
  const treeData = ref([]);
39
38
  const listMinHeight = ref(0);
File without changes
@@ -0,0 +1,410 @@
1
+ import { defineComponent, ref, computed, watch, openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, Fragment, renderList, createBlock, createVNode, unref, withCtx, withDirectives, vShow } from "vue";
2
+ import { RadioGroup, Radio, Switch } from "@arco-design/web-vue";
3
+ import { docThumbObjMap, docThumbArrMap, docThumbRatioMap } from "../utils/doc.js";
4
+ import _sfc_main$3 from "../resourceModal/component.js";
5
+ import _sfc_main$4 from "../imageCrop/component.js";
6
+ import _sfc_main$1 from "./components/card.js";
7
+ import _sfc_main$2 from "./components/colorPalette.js";
8
+ import { DEFAULT_BASE_API } from "../config.js";
9
+ const _hoisted_1 = { class: "select-thumb-container" };
10
+ const _hoisted_2 = { class: "title" };
11
+ const _hoisted_3 = {
12
+ key: 0,
13
+ class: "tip"
14
+ };
15
+ const _hoisted_4 = {
16
+ key: 0,
17
+ class: "thumb-list-view"
18
+ };
19
+ const _hoisted_5 = { class: "banner-view" };
20
+ const _hoisted_6 = { class: "title" };
21
+ const _hoisted_7 = /* @__PURE__ */ createElementVNode("span", null, "\u72EC\u7ACB\u8F6E\u64AD\u56FE", -1);
22
+ const _hoisted_8 = { class: "title" };
23
+ const _hoisted_9 = /* @__PURE__ */ createElementVNode("span", null, "\u72EC\u7ACB\u8F6E\u64AD\u56FE\u80CC\u666F\u989C\u8272", -1);
24
+ const _hoisted_10 = [
25
+ _hoisted_9
26
+ ];
27
+ const _hoisted_11 = { class: "banner-view" };
28
+ const _hoisted_12 = { class: "title" };
29
+ const _hoisted_13 = { key: 0 };
30
+ const _hoisted_14 = { key: 1 };
31
+ const _hoisted_15 = /* @__PURE__ */ createElementVNode("span", { class: "star" }, "*", -1);
32
+ const _hoisted_16 = { key: 2 };
33
+ const _hoisted_17 = /* @__PURE__ */ createElementVNode("span", { class: "tip" }, "(\u5EFA\u8BAE\u5C3A\u5BF8\uFF1A1242px*662px)", -1);
34
+ const _hoisted_18 = { class: "title" };
35
+ const _hoisted_19 = /* @__PURE__ */ createElementVNode("span", null, "\u4E13\u9898\u5934\u56FE\u80CC\u666F\u989C\u8272", -1);
36
+ const _hoisted_20 = [
37
+ _hoisted_19
38
+ ];
39
+ const _sfc_main = defineComponent({
40
+ ...{ name: "selectThumb" },
41
+ __name: "component",
42
+ props: {
43
+ BASE_API: {},
44
+ mode: {},
45
+ dataValue: {},
46
+ title: {},
47
+ cropper: { type: Boolean },
48
+ aiImages: {},
49
+ series: {}
50
+ },
51
+ emits: ["update:dataValue"],
52
+ setup(__props, { emit }) {
53
+ const props = __props;
54
+ const BASE_API = props.BASE_API || DEFAULT_BASE_API;
55
+ const useCropper = ref(props.cropper || false);
56
+ const oldData = ref(null);
57
+ const styleData = ref({});
58
+ const thumbBannerModel = ref("banner");
59
+ const dialogMediaSelectionShow = ref(false);
60
+ const dialogCropperShow = ref(false);
61
+ const thumbOptionIndex = ref(0);
62
+ const aspectRatioProp = ref(16 / 9);
63
+ const cropperData = ref([]);
64
+ const model = computed({
65
+ get() {
66
+ if (!styleData.value.model)
67
+ return "4";
68
+ return `${styleData.value.model}`;
69
+ },
70
+ set(value) {
71
+ styleData.value.model = parseInt(value, 10);
72
+ callback(styleData.value);
73
+ }
74
+ });
75
+ watch(
76
+ () => props.dataValue,
77
+ () => {
78
+ loadData(props.dataValue);
79
+ }
80
+ );
81
+ const loadData = (value) => {
82
+ let data = null;
83
+ if (!value) {
84
+ data = { model: 3, data: [{ url: "", thumb: "" }] };
85
+ } else if (props.mode === "smiple") {
86
+ data = { model: 3, data: [{ url: value, thumb: value }] };
87
+ } else {
88
+ data = { ...JSON.parse(value) };
89
+ }
90
+ if (!oldData.value) {
91
+ oldData.value = { ...data };
92
+ }
93
+ styleData.value = data;
94
+ };
95
+ const callback = (value) => {
96
+ var _a;
97
+ const temp = JSON.parse(JSON.stringify(value));
98
+ if (Array.isArray(temp.data)) {
99
+ temp.data = temp.data.map((item) => {
100
+ return item || {};
101
+ });
102
+ }
103
+ if (props.mode === "smiple") {
104
+ emit("update:dataValue", ((_a = temp.data[0]) == null ? void 0 : _a.url) || "");
105
+ } else {
106
+ if (!temp.data) {
107
+ temp.data = [];
108
+ }
109
+ emit("update:dataValue", JSON.stringify(temp));
110
+ }
111
+ };
112
+ const curtemplate = computed(() => {
113
+ if (props.mode !== "doc") {
114
+ return docThumbObjMap[3];
115
+ }
116
+ return docThumbObjMap[parseInt(model.value, 10)];
117
+ });
118
+ const modelList = computed(() => {
119
+ return docThumbArrMap().filter((item) => {
120
+ return FromThumbArr.value.split(",").includes(item.value);
121
+ });
122
+ });
123
+ const FromThumbArr = computed(() => {
124
+ const { series } = props;
125
+ if (series) {
126
+ if (series === "imagetext")
127
+ return "1,2,3,4";
128
+ if (series === "svideo")
129
+ return "2,5";
130
+ if (series === "video")
131
+ return "1,2,3,4";
132
+ if (series === "atlas")
133
+ return "1,2,3,4";
134
+ if (series === "audio")
135
+ return "1,2,3,4";
136
+ if (series === "link")
137
+ return "1,2,3,4,7";
138
+ if (series === "h5")
139
+ return "1,2,3,4,7";
140
+ }
141
+ return "1,2,3,4,5,7";
142
+ });
143
+ const currentModel = computed(() => {
144
+ if (props.mode !== "doc") {
145
+ return docThumbObjMap[3];
146
+ }
147
+ return modelList.value.find((item) => item.value === model.value);
148
+ });
149
+ const thumbList = computed(() => {
150
+ var _a;
151
+ return ((_a = styleData.value) == null ? void 0 : _a.data) || [];
152
+ });
153
+ const previewList = computed(() => {
154
+ return thumbList.value.map((item) => item.url);
155
+ });
156
+ const openDialogMediaSelection = (type, index) => {
157
+ thumbBannerModel.value = type || "thumb";
158
+ thumbOptionIndex.value = index || 0;
159
+ dialogMediaSelectionShow.value = true;
160
+ };
161
+ const docSeriesShowTopThemeColor = computed(() => {
162
+ const { series } = props;
163
+ return ["special", "special_v3", "video_album", "audio_album"].includes(
164
+ series
165
+ );
166
+ });
167
+ const submitCallback = (data) => {
168
+ var _a;
169
+ console.log("submitCallback", data);
170
+ const isPcBaner = props.mode === "doc" && thumbBannerModel.value === "pcBanner" && !docSeriesShowTopThemeColor.value;
171
+ const _useCropper = props.mode === "doc" ? true : useCropper.value;
172
+ if (isPcBaner || !_useCropper) {
173
+ dialogMediaSelectionShow.value = false;
174
+ data.map(async (media) => {
175
+ const { width, height } = await loadImage(media.url);
176
+ styleData.value.pc_banner_url = `${media.url}?width=${width}&height=${height}`;
177
+ styleData.value.pc_banner_url_info = JSON.stringify({ width, height });
178
+ callback(styleData.value);
179
+ return media;
180
+ });
181
+ } else {
182
+ cropperData.value = [].concat(data);
183
+ if (thumbBannerModel.value === "banner" || docSeriesShowTopThemeColor.value) {
184
+ aspectRatioProp.value = docThumbRatioMap()[2];
185
+ }
186
+ if (thumbBannerModel.value === "thumb") {
187
+ aspectRatioProp.value = docThumbRatioMap()[model.value];
188
+ if (data.length) {
189
+ const media = data[0];
190
+ const wh = [];
191
+ (_a = media.metas) == null ? void 0 : _a.map((item) => {
192
+ if (item.key === "width")
193
+ wh.unshift(parseInt(item.value, 10));
194
+ if (item.key === "height")
195
+ wh.push(parseInt(item.value, 10));
196
+ return item;
197
+ });
198
+ if (wh.length === 2 && Math.abs(wh[0] / wh[1] - curtemplate.value.ratio) <= 0.05) {
199
+ const [width, height] = wh;
200
+ const temp = JSON.parse(JSON.stringify(styleData.value.data || []));
201
+ temp[thumbOptionIndex.value] = {
202
+ url: `${media.url}?width=${width}&height=${height}`,
203
+ thumb: `${media.url}?width=${width}&height=${height}`
204
+ };
205
+ styleData.value.data = temp;
206
+ callback(styleData.value);
207
+ dialogMediaSelectionShow.value = false;
208
+ return false;
209
+ }
210
+ }
211
+ }
212
+ setTimeout(() => {
213
+ dialogCropperShow.value = true;
214
+ }, 300);
215
+ }
216
+ };
217
+ const cropConfirm = (data) => {
218
+ dialogMediaSelectionShow.value = false;
219
+ if (thumbBannerModel.value === "banner") {
220
+ styleData.value.banner_url = data[0].url;
221
+ styleData.value.banner_colorList = JSON.parse(
222
+ JSON.stringify(data[0].banner_theme_color)
223
+ );
224
+ styleData.value.banner_theme_color = `rgb(${data[0].banner_theme_color[1]})`;
225
+ }
226
+ if (thumbBannerModel.value === "pcBanner" && docSeriesShowTopThemeColor.value) {
227
+ styleData.value.top_image_url = data[0].url;
228
+ styleData.value.pc_banner_url = data[0].url;
229
+ styleData.value.top_colorList = JSON.parse(
230
+ JSON.stringify(data[0].banner_theme_color)
231
+ );
232
+ styleData.value.top_theme_color = `rgb(${data[0].banner_theme_color[1]})`;
233
+ }
234
+ if (thumbBannerModel.value === "thumb") {
235
+ const temp = JSON.parse(JSON.stringify(styleData.value.data || []));
236
+ temp[thumbOptionIndex.value] = {
237
+ url: data[0].url,
238
+ thumb: data[0].url
239
+ };
240
+ styleData.value.data = temp;
241
+ }
242
+ callback(styleData.value);
243
+ };
244
+ const loadImage = (url) => {
245
+ return new Promise((resolve, reject) => {
246
+ const _img = new Image();
247
+ _img.src = url;
248
+ _img.onload = () => {
249
+ resolve(_img);
250
+ };
251
+ _img.onerror = reject;
252
+ });
253
+ };
254
+ const modelChange = () => {
255
+ if (!props.dataValue)
256
+ return;
257
+ if (styleData.value.model === oldData.value.model) {
258
+ styleData.value.data = oldData.value.data;
259
+ } else {
260
+ styleData.value.data = [];
261
+ }
262
+ callback(styleData.value);
263
+ };
264
+ const banner = computed(() => {
265
+ const { banner: banner2, banner_theme_color, banner_url } = styleData.value;
266
+ return { banner: banner2, banner_theme_color, url: banner_url };
267
+ });
268
+ const hasBanner = computed({
269
+ get() {
270
+ var _a;
271
+ return !!((_a = banner.value) == null ? void 0 : _a.banner);
272
+ },
273
+ set(value) {
274
+ styleData.value.banner = value;
275
+ callback(styleData.value);
276
+ }
277
+ });
278
+ const pcBanner = computed(() => {
279
+ const { pc_banner_url_info, pc_banner_url } = styleData.value;
280
+ return { pc_banner_url_info, url: pc_banner_url };
281
+ });
282
+ const colorChange = (styleData2) => {
283
+ callback(styleData2);
284
+ };
285
+ return (_ctx, _cache) => {
286
+ var _a, _b, _c;
287
+ return openBlock(), createElementBlock("div", _hoisted_1, [
288
+ createElementVNode("div", _hoisted_2, [
289
+ createTextVNode(toDisplayString(_ctx.title ? _ctx.title : "\u5C01\u9762") + " ", 1),
290
+ ((_a = curtemplate.value) == null ? void 0 : _a.value) !== "4" ? (openBlock(), createElementBlock("span", _hoisted_3, "(" + toDisplayString((_b = curtemplate.value) == null ? void 0 : _b.alias) + "\u6BD4\u4F8B\uFF1A" + toDisplayString((_c = curtemplate.value) == null ? void 0 : _c.ratioStr) + ")", 1)) : createCommentVNode("v-if", true)
291
+ ]),
292
+ currentModel.value ? (openBlock(), createElementBlock("div", _hoisted_4, [
293
+ (openBlock(true), createElementBlock(Fragment, null, renderList(currentModel.value.maxLength, (item, index) => {
294
+ return openBlock(), createBlock(_sfc_main$1, {
295
+ key: index,
296
+ id: `thumb-card-${index}`,
297
+ data: thumbList.value[index],
298
+ model: model.value,
299
+ "preview-list": previewList.value,
300
+ "thumb-model": "thumb",
301
+ onOpen: ($event) => openDialogMediaSelection($event, index)
302
+ }, null, 8, ["id", "data", "model", "preview-list", "onOpen"]);
303
+ }), 128))
304
+ ])) : createCommentVNode("v-if", true),
305
+ _ctx.mode === "doc" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
306
+ createCommentVNode(" \u9009\u62E9\u5927\u56FE\u3001\u4E09\u56FE\u3001\u5355\u56FE...\u7B49\u6A21\u5F0F "),
307
+ createVNode(unref(RadioGroup), {
308
+ modelValue: model.value,
309
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
310
+ size: "small",
311
+ type: "button",
312
+ onChange: modelChange
313
+ }, {
314
+ default: withCtx(() => [
315
+ (openBlock(true), createElementBlock(Fragment, null, renderList(modelList.value, (item, index) => {
316
+ return openBlock(), createBlock(unref(Radio), {
317
+ key: index,
318
+ value: item.value
319
+ }, {
320
+ default: withCtx(() => [
321
+ createTextVNode(toDisplayString(item.alias), 1)
322
+ ]),
323
+ _: 2
324
+ }, 1032, ["value"]);
325
+ }), 128))
326
+ ]),
327
+ _: 1
328
+ }, 8, ["modelValue"]),
329
+ createCommentVNode(" \u72EC\u7ACB\u8F6E\u535A\u56FE "),
330
+ createElementVNode("div", _hoisted_5, [
331
+ createElementVNode("div", _hoisted_6, [
332
+ _hoisted_7,
333
+ createVNode(unref(Switch), {
334
+ modelValue: hasBanner.value,
335
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => hasBanner.value = $event),
336
+ size: "small"
337
+ }, null, 8, ["modelValue"])
338
+ ]),
339
+ withDirectives(createVNode(_sfc_main$1, {
340
+ id: `banner-card`,
341
+ data: banner.value,
342
+ "preview-list": previewList.value,
343
+ "thumb-model": "banner",
344
+ onOpen: openDialogMediaSelection
345
+ }, null, 8, ["data", "preview-list"]), [
346
+ [vShow, hasBanner.value]
347
+ ]),
348
+ withDirectives(createElementVNode("div", _hoisted_8, _hoisted_10, 512), [
349
+ [vShow, hasBanner.value && styleData.value.banner_theme_color]
350
+ ]),
351
+ createCommentVNode(" banner\u8C03\u8272\u677F "),
352
+ withDirectives(createVNode(_sfc_main$2, {
353
+ "style-data": styleData.value,
354
+ model: "banner",
355
+ onChange: colorChange
356
+ }, null, 8, ["style-data"]), [
357
+ [vShow, hasBanner.value]
358
+ ])
359
+ ]),
360
+ createCommentVNode(" pc\u5C01\u9762\u56FE\uFF08\u4E13\u9898\u5934\u56FE\u5171\u7528\u4E00\u4E2A\u5B57\u6BB5\uFF09 "),
361
+ createElementVNode("div", _hoisted_11, [
362
+ createElementVNode("div", _hoisted_12, [
363
+ ["special", "special_v3"].includes(props.series) ? (openBlock(), createElementBlock("span", _hoisted_13, "\u4E13\u9898\u5934\u56FE")) : ["video_album", "audio_album"].includes(props.series) ? (openBlock(), createElementBlock("span", _hoisted_14, [
364
+ _hoisted_15,
365
+ createTextVNode("\u5C01\u9762\u5934\u56FE")
366
+ ])) : (openBlock(), createElementBlock("span", _hoisted_16, "PC\u5C01\u9762\u56FE")),
367
+ _hoisted_17
368
+ ]),
369
+ createVNode(_sfc_main$1, {
370
+ id: `pc-banner-card`,
371
+ data: pcBanner.value,
372
+ previewList: previewList.value,
373
+ thumbModel: "pcBanner",
374
+ onOpen: openDialogMediaSelection
375
+ }, null, 8, ["data", "previewList"]),
376
+ withDirectives(createElementVNode("div", _hoisted_18, _hoisted_20, 512), [
377
+ [vShow, docSeriesShowTopThemeColor.value && styleData.value.top_theme_color]
378
+ ]),
379
+ withDirectives(createVNode(_sfc_main$2, {
380
+ styleData: styleData.value,
381
+ model: "top",
382
+ onChange: colorChange
383
+ }, null, 8, ["styleData"]), [
384
+ [vShow, docSeriesShowTopThemeColor.value]
385
+ ])
386
+ ])
387
+ ], 64)) : createCommentVNode("v-if", true),
388
+ createVNode(_sfc_main$3, {
389
+ dialogVisible: dialogMediaSelectionShow.value,
390
+ "onUpdate:dialogVisible": _cache[2] || (_cache[2] = ($event) => dialogMediaSelectionShow.value = $event),
391
+ preview: false,
392
+ "catalog-props": "image",
393
+ ai_static_covers: _ctx.aiImages,
394
+ base_api: unref(BASE_API),
395
+ onSubmit: submitCallback
396
+ }, null, 8, ["dialogVisible", "ai_static_covers", "base_api"]),
397
+ createVNode(_sfc_main$4, {
398
+ visible: dialogCropperShow.value,
399
+ "onUpdate:visible": _cache[3] || (_cache[3] = ($event) => dialogCropperShow.value = $event),
400
+ "aspect-ratio-prop": aspectRatioProp.value,
401
+ BASE_API: unref(BASE_API),
402
+ "corp-data": cropperData.value,
403
+ "generate-assets": false,
404
+ onConfirm: cropConfirm
405
+ }, null, 8, ["visible", "aspect-ratio-prop", "BASE_API", "corp-data"])
406
+ ]);
407
+ };
408
+ }
409
+ });
410
+ export { _sfc_main as default };
File without changes
@@ -0,0 +1,86 @@
1
+ import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, createVNode, unref, Transition, withCtx, createElementVNode, withModifiers, createCommentVNode } from "vue";
2
+ import { Image } from "@arco-design/web-vue";
3
+ import { IconEdit, IconDelete, IconPlus } from "@arco-design/web-vue/es/icon";
4
+ const _hoisted_1 = {
5
+ key: 0,
6
+ class: "img-v"
7
+ };
8
+ const _hoisted_2 = ["onClick"];
9
+ const _hoisted_3 = ["onClick"];
10
+ const _hoisted_4 = ["onClick"];
11
+ const _sfc_main = defineComponent({
12
+ ...{ name: "thumbCard" },
13
+ __name: "card",
14
+ props: {
15
+ data: {},
16
+ previewList: {},
17
+ thumbModel: {},
18
+ along: { type: Boolean },
19
+ model: {}
20
+ },
21
+ emits: ["open", "remove"],
22
+ setup(__props, { emit }) {
23
+ const props = __props;
24
+ const classObj = computed(() => {
25
+ var _a;
26
+ if (!props.model)
27
+ return {};
28
+ return {
29
+ [`model-${props.model}`]: ((_a = props.data) == null ? void 0 : _a.url) && props.model
30
+ };
31
+ });
32
+ const clickMask = () => {
33
+ props.along && openDialogMediaSelection();
34
+ };
35
+ const openDialogMediaSelection = () => {
36
+ emit("open", props.thumbModel);
37
+ };
38
+ const remove = () => {
39
+ emit("remove");
40
+ };
41
+ return (_ctx, _cache) => {
42
+ var _a, _b;
43
+ return openBlock(), createElementBlock("div", {
44
+ class: normalizeClass(["thumb-card-container", classObj.value])
45
+ }, [
46
+ ((_a = props.data) == null ? void 0 : _a.url) ? (openBlock(), createElementBlock("div", _hoisted_1, [
47
+ createVNode(unref(Image), {
48
+ class: "item",
49
+ fit: "cover",
50
+ src: (_b = props.data) == null ? void 0 : _b.url
51
+ }, null, 8, ["src"]),
52
+ createVNode(Transition, { name: "fade" }, {
53
+ default: withCtx(() => [
54
+ createElementVNode("div", {
55
+ class: "mask",
56
+ onClick: clickMask
57
+ }, [
58
+ createElementVNode("span", {
59
+ class: "half",
60
+ onClick: withModifiers(openDialogMediaSelection, ["stop"])
61
+ }, [
62
+ createVNode(unref(IconEdit))
63
+ ], 8, _hoisted_2),
64
+ _ctx.along ? (openBlock(), createElementBlock("span", {
65
+ key: 0,
66
+ class: "half",
67
+ onClick: withModifiers(remove, ["stop"])
68
+ }, [
69
+ createVNode(unref(IconDelete))
70
+ ], 8, _hoisted_3)) : createCommentVNode("v-if", true)
71
+ ])
72
+ ]),
73
+ _: 1
74
+ })
75
+ ])) : (openBlock(), createElementBlock("div", {
76
+ key: 1,
77
+ class: "item add-thumb",
78
+ onClick: withModifiers(openDialogMediaSelection, ["stop"])
79
+ }, [
80
+ createVNode(unref(IconPlus))
81
+ ], 8, _hoisted_4))
82
+ ], 2);
83
+ };
84
+ }
85
+ });
86
+ export { _sfc_main as default };
File without changes