kouxiangtang 0.0.40 → 0.0.42
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-DkBTVZW9.js → AttachmentUploader-Dyv1eNxy.js} +61 -55
- package/dist/AttachmentUploader-Dyv1eNxy.js.map +1 -0
- package/dist/{ImageUploader-CI5IMfbX.js → ImageUploader-Cfw1dJew.js} +2 -2
- package/dist/{ImageUploader-CI5IMfbX.js.map → ImageUploader-Cfw1dJew.js.map} +1 -1
- package/dist/{ImagesUploader-DP3H4CgN.js → ImagesUploader-GcmvCM8e.js} +2 -2
- package/dist/{ImagesUploader-DP3H4CgN.js.map → ImagesUploader-GcmvCM8e.js.map} +1 -1
- package/dist/{RichTextEditor-CmWUYWbU.js → RichTextEditor-q1NyOWsk.js} +2 -2
- package/dist/{RichTextEditor-CmWUYWbU.js.map → RichTextEditor-q1NyOWsk.js.map} +1 -1
- package/dist/{config-DiYB27JS.js → config-7Hv2OCEB.js} +2 -2
- package/dist/{config-DiYB27JS.js.map → config-7Hv2OCEB.js.map} +1 -1
- package/dist/{config-pxsBixPq.js → config-BXUYdJ5Z.js} +2 -2
- package/dist/{config-pxsBixPq.js.map → config-BXUYdJ5Z.js.map} +1 -1
- package/dist/{config-C-L6-5nl.js → config-BaiH_oxD.js} +3 -3
- package/dist/{config-C-L6-5nl.js.map → config-BaiH_oxD.js.map} +1 -1
- package/dist/{config-uT5A3c5i.js → config-BfzvN4xX.js} +2 -2
- package/dist/{config-uT5A3c5i.js.map → config-BfzvN4xX.js.map} +1 -1
- package/dist/config-BxMbNv2A.js +20 -0
- package/dist/config-BxMbNv2A.js.map +1 -0
- package/dist/{config-CtTzTOfQ.js → config-C4IeWvNQ.js} +2 -2
- package/dist/{config-CtTzTOfQ.js.map → config-C4IeWvNQ.js.map} +1 -1
- package/dist/{config-CI8auEwd.js → config-CCm-mWa8.js} +2 -2
- package/dist/{config-CI8auEwd.js.map → config-CCm-mWa8.js.map} +1 -1
- package/dist/{config-cPSnYR_W.js → config-C_0rqQDk.js} +28 -28
- package/dist/config-C_0rqQDk.js.map +1 -0
- package/dist/{config-Dv3oakjJ.js → config-Cvt56UZv.js} +2 -2
- package/dist/{config-Dv3oakjJ.js.map → config-Cvt56UZv.js.map} +1 -1
- package/dist/{config-BwOPNyIw.js → config-D4W5idCz.js} +2 -2
- package/dist/{config-BwOPNyIw.js.map → config-D4W5idCz.js.map} +1 -1
- package/dist/{config-BHQjTR1P.js → config-D8PBIIYE.js} +3 -3
- package/dist/{config-BHQjTR1P.js.map → config-D8PBIIYE.js.map} +1 -1
- package/dist/{config-C77NlS42.js → config-DcZ8E4mL.js} +2 -2
- package/dist/{config-C77NlS42.js.map → config-DcZ8E4mL.js.map} +1 -1
- package/dist/{config-rtFPHOZL.js → config-ENXuznar.js} +2 -2
- package/dist/{config-rtFPHOZL.js.map → config-ENXuznar.js.map} +1 -1
- package/dist/{config-imtlNR-t.js → config-KkWOBV0A.js} +2 -2
- package/dist/{config-imtlNR-t.js.map → config-KkWOBV0A.js.map} +1 -1
- package/dist/{config-BNwOB5hl.js → config-TwPJq19k.js} +2 -2
- package/dist/{config-BNwOB5hl.js.map → config-TwPJq19k.js.map} +1 -1
- package/dist/{config-CscLYdNf.js → config-W2wqQWo5.js} +2 -2
- package/dist/{config-CscLYdNf.js.map → config-W2wqQWo5.js.map} +1 -1
- package/dist/{index-BF3lUmGn.js → index-0gkLO2iI.js} +992 -979
- package/dist/index-0gkLO2iI.js.map +1 -0
- package/dist/kouxiangtang.js +1 -1
- package/dist/kouxiangtang.umd.cjs +7 -7
- package/dist/kouxiangtang.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/AttachmentUploader-DkBTVZW9.js.map +0 -1
- package/dist/config-ZW08WCha.js +0 -10
- package/dist/config-ZW08WCha.js.map +0 -1
- package/dist/config-cPSnYR_W.js.map +0 -1
- package/dist/index-BF3lUmGn.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import { ElUpload as
|
|
3
|
-
import { _ as Q, i as X, p as Y, d as Z, j as ee, k as te } from "./index-
|
|
1
|
+
import { computed as $, ref as h, openBlock as u, createElementBlock as b, Fragment as k, createVNode as r, unref as s, normalizeClass as M, withModifiers as R, withCtx as i, createBlock as m, createTextVNode as j, createElementVNode as E, renderList as L, toDisplayString as O, createCommentVNode as S } from "vue";
|
|
2
|
+
import { ElUpload as q, ElIcon as w, ElButton as W, ElDialog as G, ElForm as H, ElFormItem as J, ElInput as K, ElMessage as p, ElLoading as v } from "element-plus";
|
|
3
|
+
import { _ as Q, i as X, p as Y, d as Z, j as ee, k as te } from "./index-0gkLO2iI.js";
|
|
4
4
|
import "./el-progress-l0sNRNKZ.js";
|
|
5
|
-
const ae = ["src"],
|
|
5
|
+
const ae = ["src"], se = { class: "file-type" }, ne = {
|
|
6
6
|
__name: "AttachmentUploader",
|
|
7
7
|
props: {
|
|
8
8
|
pics: {
|
|
@@ -26,8 +26,8 @@ const ae = ["src"], le = { class: "file-type" }, ne = {
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
emits: ["on-success", "on-remove", "on-change"],
|
|
29
|
-
setup(
|
|
30
|
-
const f =
|
|
29
|
+
setup(U, { emit: C }) {
|
|
30
|
+
const f = C, n = U, g = $(() => n.pics.map((e) => {
|
|
31
31
|
const t = e.url.substring(e.url.lastIndexOf(".") + 1);
|
|
32
32
|
if (typeof e.name !== void 0)
|
|
33
33
|
return e.fileType = t, e;
|
|
@@ -44,14 +44,14 @@ const ae = ["src"], le = { class: "file-type" }, ne = {
|
|
|
44
44
|
h(n);
|
|
45
45
|
const x = X().fileUploadUrl;
|
|
46
46
|
`${localStorage.getItem("token")}`;
|
|
47
|
-
const
|
|
47
|
+
const V = (e) => {
|
|
48
48
|
const t = new FileReader();
|
|
49
|
-
return t.readAsDataURL(e), new Promise(function(a,
|
|
49
|
+
return t.readAsDataURL(e), new Promise(function(a, l) {
|
|
50
50
|
return e.type.startsWith("image/") ? (t.onload = async (o) => {
|
|
51
|
-
const
|
|
52
|
-
|
|
51
|
+
const d = new Image();
|
|
52
|
+
d.src = o.target.result, d.onload = () => {
|
|
53
53
|
const c = document.createElement("canvas"), z = c.getContext("2d");
|
|
54
|
-
c.width =
|
|
54
|
+
c.width = d.width, c.height = d.height, z.drawImage(d, 0, 0, c.width, c.height), c.toBlob(
|
|
55
55
|
(A) => {
|
|
56
56
|
const P = new File([A], e.name, {
|
|
57
57
|
type: e.type,
|
|
@@ -65,24 +65,30 @@ const ae = ["src"], le = { class: "file-type" }, ne = {
|
|
|
65
65
|
};
|
|
66
66
|
}, !1) : (a(e), !1);
|
|
67
67
|
});
|
|
68
|
-
},
|
|
69
|
-
f("on-remove", e);
|
|
68
|
+
}, I = (e) => {
|
|
69
|
+
e.status === "success" && f("on-remove", e);
|
|
70
70
|
}, T = () => {
|
|
71
|
-
|
|
71
|
+
p({
|
|
72
72
|
message: `最多只能上传 ${n.props.limit} 个文件!`,
|
|
73
73
|
type: "warning"
|
|
74
74
|
});
|
|
75
75
|
}, B = (e) => {
|
|
76
76
|
_.value = e.url, y.value = !0;
|
|
77
|
-
},
|
|
78
|
-
|
|
77
|
+
}, N = (e) => {
|
|
78
|
+
const t = e.name.substring(0, e.name.lastIndexOf("."));
|
|
79
|
+
if (!/^[\u4e00-\u9fa5\w-_]+$/.test(t))
|
|
80
|
+
return p({
|
|
81
|
+
message: "请勿输入特殊字符!",
|
|
82
|
+
type: "warning"
|
|
83
|
+
}), !1;
|
|
84
|
+
V(e).then((l) => l.size / 1024 / 1024 < 5 ? (F(l), !1) : (p({
|
|
79
85
|
message: "上传大小不能超过 5MB!",
|
|
80
86
|
type: "warning"
|
|
81
87
|
}), !1));
|
|
82
88
|
};
|
|
83
89
|
function D(e, t) {
|
|
84
90
|
if (!e.name) {
|
|
85
|
-
|
|
91
|
+
p({
|
|
86
92
|
message: "附件名称不能为空!",
|
|
87
93
|
type: "warning"
|
|
88
94
|
});
|
|
@@ -90,56 +96,56 @@ const ae = ["src"], le = { class: "file-type" }, ne = {
|
|
|
90
96
|
}
|
|
91
97
|
f("on-change", e);
|
|
92
98
|
}
|
|
93
|
-
function
|
|
94
|
-
return
|
|
95
|
-
const
|
|
96
|
-
|
|
99
|
+
function F(e) {
|
|
100
|
+
return v.service({ text: "上传中,请稍后", background: "rgba(0,0,0,0.3)" }), new Promise((t, a) => {
|
|
101
|
+
const l = new FormData();
|
|
102
|
+
l.append("file", e), te.post(x, l, {}).then((o) => (v.service().close(), p({
|
|
97
103
|
message: "上传成功",
|
|
98
104
|
type: "success"
|
|
99
105
|
}), f("on-success", o.data.data), t(o.data), !1)).catch(() => {
|
|
100
|
-
|
|
106
|
+
v.service().close(), p({
|
|
101
107
|
message: "上传失败",
|
|
102
108
|
type: "warning"
|
|
103
109
|
}), a("Upload failed");
|
|
104
110
|
});
|
|
105
111
|
});
|
|
106
112
|
}
|
|
107
|
-
return (e, t) => (
|
|
108
|
-
s(
|
|
113
|
+
return (e, t) => (u(), b(k, null, [
|
|
114
|
+
r(s(q), {
|
|
109
115
|
"file-list": g.value,
|
|
110
|
-
action:
|
|
116
|
+
action: s(x),
|
|
111
117
|
limit: n.props.limit,
|
|
112
118
|
accept: n.props.accept,
|
|
113
119
|
"list-type": n.props.listType,
|
|
114
|
-
"on-remove":
|
|
115
|
-
"before-upload":
|
|
120
|
+
"on-remove": I,
|
|
121
|
+
"before-upload": N,
|
|
116
122
|
"on-exceed": T,
|
|
117
123
|
"on-preview": B,
|
|
118
124
|
multiple: !0,
|
|
119
125
|
"http-request": () => !1,
|
|
120
126
|
"show-file-list": n.props.listType !== "text",
|
|
121
|
-
class:
|
|
127
|
+
class: M([
|
|
122
128
|
"upload-main",
|
|
123
129
|
{ "disable-upload": g.value.length >= n.props.limit }
|
|
124
130
|
]),
|
|
125
|
-
onClick: t[0] || (t[0] =
|
|
131
|
+
onClick: t[0] || (t[0] = R(() => {
|
|
126
132
|
}, ["prevent"]))
|
|
127
133
|
}, {
|
|
128
|
-
default:
|
|
129
|
-
n.props.listType !== "text" ? (
|
|
134
|
+
default: i(() => [
|
|
135
|
+
n.props.listType !== "text" ? (u(), m(s(w), {
|
|
130
136
|
key: 0,
|
|
131
137
|
disabled: !0
|
|
132
138
|
}, {
|
|
133
|
-
default:
|
|
134
|
-
s(
|
|
139
|
+
default: i(() => [
|
|
140
|
+
r(s(Y))
|
|
135
141
|
]),
|
|
136
142
|
_: 1
|
|
137
|
-
})) : (
|
|
143
|
+
})) : (u(), m(s(W), {
|
|
138
144
|
key: 1,
|
|
139
145
|
class: "upload-button",
|
|
140
146
|
type: "primary"
|
|
141
147
|
}, {
|
|
142
|
-
default:
|
|
148
|
+
default: i(() => [
|
|
143
149
|
j(" 上传附件 ")
|
|
144
150
|
]),
|
|
145
151
|
_: 1
|
|
@@ -147,12 +153,12 @@ const ae = ["src"], le = { class: "file-type" }, ne = {
|
|
|
147
153
|
]),
|
|
148
154
|
_: 1
|
|
149
155
|
}, 8, ["file-list", "action", "limit", "accept", "list-type", "show-file-list", "class"]),
|
|
150
|
-
s(
|
|
156
|
+
r(s(G), {
|
|
151
157
|
modelValue: y.value,
|
|
152
158
|
"onUpdate:modelValue": t[1] || (t[1] = (a) => y.value = a)
|
|
153
159
|
}, {
|
|
154
|
-
default:
|
|
155
|
-
|
|
160
|
+
default: i(() => [
|
|
161
|
+
E("img", {
|
|
156
162
|
"w-full": "",
|
|
157
163
|
src: _.value,
|
|
158
164
|
alt: "Preview Image"
|
|
@@ -160,35 +166,35 @@ const ae = ["src"], le = { class: "file-type" }, ne = {
|
|
|
160
166
|
]),
|
|
161
167
|
_: 1
|
|
162
168
|
}, 8, ["modelValue"]),
|
|
163
|
-
n.props.listType == "text" ? (
|
|
164
|
-
default:
|
|
165
|
-
(
|
|
166
|
-
key:
|
|
169
|
+
n.props.listType == "text" ? (u(), m(s(H), { key: 0 }, {
|
|
170
|
+
default: i(() => [
|
|
171
|
+
(u(!0), b(k, null, L(g.value, (a, l) => (u(), m(s(J), {
|
|
172
|
+
key: l,
|
|
167
173
|
class: "file-list"
|
|
168
174
|
}, {
|
|
169
|
-
default:
|
|
170
|
-
s(
|
|
175
|
+
default: i(() => [
|
|
176
|
+
r(s(w), {
|
|
171
177
|
color: "#73767a",
|
|
172
178
|
size: 14
|
|
173
179
|
}, {
|
|
174
|
-
default:
|
|
175
|
-
s(
|
|
180
|
+
default: i(() => [
|
|
181
|
+
r(s(Z))
|
|
176
182
|
]),
|
|
177
183
|
_: 1
|
|
178
184
|
}),
|
|
179
|
-
s(
|
|
185
|
+
r(s(K), {
|
|
180
186
|
modelValue: a.name,
|
|
181
187
|
"onUpdate:modelValue": (o) => a.name = o,
|
|
182
188
|
onChange: (o) => D(a)
|
|
183
189
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "onChange"]),
|
|
184
|
-
|
|
185
|
-
s(
|
|
190
|
+
E("span", se, "." + O(a.fileType), 1),
|
|
191
|
+
r(s(w), {
|
|
186
192
|
color: "#73767a",
|
|
187
193
|
size: 12,
|
|
188
|
-
onClick: (o) =>
|
|
194
|
+
onClick: (o) => I(a)
|
|
189
195
|
}, {
|
|
190
|
-
default:
|
|
191
|
-
s(
|
|
196
|
+
default: i(() => [
|
|
197
|
+
r(s(ee))
|
|
192
198
|
]),
|
|
193
199
|
_: 2
|
|
194
200
|
}, 1032, ["onClick"])
|
|
@@ -197,11 +203,11 @@ const ae = ["src"], le = { class: "file-type" }, ne = {
|
|
|
197
203
|
}, 1024))), 128))
|
|
198
204
|
]),
|
|
199
205
|
_: 1
|
|
200
|
-
})) :
|
|
206
|
+
})) : S("", !0)
|
|
201
207
|
], 64));
|
|
202
208
|
}
|
|
203
|
-
}, ce = /* @__PURE__ */ Q(ne, [["__scopeId", "data-v-
|
|
209
|
+
}, ce = /* @__PURE__ */ Q(ne, [["__scopeId", "data-v-aa2fe0b2"]]);
|
|
204
210
|
export {
|
|
205
211
|
ce as default
|
|
206
212
|
};
|
|
207
|
-
//# sourceMappingURL=AttachmentUploader-
|
|
213
|
+
//# sourceMappingURL=AttachmentUploader-Dyv1eNxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentUploader-Dyv1eNxy.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 if (uploadFile.status === \"success\") {\n emit(\"on-remove\", uploadFile);\n }\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 const fileName = file.name.substring(0, file.name.lastIndexOf(\".\"));\n const regex = /^[\\u4e00-\\u9fa5\\w-_]+$/;\n if (!regex.test(fileName)) {\n ElMessage({\n message: \"请勿输入特殊字符!\",\n type: \"warning\",\n });\n return false;\n }\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","fileName","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, i as C, l as S, p as L, m as N, k as V } from "./index-
|
|
3
|
+
import { _ as M, i as C, l as S, p as L, m as N, k as V } from "./index-0gkLO2iI.js";
|
|
4
4
|
import "./el-progress-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
|
P as default
|
|
96
96
|
};
|
|
97
|
-
//# sourceMappingURL=ImageUploader-
|
|
97
|
+
//# sourceMappingURL=ImageUploader-Cfw1dJew.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageUploader-
|
|
1
|
+
{"version":3,"file":"ImageUploader-Cfw1dJew.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,6 +1,6 @@
|
|
|
1
1
|
import { ref as m, computed as I, openBlock as n, createElementBlock as k, createVNode as i, unref as o, normalizeClass as E, withModifiers as T, withCtx as r, createBlock as d, createTextVNode as V, createElementVNode as h } from "vue";
|
|
2
2
|
import { ElUpload as U, ElIcon as B, ElButton as z, ElDialog as N, ElMessage as f } from "element-plus";
|
|
3
|
-
import { _ as C, p as D } from "./index-
|
|
3
|
+
import { _ as C, p as D } from "./index-0gkLO2iI.js";
|
|
4
4
|
import "./el-progress-l0sNRNKZ.js";
|
|
5
5
|
const M = ["src"], q = {
|
|
6
6
|
__name: "ImagesUploader",
|
|
@@ -118,4 +118,4 @@ const M = ["src"], q = {
|
|
|
118
118
|
export {
|
|
119
119
|
A as default
|
|
120
120
|
};
|
|
121
|
-
//# sourceMappingURL=ImagesUploader-
|
|
121
|
+
//# sourceMappingURL=ImagesUploader-GcmvCM8e.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImagesUploader-
|
|
1
|
+
{"version":3,"file":"ImagesUploader-GcmvCM8e.js","sources":["../src/framework/field/images/ImagesUploader.vue"],"sourcesContent":["<script setup>\nimport { ElUpload, ElDialog, ElIcon, ElButton } from \"element-plus\";\nimport { computed, ref } from \"vue\";\nimport { ElMessage } from \"element-plus\";\nimport { Plus } from \"@element-plus/icons-vue\";\n\nconst emit = defineEmits([\"on-remove\", \"on-upload\"]);\nconst dialogImageUrl = ref(\"\");\nconst dialogVisible = ref(false);\nconst props = defineProps({\n images: {\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\",\n limit: 5,\n accept: \"image/*\",\n };\n },\n },\n});\n\nconst files = computed(() => {\n return props.images.map((item) => {\n if (!item?.url) {\n return { ...item, name: \"unknown\", fileType: \"unknown\" };\n }\n\n const fileType = item.url.substring(item.url.lastIndexOf(\".\") + 1);\n const parts = item.url.split(\"/\");\n const namedItem = {\n ...item,\n name: parts[parts.length - 1],\n fileType,\n };\n return namedItem;\n });\n});\n\nfunction onRemove(uploadFile) {\n emit(\"on-remove\", uploadFile);\n}\n\nfunction onExceed() {\n ElMessage({\n message: `最多只能上传 ${props.props.limit} 个文件!`,\n type: \"warning\",\n });\n}\n\nfunction onPreview(uploadFile) {\n dialogImageUrl.value = uploadFile.url;\n dialogVisible.value = true;\n}\n\nfunction beforeUpload(uploadFile) {\n const limitSize = 1024 * 1024 * 5;\n if (uploadFile.size > limitSize) {\n ElMessage({\n message: \"上传大小不能超过 5MB!\",\n type: \"warning\",\n });\n return false;\n }\n\n return true;\n}\n\nfunction httpRequest(uploadFile) {\n const formData = new FormData();\n formData.append(\"file\", uploadFile.file);\n emit(\"on-upload\", formData);\n}\n</script>\n\n<template>\n <div>\n <el-upload\n :file-list=\"files\"\n :limit=\"props.props.limit\"\n :accept=\"props.props.accept\"\n :list-type=\"props.props.listType\"\n :on-remove=\"onRemove\"\n :on-exceed=\"onExceed\"\n :on-preview=\"onPreview\"\n :multiple=\"true\"\n :before-upload=\"beforeUpload\"\n :http-request=\"httpRequest\"\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 </div>\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","dialogImageUrl","ref","dialogVisible","props","__props","files","computed","item","fileType","parts","onRemove","uploadFile","onExceed","ElMessage","onPreview","beforeUpload","httpRequest","formData"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,UAAMA,IAAOC,GACPC,IAAiBC,EAAI,EAAE,GACvBC,IAAgBD,EAAI,EAAK,GACzBE,IAAQC,GAoBRC,IAAQC,EAAS,MACdH,EAAM,OAAO,IAAI,CAACI,MAAS;AAChC,UAAI,EAACA,KAAA,QAAAA,EAAM;AACT,eAAO,EAAE,GAAGA,GAAM,MAAM,WAAW,UAAU;AAG/C,YAAMC,IAAWD,EAAK,IAAI,UAAUA,EAAK,IAAI,YAAY,GAAG,IAAI,CAAC,GAC3DE,IAAQF,EAAK,IAAI,MAAM,GAAG;AAMhC,aALkB;AAAA,QAChB,GAAGA;AAAA,QACH,MAAME,EAAMA,EAAM,SAAS,CAAC;AAAA,QAC5B,UAAAD;AAAA,MACN;AAAA,IAEA,CAAG,CACF;AAED,aAASE,EAASC,GAAY;AAC5B,MAAAb,EAAK,aAAaa,CAAU;AAAA,IAC9B;AAEA,aAASC,IAAW;AAClB,MAAAC,EAAU;AAAA,QACR,SAAS,UAAUV,EAAM,MAAM,KAAK;AAAA,QACpC,MAAM;AAAA,MACV,CAAG;AAAA,IACH;AAEA,aAASW,EAAUH,GAAY;AAC7B,MAAAX,EAAe,QAAQW,EAAW,KAClCT,EAAc,QAAQ;AAAA,IACxB;AAEA,aAASa,EAAaJ,GAAY;AAEhC,aAAIA,EAAW,OAAO,WACpBE,EAAU;AAAA,QACR,SAAS;AAAA,QACT,MAAM;AAAA,MACZ,CAAK,GACM,MAGF;AAAA,IACT;AAEA,aAASG,EAAYL,GAAY;AAC/B,YAAMM,IAAW,IAAI;AACrB,MAAAA,EAAS,OAAO,QAAQN,EAAW,IAAI,GACvCb,EAAK,aAAamB,CAAQ;AAAA,IAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -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 { n as W, o as ln, k as fn, i as cn } from "./index-
|
|
4
|
+
import { n as W, o as ln, k as fn, i as cn } from "./index-0gkLO2iI.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-q1NyOWsk.js.map
|