@cmstops/pro-compo 0.3.31 → 0.3.33
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 +212 -0
- package/dist/index.min.css +1 -1
- package/es/hooks/useAttachement.d.ts +20 -0
- package/es/hooks/useAttachement.js +95 -0
- package/es/hooks/useSelection.d.ts +23 -0
- package/es/hooks/useSelection.js +59 -0
- package/es/index.css +212 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -0
- package/es/index.less +2 -0
- package/es/selectResourceModal/component.d.ts +0 -0
- package/es/selectResourceModal/component.js +211 -0
- package/es/selectResourceModal/components/ListContent/index.d.ts +0 -0
- package/es/selectResourceModal/components/ListContent/index.js +92 -0
- package/es/selectResourceModal/components/ListFilter/index.d.ts +0 -0
- package/es/selectResourceModal/components/ListFilter/index.js +259 -0
- package/es/selectResourceModal/components/ListFilter/scripts/api.d.ts +1 -0
- package/es/selectResourceModal/components/ListFilter/scripts/api.js +9 -0
- package/es/selectResourceModal/components/ListSelected/index.d.ts +0 -0
- package/es/selectResourceModal/components/ListSelected/index.js +91 -0
- package/es/selectResourceModal/index.d.ts +2 -0
- package/es/selectResourceModal/index.js +7 -0
- package/es/selectResourceModal/style/css.js +1 -0
- package/es/selectResourceModal/style/index.css +159 -0
- package/es/selectResourceModal/style/index.d.ts +1 -0
- package/es/selectResourceModal/style/index.js +1 -0
- package/es/selectResourceModal/style/index.less +43 -0
- package/es/selectResourceModal/style/listContent.less +67 -0
- package/es/selectResourceModal/style/listFilter.less +17 -0
- package/es/selectResourceModal/style/listSelected.less +67 -0
- package/es/thumbCard/component.d.ts +0 -0
- package/es/thumbCard/component.js +114 -0
- package/es/thumbCard/index.d.ts +2 -0
- package/es/thumbCard/index.js +7 -0
- package/es/thumbCard/style/css.js +1 -0
- package/es/thumbCard/style/index.css +53 -0
- package/es/thumbCard/style/index.d.ts +1 -0
- package/es/thumbCard/style/index.js +1 -0
- package/es/thumbCard/style/index.less +70 -0
- package/es/utils/typeMap.d.ts +19 -0
- package/es/utils/typeMap.js +17 -1
- package/lib/hooks/useAttachement.js +100 -0
- package/lib/hooks/useSelection.js +60 -0
- package/lib/index.css +212 -0
- package/lib/index.js +4 -0
- package/lib/index.less +2 -0
- package/lib/selectResourceModal/component.js +212 -0
- package/lib/selectResourceModal/components/ListContent/index.js +93 -0
- package/lib/selectResourceModal/components/ListFilter/index.js +260 -0
- package/lib/selectResourceModal/components/ListFilter/scripts/api.js +11 -0
- package/lib/selectResourceModal/components/ListSelected/index.js +92 -0
- package/lib/selectResourceModal/index.js +8 -0
- package/lib/selectResourceModal/style/css.js +2 -0
- package/lib/selectResourceModal/style/index.css +159 -0
- package/lib/selectResourceModal/style/index.js +2 -0
- package/lib/selectResourceModal/style/index.less +43 -0
- package/lib/selectResourceModal/style/listContent.less +67 -0
- package/lib/selectResourceModal/style/listFilter.less +17 -0
- package/lib/selectResourceModal/style/listSelected.less +67 -0
- package/lib/thumbCard/component.js +115 -0
- package/lib/thumbCard/index.js +8 -0
- package/lib/thumbCard/style/css.js +2 -0
- package/lib/thumbCard/style/index.css +53 -0
- package/lib/thumbCard/style/index.js +2 -0
- package/lib/thumbCard/style/index.less +70 -0
- package/lib/utils/typeMap.js +20 -0
- package/package.json +2 -2
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
.card-list-wrapper {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-gap: 20px;
|
|
4
|
+
grid-template-columns: repeat(4, 1fr);
|
|
5
|
+
|
|
6
|
+
.card-wrapper-image {
|
|
7
|
+
position: relative;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
|
|
10
|
+
.card-wrapper {
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
// 宽高:43
|
|
13
|
+
aspect-ratio: 4 / 3;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.card-alias {
|
|
17
|
+
width: 100%;
|
|
18
|
+
margin-top: 6px;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
color: #3d3d3d;
|
|
21
|
+
font-size: 14px;
|
|
22
|
+
line-height: 22px;
|
|
23
|
+
white-space: nowrap;
|
|
24
|
+
text-overflow: ellipsis;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&:hover .check-box-wrapper .check-box,
|
|
28
|
+
.check-box-wrapper .check-box.active {
|
|
29
|
+
opacity: 1;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.check-box-wrapper {
|
|
33
|
+
position: absolute;
|
|
34
|
+
top: 8px;
|
|
35
|
+
left: 8px;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
|
|
38
|
+
.check-box {
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
width: 22px;
|
|
41
|
+
height: 22px;
|
|
42
|
+
font-size: 14px;
|
|
43
|
+
line-height: 22px;
|
|
44
|
+
text-align: center;
|
|
45
|
+
background-color: rgba(0, 0, 0, 0.2);
|
|
46
|
+
border: 1px solid white;
|
|
47
|
+
border-radius: 50%;
|
|
48
|
+
opacity: 0;
|
|
49
|
+
transition: all 0.3s ease-in-out;
|
|
50
|
+
|
|
51
|
+
&::selection {
|
|
52
|
+
display: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&:hover {
|
|
56
|
+
background-color: rgba(0, 0, 0, 0.3);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&.active {
|
|
60
|
+
color: white;
|
|
61
|
+
background-color: #165dff;
|
|
62
|
+
border-color: #165dff;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
.list-panel-wrapper {
|
|
2
|
+
* {
|
|
3
|
+
user-select: none;
|
|
4
|
+
|
|
5
|
+
&::selection {
|
|
6
|
+
display: none;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
width: 420px;
|
|
11
|
+
max-height: 600px;
|
|
12
|
+
padding: 0 !important;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
border: none;
|
|
15
|
+
border-radius: 4px;
|
|
16
|
+
box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.1);
|
|
17
|
+
|
|
18
|
+
.arco-popover-content {
|
|
19
|
+
margin-top: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.list-panel-header {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
padding: 11px 15px;
|
|
27
|
+
color: white;
|
|
28
|
+
font-weight: 500;
|
|
29
|
+
background-color: #165dff;
|
|
30
|
+
|
|
31
|
+
.header-options {
|
|
32
|
+
display: flex;
|
|
33
|
+
gap: 12px;
|
|
34
|
+
align-items: center;
|
|
35
|
+
|
|
36
|
+
div {
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.list-selected-record {
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
|
|
46
|
+
.list-selected-item {
|
|
47
|
+
display: flex;
|
|
48
|
+
gap: 12px;
|
|
49
|
+
align-items: center;
|
|
50
|
+
padding: 9px 16px;
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
|
|
53
|
+
.item-thumb {
|
|
54
|
+
width: 50px;
|
|
55
|
+
height: 38px;
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.item-alias {
|
|
60
|
+
flex: 1;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
white-space: nowrap;
|
|
63
|
+
text-overflow: ellipsis;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createElementBlock, normalizeStyle, createBlock, unref, withCtx, createVNode, createTextVNode, createElementVNode, Fragment, createCommentVNode, mergeProps, renderList, toDisplayString } from "vue";
|
|
2
|
+
import { IconPlus } from "@arco-design/web-vue/es/icon";
|
|
3
|
+
import { IconResource, IconComputer } from "@arco-iconbox/vue-cmstop-icons";
|
|
4
|
+
import { Dropdown, Doption, Image } from "@arco-design/web-vue";
|
|
5
|
+
import { DEFAULT_BASE_API } from "../config.js";
|
|
6
|
+
const _hoisted_1 = { class: "thumb-add" };
|
|
7
|
+
const _hoisted_2 = { class: "thumb-handler-list" };
|
|
8
|
+
const _hoisted_3 = ["onClick"];
|
|
9
|
+
const _sfc_main = defineComponent({
|
|
10
|
+
...{ name: "thumbCard" },
|
|
11
|
+
__name: "component",
|
|
12
|
+
props: {
|
|
13
|
+
BASE_API: {},
|
|
14
|
+
url: {},
|
|
15
|
+
thumb: {},
|
|
16
|
+
isEdit: { type: Boolean },
|
|
17
|
+
options: {},
|
|
18
|
+
meta: {},
|
|
19
|
+
catalog: {},
|
|
20
|
+
handlersKey: {}
|
|
21
|
+
},
|
|
22
|
+
emits: ["handle", "edit"],
|
|
23
|
+
setup(__props, { emit: __emit }) {
|
|
24
|
+
const props = __props;
|
|
25
|
+
const emits = __emit;
|
|
26
|
+
const BASE_API = props.BASE_API || DEFAULT_BASE_API;
|
|
27
|
+
const WATER_BG_URL = `${BASE_API}/static/images/waterBg.png`;
|
|
28
|
+
const thumb = computed(() => {
|
|
29
|
+
return props.thumb || props.url || "";
|
|
30
|
+
});
|
|
31
|
+
const styleObject = computed(() => ({
|
|
32
|
+
backgroundImage: `url(${WATER_BG_URL})`
|
|
33
|
+
}));
|
|
34
|
+
const aImageAttr = computed(() => {
|
|
35
|
+
return {
|
|
36
|
+
fit: "contain",
|
|
37
|
+
preview: false,
|
|
38
|
+
width: "100%",
|
|
39
|
+
height: "100%",
|
|
40
|
+
...props.options
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
function handleOption(key) {
|
|
44
|
+
emits("handle", { key, item: props.meta });
|
|
45
|
+
}
|
|
46
|
+
function handleEdit(key) {
|
|
47
|
+
emits("edit", { key });
|
|
48
|
+
}
|
|
49
|
+
return (_ctx, _cache) => {
|
|
50
|
+
return openBlock(), createElementBlock("div", {
|
|
51
|
+
class: "thumb-select-wrapper",
|
|
52
|
+
style: normalizeStyle(styleObject.value)
|
|
53
|
+
}, [
|
|
54
|
+
_ctx.isEdit && !_ctx.url ? (openBlock(), createBlock(unref(Dropdown), {
|
|
55
|
+
key: 0,
|
|
56
|
+
trigger: "click",
|
|
57
|
+
onSelect: handleEdit
|
|
58
|
+
}, {
|
|
59
|
+
content: withCtx(() => [
|
|
60
|
+
createVNode(unref(Doption), { value: "resource" }, {
|
|
61
|
+
default: withCtx(() => [
|
|
62
|
+
createVNode(unref(IconResource)),
|
|
63
|
+
createTextVNode(" \u7D20\u6750\u5E93\u9009\u62E9 ")
|
|
64
|
+
]),
|
|
65
|
+
_: 1
|
|
66
|
+
}),
|
|
67
|
+
createVNode(unref(Doption), { value: "local" }, {
|
|
68
|
+
default: withCtx(() => [
|
|
69
|
+
createVNode(unref(IconComputer)),
|
|
70
|
+
createTextVNode(" \u672C\u5730\u4E0A\u4F20 ")
|
|
71
|
+
]),
|
|
72
|
+
_: 1
|
|
73
|
+
})
|
|
74
|
+
]),
|
|
75
|
+
default: withCtx(() => [
|
|
76
|
+
createElementVNode("div", _hoisted_1, [
|
|
77
|
+
createVNode(unref(IconPlus))
|
|
78
|
+
])
|
|
79
|
+
]),
|
|
80
|
+
_: 1
|
|
81
|
+
})) : _ctx.catalog && _ctx.url ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
82
|
+
createCommentVNode(" \u56FE\u7247 "),
|
|
83
|
+
_ctx.catalog === "image" ? (openBlock(), createBlock(unref(Image), mergeProps({
|
|
84
|
+
key: 0,
|
|
85
|
+
class: "thumb-image",
|
|
86
|
+
src: thumb.value
|
|
87
|
+
}, aImageAttr.value), null, 16, ["src"])) : _ctx.catalog === "video" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
88
|
+
createCommentVNode(" \u89C6\u9891 "),
|
|
89
|
+
createVNode(unref(Image), mergeProps({
|
|
90
|
+
class: "thumb-image",
|
|
91
|
+
src: thumb.value
|
|
92
|
+
}, aImageAttr.value), null, 16, ["src"])
|
|
93
|
+
], 64)) : _ctx.catalog === "audio" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
94
|
+
createCommentVNode(" \u97F3\u9891 "),
|
|
95
|
+
createTextVNode(" \u97F3\u9891 ")
|
|
96
|
+
], 64)) : createCommentVNode("v-if", true),
|
|
97
|
+
createCommentVNode(" \u5C55\u793A\u6A21\u5F0F "),
|
|
98
|
+
createElementVNode("div", _hoisted_2, [
|
|
99
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.handlersKey, (item) => {
|
|
100
|
+
return openBlock(), createElementBlock("div", {
|
|
101
|
+
key: item.key,
|
|
102
|
+
class: "handler-item",
|
|
103
|
+
onClick: () => handleOption(item.key)
|
|
104
|
+
}, toDisplayString(item.label), 9, _hoisted_3);
|
|
105
|
+
}), 128))
|
|
106
|
+
])
|
|
107
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
108
|
+
createTextVNode(" \u7F3A\u7701\u56FE ")
|
|
109
|
+
], 64))
|
|
110
|
+
], 4);
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index.css";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.thumb-select-wrapper {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
border-radius: 2px;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
}
|
|
12
|
+
.thumb-select-wrapper .thumb-add {
|
|
13
|
+
color: var(--color-text-2);
|
|
14
|
+
font-size: 16px;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
}
|
|
17
|
+
.thumb-select-wrapper .thumb-image img {
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
}
|
|
21
|
+
.thumb-select-wrapper .thumb-handler-list {
|
|
22
|
+
position: absolute;
|
|
23
|
+
bottom: 0;
|
|
24
|
+
display: flex;
|
|
25
|
+
gap: 10px;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 40px;
|
|
30
|
+
opacity: 0;
|
|
31
|
+
transition: all 0.3s ease-in-out;
|
|
32
|
+
}
|
|
33
|
+
.thumb-select-wrapper .thumb-handler-list .handler-item {
|
|
34
|
+
padding: 0 8px;
|
|
35
|
+
color: #fff;
|
|
36
|
+
font-size: 12px;
|
|
37
|
+
line-height: 26px;
|
|
38
|
+
background-color: #000000b3;
|
|
39
|
+
border-radius: 2px;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
}
|
|
42
|
+
.thumb-select-wrapper .thumb-handler-list .handler-item:hover {
|
|
43
|
+
color: rgba(255, 255, 255, 0.7);
|
|
44
|
+
}
|
|
45
|
+
.thumb-select-wrapper:hover .thumb-handler-list {
|
|
46
|
+
opacity: 1;
|
|
47
|
+
}
|
|
48
|
+
.arco-dropdown-option-content {
|
|
49
|
+
display: flex;
|
|
50
|
+
gap: 8px;
|
|
51
|
+
align-items: center;
|
|
52
|
+
font-size: 14px;
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index.less";
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
.thumb-select-wrapper {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
// 高度宽度不在这里定义,根据具体的业务场景去处理,更灵活
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100%;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
border-radius: 2px;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
|
|
13
|
+
// 添加模式
|
|
14
|
+
.thumb-add {
|
|
15
|
+
color: var(--color-text-2);
|
|
16
|
+
font-size: 16px;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// 样式
|
|
21
|
+
.thumb-image {
|
|
22
|
+
img {
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// 扩展按钮
|
|
29
|
+
.thumb-handler-list {
|
|
30
|
+
position: absolute;
|
|
31
|
+
bottom: 0;
|
|
32
|
+
display: flex;
|
|
33
|
+
gap: 10px;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
width: 100%;
|
|
37
|
+
height: 40px;
|
|
38
|
+
opacity: 0;
|
|
39
|
+
transition: all 0.3s ease-in-out;
|
|
40
|
+
|
|
41
|
+
.handler-item {
|
|
42
|
+
padding: 0 8px;
|
|
43
|
+
color: #fff;
|
|
44
|
+
font-size: 12px;
|
|
45
|
+
line-height: 26px;
|
|
46
|
+
// 50%透明度
|
|
47
|
+
background-color: #000000b3;
|
|
48
|
+
border-radius: 2px;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
|
|
51
|
+
&:hover {
|
|
52
|
+
color: rgba(255, 255, 255, 0.7);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&:hover {
|
|
58
|
+
.thumb-handler-list {
|
|
59
|
+
opacity: 1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// 素材选择
|
|
65
|
+
.arco-dropdown-option-content {
|
|
66
|
+
display: flex;
|
|
67
|
+
gap: 8px;
|
|
68
|
+
align-items: center;
|
|
69
|
+
font-size: 14px;
|
|
70
|
+
}
|
package/es/utils/typeMap.d.ts
CHANGED
|
@@ -168,3 +168,22 @@ export declare const matrixPublishFormalStateMap: {
|
|
|
168
168
|
12: string;
|
|
169
169
|
13: string;
|
|
170
170
|
};
|
|
171
|
+
export declare const RESOURCE_SOURCE_DICT: {
|
|
172
|
+
ai: string;
|
|
173
|
+
live_rec: string;
|
|
174
|
+
backend: string;
|
|
175
|
+
};
|
|
176
|
+
export declare const RESOURCE_CATALOG_DICT: {
|
|
177
|
+
image: string;
|
|
178
|
+
video: string;
|
|
179
|
+
audio: string;
|
|
180
|
+
other: string;
|
|
181
|
+
};
|
|
182
|
+
export declare const RESOURCE_SOURCE_OPTIONS: {
|
|
183
|
+
value: string;
|
|
184
|
+
label: string;
|
|
185
|
+
}[];
|
|
186
|
+
export declare const RESOURCE_CATALOG_OPTIONS: {
|
|
187
|
+
value: string;
|
|
188
|
+
label: string;
|
|
189
|
+
}[];
|
package/es/utils/typeMap.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
var _a, _b, _c;
|
|
2
|
+
function object2LabelList(object) {
|
|
3
|
+
return Object.keys(object).map((key) => ({ value: key, label: object[key] }));
|
|
4
|
+
}
|
|
2
5
|
const mpName = ((_c = (_b = (_a = window.situoyun) == null ? void 0 : _a.config) == null ? void 0 : _b.oem_config) == null ? void 0 : _c.mp_name) || "\u516C\u4F17\u53F7";
|
|
3
6
|
const key_target_type_map = {
|
|
4
7
|
3: "doc",
|
|
@@ -158,4 +161,17 @@ const matrixPublishFormalStateMap = {
|
|
|
158
161
|
12: "\u672A\u77E5",
|
|
159
162
|
13: "\u79C1\u5BC6"
|
|
160
163
|
};
|
|
161
|
-
|
|
164
|
+
const RESOURCE_SOURCE_DICT = {
|
|
165
|
+
ai: "AI \u751F\u6210",
|
|
166
|
+
live_rec: "\u76F4\u64AD\u6536\u5F55",
|
|
167
|
+
backend: "\u540E\u53F0\u4E0A\u4F20"
|
|
168
|
+
};
|
|
169
|
+
const RESOURCE_CATALOG_DICT = {
|
|
170
|
+
image: "\u56FE\u7247",
|
|
171
|
+
video: "\u89C6\u9891",
|
|
172
|
+
audio: "\u97F3\u9891",
|
|
173
|
+
other: "\u5176\u4ED6"
|
|
174
|
+
};
|
|
175
|
+
const RESOURCE_SOURCE_OPTIONS = object2LabelList(RESOURCE_SOURCE_DICT);
|
|
176
|
+
const RESOURCE_CATALOG_OPTIONS = object2LabelList(RESOURCE_CATALOG_DICT);
|
|
177
|
+
export { RESOURCE_CATALOG_DICT, RESOURCE_CATALOG_OPTIONS, RESOURCE_SOURCE_DICT, RESOURCE_SOURCE_OPTIONS, approveFlowStatusMap, calcApprovingDependent, calcApprovingUser, compoColumnsMap, componentsColumns, contentList_layout_map, contentList_list_type_map, contentList_relation_type_map, groupPieceType, ilive_type_map, key_target_type_map, kongo_source_map, local_live_doc_status, local_live_doc_type, matrixPublishFormalStateMap, matrixPublishStateMap, mp_type_map };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
var vue = require("vue");
|
|
4
|
+
var request = require("../utils/request.js");
|
|
5
|
+
function getAttachmentsAll(BASE_API, query) {
|
|
6
|
+
return request(BASE_API, {
|
|
7
|
+
url: `/poplar/v3/attachments`,
|
|
8
|
+
method: "get",
|
|
9
|
+
params: query
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function getAttachmentsMy(BASE_API, query) {
|
|
13
|
+
return request(BASE_API, {
|
|
14
|
+
url: `/poplar/v3/my/attachments`,
|
|
15
|
+
method: "get",
|
|
16
|
+
params: query
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function getAttachmentsMyMessage(BASE_API, query) {
|
|
20
|
+
return request(BASE_API, {
|
|
21
|
+
url: `/poplar/v3/remind/to/my/attachments`,
|
|
22
|
+
method: "get",
|
|
23
|
+
params: query
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function useAttachement(options) {
|
|
27
|
+
const key = vue.ref(options.key);
|
|
28
|
+
const limit = vue.ref(20);
|
|
29
|
+
const offset = vue.ref(0);
|
|
30
|
+
const filter = vue.ref({});
|
|
31
|
+
const params = vue.computed(() => {
|
|
32
|
+
return {
|
|
33
|
+
limit: limit.value,
|
|
34
|
+
offset: offset.value,
|
|
35
|
+
...filter.value
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
const loading = vue.ref(true);
|
|
39
|
+
const list = vue.ref([]);
|
|
40
|
+
const total = vue.ref(0);
|
|
41
|
+
async function loadData() {
|
|
42
|
+
let apiFunc;
|
|
43
|
+
if (key.value === "all")
|
|
44
|
+
apiFunc = getAttachmentsAll;
|
|
45
|
+
if (key.value === "my")
|
|
46
|
+
apiFunc = getAttachmentsMy;
|
|
47
|
+
if (key.value === "remind")
|
|
48
|
+
apiFunc = getAttachmentsMyMessage;
|
|
49
|
+
list.value = [];
|
|
50
|
+
if (!apiFunc)
|
|
51
|
+
return;
|
|
52
|
+
loading.value = true;
|
|
53
|
+
try {
|
|
54
|
+
const { code, message } = await apiFunc(options.BASE_API, params.value);
|
|
55
|
+
if (code !== 0)
|
|
56
|
+
return;
|
|
57
|
+
const { data, count } = message;
|
|
58
|
+
list.value = data || [];
|
|
59
|
+
total.value = count;
|
|
60
|
+
} catch (e) {
|
|
61
|
+
console.log("\u83B7\u53D6\u7D20\u6750\u5217\u8868\u5F02\u5E38", e);
|
|
62
|
+
} finally {
|
|
63
|
+
loading.value = false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function changePage(o) {
|
|
67
|
+
offset.value = o;
|
|
68
|
+
loadData();
|
|
69
|
+
}
|
|
70
|
+
function changeSize(s) {
|
|
71
|
+
limit.value = s;
|
|
72
|
+
loadData();
|
|
73
|
+
}
|
|
74
|
+
function changeKey(k) {
|
|
75
|
+
if (k === key.value)
|
|
76
|
+
return;
|
|
77
|
+
key.value = k;
|
|
78
|
+
changePage(0);
|
|
79
|
+
}
|
|
80
|
+
function changeFilter(f) {
|
|
81
|
+
filter.value = f;
|
|
82
|
+
changePage(0);
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
list,
|
|
86
|
+
total,
|
|
87
|
+
limit,
|
|
88
|
+
offset,
|
|
89
|
+
loading,
|
|
90
|
+
changeFilter,
|
|
91
|
+
changeKey,
|
|
92
|
+
changePage,
|
|
93
|
+
changeSize,
|
|
94
|
+
loadData
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
exports["default"] = useAttachement;
|
|
98
|
+
exports.getAttachmentsAll = getAttachmentsAll;
|
|
99
|
+
exports.getAttachmentsMy = getAttachmentsMy;
|
|
100
|
+
exports.getAttachmentsMyMessage = getAttachmentsMyMessage;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var vue = require("vue");
|
|
3
|
+
function getLabelValue(list, options) {
|
|
4
|
+
const { labelStr, valueStr } = options;
|
|
5
|
+
return list.map((item) => {
|
|
6
|
+
return {
|
|
7
|
+
label: item[labelStr],
|
|
8
|
+
value: item[valueStr]
|
|
9
|
+
};
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function useSelection(params) {
|
|
13
|
+
const { func, labelStr, valueStr } = params;
|
|
14
|
+
const lVParams = { labelStr, valueStr };
|
|
15
|
+
const limit = vue.ref(10);
|
|
16
|
+
const offset = vue.ref(0);
|
|
17
|
+
const keyword = vue.ref("");
|
|
18
|
+
const options = vue.ref([]);
|
|
19
|
+
const loading = vue.ref(false);
|
|
20
|
+
const queryParams = vue.computed(() => {
|
|
21
|
+
return {
|
|
22
|
+
limit: limit.value,
|
|
23
|
+
offset: offset.value,
|
|
24
|
+
keyword: keyword.value
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
async function load(more) {
|
|
28
|
+
loading.value = !more;
|
|
29
|
+
try {
|
|
30
|
+
const list = await func(queryParams.value);
|
|
31
|
+
if (more) {
|
|
32
|
+
options.value = options.value.concat(getLabelValue(list, lVParams));
|
|
33
|
+
} else {
|
|
34
|
+
options.value = getLabelValue(list, lVParams);
|
|
35
|
+
}
|
|
36
|
+
} catch (e) {
|
|
37
|
+
console.log(e);
|
|
38
|
+
} finally {
|
|
39
|
+
loading.value = false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function loadMore() {
|
|
43
|
+
offset.value += limit.value;
|
|
44
|
+
load(true);
|
|
45
|
+
}
|
|
46
|
+
function handleSearch(kw) {
|
|
47
|
+
keyword.value = kw;
|
|
48
|
+
offset.value = 0;
|
|
49
|
+
load();
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
options,
|
|
53
|
+
loading,
|
|
54
|
+
keyword,
|
|
55
|
+
load,
|
|
56
|
+
handleSearch,
|
|
57
|
+
loadMore
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
module.exports = useSelection;
|