epic-designer-gold 0.0.48 → 0.0.49
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/sign-BJBURbHk.js +218 -0
- package/dist/sign-Cn6LXVcp.cjs +1 -0
- package/dist/style.css +1 -1
- package/dist/ui/elementPlus/index.cjs +1 -1
- package/dist/ui/elementPlus/index.js +42 -44
- package/package.json +1 -1
- package/dist/sign-BRchUdJt.js +0 -156
- package/dist/sign-CnQtsTLr.cjs +0 -1
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { inject as G, watch as J, nextTick as D, ref as l, onMounted as K, onUnmounted as Q, openBlock as x, createElementBlock as w, createVNode as S, unref as P, withCtx as _, createElementVNode as m, createTextVNode as M } from "vue";
|
|
2
|
+
import { p as A, a as Z, b as ee } from "./js.cookie-oHpRFPCO.js";
|
|
3
|
+
import { ElMessageBox as R, ElMessage as k } from "element-plus";
|
|
4
|
+
import { _ as te } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
5
|
+
const oe = { class: "sign-main" }, ae = ["src"], ne = {
|
|
6
|
+
class: "sign",
|
|
7
|
+
style: {
|
|
8
|
+
height: "100%",
|
|
9
|
+
width: "100%"
|
|
10
|
+
}
|
|
11
|
+
}, le = ["id"], se = { class: "btn" }, ue = { class: "btns" }, ie = {
|
|
12
|
+
__name: "sign",
|
|
13
|
+
props: {
|
|
14
|
+
componentSchema: {
|
|
15
|
+
type: Object,
|
|
16
|
+
require: !0,
|
|
17
|
+
default: () => ({})
|
|
18
|
+
},
|
|
19
|
+
modelValue: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: ""
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
emits: ["update:modelValue"],
|
|
25
|
+
setup(W, { expose: j, emit: E }) {
|
|
26
|
+
const T = A.getComponent("button"), U = A.getComponent("Dialog"), X = E, a = W, p = G("disabled", { value: !1 });
|
|
27
|
+
J(
|
|
28
|
+
() => a.componentSchema,
|
|
29
|
+
() => {
|
|
30
|
+
D(() => {
|
|
31
|
+
f.value = a.modelValue;
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
{ deep: !0, immediate: !0 }
|
|
35
|
+
);
|
|
36
|
+
const n = l(null), i = l(null), o = l(), Y = l("");
|
|
37
|
+
function I() {
|
|
38
|
+
var t, e, u, h;
|
|
39
|
+
if (i.value && ((t = i.value) != null && t.clientHeight) && ((e = i.value) != null && e.clientWidth)) {
|
|
40
|
+
if (n.value = document.getElementById(`canvas${a.componentSchema.field}`), n.value.height = ((u = i.value) == null ? void 0 : u.clientHeight) || 600, n.value.width = (h = i.value) == null ? void 0 : h.clientWidth, o.value = n.value.getContext("2d"), a.modelValue) {
|
|
41
|
+
let r = new Image();
|
|
42
|
+
r.src = a.modelValue, r.setAttribute("crossOrigin", "anonymous"), r.onload = () => {
|
|
43
|
+
o.value.fillStyle = o.value.createPattern(r, "repeat"), o.value.fillRect(0, 0, 1e3, 550);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
o.value.lineWidth = a.componentSchema.componentProps.lineWidth || 4, a.componentSchema && a.componentSchema.componentProps && a.componentSchema.componentProps.style && a.componentSchema.componentProps.style.color && (o.value.strokeStyle = a.componentSchema.componentProps.style.color), Y.value = n.value.getBoundingClientRect();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const d = l(""), v = l(""), z = l(""), N = l(""), s = l([]), y = l(!1);
|
|
50
|
+
function F(t) {
|
|
51
|
+
if (p.value || a.componentSchema.componentProps.readonly || a.componentSchema.componentProps.disabled)
|
|
52
|
+
return;
|
|
53
|
+
t = t || event, t.preventDefault();
|
|
54
|
+
let e = {
|
|
55
|
+
x: t.offsetX,
|
|
56
|
+
y: t.offsetY
|
|
57
|
+
};
|
|
58
|
+
d.value = e.x, v.value = e.y, o.value.beginPath(), o.value.moveTo(e.x, e.y), o.value.lineTo(e.x, e.y), o.value.stroke(), o.value.closePath(), s.value.push(e), y.value = !0;
|
|
59
|
+
}
|
|
60
|
+
function H(t) {
|
|
61
|
+
if (!(p.value || a.componentSchema.componentProps.readonly || a.componentSchema.componentProps.disabled) && (t = t || event, t.preventDefault(), y.value)) {
|
|
62
|
+
let e = {
|
|
63
|
+
x: t.offsetX,
|
|
64
|
+
y: t.offsetY
|
|
65
|
+
};
|
|
66
|
+
z.value = e.x, N.value = e.y, o.value.beginPath(), o.value.moveTo(d.value, v.value), o.value.lineTo(e.x, e.y), o.value.stroke(), o.value.closePath(), d.value = e.x, v.value = e.y, s.value.push(e);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function O(t) {
|
|
70
|
+
if (p.value || a.componentSchema.componentProps.readonly || a.componentSchema.componentProps.disabled)
|
|
71
|
+
return;
|
|
72
|
+
t = t || event, t.preventDefault();
|
|
73
|
+
let e = {
|
|
74
|
+
x: t.offsetX,
|
|
75
|
+
y: t.offsetY
|
|
76
|
+
};
|
|
77
|
+
o.value.beginPath(), o.value.moveTo(d.value, v.value), o.value.lineTo(e.x, e.y), o.value.stroke(), o.value.closePath(), s.value.push(e), s.value.push({ x: -1, y: -1 }), y.value = !1;
|
|
78
|
+
}
|
|
79
|
+
function B() {
|
|
80
|
+
R.confirm("重写将清空画布,请确定是否重写?", "警告", {
|
|
81
|
+
confirmButtonText: "确定",
|
|
82
|
+
cancelButtonText: "取消",
|
|
83
|
+
type: "warning"
|
|
84
|
+
}).then(() => {
|
|
85
|
+
o.value.clearRect(0, 0, n.value.width, n.value.height), s.value = [], k({
|
|
86
|
+
type: "info",
|
|
87
|
+
message: "清空成功"
|
|
88
|
+
});
|
|
89
|
+
}).catch(() => {
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const f = l("");
|
|
93
|
+
async function b() {
|
|
94
|
+
let t = await $(n.value.toDataURL("image/png"));
|
|
95
|
+
f.value = t, X("update:modelValue", t);
|
|
96
|
+
}
|
|
97
|
+
async function $(t) {
|
|
98
|
+
try {
|
|
99
|
+
let e = atob(t.split(",")[1]), u = new ArrayBuffer(e.length), h = new Uint8Array(u);
|
|
100
|
+
for (let g = 0; g < e.length; g++)
|
|
101
|
+
h[g] = e.charCodeAt(g);
|
|
102
|
+
let r = new Blob([u], { type: "image/png" }), C = new FormData();
|
|
103
|
+
C.append("file", r, Date.now() + "png");
|
|
104
|
+
let L = await Z({
|
|
105
|
+
method: "post",
|
|
106
|
+
url: "https://ess-ds.com/prod-api/center-file/file/upload",
|
|
107
|
+
data: C,
|
|
108
|
+
headers: {
|
|
109
|
+
"Content-Type": "multipart/form-data",
|
|
110
|
+
Authorization: "Bearer " + ee.get("Admin-Token")
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return k({
|
|
114
|
+
type: "success",
|
|
115
|
+
message: "上传成功"
|
|
116
|
+
}), L.data.data.url;
|
|
117
|
+
} catch {
|
|
118
|
+
k({
|
|
119
|
+
type: "warning",
|
|
120
|
+
message: "上传失败"
|
|
121
|
+
}), c.value = !1;
|
|
122
|
+
} finally {
|
|
123
|
+
c.value = !1;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const c = l(!1);
|
|
127
|
+
function q() {
|
|
128
|
+
R.confirm("是否放弃本次签字?", "警告", {
|
|
129
|
+
confirmButtonText: "确定",
|
|
130
|
+
cancelButtonText: "取消",
|
|
131
|
+
type: "warning"
|
|
132
|
+
}).then(() => {
|
|
133
|
+
o.value.clearRect(0, 0, n.value.width, n.value.height), s.value = [], c.value = !1;
|
|
134
|
+
}).catch(() => !1);
|
|
135
|
+
}
|
|
136
|
+
function V() {
|
|
137
|
+
p.value || a.componentSchema.componentProps.readonly || a.componentSchema.componentProps.disabled || (c.value = !0, o.value && (o.value.clearRect(0, 0, n.value.width, n.value.height), s.value = []), D(() => {
|
|
138
|
+
I();
|
|
139
|
+
}));
|
|
140
|
+
}
|
|
141
|
+
return K(() => {
|
|
142
|
+
}), Q(() => {
|
|
143
|
+
}), j({
|
|
144
|
+
surewrite: b
|
|
145
|
+
}), (t, e) => (x(), w("div", oe, [
|
|
146
|
+
f.value ? (x(), w("img", {
|
|
147
|
+
key: 1,
|
|
148
|
+
class: "sign-board",
|
|
149
|
+
src: f.value,
|
|
150
|
+
alt: "",
|
|
151
|
+
onClick: V
|
|
152
|
+
}, null, 8, ae)) : (x(), w("div", {
|
|
153
|
+
key: 0,
|
|
154
|
+
class: "sign-board",
|
|
155
|
+
onClick: V
|
|
156
|
+
}, "签字板")),
|
|
157
|
+
S(P(U), {
|
|
158
|
+
modelValue: c.value,
|
|
159
|
+
"onUpdate:modelValue": e[0] || (e[0] = (u) => c.value = u),
|
|
160
|
+
title: "签字板",
|
|
161
|
+
class: "w-860px",
|
|
162
|
+
width: "860px",
|
|
163
|
+
style: { height: "600px" },
|
|
164
|
+
"before-close": q,
|
|
165
|
+
draggable: !1,
|
|
166
|
+
modal: ""
|
|
167
|
+
}, {
|
|
168
|
+
default: _(() => [
|
|
169
|
+
m("div", ne, [
|
|
170
|
+
m("div", {
|
|
171
|
+
class: "canvas",
|
|
172
|
+
ref_key: "canvasWrap",
|
|
173
|
+
ref: i
|
|
174
|
+
}, [
|
|
175
|
+
m("canvas", {
|
|
176
|
+
id: `canvas${a.componentSchema.field}`,
|
|
177
|
+
onMousedown: F,
|
|
178
|
+
onMousemove: H,
|
|
179
|
+
onMouseup: O
|
|
180
|
+
}, null, 40, le)
|
|
181
|
+
], 512),
|
|
182
|
+
m("div", se, [
|
|
183
|
+
e[3] || (e[3] = m("div", { class: "remark" }, null, -1)),
|
|
184
|
+
m("div", ue, [
|
|
185
|
+
S(P(T), {
|
|
186
|
+
type: "info",
|
|
187
|
+
size: "mini",
|
|
188
|
+
onClick: B,
|
|
189
|
+
onTouch: B
|
|
190
|
+
}, {
|
|
191
|
+
default: _(() => e[1] || (e[1] = [
|
|
192
|
+
M("重写")
|
|
193
|
+
])),
|
|
194
|
+
_: 1
|
|
195
|
+
}),
|
|
196
|
+
S(P(T), {
|
|
197
|
+
type: "primary",
|
|
198
|
+
size: "mini",
|
|
199
|
+
onClick: b,
|
|
200
|
+
onTouch: b
|
|
201
|
+
}, {
|
|
202
|
+
default: _(() => e[2] || (e[2] = [
|
|
203
|
+
M("确定")
|
|
204
|
+
])),
|
|
205
|
+
_: 1
|
|
206
|
+
})
|
|
207
|
+
])
|
|
208
|
+
])
|
|
209
|
+
])
|
|
210
|
+
]),
|
|
211
|
+
_: 1
|
|
212
|
+
}, 8, ["modelValue"])
|
|
213
|
+
]));
|
|
214
|
+
}
|
|
215
|
+
}, de = /* @__PURE__ */ te(ie, [["__scopeId", "data-v-017ab137"]]);
|
|
216
|
+
export {
|
|
217
|
+
de as default
|
|
218
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),y=require("./js.cookie-BH1G_HRi.cjs"),m=require("element-plus"),X=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),Y={class:"sign-main"},I=["src"],z={class:"sign",style:{height:"100%",width:"100%"}},H=["id"],O={class:"btn"},F={class:"btns"},$={__name:"sign",props:{componentSchema:{type:Object,require:!0,default:()=>({})},modelValue:{type:String,default:""}},emits:["update:modelValue"],setup(V,{expose:_,emit:T}){const w=y.pluginManager.getComponent("button"),B=y.pluginManager.getComponent("Dialog"),E=T,a=V,p=e.inject("disabled",{value:!1});e.watch(()=>a.componentSchema,()=>{e.nextTick(()=>{f.value=a.modelValue})},{deep:!0,immediate:!0});const l=e.ref(null),c=e.ref(null),n=e.ref(),C=e.ref("");function M(){var o,t,u,h;if(c.value&&((o=c.value)!=null&&o.clientHeight)&&((t=c.value)!=null&&t.clientWidth)){if(l.value=document.getElementById(`canvas${a.componentSchema.field}`),l.value.height=((u=c.value)==null?void 0:u.clientHeight)||600,l.value.width=(h=c.value)==null?void 0:h.clientWidth,n.value=l.value.getContext("2d"),a.modelValue){let r=new Image;r.src=a.modelValue,r.setAttribute("crossOrigin","anonymous"),r.onload=()=>{n.value.fillStyle=n.value.createPattern(r,"repeat"),n.value.fillRect(0,0,1e3,550)}}n.value.lineWidth=a.componentSchema.componentProps.lineWidth||4,a.componentSchema&&a.componentSchema.componentProps&&a.componentSchema.componentProps.style&&a.componentSchema.componentProps.style.color&&(n.value.strokeStyle=a.componentSchema.componentProps.style.color),C.value=l.value.getBoundingClientRect()}}const d=e.ref(""),v=e.ref(""),D=e.ref(""),N=e.ref(""),s=e.ref([]),x=e.ref(!1);function j(o){if(p.value||a.componentSchema.componentProps.readonly||a.componentSchema.componentProps.disabled)return;o=o||event,o.preventDefault();let t={x:o.offsetX,y:o.offsetY};d.value=t.x,v.value=t.y,n.value.beginPath(),n.value.moveTo(t.x,t.y),n.value.lineTo(t.x,t.y),n.value.stroke(),n.value.closePath(),s.value.push(t),x.value=!0}function A(o){if(!(p.value||a.componentSchema.componentProps.readonly||a.componentSchema.componentProps.disabled)&&(o=o||event,o.preventDefault(),x.value)){let t={x:o.offsetX,y:o.offsetY};D.value=t.x,N.value=t.y,n.value.beginPath(),n.value.moveTo(d.value,v.value),n.value.lineTo(t.x,t.y),n.value.stroke(),n.value.closePath(),d.value=t.x,v.value=t.y,s.value.push(t)}}function R(o){if(p.value||a.componentSchema.componentProps.readonly||a.componentSchema.componentProps.disabled)return;o=o||event,o.preventDefault();let t={x:o.offsetX,y:o.offsetY};n.value.beginPath(),n.value.moveTo(d.value,v.value),n.value.lineTo(t.x,t.y),n.value.stroke(),n.value.closePath(),s.value.push(t),s.value.push({x:-1,y:-1}),x.value=!1}function S(){m.ElMessageBox.confirm("重写将清空画布,请确定是否重写?","警告",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{n.value.clearRect(0,0,l.value.width,l.value.height),s.value=[],m.ElMessage({type:"info",message:"清空成功"})}).catch(()=>{})}const f=e.ref("");async function b(){let o=await W(l.value.toDataURL("image/png"));f.value=o,E("update:modelValue",o)}async function W(o){try{let t=atob(o.split(",")[1]),u=new ArrayBuffer(t.length),h=new Uint8Array(u);for(let g=0;g<t.length;g++)h[g]=t.charCodeAt(g);let r=new Blob([u],{type:"image/png"}),P=new FormData;P.append("file",r,Date.now()+"png");let U=await y.axios({method:"post",url:"https://ess-ds.com/prod-api/center-file/file/upload",data:P,headers:{"Content-Type":"multipart/form-data",Authorization:"Bearer "+y.api.get("Admin-Token")}});return m.ElMessage({type:"success",message:"上传成功"}),U.data.data.url}catch{m.ElMessage({type:"warning",message:"上传失败"}),i.value=!1}finally{i.value=!1}}const i=e.ref(!1);function q(){m.ElMessageBox.confirm("是否放弃本次签字?","警告",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{n.value.clearRect(0,0,l.value.width,l.value.height),s.value=[],i.value=!1}).catch(()=>!1)}function k(){p.value||a.componentSchema.componentProps.readonly||a.componentSchema.componentProps.disabled||(i.value=!0,n.value&&(n.value.clearRect(0,0,l.value.width,l.value.height),s.value=[]),e.nextTick(()=>{M()}))}return e.onMounted(()=>{}),e.onUnmounted(()=>{}),_({surewrite:b}),(o,t)=>(e.openBlock(),e.createElementBlock("div",Y,[f.value?(e.openBlock(),e.createElementBlock("img",{key:1,class:"sign-board",src:f.value,alt:"",onClick:k},null,8,I)):(e.openBlock(),e.createElementBlock("div",{key:0,class:"sign-board",onClick:k},"签字板")),e.createVNode(e.unref(B),{modelValue:i.value,"onUpdate:modelValue":t[0]||(t[0]=u=>i.value=u),title:"签字板",class:"w-860px",width:"860px",style:{height:"600px"},"before-close":q,draggable:!1,modal:""},{default:e.withCtx(()=>[e.createElementVNode("div",z,[e.createElementVNode("div",{class:"canvas",ref_key:"canvasWrap",ref:c},[e.createElementVNode("canvas",{id:`canvas${a.componentSchema.field}`,onMousedown:j,onMousemove:A,onMouseup:R},null,40,H)],512),e.createElementVNode("div",O,[t[3]||(t[3]=e.createElementVNode("div",{class:"remark"},null,-1)),e.createElementVNode("div",F,[e.createVNode(e.unref(w),{type:"info",size:"mini",onClick:S,onTouch:S},{default:e.withCtx(()=>t[1]||(t[1]=[e.createTextVNode("重写")])),_:1}),e.createVNode(e.unref(w),{type:"primary",size:"mini",onClick:b,onTouch:b},{default:e.withCtx(()=>t[2]||(t[2]=[e.createTextVNode("确定")])),_:1})])])])]),_:1},8,["modelValue"])]))}},L=X._export_sfc($,[["__scopeId","data-v-017ab137"]]);exports.default=L;
|