kouxiangtang 0.0.30 → 0.0.32
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/AttachmentUploader-DDK8ANLO.js +207 -0
- package/dist/AttachmentUploader-DDK8ANLO.js.map +1 -0
- package/dist/{ImageUploader-Bev1j9J3.js → ImageUploader-B4o50qQm.js} +2 -2
- package/dist/{ImageUploader-Bev1j9J3.js.map → ImageUploader-B4o50qQm.js.map} +1 -1
- package/dist/{RichTextEditor-D7bSjv9E.js → RichTextEditor-B7wNzt4K.js} +2 -2
- package/dist/{RichTextEditor-D7bSjv9E.js.map → RichTextEditor-B7wNzt4K.js.map} +1 -1
- package/dist/{config-tuc7f0v1.js → config-B7tHY3Ue.js} +3 -3
- package/dist/{config-tuc7f0v1.js.map → config-B7tHY3Ue.js.map} +1 -1
- package/dist/{config-Bb06m_wa.js → config-BCuBqeRH.js} +5 -5
- package/dist/config-BCuBqeRH.js.map +1 -0
- package/dist/{config-CtuaqsIg.js → config-BFUVy1Nl.js} +3 -3
- package/dist/{config-CtuaqsIg.js.map → config-BFUVy1Nl.js.map} +1 -1
- package/dist/{config-B1l6VQqX.js → config-Bjgx5Du4.js} +2 -2
- package/dist/{config-B1l6VQqX.js.map → config-Bjgx5Du4.js.map} +1 -1
- package/dist/{config-CoNy_LPm.js → config-BrQCWfAY.js} +2 -2
- package/dist/{config-CoNy_LPm.js.map → config-BrQCWfAY.js.map} +1 -1
- package/dist/{config-DXqu2RLv.js → config-CKZZQdX4.js} +3 -3
- package/dist/{config-DXqu2RLv.js.map → config-CKZZQdX4.js.map} +1 -1
- package/dist/{config-BvvzgwsK.js → config-CL6883-s.js} +2 -2
- package/dist/{config-BvvzgwsK.js.map → config-CL6883-s.js.map} +1 -1
- package/dist/config-CjLSGBcY.js +69 -0
- package/dist/config-CjLSGBcY.js.map +1 -0
- package/dist/{config-Ybl4BGU0.js → config-CyuD0z0K.js} +2 -2
- package/dist/{config-Ybl4BGU0.js.map → config-CyuD0z0K.js.map} +1 -1
- package/dist/{config-CQjve_L_.js → config-DB7VWzC4.js} +2 -2
- package/dist/{config-CQjve_L_.js.map → config-DB7VWzC4.js.map} +1 -1
- package/dist/{config-BNPqeFh8.js → config-DEaFJjRZ.js} +3 -3
- package/dist/{config-BNPqeFh8.js.map → config-DEaFJjRZ.js.map} +1 -1
- package/dist/{config-Bo5FttPF.js → config-DKVsiPLb.js} +2 -2
- package/dist/{config-Bo5FttPF.js.map → config-DKVsiPLb.js.map} +1 -1
- package/dist/{config-pvHBhmpM.js → config-DKzPrB5m.js} +2 -2
- package/dist/{config-pvHBhmpM.js.map → config-DKzPrB5m.js.map} +1 -1
- package/dist/{config-B28ViqkP.js → config-DMrtwYLi.js} +2 -2
- package/dist/{config-B28ViqkP.js.map → config-DMrtwYLi.js.map} +1 -1
- package/dist/{config-CR3_8__f.js → config-DjQvY2yS.js} +2 -2
- package/dist/{config-CR3_8__f.js.map → config-DjQvY2yS.js.map} +1 -1
- package/dist/{config-DvMt0rQB.js → config-DsqzFA5o.js} +2 -2
- package/dist/{config-DvMt0rQB.js.map → config-DsqzFA5o.js.map} +1 -1
- package/dist/{index-BmtnYeYH.js → index-DXMjIePp.js} +914 -911
- package/dist/index-DXMjIePp.js.map +1 -0
- package/dist/kouxiangtang.js +1 -1
- package/dist/kouxiangtang.umd.cjs +9 -9
- package/dist/kouxiangtang.umd.cjs.map +1 -1
- package/dist/style.css +2 -2
- package/package.json +1 -1
- package/dist/AttachmentUploader-7_gYI1Ul.js +0 -210
- package/dist/AttachmentUploader-7_gYI1Ul.js.map +0 -1
- package/dist/config-Bb06m_wa.js.map +0 -1
- package/dist/config-BsJeiX72.js +0 -72
- package/dist/config-BsJeiX72.js.map +0 -1
- package/dist/index-BmtnYeYH.js.map +0 -1
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { computed as M, ref as h, openBlock as p, createElementBlock as I, Fragment as U, createVNode as s, unref as l, normalizeClass as R, withModifiers as $, withCtx as r, createBlock as m, createTextVNode as j, createElementVNode as k, renderList as L, toDisplayString as S, createCommentVNode as q } from "vue";
|
|
2
|
+
import { ElUpload as O, ElIcon as v, ElButton as W, ElDialog as G, ElForm as H, ElFormItem as J, ElInput as K, ElMessage as d, ElLoading as w } from "element-plus";
|
|
3
|
+
import { _ as Q, f as X, p as Y, d as Z, i as ee, j as te } from "./index-DXMjIePp.js";
|
|
4
|
+
import "./el-loading-l0sNRNKZ.js";
|
|
5
|
+
const ae = ["src"], le = { class: "file-type" }, ne = {
|
|
6
|
+
__name: "AttachmentUploader",
|
|
7
|
+
props: {
|
|
8
|
+
pics: {
|
|
9
|
+
type: Array,
|
|
10
|
+
default() {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
limit: { type: Number },
|
|
15
|
+
props: {
|
|
16
|
+
type: Object,
|
|
17
|
+
default() {
|
|
18
|
+
return {
|
|
19
|
+
listType: "picture-card",
|
|
20
|
+
//'text' | 'picture' | 'picture-card'
|
|
21
|
+
limit: 5,
|
|
22
|
+
//最多上传几个文件
|
|
23
|
+
accept: "image/*"
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
emits: ["on-success", "on-remove", "on-change"],
|
|
29
|
+
setup(C, { emit: V }) {
|
|
30
|
+
const f = V, n = C, g = M(() => n.pics.map((e) => {
|
|
31
|
+
const t = e.url.substring(e.url.lastIndexOf(".") + 1);
|
|
32
|
+
if (typeof e.name !== void 0)
|
|
33
|
+
return e.fileType = t, e;
|
|
34
|
+
if (e.url) {
|
|
35
|
+
const a = e.url.split("/");
|
|
36
|
+
return {
|
|
37
|
+
...e,
|
|
38
|
+
name: a[a.length - 1],
|
|
39
|
+
fileType: t
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return { ...e, name: e.id, fileType: t };
|
|
43
|
+
})), _ = h(""), y = h(!1);
|
|
44
|
+
h(n);
|
|
45
|
+
const x = X().fileUploadUrl;
|
|
46
|
+
`${localStorage.getItem("token")}`;
|
|
47
|
+
const b = (e) => {
|
|
48
|
+
const t = new FileReader();
|
|
49
|
+
return t.readAsDataURL(e), new Promise(function(a, i) {
|
|
50
|
+
return e.type.startsWith("image/") ? (t.onload = async (o) => {
|
|
51
|
+
const u = new Image();
|
|
52
|
+
u.src = o.target.result, u.onload = () => {
|
|
53
|
+
const c = document.createElement("canvas"), z = c.getContext("2d");
|
|
54
|
+
c.width = u.width, c.height = u.height, z.drawImage(u, 0, 0, c.width, c.height), c.toBlob(
|
|
55
|
+
(A) => {
|
|
56
|
+
const P = new File([A], e.name, {
|
|
57
|
+
type: e.type,
|
|
58
|
+
lastModified: Date.now()
|
|
59
|
+
});
|
|
60
|
+
a(P);
|
|
61
|
+
},
|
|
62
|
+
e.type,
|
|
63
|
+
0.5
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
}, !1) : (a(e), !1);
|
|
67
|
+
});
|
|
68
|
+
}, E = (e) => {
|
|
69
|
+
f("on-remove", e);
|
|
70
|
+
}, T = () => {
|
|
71
|
+
d({
|
|
72
|
+
message: `最多只能上传 ${n.props.limit} 个文件!`,
|
|
73
|
+
type: "warning"
|
|
74
|
+
});
|
|
75
|
+
}, B = (e) => {
|
|
76
|
+
_.value = e.url, y.value = !0;
|
|
77
|
+
}, F = (e) => {
|
|
78
|
+
b(e).then((t) => t.size / 1024 / 1024 < 5 ? (N(t), !1) : (d({
|
|
79
|
+
message: "上传大小不能超过 5MB!",
|
|
80
|
+
type: "warning"
|
|
81
|
+
}), !1));
|
|
82
|
+
};
|
|
83
|
+
function D(e, t) {
|
|
84
|
+
if (!e.name) {
|
|
85
|
+
d({
|
|
86
|
+
message: "附件名称不能为空!",
|
|
87
|
+
type: "warning"
|
|
88
|
+
});
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
f("on-change", e);
|
|
92
|
+
}
|
|
93
|
+
function N(e) {
|
|
94
|
+
return w.service({ text: "上传中,请稍后", background: "rgba(0,0,0,0.3)" }), new Promise((t, a) => {
|
|
95
|
+
const i = new FormData();
|
|
96
|
+
i.append("file", e), te.post(x, i, {}).then((o) => (w.service().close(), d({
|
|
97
|
+
message: "上传成功",
|
|
98
|
+
type: "success"
|
|
99
|
+
}), f("on-success", o.data.data), t(o.data), !1)).catch(() => {
|
|
100
|
+
w.service().close(), d({
|
|
101
|
+
message: "上传失败",
|
|
102
|
+
type: "warning"
|
|
103
|
+
}), a("Upload failed");
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return (e, t) => (p(), I(U, null, [
|
|
108
|
+
s(l(O), {
|
|
109
|
+
"file-list": g.value,
|
|
110
|
+
action: l(x),
|
|
111
|
+
limit: n.props.limit,
|
|
112
|
+
accept: n.props.accept,
|
|
113
|
+
"list-type": n.props.listType,
|
|
114
|
+
"on-remove": E,
|
|
115
|
+
"before-upload": F,
|
|
116
|
+
"on-exceed": T,
|
|
117
|
+
"on-preview": B,
|
|
118
|
+
multiple: !0,
|
|
119
|
+
"http-request": () => !1,
|
|
120
|
+
"show-file-list": n.props.listType !== "text",
|
|
121
|
+
class: R([
|
|
122
|
+
"upload-main",
|
|
123
|
+
{ "disable-upload": g.value.length >= n.props.limit }
|
|
124
|
+
]),
|
|
125
|
+
onClick: t[0] || (t[0] = $(() => {
|
|
126
|
+
}, ["prevent"]))
|
|
127
|
+
}, {
|
|
128
|
+
default: r(() => [
|
|
129
|
+
n.props.listType !== "text" ? (p(), m(l(v), {
|
|
130
|
+
key: 0,
|
|
131
|
+
disabled: !0
|
|
132
|
+
}, {
|
|
133
|
+
default: r(() => [
|
|
134
|
+
s(l(Y))
|
|
135
|
+
]),
|
|
136
|
+
_: 1
|
|
137
|
+
})) : (p(), m(l(W), {
|
|
138
|
+
key: 1,
|
|
139
|
+
class: "upload-button",
|
|
140
|
+
type: "primary"
|
|
141
|
+
}, {
|
|
142
|
+
default: r(() => [
|
|
143
|
+
j(" 上传附件 ")
|
|
144
|
+
]),
|
|
145
|
+
_: 1
|
|
146
|
+
}))
|
|
147
|
+
]),
|
|
148
|
+
_: 1
|
|
149
|
+
}, 8, ["file-list", "action", "limit", "accept", "list-type", "show-file-list", "class"]),
|
|
150
|
+
s(l(G), {
|
|
151
|
+
modelValue: y.value,
|
|
152
|
+
"onUpdate:modelValue": t[1] || (t[1] = (a) => y.value = a)
|
|
153
|
+
}, {
|
|
154
|
+
default: r(() => [
|
|
155
|
+
k("img", {
|
|
156
|
+
"w-full": "",
|
|
157
|
+
src: _.value,
|
|
158
|
+
alt: "Preview Image"
|
|
159
|
+
}, null, 8, ae)
|
|
160
|
+
]),
|
|
161
|
+
_: 1
|
|
162
|
+
}, 8, ["modelValue"]),
|
|
163
|
+
n.props.listType == "text" ? (p(), m(l(H), { key: 0 }, {
|
|
164
|
+
default: r(() => [
|
|
165
|
+
(p(!0), I(U, null, L(g.value, (a, i) => (p(), m(l(J), {
|
|
166
|
+
key: i,
|
|
167
|
+
class: "file-list"
|
|
168
|
+
}, {
|
|
169
|
+
default: r(() => [
|
|
170
|
+
s(l(v), {
|
|
171
|
+
color: "#73767a",
|
|
172
|
+
size: 14
|
|
173
|
+
}, {
|
|
174
|
+
default: r(() => [
|
|
175
|
+
s(l(Z))
|
|
176
|
+
]),
|
|
177
|
+
_: 1
|
|
178
|
+
}),
|
|
179
|
+
s(l(K), {
|
|
180
|
+
modelValue: a.name,
|
|
181
|
+
"onUpdate:modelValue": (o) => a.name = o,
|
|
182
|
+
onChange: (o) => D(a)
|
|
183
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "onChange"]),
|
|
184
|
+
k("span", le, "." + S(a.fileType), 1),
|
|
185
|
+
s(l(v), {
|
|
186
|
+
color: "#73767a",
|
|
187
|
+
size: 12,
|
|
188
|
+
onClick: (o) => E(a)
|
|
189
|
+
}, {
|
|
190
|
+
default: r(() => [
|
|
191
|
+
s(l(ee))
|
|
192
|
+
]),
|
|
193
|
+
_: 2
|
|
194
|
+
}, 1032, ["onClick"])
|
|
195
|
+
]),
|
|
196
|
+
_: 2
|
|
197
|
+
}, 1024))), 128))
|
|
198
|
+
]),
|
|
199
|
+
_: 1
|
|
200
|
+
})) : q("", !0)
|
|
201
|
+
], 64));
|
|
202
|
+
}
|
|
203
|
+
}, ce = /* @__PURE__ */ Q(ne, [["__scopeId", "data-v-c3169746"]]);
|
|
204
|
+
export {
|
|
205
|
+
ce as default
|
|
206
|
+
};
|
|
207
|
+
//# sourceMappingURL=AttachmentUploader-DDK8ANLO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentUploader-DDK8ANLO.js","sources":["../src/framework/field/attachment/AttachmentUploader.vue"],"sourcesContent":["<script setup>\nimport {\n ElUpload,\n ElIcon,\n ElDialog,\n ElForm,\n ElFormItem,\n ElButton,\n ElInput,\n} from \"element-plus\";\nimport axios from \"axios\";\nimport { getConfig } from \"../../config-loader\";\nimport { ref, computed } from \"vue\";\nimport { ElLoading, ElMessage } from \"element-plus\";\nimport { Plus, Document, Close } from \"@element-plus/icons-vue\";\n\nconst emit = defineEmits([\"on-success\", \"on-remove\", \"on-change\"]);\nconst props = defineProps({\n pics: {\n type: Array,\n default() {\n return [];\n },\n },\n limit: { type: Number },\n props: {\n type: Object,\n default() {\n return {\n listType: \"picture-card\", //'text' | 'picture' | 'picture-card'\n limit: 5, //最多上传几个文件\n accept: \"image/*\",\n };\n },\n },\n});\n\nconst files = computed(() => {\n return props.pics.map((item) => {\n const fileType = item.url.substring(item.url.lastIndexOf(\".\") + 1);\n if (typeof item.name !== undefined) {\n item.fileType = fileType;\n return item;\n }\n\n if (item.url) {\n const parts = item.url.split(\"/\");\n const namedItem = {\n ...item,\n name: parts[parts.length - 1],\n fileType: fileType,\n };\n return namedItem;\n }\n\n return { ...item, name: item.id, fileType: fileType };\n });\n});\nconst dialogImageUrl = ref(\"\");\nconst dialogVisible = ref(false);\nconst imageUrl = ref(props);\nconst uploadUrl = getConfig().fileUploadUrl;\nconst header = {\n Authorization: `Bearer ${localStorage.getItem(\"token\")}`,\n};\nconst compressImg = (file) => {\n const reader = new FileReader();\n reader.readAsDataURL(file);\n\n return new Promise(function (resolve, reject) {\n if (!file.type.startsWith(\"image/\")) {\n resolve(file);\n return false;\n }\n reader.onload = async (e) => {\n const img = new Image();\n img.src = e.target.result;\n img.onload = () => {\n const canvas = document.createElement(\"canvas\");\n const ctx = canvas.getContext(\"2d\");\n canvas.width = img.width;\n canvas.height = img.height;\n ctx.drawImage(img, 0, 0, canvas.width, canvas.height);\n canvas.toBlob(\n (blob) => {\n const newFile = new File([blob], file.name, {\n type: file.type,\n lastModified: Date.now(),\n });\n resolve(newFile);\n },\n file.type,\n 0.5,\n );\n };\n };\n return false;\n });\n};\nconst handleRemoveSuccess = (uploadFile) => {\n emit(\"on-remove\", uploadFile);\n};\nconst handleExceed = () => {\n ElMessage({\n message: `最多只能上传 ${props.props.limit} 个文件!`,\n type: \"warning\",\n });\n};\nconst handlePictureCardPreview = (uploadFile) => {\n dialogImageUrl.value = uploadFile.url;\n dialogVisible.value = true;\n};\nconst handleBeforeUpload = (file) => {\n compressImg(file).then((newFile) => {\n if (newFile.size / 1024 / 1024 < 5) {\n uploadRequest(newFile);\n return false;\n } else {\n ElMessage({\n message: \"上传大小不能超过 5MB!\",\n type: \"warning\",\n });\n return false;\n }\n });\n};\n\nfunction handleFileNameChange(file, index) {\n if (!file.name) {\n ElMessage({\n message: \"附件名称不能为空!\",\n type: \"warning\",\n });\n return;\n }\n emit(\"on-change\", file);\n}\n\nfunction uploadRequest(file) {\n ElLoading.service({ text: \"上传中,请稍后\", background: \"rgba(0,0,0,0.3)\" });\n return new Promise((resolve, reject) => {\n const formData = new FormData();\n formData.append(\"file\", file);\n axios\n .post(uploadUrl, formData, {})\n .then((res) => {\n ElLoading.service().close();\n ElMessage({\n message: \"上传成功\",\n type: \"success\",\n });\n emit(\"on-success\", res.data.data);\n resolve(res.data);\n return false;\n })\n .catch(() => {\n ElLoading.service().close();\n ElMessage({\n message: \"上传失败\",\n type: \"warning\",\n });\n reject(\"Upload failed\");\n });\n });\n}\n</script>\n\n<template>\n <!-- 删除请求头加权限后请添加到组建中 :headers=\"header\"-->\n <el-upload\n :file-list=\"files\"\n :action=\"uploadUrl\"\n :limit=\"props.props.limit\"\n :accept=\"props.props.accept\"\n :list-type=\"props.props.listType\"\n :on-remove=\"handleRemoveSuccess\"\n :before-upload=\"handleBeforeUpload\"\n :on-exceed=\"handleExceed\"\n :on-preview=\"handlePictureCardPreview\"\n :multiple=\"true\"\n :http-request=\"\n () => {\n return false;\n }\n \"\n :show-file-list=\"props.props.listType !== 'text'\"\n :class=\"[\n 'upload-main',\n { 'disable-upload': files.length >= props.props.limit },\n ]\"\n @click.prevent\n >\n <template v-if=\"props.props.listType !== 'text'\">\n <el-icon :disabled=\"true\">\n <Plus />\n </el-icon>\n </template>\n <template v-else>\n <el-button class=\"upload-button\" type=\"primary\"> 上传附件 </el-button>\n </template>\n </el-upload>\n <el-dialog v-model=\"dialogVisible\">\n <img w-full :src=\"dialogImageUrl\" alt=\"Preview Image\" />\n </el-dialog>\n <el-form v-if=\"props.props.listType == 'text'\">\n <el-form-item v-for=\"(file, index) in files\" :key=\"index\" class=\"file-list\">\n <el-icon color=\"#73767a\" :size=\"14\">\n <Document />\n </el-icon>\n <el-input\n v-model=\"file.name\"\n @change=\"handleFileNameChange(file, index)\"\n />\n <span class=\"file-type\">.{{ file.fileType }}</span>\n <el-icon color=\"#73767a\" :size=\"12\" @click=\"handleRemoveSuccess(file)\">\n <Close />\n </el-icon>\n </el-form-item>\n </el-form>\n</template>\n<style scoped lang=\"scss\">\n:deep(.el-upload-list) {\n .el-upload-list__item-actions span {\n margin-left: 20px;\n }\n}\n\n.disable-upload {\n :deep(.el-upload--picture-card) {\n display: none !important;\n }\n\n :deep(.el-upload--text) {\n display: none !important;\n }\n\n :deep(.el-upload--picture) {\n display: none !important;\n }\n}\n.upload-main {\n flex-basis: 100%;\n}\n.file-list {\n display: flex;\n align-items: center;\n margin-top: 10px;\n .file-type {\n height: 22px;\n line-height: 22px;\n margin-right: 5px;\n background: #eeeeee;\n border-radius: 4px;\n font-size: 12px;\n padding: 0 4px;\n }\n :deep(.el-form-item__content) {\n display: contents;\n }\n :deep(.el-input__wrapper) {\n margin: 0 5px;\n }\n :deep(.el-input__inner) {\n height: 20px;\n line-height: 20px;\n }\n}\n</style>\n"],"names":["emit","__emit","props","__props","files","computed","item","fileType","parts","dialogImageUrl","ref","dialogVisible","uploadUrl","getConfig","compressImg","file","reader","resolve","reject","e","img","canvas","ctx","blob","newFile","handleRemoveSuccess","uploadFile","handleExceed","ElMessage","handlePictureCardPreview","handleBeforeUpload","uploadRequest","handleFileNameChange","index","ElLoading","formData","axios","res"],"mappings":"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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { openBlock as t, createBlock as o, unref as e, withCtx as s, renderSlot as I, createElementVNode as v, createVNode as l, withModifiers as E, createCommentVNode as b } from "vue";
|
|
2
2
|
import { ElUpload as x, ElImage as B, ElIcon as n, ElMessage as i, ElLoading as d } from "element-plus";
|
|
3
|
-
import { _ as M, f as C, l as S, p as L, n as N, j as V } from "./index-
|
|
3
|
+
import { _ as M, f as C, l as S, p as L, n as N, j as V } from "./index-DXMjIePp.js";
|
|
4
4
|
import "./el-loading-l0sNRNKZ.js";
|
|
5
5
|
const q = { class: "image-slot" }, z = {
|
|
6
6
|
__name: "ImageUploader",
|
|
@@ -94,4 +94,4 @@ const q = { class: "image-slot" }, z = {
|
|
|
94
94
|
export {
|
|
95
95
|
F as default
|
|
96
96
|
};
|
|
97
|
-
//# sourceMappingURL=ImageUploader-
|
|
97
|
+
//# sourceMappingURL=ImageUploader-B4o50qQm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageUploader-
|
|
1
|
+
{"version":3,"file":"ImageUploader-B4o50qQm.js","sources":["../src/framework/field/image/ImageUploader.vue"],"sourcesContent":["<script setup>\nimport { ElUpload, ElImage, ElIcon } from \"element-plus\";\nimport axios from \"axios\";\nimport { getConfig } from \"../../config-loader\";\nimport { ElLoading, ElMessage } from \"element-plus\";\nimport { Plus, Delete, Loading } from \"@element-plus/icons-vue\";\n\nconst emit = defineEmits([\"on-success\"]);\nconst props = defineProps({\n imageUrl: { type: String },\n});\nconst uploadUrl = getConfig().imageUploadUrl;\nconst header = {\n Authorization: `Bearer ${localStorage.getItem(\"token\")}`,\n};\nconst handleBeforeUpload = (uploadFile) => {\n const isLt2M = uploadFile.size / 1024 / 1024 < 5;\n if (!isLt2M) {\n ElMessage({\n message: \"上传大小不能超过 5MB!\",\n type: \"warning\",\n });\n return false;\n }\n};\nconst handleSuccess = (response) => {\n emit(\"on-success\", response.data.imageUrl);\n};\n\nfunction deleteImageUrl() {\n emit(\"on-success\", \"\");\n}\n\nfunction uploadRequest(file) {\n ElLoading.service({ text: \"上传中,请稍后\", background: \"rgba(0,0,0,0.3)\" });\n return new Promise((resolve, reject) => {\n const formData = new FormData();\n formData.append(\"image\", file.file);\n axios\n .post(uploadUrl, formData, {})\n .then((res) => {\n ElLoading.service().close();\n ElMessage({\n message: \"上传成功\",\n type: \"success\",\n });\n resolve(res.data);\n })\n .catch(() => {\n ElLoading.service().close();\n ElMessage({\n message: \"上传失败\",\n type: \"warning\",\n });\n reject(\"Upload failed\");\n });\n });\n}\n</script>\n\n<template>\n <!-- 删除请求头加权限后请添加到组建中 :headers=\"header\"-->\n <el-upload\n class=\"image-uploader\"\n :action=\"uploadUrl\"\n name=\"image\"\n :show-file-list=\"false\"\n :on-success=\"handleSuccess\"\n :before-upload=\"handleBeforeUpload\"\n :http-request=\"uploadRequest\"\n >\n <slot />\n <el-image\n v-if=\"props.imageUrl\"\n class=\"image\"\n :src=\"props.imageUrl\"\n fit=\"scale-down\"\n >\n <template #placeholder>\n <div class=\"image-slot\">\n <el-icon class=\"placeholder-icon\">\n <Loading />\n </el-icon>\n </div>\n </template>\n </el-image>\n <el-icon v-else class=\"uploader-icon\">\n <Plus />\n </el-icon>\n <el-icon\n v-if=\"props.imageUrl\"\n class=\"delete-icon\"\n @click.stop.prevent=\"deleteImageUrl\"\n >\n <Delete />\n </el-icon>\n </el-upload>\n</template>\n\n<style scoped lang=\"scss\">\n.image-uploader {\n :deep(.el-upload) {\n border: 1px dashed var(--el-border-color);\n border-radius: 6px;\n cursor: pointer;\n position: relative;\n overflow: hidden;\n transition: var(--el-transition-duration-fast);\n\n &:hover {\n border-color: var(--el-color-primary);\n }\n }\n\n .image {\n width: 146px;\n height: 146px;\n\n .placeholder-icon {\n width: 146px;\n height: 146px;\n font-size: 30px;\n color: #a7a7a7;\n }\n }\n\n .uploader-icon {\n font-size: 28px;\n color: #8c939d;\n width: 146px;\n height: 146px;\n text-align: center;\n }\n\n .delete-icon {\n font-size: 20px;\n color: #b7b4b4;\n position: absolute;\n top: 10px;\n right: 10px;\n }\n}\n</style>\n"],"names":["emit","__emit","props","__props","uploadUrl","getConfig","handleBeforeUpload","uploadFile","ElMessage","handleSuccess","response","deleteImageUrl","uploadRequest","file","ElLoading","resolve","reject","formData","axios","res"],"mappings":";;;;;;;;;;;AAOA,UAAMA,IAAOC,GACPC,IAAQC,GAGRC,IAAYC,EAAW,EAAC;AACf,IACY,gBAAa,QAAQ,OAAO;AAEvD,UAAMC,IAAqB,CAACC,MAAe;AAEzC,UAAI,EADWA,EAAW,OAAO,OAAO,OAAO;AAE7C,eAAAC,EAAU;AAAA,UACR,SAAS;AAAA,UACT,MAAM;AAAA,QACZ,CAAK,GACM;AAAA,IAEX,GACMC,IAAgB,CAACC,MAAa;AAClC,MAAAV,EAAK,cAAcU,EAAS,KAAK,QAAQ;AAAA,IAC3C;AAEA,aAASC,IAAiB;AACxB,MAAAX,EAAK,cAAc,EAAE;AAAA,IACvB;AAEA,aAASY,EAAcC,GAAM;AAC3B,aAAAC,EAAU,QAAQ,EAAE,MAAM,WAAW,YAAY,kBAAiB,CAAE,GAC7D,IAAI,QAAQ,CAACC,GAASC,MAAW;AACtC,cAAMC,IAAW,IAAI;AACrB,QAAAA,EAAS,OAAO,SAASJ,EAAK,IAAI,GAClCK,EACG,KAAKd,GAAWa,GAAU,EAAE,EAC5B,KAAK,CAACE,MAAQ;AACb,UAAAL,EAAU,UAAU,SACpBN,EAAU;AAAA,YACR,SAAS;AAAA,YACT,MAAM;AAAA,UAChB,CAAS,GACDO,EAAQI,EAAI,IAAI;AAAA,QACxB,CAAO,EACA,MAAM,MAAM;AACX,UAAAL,EAAU,UAAU,SACpBN,EAAU;AAAA,YACR,SAAS;AAAA,YACT,MAAM;AAAA,UAChB,CAAS,GACDQ,EAAO,eAAe;AAAA,QAC9B,CAAO;AAAA,MACP,CAAG;AAAA,IACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as tn, onMounted as rn, onBeforeUnmount as nn, ref as $r, watch as Ir, nextTick as Gr, h as an, openBlock as on, createBlock as sn, unref as un } from "vue";
|
|
2
2
|
import * as Dr from "quill";
|
|
3
3
|
import Pr from "quill";
|
|
4
|
-
import { k as W, m as ln, j as fn, f as cn } from "./index-
|
|
4
|
+
import { k as W, m as ln, j as fn, f as cn } from "./index-DXMjIePp.js";
|
|
5
5
|
import hn from "quill-image-uploader";
|
|
6
6
|
var ue = -1, ne = 1, Z = 0;
|
|
7
7
|
function it(r, a, n, u) {
|
|
@@ -1774,4 +1774,4 @@ const qr = {
|
|
|
1774
1774
|
export {
|
|
1775
1775
|
Pn as default
|
|
1776
1776
|
};
|
|
1777
|
-
//# sourceMappingURL=RichTextEditor-
|
|
1777
|
+
//# sourceMappingURL=RichTextEditor-B7wNzt4K.js.map
|