yuang-framework-ui-pc 1.1.51 → 1.1.52
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/es/core-components.d.ts +1 -2
- package/es/core-components.js +2 -4
- package/es/ele-upload-list/components/list-item.d.ts +1 -0
- package/es/ele-upload-list/components/list-item.js +11 -3
- package/es/ele-upload-list/index.d.ts +2 -0
- package/es/ele-upload-list/index.js +16 -3
- package/es/ele-upload-list/types.d.ts +2 -0
- package/es/{yu-framework-attachment-image-upload → yu-framework-attachment-upload}/index.js +31 -50
- package/es/yu-framework-slider-captcha-dialog/{SliderCaptcha.js → components/SliderCaptcha.js} +1 -1
- package/es/yu-framework-slider-captcha-dialog/index.js +1 -1
- package/lib/core-components.cjs +2 -4
- package/lib/core-components.d.ts +1 -2
- package/lib/ele-upload-list/components/list-item.cjs +11 -3
- package/lib/ele-upload-list/components/list-item.d.ts +1 -0
- package/lib/ele-upload-list/index.cjs +16 -3
- package/lib/ele-upload-list/index.d.ts +2 -0
- package/lib/ele-upload-list/types.d.ts +2 -0
- package/lib/{yu-framework-attachment-image-upload → yu-framework-attachment-upload}/index.cjs +31 -50
- package/lib/yu-framework-slider-captcha-dialog/{SliderCaptcha.cjs → components/SliderCaptcha.cjs} +1 -1
- package/lib/yu-framework-slider-captcha-dialog/index.cjs +1 -1
- package/package.json +2 -2
- package/typings/global.d.ts +1 -2
- package/es/yu-framework-attachment-file-upload/CommonUpload/index.d.ts +0 -161
- package/es/yu-framework-attachment-file-upload/CommonUpload/index.js +0 -173
- package/es/yu-framework-attachment-file-upload/FileUpload/index.d.ts +0 -143
- package/es/yu-framework-attachment-file-upload/FileUpload/index.js +0 -219
- package/es/yu-framework-attachment-file-upload/index.d.ts +0 -16
- package/es/yu-framework-attachment-file-upload/index.js +0 -55
- package/lib/yu-framework-attachment-file-upload/CommonUpload/index.cjs +0 -172
- package/lib/yu-framework-attachment-file-upload/CommonUpload/index.d.ts +0 -161
- package/lib/yu-framework-attachment-file-upload/FileUpload/index.cjs +0 -218
- package/lib/yu-framework-attachment-file-upload/FileUpload/index.d.ts +0 -143
- package/lib/yu-framework-attachment-file-upload/index.cjs +0 -54
- package/lib/yu-framework-attachment-file-upload/index.d.ts +0 -16
- /package/es/{yu-framework-attachment-image-upload → yu-framework-attachment-upload}/index.d.ts +0 -0
- /package/es/yu-framework-slider-captcha-dialog/{SliderCaptcha.d.ts → components/SliderCaptcha.d.ts} +0 -0
- /package/lib/{yu-framework-attachment-image-upload → yu-framework-attachment-upload}/index.d.ts +0 -0
- /package/lib/yu-framework-slider-captcha-dialog/{SliderCaptcha.d.ts → components/SliderCaptcha.d.ts} +0 -0
package/es/core-components.d.ts
CHANGED
|
@@ -53,5 +53,4 @@ export { default as EleWatermark } from './ele-watermark/index';
|
|
|
53
53
|
export { default as EleTest } from './ele-test/index';
|
|
54
54
|
export { default as YuTest } from './yu-test/index';
|
|
55
55
|
export { default as YuFrameworkSliderCaptchaDialog } from './yu-framework-slider-captcha-dialog/index';
|
|
56
|
-
export { default as
|
|
57
|
-
export { default as YuFrameworkAttachmentImageUpload } from './yu-framework-attachment-image-upload/index';
|
|
56
|
+
export { default as YuFrameworkAttachmentUpload } from './yu-framework-attachment-upload/index';
|
package/es/core-components.js
CHANGED
|
@@ -53,8 +53,7 @@ import { default as default53 } from "./ele-watermark/index";
|
|
|
53
53
|
import { default as default54 } from "./ele-test/index";
|
|
54
54
|
import { default as default55 } from "./yu-test/index";
|
|
55
55
|
import { default as default56 } from "./yu-framework-slider-captcha-dialog/index";
|
|
56
|
-
import { default as default57 } from "./yu-framework-attachment-
|
|
57
|
-
import { default as default58 } from "./yu-framework-attachment-image-upload/index";
|
|
56
|
+
import { default as default57 } from "./yu-framework-attachment-upload/index";
|
|
58
57
|
export {
|
|
59
58
|
default2 as EleAdminLayout,
|
|
60
59
|
default3 as EleAlert,
|
|
@@ -109,8 +108,7 @@ export {
|
|
|
109
108
|
default51 as EleUploadList,
|
|
110
109
|
default52 as EleVirtualTable,
|
|
111
110
|
default53 as EleWatermark,
|
|
112
|
-
default57 as
|
|
113
|
-
default58 as YuFrameworkAttachmentImageUpload,
|
|
111
|
+
default57 as YuFrameworkAttachmentUpload,
|
|
114
112
|
default56 as YuFrameworkSliderCaptchaDialog,
|
|
115
113
|
default55 as YuTest
|
|
116
114
|
};
|
|
@@ -37,6 +37,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
37
37
|
handleEdit: () => void;
|
|
38
38
|
handlePreview: () => void;
|
|
39
39
|
handleRetry: () => void;
|
|
40
|
+
isImage: (url?: string) => boolean | "" | undefined;
|
|
40
41
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
41
42
|
itemClick: (_item: UploadItem) => true;
|
|
42
43
|
remove: (_item: UploadItem) => true;
|
|
@@ -81,6 +81,12 @@ const _sfc_main = defineComponent({
|
|
|
81
81
|
const handleRetry = () => {
|
|
82
82
|
emit("retry", props.item);
|
|
83
83
|
};
|
|
84
|
+
const isImage = (url) => {
|
|
85
|
+
var _a, _b;
|
|
86
|
+
const parts = url ? url.split(".") : [];
|
|
87
|
+
const suffix = parts.length <= 1 || parts[0] === "" && parts.length === 2 ? "" : (_b = (_a = parts.pop()) == null ? void 0 : _a.toLowerCase) == null ? void 0 : _b.call(_a);
|
|
88
|
+
return suffix && ["png", "jpg", "jpeg", "gif", "svg"].includes(suffix);
|
|
89
|
+
};
|
|
84
90
|
return {
|
|
85
91
|
imageUrl,
|
|
86
92
|
uploadProgress,
|
|
@@ -88,7 +94,8 @@ const _sfc_main = defineComponent({
|
|
|
88
94
|
handleRemove,
|
|
89
95
|
handleEdit,
|
|
90
96
|
handlePreview,
|
|
91
|
-
handleRetry
|
|
97
|
+
handleRetry,
|
|
98
|
+
isImage
|
|
92
99
|
};
|
|
93
100
|
}
|
|
94
101
|
});
|
|
@@ -182,7 +189,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
182
189
|
], 8, _hoisted_6)) : createCommentVNode("", true)
|
|
183
190
|
])
|
|
184
191
|
])) : _ctx.tools && !_ctx.readonly && !_ctx.disabled && !_ctx.item.readonly ? (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
185
|
-
|
|
192
|
+
_ctx.isImage(_ctx.item.url) ? (openBlock(), createElementBlock("div", {
|
|
193
|
+
key: 0,
|
|
186
194
|
title: _ctx.locale.preview,
|
|
187
195
|
class: "ele-upload-tool",
|
|
188
196
|
onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.handlePreview && _ctx.handlePreview(...args), ["stop"]))
|
|
@@ -194,7 +202,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
194
202
|
_: 1
|
|
195
203
|
}),
|
|
196
204
|
createElementVNode("div", _hoisted_10, toDisplayString(_ctx.locale.preview), 1)
|
|
197
|
-
], 8, _hoisted_9),
|
|
205
|
+
], 8, _hoisted_9)) : createCommentVNode("", true),
|
|
198
206
|
createElementVNode("div", {
|
|
199
207
|
title: _ctx.locale.edit,
|
|
200
208
|
class: "ele-upload-tool",
|
|
@@ -79,6 +79,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
79
79
|
handleInputChange: (e: Event) => void;
|
|
80
80
|
handleUploadClick: (e: MouseEvent) => void;
|
|
81
81
|
openImagePreview: (urls: string[], index: number) => void;
|
|
82
|
+
isImage: (url?: string) => boolean | "" | undefined;
|
|
82
83
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
83
84
|
'update:modelValue': (_value: UploadItem[]) => boolean;
|
|
84
85
|
itemClick: (_item: UploadItem) => boolean;
|
|
@@ -1594,6 +1595,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1594
1595
|
handleEdit: () => void;
|
|
1595
1596
|
handlePreview: () => void;
|
|
1596
1597
|
handleRetry: () => void;
|
|
1598
|
+
isImage: (url?: string) => boolean | "" | undefined;
|
|
1597
1599
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
1598
1600
|
itemClick: (_item: UploadItem) => true;
|
|
1599
1601
|
remove: (_item: UploadItem) => true;
|
|
@@ -88,7 +88,11 @@ const _sfc_main = defineComponent({
|
|
|
88
88
|
};
|
|
89
89
|
const handleItemClick = (item) => {
|
|
90
90
|
if (props.preview) {
|
|
91
|
-
|
|
91
|
+
if (isImage(item.url)) {
|
|
92
|
+
previewItem(item);
|
|
93
|
+
} else {
|
|
94
|
+
window.open(item.url);
|
|
95
|
+
}
|
|
92
96
|
}
|
|
93
97
|
emit("itemClick", item);
|
|
94
98
|
};
|
|
@@ -107,7 +111,9 @@ const _sfc_main = defineComponent({
|
|
|
107
111
|
}
|
|
108
112
|
};
|
|
109
113
|
const handleItemPreview = (item) => {
|
|
110
|
-
|
|
114
|
+
if (isImage(item.url)) {
|
|
115
|
+
previewItem(item);
|
|
116
|
+
}
|
|
111
117
|
emit("preview", item);
|
|
112
118
|
};
|
|
113
119
|
const handleItemRetry = (item) => {
|
|
@@ -128,6 +134,12 @@ const _sfc_main = defineComponent({
|
|
|
128
134
|
e.preventDefault();
|
|
129
135
|
}
|
|
130
136
|
};
|
|
137
|
+
const isImage = (url) => {
|
|
138
|
+
var _a, _b;
|
|
139
|
+
const parts = url ? url.split(".") : [];
|
|
140
|
+
const suffix = parts.length <= 1 || parts[0] === "" && parts.length === 2 ? "" : (_b = (_a = parts.pop()) == null ? void 0 : _a.toLowerCase) == null ? void 0 : _b.call(_a);
|
|
141
|
+
return suffix && ["png", "jpg", "jpeg", "gif", "svg"].includes(suffix);
|
|
142
|
+
};
|
|
131
143
|
watch(
|
|
132
144
|
() => props.modelValue,
|
|
133
145
|
() => {
|
|
@@ -166,7 +178,8 @@ const _sfc_main = defineComponent({
|
|
|
166
178
|
handleItemRetry,
|
|
167
179
|
handleInputChange,
|
|
168
180
|
handleUploadClick,
|
|
169
|
-
openImagePreview
|
|
181
|
+
openImagePreview,
|
|
182
|
+
isImage
|
|
170
183
|
};
|
|
171
184
|
}
|
|
172
185
|
});
|
|
@@ -5,7 +5,7 @@ import { http } from "yuang-framework-ui-common/lib/config/httpConfig";
|
|
|
5
5
|
import { getShortUuid } from "yuang-framework-ui-common/lib/utils/uuidUtils";
|
|
6
6
|
import { application } from "yuang-framework-ui-common/lib/config/applicationConfig";
|
|
7
7
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
|
-
...{ name: "
|
|
8
|
+
...{ name: "YuFrameworkAttachmentUpload" },
|
|
9
9
|
__name: "index",
|
|
10
10
|
props: /* @__PURE__ */ mergeModels({
|
|
11
11
|
modelValue: {},
|
|
@@ -16,19 +16,30 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
16
16
|
}),
|
|
17
17
|
emits: /* @__PURE__ */ mergeModels(["change"], ["update:modelValue"]),
|
|
18
18
|
setup(__props, { emit: __emit }) {
|
|
19
|
+
const props = __props;
|
|
19
20
|
const emit = __emit;
|
|
21
|
+
props.param.mode = props.param.mode ?? "file";
|
|
22
|
+
props.param.maxCount = props.param.maxCount ?? 5;
|
|
23
|
+
props.param.maxSize = props.param.maxSize ?? 5;
|
|
20
24
|
const images = ref([]);
|
|
25
|
+
const listType = ref(props.param.mode);
|
|
26
|
+
const accept = ref("");
|
|
27
|
+
if (props.param.mode == "file") {
|
|
28
|
+
accept.value = ".txt,.xlsx";
|
|
29
|
+
} else if (props.param.mode == "image") {
|
|
30
|
+
accept.value = ".png,.jpg,.jpeg,.gif,.svg";
|
|
31
|
+
}
|
|
21
32
|
const isLoading = ref(false);
|
|
22
33
|
const checkFile = (file) => {
|
|
23
34
|
if (!file) {
|
|
24
35
|
return;
|
|
25
36
|
}
|
|
26
|
-
if (!file.type.startsWith("image")) {
|
|
37
|
+
if (props.param.mode === "image" && !file.type.startsWith("image")) {
|
|
27
38
|
EleMessage.error("只能选择图片");
|
|
28
39
|
return;
|
|
29
40
|
}
|
|
30
|
-
if (file.size / 1024 / 1024 >
|
|
31
|
-
EleMessage.error(
|
|
41
|
+
if (file.size / 1024 / 1024 > props.param.maxSize) {
|
|
42
|
+
EleMessage.error(`图片大小不能超过${props.param.maxSize}MB`);
|
|
32
43
|
return;
|
|
33
44
|
}
|
|
34
45
|
return true;
|
|
@@ -53,14 +64,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
53
64
|
}
|
|
54
65
|
});
|
|
55
66
|
};
|
|
56
|
-
const handleUpload = (
|
|
57
|
-
if (!checkFile(
|
|
67
|
+
const handleUpload = (uploadItem, retry) => {
|
|
68
|
+
if (!checkFile(uploadItem.file)) {
|
|
58
69
|
return;
|
|
59
70
|
}
|
|
60
71
|
if (!retry) {
|
|
61
|
-
images.value.push({ ...
|
|
72
|
+
images.value.push({ ...uploadItem });
|
|
62
73
|
}
|
|
63
|
-
const item = images.value.find((t) => t.key ===
|
|
74
|
+
const item = images.value.find((t) => t.key === uploadItem.key);
|
|
64
75
|
console.log(JSON.parse(JSON.stringify(item)));
|
|
65
76
|
if (!item) {
|
|
66
77
|
return;
|
|
@@ -69,7 +80,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
69
80
|
item.progress = 0;
|
|
70
81
|
let formData = new FormData();
|
|
71
82
|
formData.append("code", model.value);
|
|
72
|
-
formData.append("multipartFile",
|
|
83
|
+
formData.append("multipartFile", uploadItem.file, uploadItem.file.name);
|
|
73
84
|
http({
|
|
74
85
|
url: `${application.gatewayServerBaseUrl}/framework-api/core/framework-attachment/uploadAttachment`,
|
|
75
86
|
method: "post",
|
|
@@ -130,51 +141,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
130
141
|
emit("change", attachemtList);
|
|
131
142
|
});
|
|
132
143
|
};
|
|
133
|
-
const handleRemove = (
|
|
134
|
-
let id =
|
|
144
|
+
const handleRemove = (uploadItem) => {
|
|
145
|
+
let id = uploadItem.id;
|
|
135
146
|
ElMessageBox.confirm("确定要删除吗?", "系统提示", { type: "warning", draggable: true }).then(() => {
|
|
136
147
|
http.get(`${application.gatewayServerBaseUrl}/framework-api/core/framework-attachment/deleteInfo`, { params: { id } }).then((res) => {
|
|
137
148
|
EleMessage.success(res.data.message);
|
|
138
|
-
images.value.splice(images.value.indexOf(
|
|
149
|
+
images.value.splice(images.value.indexOf(uploadItem), 1);
|
|
150
|
+
emitChange();
|
|
139
151
|
});
|
|
140
152
|
});
|
|
141
153
|
};
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
if (item.progress == null) {
|
|
145
|
-
item.progress = 20;
|
|
146
|
-
}
|
|
147
|
-
const timer = setInterval(
|
|
148
|
-
() => {
|
|
149
|
-
if (Math.round(Math.random() * 10) < 3) {
|
|
150
|
-
item.status = "exception";
|
|
151
|
-
EleMessage.error("上传失败, 服务器繁忙,请重试");
|
|
152
|
-
clearInterval(timer);
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
if (item.progress == null) {
|
|
156
|
-
item.progress = 20;
|
|
157
|
-
} else {
|
|
158
|
-
item.progress += 20;
|
|
159
|
-
}
|
|
160
|
-
if (item.progress === 100) {
|
|
161
|
-
item.status = "done";
|
|
162
|
-
clearInterval(timer);
|
|
163
|
-
if (checkDone()) {
|
|
164
|
-
submitForm();
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
Math.round(Math.random() * 2500) + 500
|
|
169
|
-
);
|
|
170
|
-
};
|
|
171
|
-
const checkDone = () => {
|
|
172
|
-
return !images.value.some((d) => d.status !== "done");
|
|
173
|
-
};
|
|
174
|
-
const submitForm = () => {
|
|
175
|
-
EleMessage.success("已全部上传完毕");
|
|
176
|
-
console.log(JSON.parse(JSON.stringify(images.value)));
|
|
177
|
-
isLoading.value = false;
|
|
154
|
+
const handleRetryUpload = (uploadItem) => {
|
|
155
|
+
handleUpload(uploadItem, true);
|
|
178
156
|
};
|
|
179
157
|
return (_ctx, _cache) => {
|
|
180
158
|
const _component_ele_upload_list = resolveComponent("ele-upload-list");
|
|
@@ -184,14 +162,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
184
162
|
tools: true,
|
|
185
163
|
modelValue: images.value,
|
|
186
164
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => images.value = $event),
|
|
165
|
+
limit: _ctx.param.maxCount,
|
|
166
|
+
listType: listType.value,
|
|
167
|
+
accept: accept.value,
|
|
187
168
|
readonly: isLoading.value,
|
|
188
169
|
disabled: _ctx.param.type != "edit",
|
|
189
170
|
sortable: { forceFallback: true },
|
|
190
171
|
onUpload: handleUpload,
|
|
191
|
-
onRetry:
|
|
172
|
+
onRetry: handleRetryUpload,
|
|
192
173
|
onRemove: handleRemove,
|
|
193
174
|
onEditUpload: handleEditUpload
|
|
194
|
-
}, null, 8, ["modelValue", "readonly", "disabled"])
|
|
175
|
+
}, null, 8, ["modelValue", "limit", "listType", "accept", "readonly", "disabled"])
|
|
195
176
|
]);
|
|
196
177
|
};
|
|
197
178
|
}
|
package/es/yu-framework-slider-captcha-dialog/{SliderCaptcha.js → components/SliderCaptcha.js}
RENAMED
|
@@ -2,7 +2,7 @@ import { defineComponent, ref, onMounted, nextTick, createElementBlock, openBloc
|
|
|
2
2
|
import { http } from "yuang-framework-ui-common/lib/config/httpConfig";
|
|
3
3
|
import { application } from "yuang-framework-ui-common/lib/config/applicationConfig";
|
|
4
4
|
import { RefreshRight, CircleClose } from "@element-plus/icons-vue";
|
|
5
|
-
import { SliderArrowStatic, SliderArrowSlide } from "
|
|
5
|
+
import { SliderArrowStatic, SliderArrowSlide } from "../../icons";
|
|
6
6
|
const _hoisted_1 = { class: "yu-framework-slider-captcha" };
|
|
7
7
|
const _hoisted_2 = { class: "yu-framework-slider-captcha-title" };
|
|
8
8
|
const _hoisted_3 = ["width", "height"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, ref, createElementBlock, createCommentVNode, openBlock, createElementVNode, createVNode } from "vue";
|
|
2
|
-
import SliderCaptcha from "./SliderCaptcha";
|
|
2
|
+
import SliderCaptcha from "./components/SliderCaptcha";
|
|
3
3
|
const _hoisted_1 = {
|
|
4
4
|
key: 0,
|
|
5
5
|
class: "yu-framework-slider-captcha-dialog"
|
package/lib/core-components.cjs
CHANGED
|
@@ -55,8 +55,7 @@ const index$P = require("./ele-watermark/index");
|
|
|
55
55
|
const index$Q = require("./ele-test/index");
|
|
56
56
|
const index$R = require("./yu-test/index");
|
|
57
57
|
const index$S = require("./yu-framework-slider-captcha-dialog/index");
|
|
58
|
-
const index$T = require("./yu-framework-attachment-
|
|
59
|
-
const index$U = require("./yu-framework-attachment-image-upload/index");
|
|
58
|
+
const index$T = require("./yu-framework-attachment-upload/index");
|
|
60
59
|
exports.EleAdminLayout = index;
|
|
61
60
|
exports.EleAlert = index$1;
|
|
62
61
|
exports.EleApp = index$2;
|
|
@@ -112,5 +111,4 @@ exports.EleWatermark = index$P;
|
|
|
112
111
|
exports.EleTest = index$Q;
|
|
113
112
|
exports.YuTest = index$R;
|
|
114
113
|
exports.YuFrameworkSliderCaptchaDialog = index$S;
|
|
115
|
-
exports.
|
|
116
|
-
exports.YuFrameworkAttachmentImageUpload = index$U;
|
|
114
|
+
exports.YuFrameworkAttachmentUpload = index$T;
|
package/lib/core-components.d.ts
CHANGED
|
@@ -53,5 +53,4 @@ export { default as EleWatermark } from './ele-watermark/index';
|
|
|
53
53
|
export { default as EleTest } from './ele-test/index';
|
|
54
54
|
export { default as YuTest } from './yu-test/index';
|
|
55
55
|
export { default as YuFrameworkSliderCaptchaDialog } from './yu-framework-slider-captcha-dialog/index';
|
|
56
|
-
export { default as
|
|
57
|
-
export { default as YuFrameworkAttachmentImageUpload } from './yu-framework-attachment-image-upload/index';
|
|
56
|
+
export { default as YuFrameworkAttachmentUpload } from './yu-framework-attachment-upload/index';
|
|
@@ -82,6 +82,12 @@ const _sfc_main = vue.defineComponent({
|
|
|
82
82
|
const handleRetry = () => {
|
|
83
83
|
emit("retry", props.item);
|
|
84
84
|
};
|
|
85
|
+
const isImage = (url) => {
|
|
86
|
+
var _a, _b;
|
|
87
|
+
const parts = url ? url.split(".") : [];
|
|
88
|
+
const suffix = parts.length <= 1 || parts[0] === "" && parts.length === 2 ? "" : (_b = (_a = parts.pop()) == null ? void 0 : _a.toLowerCase) == null ? void 0 : _b.call(_a);
|
|
89
|
+
return suffix && ["png", "jpg", "jpeg", "gif", "svg"].includes(suffix);
|
|
90
|
+
};
|
|
85
91
|
return {
|
|
86
92
|
imageUrl,
|
|
87
93
|
uploadProgress,
|
|
@@ -89,7 +95,8 @@ const _sfc_main = vue.defineComponent({
|
|
|
89
95
|
handleRemove,
|
|
90
96
|
handleEdit,
|
|
91
97
|
handlePreview,
|
|
92
|
-
handleRetry
|
|
98
|
+
handleRetry,
|
|
99
|
+
isImage
|
|
93
100
|
};
|
|
94
101
|
}
|
|
95
102
|
});
|
|
@@ -183,7 +190,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
183
190
|
], 8, _hoisted_6)) : vue.createCommentVNode("", true)
|
|
184
191
|
])
|
|
185
192
|
])) : _ctx.tools && !_ctx.readonly && !_ctx.disabled && !_ctx.item.readonly ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
|
|
186
|
-
vue.
|
|
193
|
+
_ctx.isImage(_ctx.item.url) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
194
|
+
key: 0,
|
|
187
195
|
title: _ctx.locale.preview,
|
|
188
196
|
class: "ele-upload-tool",
|
|
189
197
|
onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.handlePreview && _ctx.handlePreview(...args), ["stop"]))
|
|
@@ -195,7 +203,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
195
203
|
_: 1
|
|
196
204
|
}),
|
|
197
205
|
vue.createElementVNode("div", _hoisted_10, vue.toDisplayString(_ctx.locale.preview), 1)
|
|
198
|
-
], 8, _hoisted_9),
|
|
206
|
+
], 8, _hoisted_9)) : vue.createCommentVNode("", true),
|
|
199
207
|
vue.createElementVNode("div", {
|
|
200
208
|
title: _ctx.locale.edit,
|
|
201
209
|
class: "ele-upload-tool",
|
|
@@ -37,6 +37,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
37
37
|
handleEdit: () => void;
|
|
38
38
|
handlePreview: () => void;
|
|
39
39
|
handleRetry: () => void;
|
|
40
|
+
isImage: (url?: string) => boolean | "" | undefined;
|
|
40
41
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
41
42
|
itemClick: (_item: UploadItem) => true;
|
|
42
43
|
remove: (_item: UploadItem) => true;
|
|
@@ -89,7 +89,11 @@ const _sfc_main = vue.defineComponent({
|
|
|
89
89
|
};
|
|
90
90
|
const handleItemClick = (item) => {
|
|
91
91
|
if (props2.preview) {
|
|
92
|
-
|
|
92
|
+
if (isImage(item.url)) {
|
|
93
|
+
previewItem(item);
|
|
94
|
+
} else {
|
|
95
|
+
window.open(item.url);
|
|
96
|
+
}
|
|
93
97
|
}
|
|
94
98
|
emit("itemClick", item);
|
|
95
99
|
};
|
|
@@ -108,7 +112,9 @@ const _sfc_main = vue.defineComponent({
|
|
|
108
112
|
}
|
|
109
113
|
};
|
|
110
114
|
const handleItemPreview = (item) => {
|
|
111
|
-
|
|
115
|
+
if (isImage(item.url)) {
|
|
116
|
+
previewItem(item);
|
|
117
|
+
}
|
|
112
118
|
emit("preview", item);
|
|
113
119
|
};
|
|
114
120
|
const handleItemRetry = (item) => {
|
|
@@ -129,6 +135,12 @@ const _sfc_main = vue.defineComponent({
|
|
|
129
135
|
e.preventDefault();
|
|
130
136
|
}
|
|
131
137
|
};
|
|
138
|
+
const isImage = (url) => {
|
|
139
|
+
var _a, _b;
|
|
140
|
+
const parts = url ? url.split(".") : [];
|
|
141
|
+
const suffix = parts.length <= 1 || parts[0] === "" && parts.length === 2 ? "" : (_b = (_a = parts.pop()) == null ? void 0 : _a.toLowerCase) == null ? void 0 : _b.call(_a);
|
|
142
|
+
return suffix && ["png", "jpg", "jpeg", "gif", "svg"].includes(suffix);
|
|
143
|
+
};
|
|
132
144
|
vue.watch(
|
|
133
145
|
() => props2.modelValue,
|
|
134
146
|
() => {
|
|
@@ -167,7 +179,8 @@ const _sfc_main = vue.defineComponent({
|
|
|
167
179
|
handleItemRetry,
|
|
168
180
|
handleInputChange,
|
|
169
181
|
handleUploadClick,
|
|
170
|
-
openImagePreview
|
|
182
|
+
openImagePreview,
|
|
183
|
+
isImage
|
|
171
184
|
};
|
|
172
185
|
}
|
|
173
186
|
});
|
|
@@ -79,6 +79,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
79
79
|
handleInputChange: (e: Event) => void;
|
|
80
80
|
handleUploadClick: (e: MouseEvent) => void;
|
|
81
81
|
openImagePreview: (urls: string[], index: number) => void;
|
|
82
|
+
isImage: (url?: string) => boolean | "" | undefined;
|
|
82
83
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
83
84
|
'update:modelValue': (_value: UploadItem[]) => boolean;
|
|
84
85
|
itemClick: (_item: UploadItem) => boolean;
|
|
@@ -1594,6 +1595,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
1594
1595
|
handleEdit: () => void;
|
|
1595
1596
|
handlePreview: () => void;
|
|
1596
1597
|
handleRetry: () => void;
|
|
1598
|
+
isImage: (url?: string) => boolean | "" | undefined;
|
|
1597
1599
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
1598
1600
|
itemClick: (_item: UploadItem) => true;
|
|
1599
1601
|
remove: (_item: UploadItem) => true;
|
package/lib/{yu-framework-attachment-image-upload → yu-framework-attachment-upload}/index.cjs
RENAMED
|
@@ -6,7 +6,7 @@ const httpConfig = require("yuang-framework-ui-common/lib/config/httpConfig");
|
|
|
6
6
|
const uuidUtils = require("yuang-framework-ui-common/lib/utils/uuidUtils");
|
|
7
7
|
const applicationConfig = require("yuang-framework-ui-common/lib/config/applicationConfig");
|
|
8
8
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
9
|
-
...{ name: "
|
|
9
|
+
...{ name: "YuFrameworkAttachmentUpload" },
|
|
10
10
|
__name: "index",
|
|
11
11
|
props: /* @__PURE__ */ vue.mergeModels({
|
|
12
12
|
modelValue: {},
|
|
@@ -17,19 +17,30 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
17
17
|
}),
|
|
18
18
|
emits: /* @__PURE__ */ vue.mergeModels(["change"], ["update:modelValue"]),
|
|
19
19
|
setup(__props, { emit: __emit }) {
|
|
20
|
+
const props = __props;
|
|
20
21
|
const emit = __emit;
|
|
22
|
+
props.param.mode = props.param.mode ?? "file";
|
|
23
|
+
props.param.maxCount = props.param.maxCount ?? 5;
|
|
24
|
+
props.param.maxSize = props.param.maxSize ?? 5;
|
|
21
25
|
const images = vue.ref([]);
|
|
26
|
+
const listType = vue.ref(props.param.mode);
|
|
27
|
+
const accept = vue.ref("");
|
|
28
|
+
if (props.param.mode == "file") {
|
|
29
|
+
accept.value = ".txt,.xlsx";
|
|
30
|
+
} else if (props.param.mode == "image") {
|
|
31
|
+
accept.value = ".png,.jpg,.jpeg,.gif,.svg";
|
|
32
|
+
}
|
|
22
33
|
const isLoading = vue.ref(false);
|
|
23
34
|
const checkFile = (file) => {
|
|
24
35
|
if (!file) {
|
|
25
36
|
return;
|
|
26
37
|
}
|
|
27
|
-
if (!file.type.startsWith("image")) {
|
|
38
|
+
if (props.param.mode === "image" && !file.type.startsWith("image")) {
|
|
28
39
|
message.EleMessage.error("只能选择图片");
|
|
29
40
|
return;
|
|
30
41
|
}
|
|
31
|
-
if (file.size / 1024 / 1024 >
|
|
32
|
-
message.EleMessage.error(
|
|
42
|
+
if (file.size / 1024 / 1024 > props.param.maxSize) {
|
|
43
|
+
message.EleMessage.error(`图片大小不能超过${props.param.maxSize}MB`);
|
|
33
44
|
return;
|
|
34
45
|
}
|
|
35
46
|
return true;
|
|
@@ -54,14 +65,14 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
54
65
|
}
|
|
55
66
|
});
|
|
56
67
|
};
|
|
57
|
-
const handleUpload = (
|
|
58
|
-
if (!checkFile(
|
|
68
|
+
const handleUpload = (uploadItem, retry) => {
|
|
69
|
+
if (!checkFile(uploadItem.file)) {
|
|
59
70
|
return;
|
|
60
71
|
}
|
|
61
72
|
if (!retry) {
|
|
62
|
-
images.value.push({ ...
|
|
73
|
+
images.value.push({ ...uploadItem });
|
|
63
74
|
}
|
|
64
|
-
const item = images.value.find((t) => t.key ===
|
|
75
|
+
const item = images.value.find((t) => t.key === uploadItem.key);
|
|
65
76
|
console.log(JSON.parse(JSON.stringify(item)));
|
|
66
77
|
if (!item) {
|
|
67
78
|
return;
|
|
@@ -70,7 +81,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
70
81
|
item.progress = 0;
|
|
71
82
|
let formData = new FormData();
|
|
72
83
|
formData.append("code", model.value);
|
|
73
|
-
formData.append("multipartFile",
|
|
84
|
+
formData.append("multipartFile", uploadItem.file, uploadItem.file.name);
|
|
74
85
|
httpConfig.http({
|
|
75
86
|
url: `${applicationConfig.application.gatewayServerBaseUrl}/framework-api/core/framework-attachment/uploadAttachment`,
|
|
76
87
|
method: "post",
|
|
@@ -131,51 +142,18 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
131
142
|
emit("change", attachemtList);
|
|
132
143
|
});
|
|
133
144
|
};
|
|
134
|
-
const handleRemove = (
|
|
135
|
-
let id =
|
|
145
|
+
const handleRemove = (uploadItem) => {
|
|
146
|
+
let id = uploadItem.id;
|
|
136
147
|
es.ElMessageBox.confirm("确定要删除吗?", "系统提示", { type: "warning", draggable: true }).then(() => {
|
|
137
148
|
httpConfig.http.get(`${applicationConfig.application.gatewayServerBaseUrl}/framework-api/core/framework-attachment/deleteInfo`, { params: { id } }).then((res) => {
|
|
138
149
|
message.EleMessage.success(res.data.message);
|
|
139
|
-
images.value.splice(images.value.indexOf(
|
|
150
|
+
images.value.splice(images.value.indexOf(uploadItem), 1);
|
|
151
|
+
emitChange();
|
|
140
152
|
});
|
|
141
153
|
});
|
|
142
154
|
};
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
if (item.progress == null) {
|
|
146
|
-
item.progress = 20;
|
|
147
|
-
}
|
|
148
|
-
const timer = setInterval(
|
|
149
|
-
() => {
|
|
150
|
-
if (Math.round(Math.random() * 10) < 3) {
|
|
151
|
-
item.status = "exception";
|
|
152
|
-
message.EleMessage.error("上传失败, 服务器繁忙,请重试");
|
|
153
|
-
clearInterval(timer);
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
if (item.progress == null) {
|
|
157
|
-
item.progress = 20;
|
|
158
|
-
} else {
|
|
159
|
-
item.progress += 20;
|
|
160
|
-
}
|
|
161
|
-
if (item.progress === 100) {
|
|
162
|
-
item.status = "done";
|
|
163
|
-
clearInterval(timer);
|
|
164
|
-
if (checkDone()) {
|
|
165
|
-
submitForm();
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
Math.round(Math.random() * 2500) + 500
|
|
170
|
-
);
|
|
171
|
-
};
|
|
172
|
-
const checkDone = () => {
|
|
173
|
-
return !images.value.some((d) => d.status !== "done");
|
|
174
|
-
};
|
|
175
|
-
const submitForm = () => {
|
|
176
|
-
message.EleMessage.success("已全部上传完毕");
|
|
177
|
-
console.log(JSON.parse(JSON.stringify(images.value)));
|
|
178
|
-
isLoading.value = false;
|
|
155
|
+
const handleRetryUpload = (uploadItem) => {
|
|
156
|
+
handleUpload(uploadItem, true);
|
|
179
157
|
};
|
|
180
158
|
return (_ctx, _cache) => {
|
|
181
159
|
const _component_ele_upload_list = vue.resolveComponent("ele-upload-list");
|
|
@@ -185,14 +163,17 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
185
163
|
tools: true,
|
|
186
164
|
modelValue: images.value,
|
|
187
165
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => images.value = $event),
|
|
166
|
+
limit: _ctx.param.maxCount,
|
|
167
|
+
listType: listType.value,
|
|
168
|
+
accept: accept.value,
|
|
188
169
|
readonly: isLoading.value,
|
|
189
170
|
disabled: _ctx.param.type != "edit",
|
|
190
171
|
sortable: { forceFallback: true },
|
|
191
172
|
onUpload: handleUpload,
|
|
192
|
-
onRetry:
|
|
173
|
+
onRetry: handleRetryUpload,
|
|
193
174
|
onRemove: handleRemove,
|
|
194
175
|
onEditUpload: handleEditUpload
|
|
195
|
-
}, null, 8, ["modelValue", "readonly", "disabled"])
|
|
176
|
+
}, null, 8, ["modelValue", "limit", "listType", "accept", "readonly", "disabled"])
|
|
196
177
|
]);
|
|
197
178
|
};
|
|
198
179
|
}
|
package/lib/yu-framework-slider-captcha-dialog/{SliderCaptcha.cjs → components/SliderCaptcha.cjs}
RENAMED
|
@@ -3,7 +3,7 @@ const vue = require("vue");
|
|
|
3
3
|
const httpConfig = require("yuang-framework-ui-common/lib/config/httpConfig");
|
|
4
4
|
const applicationConfig = require("yuang-framework-ui-common/lib/config/applicationConfig");
|
|
5
5
|
const iconsVue = require("@element-plus/icons-vue");
|
|
6
|
-
const icons = require("
|
|
6
|
+
const icons = require("../../icons");
|
|
7
7
|
const _hoisted_1 = { class: "yu-framework-slider-captcha" };
|
|
8
8
|
const _hoisted_2 = { class: "yu-framework-slider-captcha-title" };
|
|
9
9
|
const _hoisted_3 = ["width", "height"];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yuang-framework-ui-pc",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.52",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite --host --config vite.global.ts --mode dev",
|
|
@@ -188,6 +188,6 @@
|
|
|
188
188
|
"repository": "",
|
|
189
189
|
"license": "",
|
|
190
190
|
"dependencies": {
|
|
191
|
-
"yuang-framework-ui-common": "^1.0.
|
|
191
|
+
"yuang-framework-ui-common": "^1.0.62"
|
|
192
192
|
}
|
|
193
193
|
}
|