@qynpm/ui 1.0.4 → 1.0.6
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/README.md +169 -0
- package/dist/index.cjs +2 -1
- package/dist/index.mjs +54 -15
- package/dist/qy-action-bar/index.cjs +1 -1
- package/dist/qy-action-bar/index.mjs +4 -4
- package/dist/qy-dialog/index.cjs +1 -1
- package/dist/qy-dialog/index.mjs +4 -4
- package/dist/qy-form-section/index.cjs +1 -1
- package/dist/qy-form-section/index.mjs +2 -2
- package/dist/qy-input/index.cjs +1 -1
- package/dist/qy-input/index.mjs +4 -4
- package/dist/qy-money-input/index.cjs +1 -0
- package/dist/qy-money-input/index.mjs +6 -0
- package/dist/qy-radio-group/index.cjs +1 -0
- package/dist/qy-radio-group/index.mjs +6 -0
- package/dist/qy-record-quote-search/index.cjs +1 -1
- package/dist/qy-record-quote-search/index.mjs +2 -2
- package/dist/qy-remark-image/index.cjs +1 -2
- package/dist/qy-remark-image/index.mjs +3 -4
- package/dist/qy-remote-select/index.cjs +1 -0
- package/dist/qy-remote-select/index.mjs +6 -0
- package/dist/qy-search-input/index.cjs +1 -1
- package/dist/qy-search-input/index.mjs +3 -3
- package/dist/qy-select/index.cjs +1 -1
- package/dist/qy-select/index.mjs +4 -4
- package/dist/qy-upload/index.cjs +1 -1
- package/dist/qy-upload/index.mjs +3 -3
- package/dist/qy-voucher-upload/index.cjs +1 -0
- package/dist/qy-voucher-upload/index.mjs +6 -0
- package/dist/shared/_plugin-vue_export-helper-BHFhmbuH.cjs +1 -0
- package/dist/shared/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
- package/dist/{lib/qy-action-bar/index.vue.mjs → shared/index-Bw9kVFsm.mjs} +13 -13
- package/dist/{lib/qy-record-quote-search/index.vue.mjs → shared/index-BzV4959-.mjs} +42 -43
- package/dist/{lib/qy-form-section/index.vue.mjs → shared/index-C0ADdL4S.mjs} +11 -12
- package/dist/shared/index-CBSjmD0C.mjs +217 -0
- package/dist/shared/index-CJb1S7CP.cjs +1 -0
- package/dist/shared/index-CO8lz02r.cjs +1 -0
- package/dist/shared/index-ClPxDFKd.cjs +1 -0
- package/dist/shared/index-CtOqRiaj.cjs +1 -0
- package/dist/shared/index-DXB7_Tb5.cjs +1 -0
- package/dist/shared/index-DeWkPj3O.mjs +484 -0
- package/dist/shared/index-PUYQxK94.mjs +123 -0
- package/dist/shared/index-UzZbxoqZ.cjs +1 -0
- package/dist/shared/index-a90QeEC4.cjs +1 -0
- package/dist/{lib/qy-search-input/index.vue.mjs → shared/index-wW02nNOp.mjs} +55 -55
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-BcZg8D-y.mjs +214 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-BmeBeCu0.mjs +162 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-C85575cL.cjs +1 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-DkYwdYdF.mjs +90 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-Do5SZ8yS.cjs +1 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-DpZzyX5f.cjs +1 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-DuUkOqwY.cjs +1 -0
- package/dist/{lib/qy-input/index.vue.mjs → shared/index.vue_vue_type_script_setup_true_lang-Dvh1BFaR.mjs} +8 -7
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-RtfqJ73A.mjs +171 -0
- package/dist/shared/index.vue_vue_type_script_setup_true_lang-VVjCLNMD.cjs +1 -0
- package/dist/{lib/dialog/index.vue.mjs → shared/index.vue_vue_type_style_index_0_lang-DpIL_6vO.mjs} +24 -25
- package/dist/shared/index.vue_vue_type_style_index_0_lang-haqCjB5x.cjs +1 -0
- package/dist/{lib/utils/install.mjs → shared/install-CxBnxbuN.mjs} +2 -2
- package/dist/shared/install-c8il9DQv.cjs +1 -0
- package/dist/shared/js.cookie-CojEIxHg.cjs +1 -0
- package/dist/{node_modules/.pnpm/js-cookie@3.0.1/node_modules/js-cookie/dist/js.cookie.mjs → shared/js.cookie-OLEfuq_g.mjs} +16 -16
- package/index.d.ts +9 -0
- package/package.json +25 -1
- package/qy-money-input/index.d.ts +12 -0
- package/qy-money-input/index.js +15 -0
- package/qy-radio-group/index.d.ts +12 -0
- package/qy-radio-group/index.js +15 -0
- package/qy-remote-select/index.d.ts +12 -0
- package/qy-remote-select/index.js +15 -0
- package/qy-voucher-upload/index.d.ts +12 -0
- package/qy-voucher-upload/index.js +15 -0
- package/dist/_virtual/plugin-vue_export-helper.cjs +0 -1
- package/dist/_virtual/plugin-vue_export-helper.mjs +0 -9
- package/dist/lib/dialog/index.vue.cjs +0 -1
- package/dist/lib/index.cjs +0 -1
- package/dist/lib/index.mjs +0 -40
- package/dist/lib/qy-action-bar/index.vue.cjs +0 -1
- package/dist/lib/qy-form-section/index.vue.cjs +0 -1
- package/dist/lib/qy-input/index.vue.cjs +0 -1
- package/dist/lib/qy-record-quote-search/index.vue.cjs +0 -1
- package/dist/lib/qy-search-input/index.vue.cjs +0 -1
- package/dist/lib/qy-select/index.vue.cjs +0 -1
- package/dist/lib/qy-select/index.vue.mjs +0 -137
- package/dist/lib/remark-image/index.vue.cjs +0 -1
- package/dist/lib/remark-image/index.vue.mjs +0 -198
- package/dist/lib/remark-image/utils.cjs +0 -1
- package/dist/lib/remark-image/utils.mjs +0 -22
- package/dist/lib/upload/index.vue.cjs +0 -1
- package/dist/lib/upload/index.vue.mjs +0 -382
- package/dist/lib/utils/auth.cjs +0 -1
- package/dist/lib/utils/auth.mjs +0 -8
- package/dist/lib/utils/install.cjs +0 -1
- package/dist/node_modules/.pnpm/js-cookie@3.0.1/node_modules/js-cookie/dist/js.cookie.cjs +0 -1
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { defineComponent as N, useAttrs as j, ref as f, computed as B, watch as I, onMounted as K, nextTick as M, onUnmounted as O, createElementBlock as p, openBlock as v, normalizeStyle as W, createElementVNode as u, createVNode as g, unref as n, mergeProps as $, withCtx as h, createTextVNode as Q } from "vue";
|
|
2
|
-
import { ElMessage as w, ElInput as G, ElPopover as H, ElButton as J, ElUpload as X } from "element-plus";
|
|
3
|
-
import Y from "../../node_modules/.pnpm/js-cookie@3.0.1/node_modules/js-cookie/dist/js.cookie.mjs";
|
|
4
|
-
import { parseRemarkText as T, parseRemarkWithImage as q, formatRemarkText as Z } from "./utils.mjs";
|
|
5
|
-
/* empty css */
|
|
6
|
-
import ee from "../../_virtual/plugin-vue_export-helper.mjs";
|
|
7
|
-
const ae = { class: "qy-remark-image__field" }, te = { class: "qy-remark-image__upload-anchor" }, re = {
|
|
8
|
-
key: 0,
|
|
9
|
-
class: "icon-[line-md--loading-twotone-loop]",
|
|
10
|
-
role: "img",
|
|
11
|
-
"aria-hidden": "true"
|
|
12
|
-
}, le = {
|
|
13
|
-
key: 1,
|
|
14
|
-
class: "icon-[ion--cloud-upload-outline]",
|
|
15
|
-
role: "img",
|
|
16
|
-
"aria-hidden": "true"
|
|
17
|
-
}, oe = {
|
|
18
|
-
key: 2,
|
|
19
|
-
class: "icon-[ph--images-thin]",
|
|
20
|
-
role: "img",
|
|
21
|
-
"aria-hidden": "true"
|
|
22
|
-
}, ue = { class: "qy-remark-image__popover" }, ie = ["src"], se = { class: "qy-remark-image__popover-footer" }, ne = N({
|
|
23
|
-
__name: "index",
|
|
24
|
-
props: {
|
|
25
|
-
defaultValue: { default: "" },
|
|
26
|
-
defaultImage: { default: "" },
|
|
27
|
-
rows: { default: 6 },
|
|
28
|
-
width: { default: "" },
|
|
29
|
-
autosize: { type: [Boolean, Object], default: !1 },
|
|
30
|
-
disabled: { type: Boolean, default: !1 },
|
|
31
|
-
placeholder: { default: "粘贴图片上传" },
|
|
32
|
-
type: { default: "textarea" },
|
|
33
|
-
api: { default: "/permission-api/common/uploads" },
|
|
34
|
-
tokenKey: { default: "Admin-Token" }
|
|
35
|
-
},
|
|
36
|
-
emits: ["change"],
|
|
37
|
-
setup(z, { expose: V, emit: C }) {
|
|
38
|
-
const r = z, D = C, U = j(), y = f(null), o = f(""), l = f(""), d = f(!1), P = B(
|
|
39
|
-
() => r.type === "text" ? "text" : "textarea"
|
|
40
|
-
), R = B(() => {
|
|
41
|
-
if (r.width)
|
|
42
|
-
return {
|
|
43
|
-
width: typeof r.width == "number" ? `${r.width}px` : r.width
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
I(
|
|
47
|
-
() => r.defaultValue,
|
|
48
|
-
(e) => {
|
|
49
|
-
const a = T(e || "");
|
|
50
|
-
o.value = a.text, l.value = a.imageUrl || r.defaultImage || "";
|
|
51
|
-
},
|
|
52
|
-
{ immediate: !0 }
|
|
53
|
-
), I(
|
|
54
|
-
() => r.defaultImage,
|
|
55
|
-
(e) => {
|
|
56
|
-
e !== void 0 && !T(r.defaultValue || "").imageUrl && (l.value = e || "");
|
|
57
|
-
},
|
|
58
|
-
{ immediate: !0 }
|
|
59
|
-
), K(() => {
|
|
60
|
-
M(S);
|
|
61
|
-
}), O(() => {
|
|
62
|
-
const e = b();
|
|
63
|
-
e && e.removeEventListener("paste", _);
|
|
64
|
-
});
|
|
65
|
-
function b() {
|
|
66
|
-
var e, a;
|
|
67
|
-
return ((e = y.value) == null ? void 0 : e.textarea) || ((a = y.value) == null ? void 0 : a.input) || null;
|
|
68
|
-
}
|
|
69
|
-
function S() {
|
|
70
|
-
const e = b();
|
|
71
|
-
e && (e.removeEventListener("paste", _), e.addEventListener("paste", _));
|
|
72
|
-
}
|
|
73
|
-
function L(e) {
|
|
74
|
-
o.value = Z(e || "");
|
|
75
|
-
}
|
|
76
|
-
function x() {
|
|
77
|
-
l.value = "", k();
|
|
78
|
-
}
|
|
79
|
-
async function _(e) {
|
|
80
|
-
var s;
|
|
81
|
-
const i = Array.from(((s = e.clipboardData) == null ? void 0 : s.files) || []).find((m) => m.type.startsWith("image/"));
|
|
82
|
-
i && (e.preventDefault(), await F({
|
|
83
|
-
file: i,
|
|
84
|
-
onError: () => {
|
|
85
|
-
},
|
|
86
|
-
onProgress: () => {
|
|
87
|
-
},
|
|
88
|
-
onSuccess: () => {
|
|
89
|
-
}
|
|
90
|
-
}));
|
|
91
|
-
}
|
|
92
|
-
async function F(e) {
|
|
93
|
-
var a, i, s, m;
|
|
94
|
-
if (e.file.size > 51200 * 1e3)
|
|
95
|
-
return w.error("图片过大"), !1;
|
|
96
|
-
d.value = !0;
|
|
97
|
-
try {
|
|
98
|
-
const c = new FormData();
|
|
99
|
-
c.append("files", e.file);
|
|
100
|
-
const A = Y.get(r.tokenKey), t = await (await fetch(r.api, {
|
|
101
|
-
method: "POST",
|
|
102
|
-
body: c,
|
|
103
|
-
credentials: "include",
|
|
104
|
-
headers: A ? { Authorization: `Bearer ${A}` } : void 0
|
|
105
|
-
})).json(), E = (t == null ? void 0 : t.urls) ?? ((a = t == null ? void 0 : t.data) == null ? void 0 : a.urls) ?? ((i = t == null ? void 0 : t.data) == null ? void 0 : i.url) ?? (t == null ? void 0 : t.url) ?? "";
|
|
106
|
-
return l.value = Array.isArray(E) ? E[0] : E, k(), w.success("上传图片成功"), (s = e.onSuccess) == null || s.call(e, t), !0;
|
|
107
|
-
} catch (c) {
|
|
108
|
-
return (m = e.onError) == null || m.call(e, c), w.error("上传失败"), !1;
|
|
109
|
-
} finally {
|
|
110
|
-
d.value = !1;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
function k() {
|
|
114
|
-
D(
|
|
115
|
-
"change",
|
|
116
|
-
q(o.value || "", l.value || ""),
|
|
117
|
-
l.value || ""
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
return V({
|
|
121
|
-
deleteImage: x,
|
|
122
|
-
getValue: () => ({
|
|
123
|
-
text: o.value || "",
|
|
124
|
-
imageUrl: l.value || "",
|
|
125
|
-
value: q(o.value || "", l.value || "")
|
|
126
|
-
})
|
|
127
|
-
}), (e, a) => (v(), p("div", {
|
|
128
|
-
class: "qy-remark-image",
|
|
129
|
-
style: W(R.value)
|
|
130
|
-
}, [
|
|
131
|
-
u("div", ae, [
|
|
132
|
-
g(n(G), $({
|
|
133
|
-
ref_key: "inputRef",
|
|
134
|
-
ref: y,
|
|
135
|
-
"model-value": o.value,
|
|
136
|
-
type: P.value,
|
|
137
|
-
rows: e.rows,
|
|
138
|
-
autosize: e.autosize,
|
|
139
|
-
disabled: e.disabled,
|
|
140
|
-
placeholder: e.placeholder
|
|
141
|
-
}, n(U), {
|
|
142
|
-
"onUpdate:modelValue": L,
|
|
143
|
-
onBlur: k
|
|
144
|
-
}), null, 16, ["model-value", "type", "rows", "autosize", "disabled", "placeholder"]),
|
|
145
|
-
g(n(H), {
|
|
146
|
-
placement: "top-start",
|
|
147
|
-
width: 400,
|
|
148
|
-
trigger: "hover",
|
|
149
|
-
disabled: !l.value
|
|
150
|
-
}, {
|
|
151
|
-
reference: h(() => [
|
|
152
|
-
u("div", te, [
|
|
153
|
-
g(n(X), {
|
|
154
|
-
disabled: d.value || e.disabled,
|
|
155
|
-
class: "qy-remark-image__upload",
|
|
156
|
-
"show-file-list": !1,
|
|
157
|
-
"http-request": F
|
|
158
|
-
}, {
|
|
159
|
-
default: h(() => [
|
|
160
|
-
d.value ? (v(), p("span", re)) : l.value ? (v(), p("span", oe)) : (v(), p("span", le))
|
|
161
|
-
]),
|
|
162
|
-
_: 1
|
|
163
|
-
}, 8, ["disabled"])
|
|
164
|
-
])
|
|
165
|
-
]),
|
|
166
|
-
default: h(() => [
|
|
167
|
-
u("div", ue, [
|
|
168
|
-
u("img", {
|
|
169
|
-
src: l.value,
|
|
170
|
-
class: "qy-remark-image__preview-img"
|
|
171
|
-
}, null, 8, ie),
|
|
172
|
-
u("div", se, [
|
|
173
|
-
a[1] || (a[1] = u("span", { class: "qy-remark-image__popover-tip" }, "再次点击按钮可更换图片", -1)),
|
|
174
|
-
g(n(J), {
|
|
175
|
-
link: "",
|
|
176
|
-
size: "small",
|
|
177
|
-
type: "danger",
|
|
178
|
-
disabled: e.disabled,
|
|
179
|
-
onClick: x
|
|
180
|
-
}, {
|
|
181
|
-
default: h(() => a[0] || (a[0] = [
|
|
182
|
-
Q(" 删除图片 ", -1)
|
|
183
|
-
])),
|
|
184
|
-
_: 1,
|
|
185
|
-
__: [0]
|
|
186
|
-
}, 8, ["disabled"])
|
|
187
|
-
])
|
|
188
|
-
])
|
|
189
|
-
]),
|
|
190
|
-
_: 1
|
|
191
|
-
}, 8, ["disabled"])
|
|
192
|
-
])
|
|
193
|
-
], 4));
|
|
194
|
-
}
|
|
195
|
-
}), he = /* @__PURE__ */ ee(ne, [["__scopeId", "data-v-3b943ab8"]]);
|
|
196
|
-
export {
|
|
197
|
-
he as default
|
|
198
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function e(t){const r=t==null?void 0:t.match(/(\[url\:(.*?)\])(.*)/);return r?{imageUrl:r[2],text:r[3]}:{imageUrl:"",text:t||""}}function a(t){const r=String(t||"").match(/(\[url\:.*?\])([\s\S]*)/);return r?r[2]:t}function n(t,r){return r?`[url:${r}]${t}`:t}exports.formatRemarkText=a;exports.parseRemarkText=e;exports.parseRemarkWithImage=n;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
function r(t) {
|
|
2
|
-
const n = t == null ? void 0 : t.match(/(\[url\:(.*?)\])(.*)/);
|
|
3
|
-
return n ? {
|
|
4
|
-
imageUrl: n[2],
|
|
5
|
-
text: n[3]
|
|
6
|
-
} : {
|
|
7
|
-
imageUrl: "",
|
|
8
|
-
text: t || ""
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
function u(t) {
|
|
12
|
-
const n = String(t || "").match(/(\[url\:.*?\])([\s\S]*)/);
|
|
13
|
-
return n ? n[2] : t;
|
|
14
|
-
}
|
|
15
|
-
function c(t, n) {
|
|
16
|
-
return n ? `[url:${n}]${t}` : t;
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
u as formatRemarkText,
|
|
20
|
-
r as parseRemarkText,
|
|
21
|
-
c as parseRemarkWithImage
|
|
22
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=require("element-plus/es"),e=require("vue"),O=require("@element-plus/icons-vue"),v=require("element-plus"),oe=require("../utils/auth.cjs");;/* empty css */;/* empty css */const ie=require("../../_virtual/plugin-vue_export-helper.cjs"),se={class:"qy-upload__hint"},ne=["src"],re={key:1,class:"qy-upload__tip"},ue={class:"error"},de={class:"error"},ce=Object.assign({name:"QyUpload"},{__name:"index",props:{defaultValue:{type:Object,default:()=>({files:"",text:""})},multiple:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},fileType:{type:Array,default:()=>[]},fileSize:{type:Number,default:10},limit:{type:Number,default:9},isShowTip:{type:Boolean,default:!1},api:{type:String,default:"/permission-api/common/uploads"},name:{type:String,default:"file"},tokenKey:{type:String,default:"Admin-Token"},supportVideo:{type:Boolean,default:!1},size:{type:String,default:"default"},disableDrag:{type:Boolean,default:!1},callBack:{type:Function,default:null},extraData:{type:Object,default:()=>({})}},emits:["change","success","error","remove"],setup(p,{expose:A,emit:I}){const s=p,g=I,h=e.ref(null),u=e.ref([]),M=e.ref(null),x=[],C=e.ref(!1),S=e.ref([]),E=e.ref(0),V=e.ref(!1),L=e.ref(""),T=e.ref(""),k=new Set,B=e.ref(!1),f=e.ref(""),D=e.ref(!1);e.onMounted(()=>{const l=s.defaultValue;if(!l)return;f.value=l.text??"";const t=l.files??"",o=Array.isArray(t)?t.filter(Boolean):String(t).split(",").filter(Boolean);o.length&&(u.value=o.map((a,i)=>({name:a.split("/").pop()||`file-${i}`,url:a,status:"success",uid:Date.now()+i})))});const P=e.computed(()=>({large:"160px",default:"140px",small:"80px"})[s.size]??s.size),H=e.computed(()=>s.disabled),W=e.computed(()=>{var l;return s.isShowTip&&(s.fileSize||((l=m.value)==null?void 0:l.length))}),m=e.computed(()=>{var l;return(l=s.fileType)!=null&&l.length?s.fileType.map(t=>t.toLowerCase()):s.supportVideo?["mp4","mov","avi"]:["jpg","jpeg","png","gif","webp"]}),N=e.computed(()=>{const l=s.supportVideo?1:s.limit;return u.value.length>=l}),X=e.computed(()=>m.value.map(l=>`.${l}`).join(",")),K=e.computed(()=>({"qy-upload--reached-limit":N.value,"qy-upload--disabled":s.disabled,"qy-upload--video":s.supportVideo}));e.watch(f,()=>b());function Q(){var l;(l=M.value)==null||l.focus()}function b(l){const a={files:(l??u.value).filter(i=>i.status==="success"&&i.url).map(i=>i.url),text:f.value};g("change",a),s.callBack&&s.callBack(a)}function J(l,t){b(t)}function G(l){var a;if(!(l.size/1024/1024<s.fileSize))return v.ElMessage.warning(`文件大小不能超过${s.fileSize}M`),!1;const o=((a=l.name.split(".").pop())==null?void 0:a.toLowerCase())||"";return m.value.includes(o)?!0:(v.ElMessage.warning(`格式不支持,仅允许: ${m.value.join("/")}`),!1)}function z(l,t,o,a){var $,F;const i=s.api.startsWith("http")?s.api:window.location.origin+s.api.replace(/^([^/])/,"/$1"),d=new FormData;d.append(s.name,l),s.extraData&&Object.entries(s.extraData).forEach(([r,ae])=>d.append(r,ae));const n=new XMLHttpRequest;x.push(n);const y=(($=h.value)==null?void 0:$.$el.querySelector(".el-upload--picture-card"))||((F=h.value)==null?void 0:F.$el),q=v.ElLoading.service({target:y,text:"上传中",background:"rgba(255,255,255,0.7)"}),c=()=>{const r=x.indexOf(n);r!==-1&&x.splice(r,1),q.close()};n.open("POST",i);const _=oe.getToken(s.tokenKey);_&&n.setRequestHeader("Authorization",`Bearer ${_}`),n.upload.onprogress=r=>{r.total>0&&(t==null||t({percent:r.loaded/r.total*100}))},n.onload=()=>{if(c(),n.status<200||n.status>=300){const r=`上传失败 (HTTP ${n.status})`;v.ElMessage.error(r),g("error",{msg:r,status:n.status}),a==null||a(new Error(r));return}try{const r=JSON.parse(n.responseText);r.code===200&&r.urls?(v.ElMessage.success("上传成功"),o==null||o({...r,url:r.urls})):(v.ElMessage.error(r.msg||"上传失败"),g("error",r),a==null||a(r))}catch{v.ElMessage.error("上传失败,响应格式错误"),g("error",new Error("Response parse error")),a==null||a(new Error("Response parse error"))}},n.onerror=()=>{c(),v.ElMessage.error("上传失败,网络异常"),g("error",new Error("Network error")),a==null||a(new Error("Network error"))},n.send(d)}function R(l){return s.disabled?!1:G(l)}function Y(l){z(l.file,l.onProgress,t=>{l.onSuccess(t),b(),g("success",t)},t=>l.onError(t))}function Z(l){var a;if(!l.url)return;const t=((a=l.url.split(".").pop())==null?void 0:a.toLowerCase())||"";if(["mp4","mov","avi","webm"].includes(t)){L.value=l.url,T.value=l.name||"视频预览",V.value=!0;return}const o=u.value.filter(i=>{var d;return i.status==="success"&&i.url&&!["mp4","mov","avi","webm"].includes((d=i.url.split(".").pop())==null?void 0:d.toLowerCase())});S.value=o.map(i=>i.url),E.value=o.findIndex(i=>i.uid===l.uid)||0,C.value=!0}function ee(){C.value=!1,S.value=[]}function j(l){for(let t=0;t<l.length;t++){const o=l[t];if(!R(o))continue;const a=Date.now()+t,i=URL.createObjectURL(o);k.add(i),u.value.push({uid:a,name:o.name||`file-${a}`,status:"uploading",percentage:0,url:i}),z(o,d=>{const n=u.value.find(y=>y.uid===a);n&&(n.percentage=d.percent)},d=>{const n=u.value.find(y=>y.uid===a);n&&(n.status="success",n.url=d.url,b(),g("success",d))},()=>le(a))}}function U(l){var a;if(s.disabled)return;const t=(a=l.clipboardData)==null?void 0:a.items;if(!t)return;const o=[];for(let i=0;i<t.length;i++){const d=t[i];if(d.kind==="file"&&d.type.startsWith("image/")){const n=d.getAsFile();n&&o.push(n)}}o.length&&(l.preventDefault(),j(o))}function te(l){var o;if(B.value=!1,s.disabled||N.value)return;const t=Array.from(((o=l.dataTransfer)==null?void 0:o.files)||[]).filter(a=>{var i;return m.value.includes((i=a.name.split(".").pop())==null?void 0:i.toLowerCase())});t.length&&j(t)}function le(l){var o;const t=u.value.findIndex(a=>a.uid===l);t!==-1&&((o=u.value[t].url)!=null&&o.startsWith("blob:")&&(URL.revokeObjectURL(u.value[t].url),k.delete(u.value[t].url)),u.value.splice(t,1))}return e.onBeforeUnmount(()=>{x.forEach(l=>l.abort()),x.length=0,k.forEach(l=>URL.revokeObjectURL(l)),k.clear()}),A({openFileDialog:()=>{var l,t;s.disabled||N.value||(t=(l=h.value)==null?void 0:l.$el.querySelector('input[type="file"]'))==null||t.click()},getPathList:()=>u.value.filter(l=>l.status==="success").map(l=>l.url),clearFiles:()=>{u.value=[],f.value="",b()},getValue:()=>({files:u.value.filter(l=>l.status==="success"&&l.url).map(l=>l.url),text:f.value})}),(l,t)=>{var q;const o=w.ElIcon,a=w.ElInput,i=w.ElPopover,d=w.ElUpload,n=w.ElImageViewer,y=w.ElDialog;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["qy-upload",K.value]),style:e.normalizeStyle({"--qy-upload-size":P.value})},[e.createVNode(d,{ref_key:"uploadRef",ref:h,"file-list":u.value,"onUpdate:fileList":t[6]||(t[6]=c=>u.value=c),action:"#",multiple:p.supportVideo?!1:p.multiple,limit:p.supportVideo?1:p.limit,"list-type":p.supportVideo?"text":"picture-card",accept:X.value,disabled:H.value,"http-request":Y,"before-upload":R,"on-preview":Z,"on-remove":J},{default:e.withCtx(()=>[N.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["qy-upload__trigger",{"is-dragover":B.value}]),onPaste:U,onDragover:t[4]||(t[4]=e.withModifiers(c=>B.value=!0,["prevent"])),onDragleave:t[5]||(t[5]=e.withModifiers(c=>B.value=!1,["prevent"])),onDrop:e.withModifiers(te,["prevent"])},[e.createVNode(o,{class:"qy-upload__icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(O.Plus))]),_:1}),p.supportVideo?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t[9]||(t[9]=e.createElementVNode("span",{class:"qy-upload__label"},"点击上传视频",-1)),e.createElementVNode("span",se,"支持 "+e.toDisplayString(m.value.join(" / "))+",不超过 "+e.toDisplayString(p.fileSize)+"MB",1)],64)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"qy-upload__text",onClick:t[3]||(t[3]=e.withModifiers(()=>{},["stop"])),onPaste:e.withModifiers(U,["stop"])},[e.createVNode(i,{visible:D.value,"onUpdate:visible":t[2]||(t[2]=c=>D.value=c),placement:"bottom-start",width:220,trigger:"click","popper-class":"qy-upload__text-popover",onAfterEnter:Q},{reference:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["qy-upload__text-preview",{"is-placeholder":!f.value}])},e.toDisplayString(f.value||"输入文字"),3)]),default:e.withCtx(()=>[e.createVNode(a,{ref_key:"inputRef",ref:M,modelValue:f.value,"onUpdate:modelValue":t[0]||(t[0]=c=>f.value=c),type:"textarea",autosize:{minRows:2,maxRows:5},placeholder:"输入文字或粘贴图片",disabled:p.disabled,onBlur:t[1]||(t[1]=c=>D.value=!1),onPaste:e.withModifiers(U,["stop"])},null,8,["modelValue","disabled"])]),_:1},8,["visible"])],32)],34))]),_:1},8,["file-list","multiple","limit","list-type","accept","disabled"]),C.value?(e.openBlock(),e.createBlock(n,{key:0,"url-list":S.value,"initial-index":E.value,onClose:ee},null,8,["url-list","initial-index"])):e.createCommentVNode("",!0),e.createVNode(y,{modelValue:V.value,"onUpdate:modelValue":t[7]||(t[7]=c=>V.value=c),title:T.value,width:"640px","append-to-body":"","destroy-on-close":"",onClose:t[8]||(t[8]=c=>V.value=!1)},{default:e.withCtx(()=>[V.value?(e.openBlock(),e.createElementBlock("video",{key:0,src:L.value,controls:"",autoplay:"",style:{width:"100%","max-height":"400px","border-radius":"4px"}},null,8,ne)):e.createCommentVNode("",!0)]),_:1},8,["modelValue","title"]),W.value?(e.openBlock(),e.createElementBlock("div",re,[e.createVNode(o,null,{default:e.withCtx(()=>[e.createVNode(e.unref(O.InfoFilled))]),_:1}),e.createElementVNode("span",null,[t[12]||(t[12]=e.createTextVNode(" 请上传 ",-1)),p.fileSize?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t[10]||(t[10]=e.createTextVNode("大小不超过 ",-1)),e.createElementVNode("b",ue,e.toDisplayString(p.fileSize)+"MB",1)],64)):e.createCommentVNode("",!0),(q=m.value)!=null&&q.length?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t[11]||(t[11]=e.createTextVNode(",格式为 ",-1)),e.createElementVNode("b",de,e.toDisplayString(m.value.join("/")),1)],64)):e.createCommentVNode("",!0),t[13]||(t[13]=e.createTextVNode(" 的文件。 ",-1))])])):e.createCommentVNode("",!0)],6)}}}),pe=ie.default(ce,[["__scopeId","data-v-c1472320"]]);exports.default=pe;
|
|
@@ -1,382 +0,0 @@
|
|
|
1
|
-
import { ElUpload as me, ElIcon as ye, ElPopover as ge, ElInput as be, ElImageViewer as xe, ElDialog as we } from "element-plus/es";
|
|
2
|
-
import { ref as p, onMounted as he, computed as x, watch as ke, onBeforeUnmount as Ve, createElementBlock as w, openBlock as m, normalizeStyle as Ue, normalizeClass as I, createVNode as y, createBlock as Be, createCommentVNode as h, withCtx as U, withModifiers as B, createElementVNode as k, unref as Y, Fragment as M, toDisplayString as R, createTextVNode as $ } from "vue";
|
|
3
|
-
import { Plus as Le, InfoFilled as Se } from "@element-plus/icons-vue";
|
|
4
|
-
import { ElMessage as V, ElLoading as De } from "element-plus";
|
|
5
|
-
import { getToken as Re } from "../utils/auth.mjs";
|
|
6
|
-
/* empty css */
|
|
7
|
-
/* empty css */
|
|
8
|
-
import qe from "../../_virtual/plugin-vue_export-helper.mjs";
|
|
9
|
-
const ze = { class: "qy-upload__hint" }, Te = ["src"], je = {
|
|
10
|
-
key: 1,
|
|
11
|
-
class: "qy-upload__tip"
|
|
12
|
-
}, _e = { class: "error" }, $e = { class: "error" }, Ce = Object.assign({
|
|
13
|
-
name: "QyUpload"
|
|
14
|
-
}, {
|
|
15
|
-
__name: "index",
|
|
16
|
-
props: {
|
|
17
|
-
/**
|
|
18
|
-
* 初始值,结构为 { files: '逗号分隔的URL', text: '文字内容' }
|
|
19
|
-
* 非受控模式,仅初始化时读取一次
|
|
20
|
-
*/
|
|
21
|
-
defaultValue: { type: Object, default: () => ({ files: "", text: "" }) },
|
|
22
|
-
/** 是否多选 */
|
|
23
|
-
multiple: { type: Boolean, default: !0 },
|
|
24
|
-
/** 是否禁用 */
|
|
25
|
-
disabled: { type: Boolean, default: !1 },
|
|
26
|
-
/** 允许的文件类型后缀(如 ['jpg', 'mp4']) */
|
|
27
|
-
fileType: { type: Array, default: () => [] },
|
|
28
|
-
/** 单个文件大小限制(MB) */
|
|
29
|
-
fileSize: { type: Number, default: 10 },
|
|
30
|
-
/** 文件数量限制 */
|
|
31
|
-
limit: { type: Number, default: 9 },
|
|
32
|
-
/** 是否显示格式/大小提示 */
|
|
33
|
-
isShowTip: { type: Boolean, default: !1 },
|
|
34
|
-
/** 接口路径 */
|
|
35
|
-
api: { type: String, default: "/permission-api/common/uploads" },
|
|
36
|
-
/** FormData 中文件字段名 */
|
|
37
|
-
name: { type: String, default: "file" },
|
|
38
|
-
tokenKey: { type: String, default: "Admin-Token" },
|
|
39
|
-
/** 是否支持视频模式(强制 limit=1) */
|
|
40
|
-
supportVideo: { type: Boolean, default: !1 },
|
|
41
|
-
/**
|
|
42
|
-
* 卡片尺寸
|
|
43
|
-
* 预设:'large'(160px) | 'default'(140px) | 'small'(80px)
|
|
44
|
-
* 自定义:任意 CSS 单位,如 '60px'、'8vw'
|
|
45
|
-
*/
|
|
46
|
-
size: { type: String, default: "default" },
|
|
47
|
-
/** 禁用拖拽(默认在触发区开启) */
|
|
48
|
-
disableDrag: { type: Boolean, default: !1 },
|
|
49
|
-
/** 成功回调(用于复杂业务联动) */
|
|
50
|
-
callBack: { type: Function, default: null },
|
|
51
|
-
/** 上传时附加的额外 FormData 字段 */
|
|
52
|
-
extraData: { type: Object, default: () => ({}) }
|
|
53
|
-
},
|
|
54
|
-
emits: ["change", "success", "error", "remove"],
|
|
55
|
-
setup(c, { expose: Z, emit: ee }) {
|
|
56
|
-
const o = c, g = ee, q = p(null), u = p([]), N = p(null), L = [], C = p(!1), F = p([]), P = p(0), S = p(!1), E = p(""), H = p(""), z = /* @__PURE__ */ new Set(), T = p(!1), f = p(""), O = p(!1);
|
|
57
|
-
he(() => {
|
|
58
|
-
const t = o.defaultValue;
|
|
59
|
-
if (!t) return;
|
|
60
|
-
f.value = t.text ?? "";
|
|
61
|
-
const e = t.files ?? "", a = Array.isArray(e) ? e.filter(Boolean) : String(e).split(",").filter(Boolean);
|
|
62
|
-
a.length && (u.value = a.map((l, i) => ({
|
|
63
|
-
name: l.split("/").pop() || `file-${i}`,
|
|
64
|
-
url: l,
|
|
65
|
-
status: "success",
|
|
66
|
-
uid: Date.now() + i
|
|
67
|
-
})));
|
|
68
|
-
});
|
|
69
|
-
const te = x(() => ({ large: "160px", default: "140px", small: "80px" })[o.size] ?? o.size), le = x(() => o.disabled), ae = x(
|
|
70
|
-
() => {
|
|
71
|
-
var t;
|
|
72
|
-
return o.isShowTip && (o.fileSize || ((t = v.value) == null ? void 0 : t.length));
|
|
73
|
-
}
|
|
74
|
-
), v = x(() => {
|
|
75
|
-
var t;
|
|
76
|
-
return (t = o.fileType) != null && t.length ? o.fileType.map((e) => e.toLowerCase()) : o.supportVideo ? ["mp4", "mov", "avi"] : ["jpg", "jpeg", "png", "gif", "webp"];
|
|
77
|
-
}), j = x(() => {
|
|
78
|
-
const t = o.supportVideo ? 1 : o.limit;
|
|
79
|
-
return u.value.length >= t;
|
|
80
|
-
}), ie = x(
|
|
81
|
-
() => v.value.map((t) => `.${t}`).join(",")
|
|
82
|
-
), oe = x(() => ({
|
|
83
|
-
"qy-upload--reached-limit": j.value,
|
|
84
|
-
"qy-upload--disabled": o.disabled,
|
|
85
|
-
"qy-upload--video": o.supportVideo
|
|
86
|
-
}));
|
|
87
|
-
ke(f, () => D());
|
|
88
|
-
function se() {
|
|
89
|
-
var t;
|
|
90
|
-
(t = N.value) == null || t.focus();
|
|
91
|
-
}
|
|
92
|
-
function D(t) {
|
|
93
|
-
const l = { files: (t ?? u.value).filter((i) => i.status === "success" && i.url).map((i) => i.url), text: f.value };
|
|
94
|
-
g("change", l), o.callBack && o.callBack(l);
|
|
95
|
-
}
|
|
96
|
-
function ne(t, e) {
|
|
97
|
-
D(e);
|
|
98
|
-
}
|
|
99
|
-
function ue(t) {
|
|
100
|
-
var l;
|
|
101
|
-
if (!(t.size / 1024 / 1024 < o.fileSize))
|
|
102
|
-
return V.warning(`文件大小不能超过${o.fileSize}M`), !1;
|
|
103
|
-
const a = ((l = t.name.split(".").pop()) == null ? void 0 : l.toLowerCase()) || "";
|
|
104
|
-
return v.value.includes(a) ? !0 : (V.warning(
|
|
105
|
-
`格式不支持,仅允许: ${v.value.join("/")}`
|
|
106
|
-
), !1);
|
|
107
|
-
}
|
|
108
|
-
function W(t, e, a, l) {
|
|
109
|
-
var J, G;
|
|
110
|
-
const i = o.api.startsWith("http") ? o.api : window.location.origin + o.api.replace(/^([^/])/, "/$1"), r = new FormData();
|
|
111
|
-
r.append(o.name, t), o.extraData && Object.entries(o.extraData).forEach(([n, ve]) => r.append(n, ve));
|
|
112
|
-
const s = new XMLHttpRequest();
|
|
113
|
-
L.push(s);
|
|
114
|
-
const b = ((J = q.value) == null ? void 0 : J.$el.querySelector(".el-upload--picture-card")) || ((G = q.value) == null ? void 0 : G.$el), _ = De.service({
|
|
115
|
-
target: b,
|
|
116
|
-
text: "上传中",
|
|
117
|
-
background: "rgba(255,255,255,0.7)"
|
|
118
|
-
}), d = () => {
|
|
119
|
-
const n = L.indexOf(s);
|
|
120
|
-
n !== -1 && L.splice(n, 1), _.close();
|
|
121
|
-
};
|
|
122
|
-
s.open("POST", i);
|
|
123
|
-
const Q = Re(o.tokenKey);
|
|
124
|
-
Q && s.setRequestHeader("Authorization", `Bearer ${Q}`), s.upload.onprogress = (n) => {
|
|
125
|
-
n.total > 0 && (e == null || e({ percent: n.loaded / n.total * 100 }));
|
|
126
|
-
}, s.onload = () => {
|
|
127
|
-
if (d(), s.status < 200 || s.status >= 300) {
|
|
128
|
-
const n = `上传失败 (HTTP ${s.status})`;
|
|
129
|
-
V.error(n), g("error", { msg: n, status: s.status }), l == null || l(new Error(n));
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
try {
|
|
133
|
-
const n = JSON.parse(s.responseText);
|
|
134
|
-
n.code === 200 && n.urls ? (V.success("上传成功"), a == null || a({ ...n, url: n.urls })) : (V.error(n.msg || "上传失败"), g("error", n), l == null || l(n));
|
|
135
|
-
} catch {
|
|
136
|
-
V.error("上传失败,响应格式错误"), g("error", new Error("Response parse error")), l == null || l(new Error("Response parse error"));
|
|
137
|
-
}
|
|
138
|
-
}, s.onerror = () => {
|
|
139
|
-
d(), V.error("上传失败,网络异常"), g("error", new Error("Network error")), l == null || l(new Error("Network error"));
|
|
140
|
-
}, s.send(r);
|
|
141
|
-
}
|
|
142
|
-
function X(t) {
|
|
143
|
-
return o.disabled ? !1 : ue(t);
|
|
144
|
-
}
|
|
145
|
-
function re(t) {
|
|
146
|
-
W(
|
|
147
|
-
t.file,
|
|
148
|
-
t.onProgress,
|
|
149
|
-
(e) => {
|
|
150
|
-
t.onSuccess(e), D(), g("success", e);
|
|
151
|
-
},
|
|
152
|
-
(e) => t.onError(e)
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
function de(t) {
|
|
156
|
-
var l;
|
|
157
|
-
if (!t.url) return;
|
|
158
|
-
const e = ((l = t.url.split(".").pop()) == null ? void 0 : l.toLowerCase()) || "";
|
|
159
|
-
if (["mp4", "mov", "avi", "webm"].includes(e)) {
|
|
160
|
-
E.value = t.url, H.value = t.name || "视频预览", S.value = !0;
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
const a = u.value.filter(
|
|
164
|
-
(i) => {
|
|
165
|
-
var r;
|
|
166
|
-
return i.status === "success" && i.url && !["mp4", "mov", "avi", "webm"].includes(
|
|
167
|
-
(r = i.url.split(".").pop()) == null ? void 0 : r.toLowerCase()
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
);
|
|
171
|
-
F.value = a.map((i) => i.url), P.value = a.findIndex((i) => i.uid === t.uid) || 0, C.value = !0;
|
|
172
|
-
}
|
|
173
|
-
function pe() {
|
|
174
|
-
C.value = !1, F.value = [];
|
|
175
|
-
}
|
|
176
|
-
function K(t) {
|
|
177
|
-
for (let e = 0; e < t.length; e++) {
|
|
178
|
-
const a = t[e];
|
|
179
|
-
if (!X(a)) continue;
|
|
180
|
-
const l = Date.now() + e, i = URL.createObjectURL(a);
|
|
181
|
-
z.add(i), u.value.push({
|
|
182
|
-
uid: l,
|
|
183
|
-
name: a.name || `file-${l}`,
|
|
184
|
-
status: "uploading",
|
|
185
|
-
percentage: 0,
|
|
186
|
-
url: i
|
|
187
|
-
}), W(
|
|
188
|
-
a,
|
|
189
|
-
(r) => {
|
|
190
|
-
const s = u.value.find((b) => b.uid === l);
|
|
191
|
-
s && (s.percentage = r.percent);
|
|
192
|
-
},
|
|
193
|
-
(r) => {
|
|
194
|
-
const s = u.value.find((b) => b.uid === l);
|
|
195
|
-
s && (s.status = "success", s.url = r.url, D(), g("success", r));
|
|
196
|
-
},
|
|
197
|
-
() => fe(l)
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
function A(t) {
|
|
202
|
-
var l;
|
|
203
|
-
if (o.disabled) return;
|
|
204
|
-
const e = (l = t.clipboardData) == null ? void 0 : l.items;
|
|
205
|
-
if (!e) return;
|
|
206
|
-
const a = [];
|
|
207
|
-
for (let i = 0; i < e.length; i++) {
|
|
208
|
-
const r = e[i];
|
|
209
|
-
if (r.kind === "file" && r.type.startsWith("image/")) {
|
|
210
|
-
const s = r.getAsFile();
|
|
211
|
-
s && a.push(s);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
a.length && (t.preventDefault(), K(a));
|
|
215
|
-
}
|
|
216
|
-
function ce(t) {
|
|
217
|
-
var a;
|
|
218
|
-
if (T.value = !1, o.disabled || j.value) return;
|
|
219
|
-
const e = Array.from(((a = t.dataTransfer) == null ? void 0 : a.files) || []).filter(
|
|
220
|
-
(l) => {
|
|
221
|
-
var i;
|
|
222
|
-
return v.value.includes((i = l.name.split(".").pop()) == null ? void 0 : i.toLowerCase());
|
|
223
|
-
}
|
|
224
|
-
);
|
|
225
|
-
e.length && K(e);
|
|
226
|
-
}
|
|
227
|
-
function fe(t) {
|
|
228
|
-
var a;
|
|
229
|
-
const e = u.value.findIndex((l) => l.uid === t);
|
|
230
|
-
e !== -1 && ((a = u.value[e].url) != null && a.startsWith("blob:") && (URL.revokeObjectURL(u.value[e].url), z.delete(u.value[e].url)), u.value.splice(e, 1));
|
|
231
|
-
}
|
|
232
|
-
return Ve(() => {
|
|
233
|
-
L.forEach((t) => t.abort()), L.length = 0, z.forEach((t) => URL.revokeObjectURL(t)), z.clear();
|
|
234
|
-
}), Z({
|
|
235
|
-
openFileDialog: () => {
|
|
236
|
-
var t, e;
|
|
237
|
-
o.disabled || j.value || (e = (t = q.value) == null ? void 0 : t.$el.querySelector('input[type="file"]')) == null || e.click();
|
|
238
|
-
},
|
|
239
|
-
getPathList: () => u.value.filter((t) => t.status === "success").map((t) => t.url),
|
|
240
|
-
clearFiles: () => {
|
|
241
|
-
u.value = [], f.value = "", D();
|
|
242
|
-
},
|
|
243
|
-
getValue: () => ({
|
|
244
|
-
files: u.value.filter((t) => t.status === "success" && t.url).map((t) => t.url),
|
|
245
|
-
text: f.value
|
|
246
|
-
})
|
|
247
|
-
}), (t, e) => {
|
|
248
|
-
var _;
|
|
249
|
-
const a = ye, l = be, i = ge, r = me, s = xe, b = we;
|
|
250
|
-
return m(), w("div", {
|
|
251
|
-
class: I(["qy-upload", oe.value]),
|
|
252
|
-
style: Ue({ "--qy-upload-size": te.value })
|
|
253
|
-
}, [
|
|
254
|
-
y(r, {
|
|
255
|
-
ref_key: "uploadRef",
|
|
256
|
-
ref: q,
|
|
257
|
-
"file-list": u.value,
|
|
258
|
-
"onUpdate:fileList": e[6] || (e[6] = (d) => u.value = d),
|
|
259
|
-
action: "#",
|
|
260
|
-
multiple: c.supportVideo ? !1 : c.multiple,
|
|
261
|
-
limit: c.supportVideo ? 1 : c.limit,
|
|
262
|
-
"list-type": c.supportVideo ? "text" : "picture-card",
|
|
263
|
-
accept: ie.value,
|
|
264
|
-
disabled: le.value,
|
|
265
|
-
"http-request": re,
|
|
266
|
-
"before-upload": X,
|
|
267
|
-
"on-preview": de,
|
|
268
|
-
"on-remove": ne
|
|
269
|
-
}, {
|
|
270
|
-
default: U(() => [
|
|
271
|
-
j.value ? h("", !0) : (m(), w("div", {
|
|
272
|
-
key: 0,
|
|
273
|
-
class: I(["qy-upload__trigger", { "is-dragover": T.value }]),
|
|
274
|
-
onPaste: A,
|
|
275
|
-
onDragover: e[4] || (e[4] = B((d) => T.value = !0, ["prevent"])),
|
|
276
|
-
onDragleave: e[5] || (e[5] = B((d) => T.value = !1, ["prevent"])),
|
|
277
|
-
onDrop: B(ce, ["prevent"])
|
|
278
|
-
}, [
|
|
279
|
-
y(a, { class: "qy-upload__icon" }, {
|
|
280
|
-
default: U(() => [
|
|
281
|
-
y(Y(Le))
|
|
282
|
-
]),
|
|
283
|
-
_: 1
|
|
284
|
-
}),
|
|
285
|
-
c.supportVideo ? (m(), w(M, { key: 0 }, [
|
|
286
|
-
e[9] || (e[9] = k("span", { class: "qy-upload__label" }, "点击上传视频", -1)),
|
|
287
|
-
k("span", ze, "支持 " + R(v.value.join(" / ")) + ",不超过 " + R(c.fileSize) + "MB", 1)
|
|
288
|
-
], 64)) : h("", !0),
|
|
289
|
-
k("div", {
|
|
290
|
-
class: "qy-upload__text",
|
|
291
|
-
onClick: e[3] || (e[3] = B(() => {
|
|
292
|
-
}, ["stop"])),
|
|
293
|
-
onPaste: B(A, ["stop"])
|
|
294
|
-
}, [
|
|
295
|
-
y(i, {
|
|
296
|
-
visible: O.value,
|
|
297
|
-
"onUpdate:visible": e[2] || (e[2] = (d) => O.value = d),
|
|
298
|
-
placement: "bottom-start",
|
|
299
|
-
width: 220,
|
|
300
|
-
trigger: "click",
|
|
301
|
-
"popper-class": "qy-upload__text-popover",
|
|
302
|
-
onAfterEnter: se
|
|
303
|
-
}, {
|
|
304
|
-
reference: U(() => [
|
|
305
|
-
k("div", {
|
|
306
|
-
class: I(["qy-upload__text-preview", { "is-placeholder": !f.value }])
|
|
307
|
-
}, R(f.value || "输入文字"), 3)
|
|
308
|
-
]),
|
|
309
|
-
default: U(() => [
|
|
310
|
-
y(l, {
|
|
311
|
-
ref_key: "inputRef",
|
|
312
|
-
ref: N,
|
|
313
|
-
modelValue: f.value,
|
|
314
|
-
"onUpdate:modelValue": e[0] || (e[0] = (d) => f.value = d),
|
|
315
|
-
type: "textarea",
|
|
316
|
-
autosize: { minRows: 2, maxRows: 5 },
|
|
317
|
-
placeholder: "输入文字或粘贴图片",
|
|
318
|
-
disabled: c.disabled,
|
|
319
|
-
onBlur: e[1] || (e[1] = (d) => O.value = !1),
|
|
320
|
-
onPaste: B(A, ["stop"])
|
|
321
|
-
}, null, 8, ["modelValue", "disabled"])
|
|
322
|
-
]),
|
|
323
|
-
_: 1
|
|
324
|
-
}, 8, ["visible"])
|
|
325
|
-
], 32)
|
|
326
|
-
], 34))
|
|
327
|
-
]),
|
|
328
|
-
_: 1
|
|
329
|
-
}, 8, ["file-list", "multiple", "limit", "list-type", "accept", "disabled"]),
|
|
330
|
-
C.value ? (m(), Be(s, {
|
|
331
|
-
key: 0,
|
|
332
|
-
"url-list": F.value,
|
|
333
|
-
"initial-index": P.value,
|
|
334
|
-
onClose: pe
|
|
335
|
-
}, null, 8, ["url-list", "initial-index"])) : h("", !0),
|
|
336
|
-
y(b, {
|
|
337
|
-
modelValue: S.value,
|
|
338
|
-
"onUpdate:modelValue": e[7] || (e[7] = (d) => S.value = d),
|
|
339
|
-
title: H.value,
|
|
340
|
-
width: "640px",
|
|
341
|
-
"append-to-body": "",
|
|
342
|
-
"destroy-on-close": "",
|
|
343
|
-
onClose: e[8] || (e[8] = (d) => S.value = !1)
|
|
344
|
-
}, {
|
|
345
|
-
default: U(() => [
|
|
346
|
-
S.value ? (m(), w("video", {
|
|
347
|
-
key: 0,
|
|
348
|
-
src: E.value,
|
|
349
|
-
controls: "",
|
|
350
|
-
autoplay: "",
|
|
351
|
-
style: { width: "100%", "max-height": "400px", "border-radius": "4px" }
|
|
352
|
-
}, null, 8, Te)) : h("", !0)
|
|
353
|
-
]),
|
|
354
|
-
_: 1
|
|
355
|
-
}, 8, ["modelValue", "title"]),
|
|
356
|
-
ae.value ? (m(), w("div", je, [
|
|
357
|
-
y(a, null, {
|
|
358
|
-
default: U(() => [
|
|
359
|
-
y(Y(Se))
|
|
360
|
-
]),
|
|
361
|
-
_: 1
|
|
362
|
-
}),
|
|
363
|
-
k("span", null, [
|
|
364
|
-
e[12] || (e[12] = $(" 请上传 ", -1)),
|
|
365
|
-
c.fileSize ? (m(), w(M, { key: 0 }, [
|
|
366
|
-
e[10] || (e[10] = $("大小不超过 ", -1)),
|
|
367
|
-
k("b", _e, R(c.fileSize) + "MB", 1)
|
|
368
|
-
], 64)) : h("", !0),
|
|
369
|
-
(_ = v.value) != null && _.length ? (m(), w(M, { key: 1 }, [
|
|
370
|
-
e[11] || (e[11] = $(",格式为 ", -1)),
|
|
371
|
-
k("b", $e, R(v.value.join("/")), 1)
|
|
372
|
-
], 64)) : h("", !0),
|
|
373
|
-
e[13] || (e[13] = $(" 的文件。 ", -1))
|
|
374
|
-
])
|
|
375
|
-
])) : h("", !0)
|
|
376
|
-
], 6);
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
}), He = /* @__PURE__ */ qe(Ce, [["__scopeId", "data-v-c1472320"]]);
|
|
380
|
-
export {
|
|
381
|
-
He as default
|
|
382
|
-
};
|
package/dist/lib/utils/auth.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../node_modules/.pnpm/js-cookie@3.0.1/node_modules/js-cookie/dist/js.cookie.cjs"),o="Admin-Token";function n(e=o){return t.default.get(e)}exports.getToken=n;
|
package/dist/lib/utils/auth.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function t(l,i=l==null?void 0:l.name){return i&&(l.install=r=>{r.component(i,l)}),l}exports.withInstall=t;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});/*! js-cookie v3.0.1 | MIT */function u(r){for(var i=1;i<arguments.length;i++){var f=arguments[i];for(var p in f)r[p]=f[p]}return r}var v={read:function(r){return r[0]==='"'&&(r=r.slice(1,-1)),r.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(r){return encodeURIComponent(r).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function s(r,i){function f(n,c,e){if(!(typeof document>"u")){e=u({},i,e),typeof e.expires=="number"&&(e.expires=new Date(Date.now()+e.expires*864e5)),e.expires&&(e.expires=e.expires.toUTCString()),n=encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var t in e)e[t]&&(o+="; "+t,e[t]!==!0&&(o+="="+e[t].split(";")[0]));return document.cookie=n+"="+r.write(c,n)+o}}function p(n){if(!(typeof document>"u"||arguments.length&&!n)){for(var c=document.cookie?document.cookie.split("; "):[],e={},o=0;o<c.length;o++){var t=c[o].split("="),a=t.slice(1).join("=");try{var d=decodeURIComponent(t[0]);if(e[d]=r.read(a,d),n===d)break}catch{}}return n?e[n]:e}}return Object.create({set:f,get:p,remove:function(n,c){f(n,"",u({},c,{expires:-1}))},withAttributes:function(n){return s(this.converter,u({},this.attributes,n))},withConverter:function(n){return s(u({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(i)},converter:{value:Object.freeze(r)}})}var l=s(v,{path:"/"});exports.default=l;
|