z-certificate-editor 1.0.3 → 1.0.4
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/style.css +1047 -0
- package/dist/z-certificate-editor.es.js +2128 -0
- package/dist/z-certificate-editor.es.js.map +1 -0
- package/dist/z-certificate-editor.umd.js +2131 -0
- package/dist/z-certificate-editor.umd.js.map +1 -0
- package/package.json +9 -3
- package/dist/assets/index-CujE4kZ0.js +0 -17
- package/dist/assets/index-j3Ih4QMK.css +0 -1
- package/dist/index.html +0 -13
|
@@ -0,0 +1,2131 @@
|
|
|
1
|
+
(function(global, factory) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue")) : typeof define === "function" && define.amd ? define(["exports", "vue"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.ZCertificateEditor = {}, global.Vue));
|
|
3
|
+
})(this, function(exports2, vue) {
|
|
4
|
+
"use strict";
|
|
5
|
+
const PRESET_TEMPLATES = [
|
|
6
|
+
{
|
|
7
|
+
id: "vertical-1",
|
|
8
|
+
name: "竖版模板1",
|
|
9
|
+
type: "vertical",
|
|
10
|
+
width: 972,
|
|
11
|
+
height: 1378,
|
|
12
|
+
background: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
|
|
13
|
+
description: "经典竖版证书模板"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: "vertical-2",
|
|
17
|
+
name: "竖版模板2",
|
|
18
|
+
type: "vertical",
|
|
19
|
+
width: 972,
|
|
20
|
+
height: 1378,
|
|
21
|
+
background: "linear-gradient(135deg, #f093fb 0%, #f5576c 100%)",
|
|
22
|
+
description: "优雅竖版证书模板"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "vertical-3",
|
|
26
|
+
name: "竖版模板3",
|
|
27
|
+
type: "vertical",
|
|
28
|
+
width: 972,
|
|
29
|
+
height: 1378,
|
|
30
|
+
background: "linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)",
|
|
31
|
+
description: "现代竖版证书模板"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "horizontal-1",
|
|
35
|
+
name: "横版模板1",
|
|
36
|
+
type: "horizontal",
|
|
37
|
+
width: 1303,
|
|
38
|
+
height: 897,
|
|
39
|
+
background: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
|
|
40
|
+
description: "经典横版证书模板"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "horizontal-2",
|
|
44
|
+
name: "横版模板2",
|
|
45
|
+
type: "horizontal",
|
|
46
|
+
width: 1303,
|
|
47
|
+
height: 897,
|
|
48
|
+
background: "linear-gradient(135deg, #f093fb 0%, #f5576c 100%)",
|
|
49
|
+
description: "优雅横版证书模板"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "horizontal-3",
|
|
53
|
+
name: "横版模板3",
|
|
54
|
+
type: "horizontal",
|
|
55
|
+
width: 1303,
|
|
56
|
+
height: 897,
|
|
57
|
+
background: "linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)",
|
|
58
|
+
description: "现代横版证书模板"
|
|
59
|
+
}
|
|
60
|
+
];
|
|
61
|
+
const validateImageFile = (file) => {
|
|
62
|
+
const allowedTypes = ["image/jpeg", "image/jpg", "image/png"];
|
|
63
|
+
const maxSize = 2 * 1024 * 1024;
|
|
64
|
+
if (!allowedTypes.includes(file.type)) {
|
|
65
|
+
return { valid: false, error: "只支持 JPG、JPEG、PNG 格式的图片" };
|
|
66
|
+
}
|
|
67
|
+
if (file.size > maxSize) {
|
|
68
|
+
return { valid: false, error: "图片大小不能超过 2MB" };
|
|
69
|
+
}
|
|
70
|
+
return { valid: true };
|
|
71
|
+
};
|
|
72
|
+
const fileToBase64 = (file) => {
|
|
73
|
+
return new Promise((resolve, reject) => {
|
|
74
|
+
const reader = new FileReader();
|
|
75
|
+
reader.onload = () => resolve(reader.result);
|
|
76
|
+
reader.onerror = reject;
|
|
77
|
+
reader.readAsDataURL(file);
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
const getTemplateSizeSuggestion = (type) => {
|
|
81
|
+
if (type === "vertical") {
|
|
82
|
+
return { width: 972, height: 1378 };
|
|
83
|
+
} else {
|
|
84
|
+
return { width: 1303, height: 897 };
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const _export_sfc = (sfc, props) => {
|
|
88
|
+
const target = sfc.__vccOpts || sfc;
|
|
89
|
+
for (const [key, val] of props) {
|
|
90
|
+
target[key] = val;
|
|
91
|
+
}
|
|
92
|
+
return target;
|
|
93
|
+
};
|
|
94
|
+
const _hoisted_1$6 = { class: "design-panel" };
|
|
95
|
+
const _hoisted_2$6 = { class: "panel-tabs" };
|
|
96
|
+
const _hoisted_3$6 = { class: "panel-content" };
|
|
97
|
+
const _hoisted_4$6 = {
|
|
98
|
+
key: 0,
|
|
99
|
+
class: "elements-section"
|
|
100
|
+
};
|
|
101
|
+
const _hoisted_5$5 = { class: "elements-grid" };
|
|
102
|
+
const _hoisted_6$5 = {
|
|
103
|
+
key: 1,
|
|
104
|
+
class: "templates-section"
|
|
105
|
+
};
|
|
106
|
+
const _hoisted_7$5 = { class: "upload-section" };
|
|
107
|
+
const _hoisted_8$4 = { class: "upload-hint" };
|
|
108
|
+
const _hoisted_9$4 = { class: "template-type-switch" };
|
|
109
|
+
const _hoisted_10$4 = { class: "templates-list" };
|
|
110
|
+
const _hoisted_11$3 = ["onClick"];
|
|
111
|
+
const _hoisted_12$3 = { class: "template-name" };
|
|
112
|
+
const _sfc_main$6 = {
|
|
113
|
+
__name: "DesignPanel",
|
|
114
|
+
emits: ["add-element", "select-template", "upload-template"],
|
|
115
|
+
setup(__props, { emit: __emit }) {
|
|
116
|
+
const emit = __emit;
|
|
117
|
+
const activeTab = vue.ref("elements");
|
|
118
|
+
const templateType = vue.ref("vertical");
|
|
119
|
+
const fileInputRef = vue.ref(null);
|
|
120
|
+
const filteredTemplates = vue.computed(() => {
|
|
121
|
+
return PRESET_TEMPLATES.filter((t) => t.type === templateType.value);
|
|
122
|
+
});
|
|
123
|
+
const handleSelectTemplate = (template) => {
|
|
124
|
+
emit("select-template", template);
|
|
125
|
+
};
|
|
126
|
+
const triggerUpload = () => {
|
|
127
|
+
var _a;
|
|
128
|
+
(_a = fileInputRef.value) == null ? void 0 : _a.click();
|
|
129
|
+
};
|
|
130
|
+
const handleFileUpload = async (event) => {
|
|
131
|
+
var _a;
|
|
132
|
+
const file = (_a = event.target.files) == null ? void 0 : _a[0];
|
|
133
|
+
if (!file) return;
|
|
134
|
+
const validation = validateImageFile(file);
|
|
135
|
+
if (!validation.valid) {
|
|
136
|
+
alert(validation.error);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
const base64 = await fileToBase64(file);
|
|
141
|
+
const suggestion = getTemplateSizeSuggestion(templateType.value);
|
|
142
|
+
const customTemplate = {
|
|
143
|
+
id: `custom-${Date.now()}`,
|
|
144
|
+
name: "自定义模板",
|
|
145
|
+
type: templateType.value,
|
|
146
|
+
width: suggestion.width,
|
|
147
|
+
height: suggestion.height,
|
|
148
|
+
background: base64,
|
|
149
|
+
description: "自定义上传的模板"
|
|
150
|
+
};
|
|
151
|
+
emit("upload-template", customTemplate);
|
|
152
|
+
} catch (error) {
|
|
153
|
+
alert("上传失败,请重试");
|
|
154
|
+
console.error(error);
|
|
155
|
+
}
|
|
156
|
+
if (fileInputRef.value) {
|
|
157
|
+
fileInputRef.value.value = "";
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
return (_ctx, _cache) => {
|
|
161
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$6, [
|
|
162
|
+
vue.createElementVNode("div", _hoisted_2$6, [
|
|
163
|
+
vue.createElementVNode("div", {
|
|
164
|
+
class: vue.normalizeClass(["tab-item", { active: activeTab.value === "elements" }]),
|
|
165
|
+
onClick: _cache[0] || (_cache[0] = ($event) => activeTab.value = "elements")
|
|
166
|
+
}, " 设计元素 ", 2),
|
|
167
|
+
vue.createElementVNode("div", {
|
|
168
|
+
class: vue.normalizeClass(["tab-item", { active: activeTab.value === "templates" }]),
|
|
169
|
+
onClick: _cache[1] || (_cache[1] = ($event) => activeTab.value = "templates")
|
|
170
|
+
}, " 底图模板 ", 2)
|
|
171
|
+
]),
|
|
172
|
+
vue.createElementVNode("div", _hoisted_3$6, [
|
|
173
|
+
activeTab.value === "elements" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$6, [
|
|
174
|
+
vue.createElementVNode("div", _hoisted_5$5, [
|
|
175
|
+
vue.createElementVNode("div", {
|
|
176
|
+
class: "element-item",
|
|
177
|
+
onClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("add-element", "text"))
|
|
178
|
+
}, [..._cache[8] || (_cache[8] = [
|
|
179
|
+
vue.createElementVNode("div", { class: "element-icon" }, "📝", -1),
|
|
180
|
+
vue.createElementVNode("div", { class: "element-label" }, "短文本", -1)
|
|
181
|
+
])]),
|
|
182
|
+
vue.createElementVNode("div", {
|
|
183
|
+
class: "element-item",
|
|
184
|
+
onClick: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("add-element", "longtext"))
|
|
185
|
+
}, [..._cache[9] || (_cache[9] = [
|
|
186
|
+
vue.createElementVNode("div", { class: "element-icon" }, "📄", -1),
|
|
187
|
+
vue.createElementVNode("div", { class: "element-label" }, "长文本", -1)
|
|
188
|
+
])]),
|
|
189
|
+
vue.createElementVNode("div", {
|
|
190
|
+
class: "element-item",
|
|
191
|
+
onClick: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("add-element", "image"))
|
|
192
|
+
}, [..._cache[10] || (_cache[10] = [
|
|
193
|
+
vue.createElementVNode("div", { class: "element-icon" }, "🖼️", -1),
|
|
194
|
+
vue.createElementVNode("div", { class: "element-label" }, "图片", -1)
|
|
195
|
+
])]),
|
|
196
|
+
vue.createElementVNode("div", {
|
|
197
|
+
class: "element-item",
|
|
198
|
+
onClick: _cache[5] || (_cache[5] = ($event) => _ctx.$emit("add-element", "qrcode"))
|
|
199
|
+
}, [..._cache[11] || (_cache[11] = [
|
|
200
|
+
vue.createElementVNode("div", { class: "element-icon" }, "🔲", -1),
|
|
201
|
+
vue.createElementVNode("div", { class: "element-label" }, "二维码", -1)
|
|
202
|
+
])])
|
|
203
|
+
])
|
|
204
|
+
])) : vue.createCommentVNode("", true),
|
|
205
|
+
activeTab.value === "templates" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$5, [
|
|
206
|
+
vue.createElementVNode("div", _hoisted_7$5, [
|
|
207
|
+
vue.createElementVNode("input", {
|
|
208
|
+
ref_key: "fileInputRef",
|
|
209
|
+
ref: fileInputRef,
|
|
210
|
+
type: "file",
|
|
211
|
+
accept: "image/jpeg,image/jpg,image/png",
|
|
212
|
+
onChange: handleFileUpload,
|
|
213
|
+
style: { "display": "none" }
|
|
214
|
+
}, null, 544),
|
|
215
|
+
vue.createElementVNode("button", {
|
|
216
|
+
class: "upload-btn",
|
|
217
|
+
onClick: triggerUpload
|
|
218
|
+
}, [..._cache[12] || (_cache[12] = [
|
|
219
|
+
vue.createElementVNode("span", null, "📁", -1),
|
|
220
|
+
vue.createElementVNode("span", null, "上传模板", -1)
|
|
221
|
+
])]),
|
|
222
|
+
vue.createElementVNode("div", _hoisted_8$4, [
|
|
223
|
+
_cache[13] || (_cache[13] = vue.createTextVNode(" 支持:jpg、jpeg、png 小于2M", -1)),
|
|
224
|
+
_cache[14] || (_cache[14] = vue.createElementVNode("br", null, null, -1)),
|
|
225
|
+
vue.createTextVNode(" 建议尺寸:" + vue.toDisplayString(templateType.value === "vertical" ? "972 x 1378" : "1303 x 897"), 1)
|
|
226
|
+
])
|
|
227
|
+
]),
|
|
228
|
+
vue.createElementVNode("div", _hoisted_9$4, [
|
|
229
|
+
vue.createElementVNode("button", {
|
|
230
|
+
class: vue.normalizeClass(["switch-btn", { active: templateType.value === "vertical" }]),
|
|
231
|
+
onClick: _cache[6] || (_cache[6] = ($event) => templateType.value = "vertical")
|
|
232
|
+
}, " 竖版 ", 2),
|
|
233
|
+
vue.createElementVNode("button", {
|
|
234
|
+
class: vue.normalizeClass(["switch-btn", { active: templateType.value === "horizontal" }]),
|
|
235
|
+
onClick: _cache[7] || (_cache[7] = ($event) => templateType.value = "horizontal")
|
|
236
|
+
}, " 横版 ", 2)
|
|
237
|
+
]),
|
|
238
|
+
vue.createElementVNode("div", _hoisted_10$4, [
|
|
239
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(filteredTemplates.value, (template) => {
|
|
240
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
241
|
+
key: template.id,
|
|
242
|
+
class: "template-item",
|
|
243
|
+
onClick: ($event) => handleSelectTemplate(template)
|
|
244
|
+
}, [
|
|
245
|
+
vue.createElementVNode("div", {
|
|
246
|
+
class: "template-preview",
|
|
247
|
+
style: vue.normalizeStyle({ background: template.background })
|
|
248
|
+
}, null, 4),
|
|
249
|
+
vue.createElementVNode("div", _hoisted_12$3, vue.toDisplayString(template.name), 1)
|
|
250
|
+
], 8, _hoisted_11$3);
|
|
251
|
+
}), 128))
|
|
252
|
+
])
|
|
253
|
+
])) : vue.createCommentVNode("", true)
|
|
254
|
+
])
|
|
255
|
+
]);
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
const DesignPanel = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-b694f9ff"]]);
|
|
260
|
+
const SYSTEM_FIELDS = [
|
|
261
|
+
{
|
|
262
|
+
key: "name",
|
|
263
|
+
label: "姓名",
|
|
264
|
+
placeholder: "{{姓名}}",
|
|
265
|
+
category: "基本信息",
|
|
266
|
+
description: "证书持有人的姓名"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
key: "gender",
|
|
270
|
+
label: "性别称呼",
|
|
271
|
+
placeholder: "{{性别称呼}}",
|
|
272
|
+
category: "基本信息",
|
|
273
|
+
description: "先生/女士"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
key: "examName",
|
|
277
|
+
label: "考试名称",
|
|
278
|
+
placeholder: "{{考试名称}}",
|
|
279
|
+
category: "考试信息",
|
|
280
|
+
description: "参加的考试名称"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
key: "score",
|
|
284
|
+
label: "成绩",
|
|
285
|
+
placeholder: "{{成绩}}",
|
|
286
|
+
category: "考试信息",
|
|
287
|
+
description: "考试成绩"
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
key: "scoreLevel",
|
|
291
|
+
label: "成绩等级",
|
|
292
|
+
placeholder: "{{成绩等级}}",
|
|
293
|
+
category: "考试信息",
|
|
294
|
+
description: "成绩等级(如:优秀、良好、合格等)"
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
key: "certificateNumber",
|
|
298
|
+
label: "证书编号",
|
|
299
|
+
placeholder: "{{证书编号}}",
|
|
300
|
+
category: "证书信息",
|
|
301
|
+
description: "证书的唯一编号"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
key: "validityPeriod",
|
|
305
|
+
label: "有效期",
|
|
306
|
+
placeholder: "{{有效期}}",
|
|
307
|
+
category: "证书信息",
|
|
308
|
+
description: "证书的有效期限"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
key: "issueDate",
|
|
312
|
+
label: "颁发日期",
|
|
313
|
+
placeholder: "{{颁发日期}}",
|
|
314
|
+
category: "证书信息",
|
|
315
|
+
description: "证书颁发的日期"
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
key: "organization",
|
|
319
|
+
label: "颁发机构",
|
|
320
|
+
placeholder: "{{颁发机构}}",
|
|
321
|
+
category: "证书信息",
|
|
322
|
+
description: "颁发证书的机构名称"
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
key: "idNumber",
|
|
326
|
+
label: "身份证号",
|
|
327
|
+
placeholder: "{{身份证号}}",
|
|
328
|
+
category: "基本信息",
|
|
329
|
+
description: "身份证号码"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
key: "phone",
|
|
333
|
+
label: "联系电话",
|
|
334
|
+
placeholder: "{{联系电话}}",
|
|
335
|
+
category: "基本信息",
|
|
336
|
+
description: "联系电话"
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
key: "email",
|
|
340
|
+
label: "电子邮箱",
|
|
341
|
+
placeholder: "{{电子邮箱}}",
|
|
342
|
+
category: "基本信息",
|
|
343
|
+
description: "电子邮箱地址"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
key: "account",
|
|
347
|
+
label: "账号",
|
|
348
|
+
placeholder: "{{账号}}",
|
|
349
|
+
category: "基本信息",
|
|
350
|
+
description: "用户账号"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
key: "examScore",
|
|
354
|
+
label: "考试得分",
|
|
355
|
+
placeholder: "{{考试得分}}",
|
|
356
|
+
category: "考试信息",
|
|
357
|
+
description: "考试得分"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
key: "issueDateMonth",
|
|
361
|
+
label: "颁证时间(月)",
|
|
362
|
+
placeholder: "{{颁证时间(月)}}",
|
|
363
|
+
category: "证书信息",
|
|
364
|
+
description: "证书颁发的月份"
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
key: "issueDateDay",
|
|
368
|
+
label: "颁证时间(日)",
|
|
369
|
+
placeholder: "{{颁证时间(日)}}",
|
|
370
|
+
category: "证书信息",
|
|
371
|
+
description: "证书颁发的日期"
|
|
372
|
+
}
|
|
373
|
+
];
|
|
374
|
+
const FIELDS_BY_CATEGORY = SYSTEM_FIELDS.reduce((acc, field) => {
|
|
375
|
+
if (!acc[field.category]) {
|
|
376
|
+
acc[field.category] = [];
|
|
377
|
+
}
|
|
378
|
+
acc[field.category].push(field);
|
|
379
|
+
return acc;
|
|
380
|
+
}, {});
|
|
381
|
+
const getFieldByKey = (key) => {
|
|
382
|
+
return SYSTEM_FIELDS.find((field) => field.key === key);
|
|
383
|
+
};
|
|
384
|
+
const getPlaceholderByKey = (key) => {
|
|
385
|
+
const field = getFieldByKey(key);
|
|
386
|
+
return field ? field.placeholder : `{{${key}}}`;
|
|
387
|
+
};
|
|
388
|
+
const replaceFields = (text, fieldData = {}) => {
|
|
389
|
+
if (!text) return "";
|
|
390
|
+
let result = text;
|
|
391
|
+
SYSTEM_FIELDS.forEach((field) => {
|
|
392
|
+
const placeholder = field.placeholder;
|
|
393
|
+
const value = fieldData[field.key] || field.placeholder;
|
|
394
|
+
const regex = new RegExp(placeholder.replace(/[{}]/g, "\\$&"), "g");
|
|
395
|
+
result = result.replace(regex, value);
|
|
396
|
+
});
|
|
397
|
+
return result;
|
|
398
|
+
};
|
|
399
|
+
const extractFields = (text) => {
|
|
400
|
+
if (!text) return [];
|
|
401
|
+
const fields = [];
|
|
402
|
+
SYSTEM_FIELDS.forEach((field) => {
|
|
403
|
+
if (text.includes(field.placeholder)) {
|
|
404
|
+
fields.push(field);
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
return fields;
|
|
408
|
+
};
|
|
409
|
+
const hasFields = (text) => {
|
|
410
|
+
if (!text) return false;
|
|
411
|
+
return SYSTEM_FIELDS.some((field) => text.includes(field.placeholder));
|
|
412
|
+
};
|
|
413
|
+
const DEFAULT_FIELD_DATA = {
|
|
414
|
+
name: "张三",
|
|
415
|
+
gender: "先生",
|
|
416
|
+
examName: "计算机应用能力考试",
|
|
417
|
+
score: "95",
|
|
418
|
+
scoreLevel: "优秀",
|
|
419
|
+
certificateNumber: "CERT-2024-001234",
|
|
420
|
+
validityPeriod: "2024-01-01 至 2027-01-01",
|
|
421
|
+
issueDate: "2024-01-01",
|
|
422
|
+
organization: "考试认证中心",
|
|
423
|
+
idNumber: "110101199001011234",
|
|
424
|
+
phone: "13800138000",
|
|
425
|
+
email: "zhangsan@example.com",
|
|
426
|
+
account: "user001",
|
|
427
|
+
examScore: "95",
|
|
428
|
+
issueDateMonth: "01",
|
|
429
|
+
issueDateDay: "01"
|
|
430
|
+
};
|
|
431
|
+
const _hoisted_1$5 = { class: "canvas-area" };
|
|
432
|
+
const _hoisted_2$5 = {
|
|
433
|
+
key: 0,
|
|
434
|
+
class: "certificate-border"
|
|
435
|
+
};
|
|
436
|
+
const _hoisted_3$5 = ["onClick", "onMousedown"];
|
|
437
|
+
const _hoisted_4$5 = {
|
|
438
|
+
key: 0,
|
|
439
|
+
class: "text-content"
|
|
440
|
+
};
|
|
441
|
+
const _hoisted_5$4 = ["innerHTML"];
|
|
442
|
+
const _hoisted_6$4 = {
|
|
443
|
+
key: 1,
|
|
444
|
+
class: "image-element"
|
|
445
|
+
};
|
|
446
|
+
const _hoisted_7$4 = ["src"];
|
|
447
|
+
const _hoisted_8$3 = {
|
|
448
|
+
key: 1,
|
|
449
|
+
class: "image-placeholder"
|
|
450
|
+
};
|
|
451
|
+
const _hoisted_9$3 = {
|
|
452
|
+
key: 2,
|
|
453
|
+
class: "qrcode-element"
|
|
454
|
+
};
|
|
455
|
+
const _hoisted_10$3 = ["src"];
|
|
456
|
+
const _hoisted_11$2 = {
|
|
457
|
+
key: 1,
|
|
458
|
+
class: "qrcode-content"
|
|
459
|
+
};
|
|
460
|
+
const _hoisted_12$2 = { class: "qrcode-info" };
|
|
461
|
+
const _hoisted_13$1 = {
|
|
462
|
+
key: 2,
|
|
463
|
+
class: "qrcode-placeholder"
|
|
464
|
+
};
|
|
465
|
+
const _hoisted_14$1 = {
|
|
466
|
+
key: 3,
|
|
467
|
+
class: "resize-handles"
|
|
468
|
+
};
|
|
469
|
+
const _hoisted_15$1 = ["onMousedown"];
|
|
470
|
+
const _hoisted_16$1 = ["onMousedown"];
|
|
471
|
+
const _hoisted_17$1 = ["onMousedown"];
|
|
472
|
+
const _hoisted_18$1 = ["onMousedown"];
|
|
473
|
+
const _hoisted_19$1 = ["onClick"];
|
|
474
|
+
const _sfc_main$5 = {
|
|
475
|
+
__name: "CanvasArea",
|
|
476
|
+
props: {
|
|
477
|
+
elements: {
|
|
478
|
+
type: Array,
|
|
479
|
+
default: () => []
|
|
480
|
+
},
|
|
481
|
+
selectedElement: {
|
|
482
|
+
type: Object,
|
|
483
|
+
default: null
|
|
484
|
+
},
|
|
485
|
+
fieldData: {
|
|
486
|
+
type: Object,
|
|
487
|
+
default: () => ({})
|
|
488
|
+
},
|
|
489
|
+
template: {
|
|
490
|
+
type: Object,
|
|
491
|
+
default: null
|
|
492
|
+
},
|
|
493
|
+
systemFields: {
|
|
494
|
+
type: Array,
|
|
495
|
+
default: () => SYSTEM_FIELDS
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
emits: ["select-element", "update-element", "delete-element"],
|
|
499
|
+
setup(__props, { emit: __emit }) {
|
|
500
|
+
const props = __props;
|
|
501
|
+
const emit = __emit;
|
|
502
|
+
const renderTextWithFields = (text) => {
|
|
503
|
+
if (!text) return "";
|
|
504
|
+
const fieldData = props.fieldData || {};
|
|
505
|
+
let result = text;
|
|
506
|
+
props.systemFields.forEach((field) => {
|
|
507
|
+
const placeholder = field.placeholder;
|
|
508
|
+
const value = fieldData[field.key] || placeholder;
|
|
509
|
+
if (fieldData[field.key]) {
|
|
510
|
+
const regex = new RegExp(placeholder.replace(/[{}]/g, "\\$&"), "g");
|
|
511
|
+
result = result.replace(regex, `<span class="field-value">${value}</span>`);
|
|
512
|
+
} else {
|
|
513
|
+
const regex = new RegExp(placeholder.replace(/[{}]/g, "\\$&"), "g");
|
|
514
|
+
result = result.replace(regex, `<span class="field-placeholder-highlight">${placeholder}</span>`);
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
return result;
|
|
518
|
+
};
|
|
519
|
+
const getImageSrc = (element) => {
|
|
520
|
+
if (!element) return null;
|
|
521
|
+
if (element.imageSource === "field") {
|
|
522
|
+
const fieldKey = element.imageField;
|
|
523
|
+
if (fieldKey && props.fieldData && props.fieldData[fieldKey]) {
|
|
524
|
+
return props.fieldData[fieldKey];
|
|
525
|
+
}
|
|
526
|
+
return null;
|
|
527
|
+
} else {
|
|
528
|
+
return element.imageUrl || null;
|
|
529
|
+
}
|
|
530
|
+
};
|
|
531
|
+
const getQrcodeContent = (element) => {
|
|
532
|
+
if (!element) return null;
|
|
533
|
+
if (element.qrcodeSource === "field") {
|
|
534
|
+
const fieldKey = element.qrcodeField;
|
|
535
|
+
if (fieldKey && props.fieldData && props.fieldData[fieldKey]) {
|
|
536
|
+
return props.fieldData[fieldKey];
|
|
537
|
+
}
|
|
538
|
+
return null;
|
|
539
|
+
} else {
|
|
540
|
+
return element.qrcodeContent || null;
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
const isImageUrl = (url) => {
|
|
544
|
+
if (!url) return false;
|
|
545
|
+
if (url.startsWith("data:image/")) return true;
|
|
546
|
+
if (url.startsWith("http://") || url.startsWith("https://")) {
|
|
547
|
+
const imageExtensions = [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".bmp"];
|
|
548
|
+
const lowerUrl = url.toLowerCase();
|
|
549
|
+
return imageExtensions.some((ext) => lowerUrl.includes(ext));
|
|
550
|
+
}
|
|
551
|
+
return false;
|
|
552
|
+
};
|
|
553
|
+
const getCanvasStyle = () => {
|
|
554
|
+
const baseStyle = {};
|
|
555
|
+
if (props.template) {
|
|
556
|
+
baseStyle.width = `${props.template.width}px`;
|
|
557
|
+
baseStyle.minHeight = `${props.template.height}px`;
|
|
558
|
+
} else {
|
|
559
|
+
baseStyle.width = "800px";
|
|
560
|
+
baseStyle.minHeight = "1000px";
|
|
561
|
+
}
|
|
562
|
+
if (props.template && props.template.background) {
|
|
563
|
+
if (props.template.background.startsWith("data:") || props.template.background.startsWith("http")) {
|
|
564
|
+
baseStyle.backgroundImage = `url(${props.template.background})`;
|
|
565
|
+
baseStyle.backgroundSize = "100% 100%";
|
|
566
|
+
baseStyle.backgroundPosition = "center";
|
|
567
|
+
baseStyle.backgroundRepeat = "no-repeat";
|
|
568
|
+
} else {
|
|
569
|
+
baseStyle.background = props.template.background;
|
|
570
|
+
baseStyle.backgroundSize = "100% 100%";
|
|
571
|
+
baseStyle.backgroundPosition = "center";
|
|
572
|
+
baseStyle.backgroundRepeat = "no-repeat";
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
return baseStyle;
|
|
576
|
+
};
|
|
577
|
+
const canvasRef = vue.ref(null);
|
|
578
|
+
const isDragging = vue.ref(false);
|
|
579
|
+
const isResizing = vue.ref(false);
|
|
580
|
+
const dragStart = vue.ref({ x: 0, y: 0 });
|
|
581
|
+
const resizeStart = vue.ref({ x: 0, y: 0, width: 0, height: 0 });
|
|
582
|
+
const currentElement = vue.ref(null);
|
|
583
|
+
const resizeDirection = vue.ref("");
|
|
584
|
+
const getElementStyle = (element) => {
|
|
585
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
586
|
+
const baseStyle = {
|
|
587
|
+
position: "absolute",
|
|
588
|
+
left: `${element.x}px`,
|
|
589
|
+
top: `${element.y}px`,
|
|
590
|
+
width: `${element.width}px`,
|
|
591
|
+
minHeight: `${element.height}px`
|
|
592
|
+
};
|
|
593
|
+
if (element.type === "text" || element.type === "longtext") {
|
|
594
|
+
return {
|
|
595
|
+
...baseStyle,
|
|
596
|
+
fontSize: `${((_a = element.style) == null ? void 0 : _a.fontSize) || 18}px`,
|
|
597
|
+
fontFamily: ((_b = element.style) == null ? void 0 : _b.fontFamily) || "方正书宋简体",
|
|
598
|
+
fontWeight: ((_c = element.style) == null ? void 0 : _c.fontWeight) || "normal",
|
|
599
|
+
fontStyle: ((_d = element.style) == null ? void 0 : _d.fontStyle) || "normal",
|
|
600
|
+
textDecoration: ((_e = element.style) == null ? void 0 : _e.textDecoration) || "none",
|
|
601
|
+
color: ((_f = element.style) == null ? void 0 : _f.color) || "#000000",
|
|
602
|
+
textAlign: ((_g = element.style) == null ? void 0 : _g.textAlign) || "left",
|
|
603
|
+
lineHeight: ((_h = element.style) == null ? void 0 : _h.lineHeight) || 1.2
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
return baseStyle;
|
|
607
|
+
};
|
|
608
|
+
const handleMouseDown = (e, element) => {
|
|
609
|
+
if (e.target.closest(".handle") || e.target.closest(".delete-btn")) {
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
isDragging.value = true;
|
|
613
|
+
currentElement.value = element;
|
|
614
|
+
dragStart.value = {
|
|
615
|
+
x: e.clientX - element.x,
|
|
616
|
+
y: e.clientY - element.y
|
|
617
|
+
};
|
|
618
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
619
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
620
|
+
};
|
|
621
|
+
const handleMouseMove = (e) => {
|
|
622
|
+
if (isDragging.value && currentElement.value) {
|
|
623
|
+
const newX = e.clientX - dragStart.value.x;
|
|
624
|
+
const newY = e.clientY - dragStart.value.y;
|
|
625
|
+
const updatedElement = {
|
|
626
|
+
...currentElement.value,
|
|
627
|
+
x: Math.max(0, newX),
|
|
628
|
+
y: Math.max(0, newY)
|
|
629
|
+
};
|
|
630
|
+
emit("update-element", updatedElement);
|
|
631
|
+
} else if (isResizing.value && currentElement.value) {
|
|
632
|
+
const deltaX = e.clientX - resizeStart.value.x;
|
|
633
|
+
const deltaY = e.clientY - resizeStart.value.y;
|
|
634
|
+
let newWidth = resizeStart.value.width;
|
|
635
|
+
let newHeight = resizeStart.value.height;
|
|
636
|
+
let newX = currentElement.value.x;
|
|
637
|
+
let newY = currentElement.value.y;
|
|
638
|
+
if (resizeDirection.value.includes("e")) {
|
|
639
|
+
newWidth = Math.max(50, resizeStart.value.width + deltaX);
|
|
640
|
+
}
|
|
641
|
+
if (resizeDirection.value.includes("w")) {
|
|
642
|
+
newWidth = Math.max(50, resizeStart.value.width - deltaX);
|
|
643
|
+
newX = currentElement.value.x + (resizeStart.value.width - newWidth);
|
|
644
|
+
}
|
|
645
|
+
if (resizeDirection.value.includes("s")) {
|
|
646
|
+
newHeight = Math.max(30, resizeStart.value.height + deltaY);
|
|
647
|
+
}
|
|
648
|
+
if (resizeDirection.value.includes("n")) {
|
|
649
|
+
newHeight = Math.max(30, resizeStart.value.height - deltaY);
|
|
650
|
+
newY = currentElement.value.y + (resizeStart.value.height - newHeight);
|
|
651
|
+
}
|
|
652
|
+
const updatedElement = {
|
|
653
|
+
...currentElement.value,
|
|
654
|
+
x: newX,
|
|
655
|
+
y: newY,
|
|
656
|
+
width: newWidth,
|
|
657
|
+
height: newHeight
|
|
658
|
+
};
|
|
659
|
+
emit("update-element", updatedElement);
|
|
660
|
+
}
|
|
661
|
+
};
|
|
662
|
+
const handleMouseUp = () => {
|
|
663
|
+
isDragging.value = false;
|
|
664
|
+
isResizing.value = false;
|
|
665
|
+
currentElement.value = null;
|
|
666
|
+
resizeDirection.value = "";
|
|
667
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
668
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
669
|
+
};
|
|
670
|
+
const handleResizeStart = (e, element, direction) => {
|
|
671
|
+
e.stopPropagation();
|
|
672
|
+
isResizing.value = true;
|
|
673
|
+
currentElement.value = element;
|
|
674
|
+
resizeDirection.value = direction;
|
|
675
|
+
resizeStart.value = {
|
|
676
|
+
x: e.clientX,
|
|
677
|
+
y: e.clientY,
|
|
678
|
+
width: element.width,
|
|
679
|
+
height: element.height
|
|
680
|
+
};
|
|
681
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
682
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
683
|
+
};
|
|
684
|
+
vue.onUnmounted(() => {
|
|
685
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
686
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
687
|
+
});
|
|
688
|
+
return (_ctx, _cache) => {
|
|
689
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
|
|
690
|
+
vue.createElementVNode("div", {
|
|
691
|
+
class: "certificate-canvas",
|
|
692
|
+
ref_key: "canvasRef",
|
|
693
|
+
ref: canvasRef,
|
|
694
|
+
style: vue.normalizeStyle(getCanvasStyle())
|
|
695
|
+
}, [
|
|
696
|
+
!props.template || !props.template.background ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$5)) : vue.createCommentVNode("", true),
|
|
697
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.elements, (element) => {
|
|
698
|
+
var _a, _b, _c;
|
|
699
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
700
|
+
key: element.id,
|
|
701
|
+
class: vue.normalizeClass(["editable-element", element.type, { selected: ((_a = __props.selectedElement) == null ? void 0 : _a.id) === element.id }]),
|
|
702
|
+
style: vue.normalizeStyle(getElementStyle(element)),
|
|
703
|
+
onClick: vue.withModifiers(($event) => _ctx.$emit("select-element", element), ["stop"]),
|
|
704
|
+
onMousedown: ($event) => handleMouseDown($event, element)
|
|
705
|
+
}, [
|
|
706
|
+
element.type === "text" || element.type === "longtext" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$5, [
|
|
707
|
+
vue.createElementVNode("span", {
|
|
708
|
+
innerHTML: renderTextWithFields(element.content)
|
|
709
|
+
}, null, 8, _hoisted_5$4)
|
|
710
|
+
])) : element.type === "image" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$4, [
|
|
711
|
+
getImageSrc(element) ? (vue.openBlock(), vue.createElementBlock("img", {
|
|
712
|
+
key: 0,
|
|
713
|
+
src: getImageSrc(element),
|
|
714
|
+
alt: "图片",
|
|
715
|
+
class: "element-image"
|
|
716
|
+
}, null, 8, _hoisted_7$4)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$3, [..._cache[0] || (_cache[0] = [
|
|
717
|
+
vue.createElementVNode("span", null, "🖼️ 请设置图片", -1)
|
|
718
|
+
])]))
|
|
719
|
+
])) : element.type === "qrcode" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$3, [
|
|
720
|
+
getQrcodeContent(element) && isImageUrl(getQrcodeContent(element)) ? (vue.openBlock(), vue.createElementBlock("img", {
|
|
721
|
+
key: 0,
|
|
722
|
+
src: getQrcodeContent(element),
|
|
723
|
+
alt: "二维码",
|
|
724
|
+
class: "element-image"
|
|
725
|
+
}, null, 8, _hoisted_10$3)) : getQrcodeContent(element) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11$2, [
|
|
726
|
+
_cache[1] || (_cache[1] = vue.createElementVNode("div", { class: "qrcode-placeholder-text" }, "二维码", -1)),
|
|
727
|
+
vue.createElementVNode("div", _hoisted_12$2, vue.toDisplayString(getQrcodeContent(element)), 1)
|
|
728
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_13$1, [..._cache[2] || (_cache[2] = [
|
|
729
|
+
vue.createElementVNode("span", null, "🔲 请设置二维码", -1)
|
|
730
|
+
])]))
|
|
731
|
+
])) : vue.createCommentVNode("", true),
|
|
732
|
+
((_b = __props.selectedElement) == null ? void 0 : _b.id) === element.id ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14$1, [
|
|
733
|
+
vue.createElementVNode("div", {
|
|
734
|
+
class: "handle handle-nw",
|
|
735
|
+
onMousedown: vue.withModifiers(($event) => handleResizeStart($event, element, "nw"), ["stop"])
|
|
736
|
+
}, null, 40, _hoisted_15$1),
|
|
737
|
+
vue.createElementVNode("div", {
|
|
738
|
+
class: "handle handle-ne",
|
|
739
|
+
onMousedown: vue.withModifiers(($event) => handleResizeStart($event, element, "ne"), ["stop"])
|
|
740
|
+
}, null, 40, _hoisted_16$1),
|
|
741
|
+
vue.createElementVNode("div", {
|
|
742
|
+
class: "handle handle-sw",
|
|
743
|
+
onMousedown: vue.withModifiers(($event) => handleResizeStart($event, element, "sw"), ["stop"])
|
|
744
|
+
}, null, 40, _hoisted_17$1),
|
|
745
|
+
vue.createElementVNode("div", {
|
|
746
|
+
class: "handle handle-se",
|
|
747
|
+
onMousedown: vue.withModifiers(($event) => handleResizeStart($event, element, "se"), ["stop"])
|
|
748
|
+
}, null, 40, _hoisted_18$1)
|
|
749
|
+
])) : vue.createCommentVNode("", true),
|
|
750
|
+
((_c = __props.selectedElement) == null ? void 0 : _c.id) === element.id ? (vue.openBlock(), vue.createElementBlock("button", {
|
|
751
|
+
key: 4,
|
|
752
|
+
class: "delete-btn",
|
|
753
|
+
onClick: vue.withModifiers(($event) => _ctx.$emit("delete-element", element.id), ["stop"])
|
|
754
|
+
}, " × ", 8, _hoisted_19$1)) : vue.createCommentVNode("", true)
|
|
755
|
+
], 46, _hoisted_3$5);
|
|
756
|
+
}), 128))
|
|
757
|
+
], 4)
|
|
758
|
+
]);
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
const CanvasArea = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-81f2131e"]]);
|
|
763
|
+
const _hoisted_1$4 = { class: "field-dialog" };
|
|
764
|
+
const _hoisted_2$4 = { class: "dialog-content" };
|
|
765
|
+
const _hoisted_3$4 = { class: "search-box" };
|
|
766
|
+
const _hoisted_4$4 = { class: "table-container" };
|
|
767
|
+
const _hoisted_5$3 = { class: "fields-table" };
|
|
768
|
+
const _hoisted_6$3 = { class: "field-name" };
|
|
769
|
+
const _hoisted_7$3 = { class: "field-action" };
|
|
770
|
+
const _hoisted_8$2 = ["onClick"];
|
|
771
|
+
const _hoisted_9$2 = {
|
|
772
|
+
key: 0,
|
|
773
|
+
class: "pagination"
|
|
774
|
+
};
|
|
775
|
+
const _hoisted_10$2 = ["disabled"];
|
|
776
|
+
const _hoisted_11$1 = ["onClick"];
|
|
777
|
+
const _hoisted_12$1 = ["disabled"];
|
|
778
|
+
const pageSize = 10;
|
|
779
|
+
const _sfc_main$4 = {
|
|
780
|
+
__name: "FieldDialog",
|
|
781
|
+
props: {
|
|
782
|
+
visible: {
|
|
783
|
+
type: Boolean,
|
|
784
|
+
default: false
|
|
785
|
+
},
|
|
786
|
+
currentText: {
|
|
787
|
+
type: String,
|
|
788
|
+
default: ""
|
|
789
|
+
},
|
|
790
|
+
selectionStart: {
|
|
791
|
+
type: Number,
|
|
792
|
+
default: 0
|
|
793
|
+
},
|
|
794
|
+
selectionEnd: {
|
|
795
|
+
type: Number,
|
|
796
|
+
default: 0
|
|
797
|
+
},
|
|
798
|
+
systemFields: {
|
|
799
|
+
type: Array,
|
|
800
|
+
default: () => SYSTEM_FIELDS
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
emits: ["close", "insert"],
|
|
804
|
+
setup(__props, { emit: __emit }) {
|
|
805
|
+
const props = __props;
|
|
806
|
+
const emit = __emit;
|
|
807
|
+
const searchText = vue.ref("");
|
|
808
|
+
const currentPage = vue.ref(1);
|
|
809
|
+
const filteredFields = vue.computed(() => {
|
|
810
|
+
if (!searchText.value.trim()) {
|
|
811
|
+
return props.systemFields;
|
|
812
|
+
}
|
|
813
|
+
const searchLower = searchText.value.toLowerCase();
|
|
814
|
+
return props.systemFields.filter(
|
|
815
|
+
(field) => field.label.toLowerCase().includes(searchLower) || field.key.toLowerCase().includes(searchLower) || field.description && field.description.toLowerCase().includes(searchLower)
|
|
816
|
+
);
|
|
817
|
+
});
|
|
818
|
+
const totalPages = vue.computed(() => {
|
|
819
|
+
return Math.ceil(filteredFields.value.length / pageSize);
|
|
820
|
+
});
|
|
821
|
+
const paginatedFields = vue.computed(() => {
|
|
822
|
+
const start = (currentPage.value - 1) * pageSize;
|
|
823
|
+
const end = start + pageSize;
|
|
824
|
+
return filteredFields.value.slice(start, end);
|
|
825
|
+
});
|
|
826
|
+
const handleSearch = () => {
|
|
827
|
+
currentPage.value = 1;
|
|
828
|
+
};
|
|
829
|
+
const goToPage = (page) => {
|
|
830
|
+
if (page >= 1 && page <= totalPages.value) {
|
|
831
|
+
currentPage.value = page;
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
const handleSelectField = (field) => {
|
|
835
|
+
emit("insert", [field]);
|
|
836
|
+
};
|
|
837
|
+
const handleClose = () => {
|
|
838
|
+
searchText.value = "";
|
|
839
|
+
currentPage.value = 1;
|
|
840
|
+
emit("close");
|
|
841
|
+
};
|
|
842
|
+
return (_ctx, _cache) => {
|
|
843
|
+
return __props.visible ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
844
|
+
key: 0,
|
|
845
|
+
class: "field-dialog-overlay",
|
|
846
|
+
onClick: vue.withModifiers(handleClose, ["self"])
|
|
847
|
+
}, [
|
|
848
|
+
vue.createElementVNode("div", _hoisted_1$4, [
|
|
849
|
+
vue.createElementVNode("div", { class: "dialog-header" }, [
|
|
850
|
+
_cache[3] || (_cache[3] = vue.createElementVNode("h3", null, "选择字段", -1)),
|
|
851
|
+
vue.createElementVNode("button", {
|
|
852
|
+
class: "close-btn",
|
|
853
|
+
onClick: handleClose
|
|
854
|
+
}, "×")
|
|
855
|
+
]),
|
|
856
|
+
vue.createElementVNode("div", _hoisted_2$4, [
|
|
857
|
+
vue.createElementVNode("div", _hoisted_3$4, [
|
|
858
|
+
vue.withDirectives(vue.createElementVNode("input", {
|
|
859
|
+
type: "text",
|
|
860
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchText.value = $event),
|
|
861
|
+
placeholder: "搜索字段...",
|
|
862
|
+
class: "search-input",
|
|
863
|
+
onInput: handleSearch
|
|
864
|
+
}, null, 544), [
|
|
865
|
+
[vue.vModelText, searchText.value]
|
|
866
|
+
])
|
|
867
|
+
]),
|
|
868
|
+
vue.createElementVNode("div", _hoisted_4$4, [
|
|
869
|
+
vue.createElementVNode("table", _hoisted_5$3, [
|
|
870
|
+
_cache[4] || (_cache[4] = vue.createElementVNode("thead", null, [
|
|
871
|
+
vue.createElementVNode("tr", null, [
|
|
872
|
+
vue.createElementVNode("th", null, "系统字段"),
|
|
873
|
+
vue.createElementVNode("th", null, "操作")
|
|
874
|
+
])
|
|
875
|
+
], -1)),
|
|
876
|
+
vue.createElementVNode("tbody", null, [
|
|
877
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(paginatedFields.value, (field) => {
|
|
878
|
+
return vue.openBlock(), vue.createElementBlock("tr", {
|
|
879
|
+
key: field.key,
|
|
880
|
+
class: "field-row"
|
|
881
|
+
}, [
|
|
882
|
+
vue.createElementVNode("td", _hoisted_6$3, vue.toDisplayString(field.label), 1),
|
|
883
|
+
vue.createElementVNode("td", _hoisted_7$3, [
|
|
884
|
+
vue.createElementVNode("button", {
|
|
885
|
+
class: "select-btn",
|
|
886
|
+
onClick: ($event) => handleSelectField(field)
|
|
887
|
+
}, " 选择 ", 8, _hoisted_8$2)
|
|
888
|
+
])
|
|
889
|
+
]);
|
|
890
|
+
}), 128))
|
|
891
|
+
])
|
|
892
|
+
])
|
|
893
|
+
]),
|
|
894
|
+
totalPages.value > 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$2, [
|
|
895
|
+
vue.createElementVNode("button", {
|
|
896
|
+
class: "page-btn",
|
|
897
|
+
disabled: currentPage.value === 1,
|
|
898
|
+
onClick: _cache[1] || (_cache[1] = ($event) => goToPage(currentPage.value - 1))
|
|
899
|
+
}, " < ", 8, _hoisted_10$2),
|
|
900
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(totalPages.value, (page) => {
|
|
901
|
+
return vue.openBlock(), vue.createElementBlock("button", {
|
|
902
|
+
key: page,
|
|
903
|
+
class: vue.normalizeClass(["page-btn", { active: page === currentPage.value }]),
|
|
904
|
+
onClick: ($event) => goToPage(page)
|
|
905
|
+
}, vue.toDisplayString(page), 11, _hoisted_11$1);
|
|
906
|
+
}), 128)),
|
|
907
|
+
vue.createElementVNode("button", {
|
|
908
|
+
class: "page-btn",
|
|
909
|
+
disabled: currentPage.value === totalPages.value,
|
|
910
|
+
onClick: _cache[2] || (_cache[2] = ($event) => goToPage(currentPage.value + 1))
|
|
911
|
+
}, " > ", 8, _hoisted_12$1)
|
|
912
|
+
])) : vue.createCommentVNode("", true)
|
|
913
|
+
])
|
|
914
|
+
])
|
|
915
|
+
])) : vue.createCommentVNode("", true);
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
};
|
|
919
|
+
const FieldDialog = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-c4ecd92f"]]);
|
|
920
|
+
const _hoisted_1$3 = { class: "properties-panel" };
|
|
921
|
+
const _hoisted_2$3 = { class: "panel-content" };
|
|
922
|
+
const _hoisted_3$3 = {
|
|
923
|
+
key: 0,
|
|
924
|
+
class: "content-section"
|
|
925
|
+
};
|
|
926
|
+
const _hoisted_4$3 = { class: "form-group" };
|
|
927
|
+
const _hoisted_5$2 = { class: "content-input-wrapper" };
|
|
928
|
+
const _hoisted_6$2 = ["rows"];
|
|
929
|
+
const _hoisted_7$2 = {
|
|
930
|
+
key: 1,
|
|
931
|
+
class: "style-section"
|
|
932
|
+
};
|
|
933
|
+
const _hoisted_8$1 = { class: "form-group" };
|
|
934
|
+
const _hoisted_9$1 = { class: "form-group" };
|
|
935
|
+
const _hoisted_10$1 = { class: "form-group" };
|
|
936
|
+
const _hoisted_11 = { class: "style-buttons" };
|
|
937
|
+
const _hoisted_12 = { class: "form-group" };
|
|
938
|
+
const _hoisted_13 = { class: "form-group" };
|
|
939
|
+
const _hoisted_14 = { class: "align-buttons" };
|
|
940
|
+
const _hoisted_15 = { class: "form-group" };
|
|
941
|
+
const _hoisted_16 = {
|
|
942
|
+
key: 2,
|
|
943
|
+
class: "image-section"
|
|
944
|
+
};
|
|
945
|
+
const _hoisted_17 = { class: "form-group" };
|
|
946
|
+
const _hoisted_18 = { class: "radio-group" };
|
|
947
|
+
const _hoisted_19 = { class: "radio-label" };
|
|
948
|
+
const _hoisted_20 = { class: "radio-label" };
|
|
949
|
+
const _hoisted_21 = {
|
|
950
|
+
key: 0,
|
|
951
|
+
class: "form-group"
|
|
952
|
+
};
|
|
953
|
+
const _hoisted_22 = { class: "image-upload-wrapper" };
|
|
954
|
+
const _hoisted_23 = {
|
|
955
|
+
key: 0,
|
|
956
|
+
class: "image-preview"
|
|
957
|
+
};
|
|
958
|
+
const _hoisted_24 = ["src"];
|
|
959
|
+
const _hoisted_25 = {
|
|
960
|
+
key: 1,
|
|
961
|
+
class: "form-group"
|
|
962
|
+
};
|
|
963
|
+
const _hoisted_26 = ["value"];
|
|
964
|
+
const _hoisted_27 = {
|
|
965
|
+
key: 0,
|
|
966
|
+
class: "field-preview"
|
|
967
|
+
};
|
|
968
|
+
const _hoisted_28 = {
|
|
969
|
+
key: 3,
|
|
970
|
+
class: "qrcode-section"
|
|
971
|
+
};
|
|
972
|
+
const _hoisted_29 = { class: "form-group" };
|
|
973
|
+
const _hoisted_30 = { class: "radio-group" };
|
|
974
|
+
const _hoisted_31 = { class: "radio-label" };
|
|
975
|
+
const _hoisted_32 = { class: "radio-label" };
|
|
976
|
+
const _hoisted_33 = {
|
|
977
|
+
key: 0,
|
|
978
|
+
class: "form-group"
|
|
979
|
+
};
|
|
980
|
+
const _hoisted_34 = { class: "qrcode-upload-wrapper" };
|
|
981
|
+
const _hoisted_35 = {
|
|
982
|
+
key: 0,
|
|
983
|
+
class: "qrcode-preview"
|
|
984
|
+
};
|
|
985
|
+
const _hoisted_36 = ["src"];
|
|
986
|
+
const _hoisted_37 = {
|
|
987
|
+
key: 1,
|
|
988
|
+
class: "form-group"
|
|
989
|
+
};
|
|
990
|
+
const _hoisted_38 = ["value"];
|
|
991
|
+
const _hoisted_39 = {
|
|
992
|
+
key: 0,
|
|
993
|
+
class: "field-preview"
|
|
994
|
+
};
|
|
995
|
+
const _hoisted_40 = { class: "position-section" };
|
|
996
|
+
const _hoisted_41 = { class: "form-row" };
|
|
997
|
+
const _hoisted_42 = { class: "form-group" };
|
|
998
|
+
const _hoisted_43 = { class: "form-group" };
|
|
999
|
+
const _hoisted_44 = { class: "form-row" };
|
|
1000
|
+
const _hoisted_45 = { class: "form-group" };
|
|
1001
|
+
const _hoisted_46 = { class: "form-group" };
|
|
1002
|
+
const _sfc_main$3 = {
|
|
1003
|
+
__name: "PropertiesPanel",
|
|
1004
|
+
props: {
|
|
1005
|
+
element: {
|
|
1006
|
+
type: Object,
|
|
1007
|
+
required: true
|
|
1008
|
+
},
|
|
1009
|
+
systemFields: {
|
|
1010
|
+
type: Array,
|
|
1011
|
+
default: () => SYSTEM_FIELDS
|
|
1012
|
+
}
|
|
1013
|
+
},
|
|
1014
|
+
emits: ["update-element"],
|
|
1015
|
+
setup(__props, { emit: __emit }) {
|
|
1016
|
+
const props = __props;
|
|
1017
|
+
const emit = __emit;
|
|
1018
|
+
const localContent = vue.ref("");
|
|
1019
|
+
const localStyle = vue.ref({});
|
|
1020
|
+
const localImageSource = vue.ref("url");
|
|
1021
|
+
const localImageUrl = vue.ref("");
|
|
1022
|
+
const localImageField = vue.ref("");
|
|
1023
|
+
const localQrcodeSource = vue.ref("url");
|
|
1024
|
+
const localQrcodeContent = vue.ref("");
|
|
1025
|
+
const localQrcodeField = vue.ref("");
|
|
1026
|
+
const showFieldDialog = vue.ref(false);
|
|
1027
|
+
const selectionStart = vue.ref(0);
|
|
1028
|
+
const selectionEnd = vue.ref(0);
|
|
1029
|
+
const contentTextareaRef = vue.ref(null);
|
|
1030
|
+
const imageFileInputRef = vue.ref(null);
|
|
1031
|
+
const qrcodeFileInputRef = vue.ref(null);
|
|
1032
|
+
const initLocalState = () => {
|
|
1033
|
+
localContent.value = props.element.content || "";
|
|
1034
|
+
localStyle.value = { ...props.element.style };
|
|
1035
|
+
if (props.element.type === "image") {
|
|
1036
|
+
localImageSource.value = props.element.imageSource || "url";
|
|
1037
|
+
localImageUrl.value = props.element.imageUrl || "";
|
|
1038
|
+
localImageField.value = props.element.imageField || "";
|
|
1039
|
+
}
|
|
1040
|
+
if (props.element.type === "qrcode") {
|
|
1041
|
+
localQrcodeSource.value = props.element.qrcodeSource || "url";
|
|
1042
|
+
localQrcodeContent.value = props.element.qrcodeContent || "";
|
|
1043
|
+
localQrcodeField.value = props.element.qrcodeField || "";
|
|
1044
|
+
}
|
|
1045
|
+
};
|
|
1046
|
+
vue.watch(() => props.element, initLocalState, { immediate: true, deep: true });
|
|
1047
|
+
const updateElement = () => {
|
|
1048
|
+
const updated = { ...props.element };
|
|
1049
|
+
if (props.element.type === "text" || props.element.type === "longtext") {
|
|
1050
|
+
updated.content = localContent.value;
|
|
1051
|
+
updated.style = { ...localStyle.value };
|
|
1052
|
+
}
|
|
1053
|
+
if (props.element.type === "image") {
|
|
1054
|
+
updated.imageSource = localImageSource.value;
|
|
1055
|
+
updated.imageUrl = localImageUrl.value;
|
|
1056
|
+
updated.imageField = localImageField.value;
|
|
1057
|
+
}
|
|
1058
|
+
if (props.element.type === "qrcode") {
|
|
1059
|
+
updated.qrcodeSource = localQrcodeSource.value;
|
|
1060
|
+
updated.qrcodeContent = localQrcodeContent.value;
|
|
1061
|
+
updated.qrcodeField = localQrcodeField.value;
|
|
1062
|
+
}
|
|
1063
|
+
emit("update-element", updated);
|
|
1064
|
+
};
|
|
1065
|
+
const handleContentChange = () => {
|
|
1066
|
+
updateElement();
|
|
1067
|
+
};
|
|
1068
|
+
const handleTextareaFocus = (e) => {
|
|
1069
|
+
selectionStart.value = e.target.selectionStart;
|
|
1070
|
+
selectionEnd.value = e.target.selectionEnd;
|
|
1071
|
+
};
|
|
1072
|
+
const handleInsertField = (fields) => {
|
|
1073
|
+
if (fields.length > 0) {
|
|
1074
|
+
const field = fields[0];
|
|
1075
|
+
const textarea = contentTextareaRef.value;
|
|
1076
|
+
if (textarea) {
|
|
1077
|
+
const start = selectionStart.value;
|
|
1078
|
+
const end = selectionEnd.value;
|
|
1079
|
+
const text = localContent.value;
|
|
1080
|
+
const newText = text.substring(0, start) + field.placeholder + text.substring(end);
|
|
1081
|
+
localContent.value = newText;
|
|
1082
|
+
setTimeout(() => {
|
|
1083
|
+
const newPos = start + field.placeholder.length;
|
|
1084
|
+
textarea.setSelectionRange(newPos, newPos);
|
|
1085
|
+
textarea.focus();
|
|
1086
|
+
}, 0);
|
|
1087
|
+
updateElement();
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
};
|
|
1091
|
+
const toggleStyle = (property, value1, value2) => {
|
|
1092
|
+
localStyle.value[property] = localStyle.value[property] === value1 ? value2 : value1;
|
|
1093
|
+
updateElement();
|
|
1094
|
+
};
|
|
1095
|
+
const setAlign = (align) => {
|
|
1096
|
+
localStyle.value.textAlign = align;
|
|
1097
|
+
updateElement();
|
|
1098
|
+
};
|
|
1099
|
+
const handleImageSourceChange = () => {
|
|
1100
|
+
updateElement();
|
|
1101
|
+
};
|
|
1102
|
+
const triggerImageUpload = () => {
|
|
1103
|
+
var _a;
|
|
1104
|
+
(_a = imageFileInputRef.value) == null ? void 0 : _a.click();
|
|
1105
|
+
};
|
|
1106
|
+
const handleImageUpload = async (event) => {
|
|
1107
|
+
var _a;
|
|
1108
|
+
const file = (_a = event.target.files) == null ? void 0 : _a[0];
|
|
1109
|
+
if (!file) return;
|
|
1110
|
+
const validation = validateImageFile(file);
|
|
1111
|
+
if (!validation.valid) {
|
|
1112
|
+
alert(validation.error);
|
|
1113
|
+
return;
|
|
1114
|
+
}
|
|
1115
|
+
try {
|
|
1116
|
+
const base64 = await fileToBase64(file);
|
|
1117
|
+
localImageUrl.value = base64;
|
|
1118
|
+
localImageSource.value = "url";
|
|
1119
|
+
updateElement();
|
|
1120
|
+
} catch (error) {
|
|
1121
|
+
alert("上传失败,请重试");
|
|
1122
|
+
console.error(error);
|
|
1123
|
+
}
|
|
1124
|
+
if (imageFileInputRef.value) {
|
|
1125
|
+
imageFileInputRef.value.value = "";
|
|
1126
|
+
}
|
|
1127
|
+
};
|
|
1128
|
+
const removeImage = () => {
|
|
1129
|
+
localImageUrl.value = "";
|
|
1130
|
+
updateElement();
|
|
1131
|
+
};
|
|
1132
|
+
const handleQrcodeSourceChange = () => {
|
|
1133
|
+
updateElement();
|
|
1134
|
+
};
|
|
1135
|
+
const triggerQrcodeUpload = () => {
|
|
1136
|
+
var _a;
|
|
1137
|
+
(_a = qrcodeFileInputRef.value) == null ? void 0 : _a.click();
|
|
1138
|
+
};
|
|
1139
|
+
const handleQrcodeUpload = async (event) => {
|
|
1140
|
+
var _a;
|
|
1141
|
+
const file = (_a = event.target.files) == null ? void 0 : _a[0];
|
|
1142
|
+
if (!file) return;
|
|
1143
|
+
const validation = validateImageFile(file);
|
|
1144
|
+
if (!validation.valid) {
|
|
1145
|
+
alert(validation.error);
|
|
1146
|
+
return;
|
|
1147
|
+
}
|
|
1148
|
+
try {
|
|
1149
|
+
const base64 = await fileToBase64(file);
|
|
1150
|
+
localQrcodeContent.value = base64;
|
|
1151
|
+
localQrcodeSource.value = "url";
|
|
1152
|
+
updateElement();
|
|
1153
|
+
} catch (error) {
|
|
1154
|
+
alert("上传失败,请重试");
|
|
1155
|
+
console.error(error);
|
|
1156
|
+
}
|
|
1157
|
+
if (qrcodeFileInputRef.value) {
|
|
1158
|
+
qrcodeFileInputRef.value.value = "";
|
|
1159
|
+
}
|
|
1160
|
+
};
|
|
1161
|
+
const removeQrcode = () => {
|
|
1162
|
+
localQrcodeContent.value = "";
|
|
1163
|
+
updateElement();
|
|
1164
|
+
};
|
|
1165
|
+
const getFieldLabel = (key) => {
|
|
1166
|
+
const field = props.systemFields.find((f) => f.key === key);
|
|
1167
|
+
if (field) return field.label;
|
|
1168
|
+
const defaultField = getFieldByKey(key);
|
|
1169
|
+
return defaultField ? defaultField.label : key;
|
|
1170
|
+
};
|
|
1171
|
+
const isImageUrl = (url) => {
|
|
1172
|
+
if (!url) return false;
|
|
1173
|
+
if (url.startsWith("data:image/")) return true;
|
|
1174
|
+
if (url.startsWith("http://") || url.startsWith("https://")) {
|
|
1175
|
+
const imageExtensions = [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".bmp"];
|
|
1176
|
+
const lowerUrl = url.toLowerCase();
|
|
1177
|
+
return imageExtensions.some((ext) => lowerUrl.includes(ext));
|
|
1178
|
+
}
|
|
1179
|
+
return false;
|
|
1180
|
+
};
|
|
1181
|
+
return (_ctx, _cache) => {
|
|
1182
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
|
|
1183
|
+
_cache[63] || (_cache[63] = vue.createElementVNode("div", { class: "panel-header" }, [
|
|
1184
|
+
vue.createElementVNode("h3", null, "属性设置")
|
|
1185
|
+
], -1)),
|
|
1186
|
+
vue.createElementVNode("div", _hoisted_2$3, [
|
|
1187
|
+
__props.element.type === "text" || __props.element.type === "longtext" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$3, [
|
|
1188
|
+
vue.createElementVNode("div", _hoisted_4$3, [
|
|
1189
|
+
_cache[26] || (_cache[26] = vue.createElementVNode("label", { class: "form-label" }, "内容", -1)),
|
|
1190
|
+
vue.createElementVNode("div", _hoisted_5$2, [
|
|
1191
|
+
vue.withDirectives(vue.createElementVNode("textarea", {
|
|
1192
|
+
ref_key: "contentTextareaRef",
|
|
1193
|
+
ref: contentTextareaRef,
|
|
1194
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => localContent.value = $event),
|
|
1195
|
+
onInput: handleContentChange,
|
|
1196
|
+
onFocus: handleTextareaFocus,
|
|
1197
|
+
rows: __props.element.type === "longtext" ? 6 : 3,
|
|
1198
|
+
class: "content-textarea"
|
|
1199
|
+
}, null, 40, _hoisted_6$2), [
|
|
1200
|
+
[vue.vModelText, localContent.value]
|
|
1201
|
+
]),
|
|
1202
|
+
vue.createElementVNode("button", {
|
|
1203
|
+
class: "insert-field-btn",
|
|
1204
|
+
onClick: _cache[1] || (_cache[1] = ($event) => showFieldDialog.value = true)
|
|
1205
|
+
}, [..._cache[25] || (_cache[25] = [
|
|
1206
|
+
vue.createElementVNode("span", null, "+", -1),
|
|
1207
|
+
vue.createElementVNode("span", null, "在内容中关联系统字段", -1)
|
|
1208
|
+
])])
|
|
1209
|
+
])
|
|
1210
|
+
])
|
|
1211
|
+
])) : vue.createCommentVNode("", true),
|
|
1212
|
+
__props.element.type === "text" || __props.element.type === "longtext" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$2, [
|
|
1213
|
+
_cache[38] || (_cache[38] = vue.createElementVNode("div", { class: "section-title" }, "文本样式", -1)),
|
|
1214
|
+
vue.createElementVNode("div", _hoisted_8$1, [
|
|
1215
|
+
_cache[28] || (_cache[28] = vue.createElementVNode("label", { class: "form-label" }, "字体大小", -1)),
|
|
1216
|
+
vue.withDirectives(vue.createElementVNode("select", {
|
|
1217
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => localStyle.value.fontSize = $event),
|
|
1218
|
+
onChange: updateElement,
|
|
1219
|
+
class: "form-select"
|
|
1220
|
+
}, [..._cache[27] || (_cache[27] = [
|
|
1221
|
+
vue.createElementVNode("option", { value: 12 }, "12px", -1),
|
|
1222
|
+
vue.createElementVNode("option", { value: 14 }, "14px", -1),
|
|
1223
|
+
vue.createElementVNode("option", { value: 16 }, "16px", -1),
|
|
1224
|
+
vue.createElementVNode("option", { value: 18 }, "18px", -1),
|
|
1225
|
+
vue.createElementVNode("option", { value: 20 }, "20px", -1),
|
|
1226
|
+
vue.createElementVNode("option", { value: 24 }, "24px", -1),
|
|
1227
|
+
vue.createElementVNode("option", { value: 28 }, "28px", -1),
|
|
1228
|
+
vue.createElementVNode("option", { value: 32 }, "32px", -1),
|
|
1229
|
+
vue.createElementVNode("option", { value: 36 }, "36px", -1),
|
|
1230
|
+
vue.createElementVNode("option", { value: 48 }, "48px", -1)
|
|
1231
|
+
])], 544), [
|
|
1232
|
+
[
|
|
1233
|
+
vue.vModelSelect,
|
|
1234
|
+
localStyle.value.fontSize,
|
|
1235
|
+
void 0,
|
|
1236
|
+
{ number: true }
|
|
1237
|
+
]
|
|
1238
|
+
])
|
|
1239
|
+
]),
|
|
1240
|
+
vue.createElementVNode("div", _hoisted_9$1, [
|
|
1241
|
+
_cache[30] || (_cache[30] = vue.createElementVNode("label", { class: "form-label" }, "字体", -1)),
|
|
1242
|
+
vue.withDirectives(vue.createElementVNode("select", {
|
|
1243
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => localStyle.value.fontFamily = $event),
|
|
1244
|
+
onChange: updateElement,
|
|
1245
|
+
class: "form-select"
|
|
1246
|
+
}, [..._cache[29] || (_cache[29] = [
|
|
1247
|
+
vue.createStaticVNode('<option value="方正书宋简体" data-v-7662a3c6>方正书宋简体</option><option value="微软雅黑" data-v-7662a3c6>微软雅黑</option><option value="宋体" data-v-7662a3c6>宋体</option><option value="黑体" data-v-7662a3c6>黑体</option><option value="Arial" data-v-7662a3c6>Arial</option>', 5)
|
|
1248
|
+
])], 544), [
|
|
1249
|
+
[vue.vModelSelect, localStyle.value.fontFamily]
|
|
1250
|
+
])
|
|
1251
|
+
]),
|
|
1252
|
+
vue.createElementVNode("div", _hoisted_10$1, [
|
|
1253
|
+
_cache[34] || (_cache[34] = vue.createElementVNode("label", { class: "form-label" }, "文字样式", -1)),
|
|
1254
|
+
vue.createElementVNode("div", _hoisted_11, [
|
|
1255
|
+
vue.createElementVNode("button", {
|
|
1256
|
+
class: vue.normalizeClass(["style-btn", { active: localStyle.value.fontWeight === "bold" }]),
|
|
1257
|
+
onClick: _cache[4] || (_cache[4] = ($event) => toggleStyle("fontWeight", "bold", "normal"))
|
|
1258
|
+
}, [..._cache[31] || (_cache[31] = [
|
|
1259
|
+
vue.createElementVNode("strong", null, "B", -1)
|
|
1260
|
+
])], 2),
|
|
1261
|
+
vue.createElementVNode("button", {
|
|
1262
|
+
class: vue.normalizeClass(["style-btn", { active: localStyle.value.fontStyle === "italic" }]),
|
|
1263
|
+
onClick: _cache[5] || (_cache[5] = ($event) => toggleStyle("fontStyle", "italic", "normal"))
|
|
1264
|
+
}, [..._cache[32] || (_cache[32] = [
|
|
1265
|
+
vue.createElementVNode("em", null, "I", -1)
|
|
1266
|
+
])], 2),
|
|
1267
|
+
vue.createElementVNode("button", {
|
|
1268
|
+
class: vue.normalizeClass(["style-btn", { active: localStyle.value.textDecoration === "underline" }]),
|
|
1269
|
+
onClick: _cache[6] || (_cache[6] = ($event) => toggleStyle("textDecoration", "underline", "none"))
|
|
1270
|
+
}, [..._cache[33] || (_cache[33] = [
|
|
1271
|
+
vue.createElementVNode("u", null, "U", -1)
|
|
1272
|
+
])], 2)
|
|
1273
|
+
])
|
|
1274
|
+
]),
|
|
1275
|
+
vue.createElementVNode("div", _hoisted_12, [
|
|
1276
|
+
_cache[35] || (_cache[35] = vue.createElementVNode("label", { class: "form-label" }, "颜色", -1)),
|
|
1277
|
+
vue.withDirectives(vue.createElementVNode("input", {
|
|
1278
|
+
type: "color",
|
|
1279
|
+
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => localStyle.value.color = $event),
|
|
1280
|
+
onChange: updateElement,
|
|
1281
|
+
class: "color-input"
|
|
1282
|
+
}, null, 544), [
|
|
1283
|
+
[vue.vModelText, localStyle.value.color]
|
|
1284
|
+
])
|
|
1285
|
+
]),
|
|
1286
|
+
vue.createElementVNode("div", _hoisted_13, [
|
|
1287
|
+
_cache[36] || (_cache[36] = vue.createElementVNode("label", { class: "form-label" }, "对齐方式", -1)),
|
|
1288
|
+
vue.createElementVNode("div", _hoisted_14, [
|
|
1289
|
+
vue.createElementVNode("button", {
|
|
1290
|
+
class: vue.normalizeClass(["align-btn", { active: localStyle.value.textAlign === "left" }]),
|
|
1291
|
+
onClick: _cache[8] || (_cache[8] = ($event) => setAlign("left"))
|
|
1292
|
+
}, " 左对齐 ", 2),
|
|
1293
|
+
vue.createElementVNode("button", {
|
|
1294
|
+
class: vue.normalizeClass(["align-btn", { active: localStyle.value.textAlign === "center" }]),
|
|
1295
|
+
onClick: _cache[9] || (_cache[9] = ($event) => setAlign("center"))
|
|
1296
|
+
}, " 居中 ", 2),
|
|
1297
|
+
vue.createElementVNode("button", {
|
|
1298
|
+
class: vue.normalizeClass(["align-btn", { active: localStyle.value.textAlign === "right" }]),
|
|
1299
|
+
onClick: _cache[10] || (_cache[10] = ($event) => setAlign("right"))
|
|
1300
|
+
}, " 右对齐 ", 2)
|
|
1301
|
+
])
|
|
1302
|
+
]),
|
|
1303
|
+
vue.createElementVNode("div", _hoisted_15, [
|
|
1304
|
+
_cache[37] || (_cache[37] = vue.createElementVNode("label", { class: "form-label" }, "行高", -1)),
|
|
1305
|
+
vue.withDirectives(vue.createElementVNode("input", {
|
|
1306
|
+
type: "number",
|
|
1307
|
+
"onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => localStyle.value.lineHeight = $event),
|
|
1308
|
+
onInput: updateElement,
|
|
1309
|
+
step: "0.1",
|
|
1310
|
+
min: "0.5",
|
|
1311
|
+
max: "3",
|
|
1312
|
+
class: "form-input"
|
|
1313
|
+
}, null, 544), [
|
|
1314
|
+
[
|
|
1315
|
+
vue.vModelText,
|
|
1316
|
+
localStyle.value.lineHeight,
|
|
1317
|
+
void 0,
|
|
1318
|
+
{ number: true }
|
|
1319
|
+
]
|
|
1320
|
+
])
|
|
1321
|
+
])
|
|
1322
|
+
])) : vue.createCommentVNode("", true),
|
|
1323
|
+
__props.element.type === "image" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_16, [
|
|
1324
|
+
_cache[49] || (_cache[49] = vue.createElementVNode("div", { class: "section-title" }, "图片设置", -1)),
|
|
1325
|
+
vue.createElementVNode("div", _hoisted_17, [
|
|
1326
|
+
_cache[41] || (_cache[41] = vue.createElementVNode("label", { class: "form-label" }, "图片来源", -1)),
|
|
1327
|
+
vue.createElementVNode("div", _hoisted_18, [
|
|
1328
|
+
vue.createElementVNode("label", _hoisted_19, [
|
|
1329
|
+
vue.withDirectives(vue.createElementVNode("input", {
|
|
1330
|
+
type: "radio",
|
|
1331
|
+
value: "url",
|
|
1332
|
+
"onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => localImageSource.value = $event),
|
|
1333
|
+
onChange: handleImageSourceChange
|
|
1334
|
+
}, null, 544), [
|
|
1335
|
+
[vue.vModelRadio, localImageSource.value]
|
|
1336
|
+
]),
|
|
1337
|
+
_cache[39] || (_cache[39] = vue.createElementVNode("span", null, "URL", -1))
|
|
1338
|
+
]),
|
|
1339
|
+
vue.createElementVNode("label", _hoisted_20, [
|
|
1340
|
+
vue.withDirectives(vue.createElementVNode("input", {
|
|
1341
|
+
type: "radio",
|
|
1342
|
+
value: "field",
|
|
1343
|
+
"onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => localImageSource.value = $event),
|
|
1344
|
+
onChange: handleImageSourceChange
|
|
1345
|
+
}, null, 544), [
|
|
1346
|
+
[vue.vModelRadio, localImageSource.value]
|
|
1347
|
+
]),
|
|
1348
|
+
_cache[40] || (_cache[40] = vue.createElementVNode("span", null, "关联字段", -1))
|
|
1349
|
+
])
|
|
1350
|
+
])
|
|
1351
|
+
]),
|
|
1352
|
+
localImageSource.value === "url" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_21, [
|
|
1353
|
+
_cache[43] || (_cache[43] = vue.createElementVNode("label", { class: "form-label" }, "图片URL", -1)),
|
|
1354
|
+
vue.createElementVNode("div", _hoisted_22, [
|
|
1355
|
+
vue.createElementVNode("input", {
|
|
1356
|
+
ref_key: "imageFileInputRef",
|
|
1357
|
+
ref: imageFileInputRef,
|
|
1358
|
+
type: "file",
|
|
1359
|
+
accept: "image/jpeg,image/jpg,image/png",
|
|
1360
|
+
onChange: handleImageUpload,
|
|
1361
|
+
style: { "display": "none" }
|
|
1362
|
+
}, null, 544),
|
|
1363
|
+
vue.createElementVNode("button", {
|
|
1364
|
+
class: "upload-btn",
|
|
1365
|
+
onClick: triggerImageUpload
|
|
1366
|
+
}, [..._cache[42] || (_cache[42] = [
|
|
1367
|
+
vue.createElementVNode("span", null, "📁", -1),
|
|
1368
|
+
vue.createElementVNode("span", null, "本地上传", -1)
|
|
1369
|
+
])]),
|
|
1370
|
+
vue.withDirectives(vue.createElementVNode("input", {
|
|
1371
|
+
type: "text",
|
|
1372
|
+
"onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => localImageUrl.value = $event),
|
|
1373
|
+
onInput: updateElement,
|
|
1374
|
+
placeholder: "请输入图片URL",
|
|
1375
|
+
class: "image-url-input"
|
|
1376
|
+
}, null, 544), [
|
|
1377
|
+
[vue.vModelText, localImageUrl.value]
|
|
1378
|
+
]),
|
|
1379
|
+
localImageUrl.value ? (vue.openBlock(), vue.createElementBlock("button", {
|
|
1380
|
+
key: 0,
|
|
1381
|
+
class: "remove-btn",
|
|
1382
|
+
onClick: removeImage
|
|
1383
|
+
}, "移除")) : vue.createCommentVNode("", true)
|
|
1384
|
+
]),
|
|
1385
|
+
localImageUrl.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_23, [
|
|
1386
|
+
vue.createElementVNode("img", {
|
|
1387
|
+
src: localImageUrl.value,
|
|
1388
|
+
alt: "预览"
|
|
1389
|
+
}, null, 8, _hoisted_24)
|
|
1390
|
+
])) : vue.createCommentVNode("", true)
|
|
1391
|
+
])) : vue.createCommentVNode("", true),
|
|
1392
|
+
localImageSource.value === "field" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_25, [
|
|
1393
|
+
_cache[48] || (_cache[48] = vue.createElementVNode("label", { class: "form-label" }, "关联字段", -1)),
|
|
1394
|
+
vue.withDirectives(vue.createElementVNode("select", {
|
|
1395
|
+
"onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => localImageField.value = $event),
|
|
1396
|
+
onChange: updateElement,
|
|
1397
|
+
class: "form-select"
|
|
1398
|
+
}, [
|
|
1399
|
+
_cache[44] || (_cache[44] = vue.createElementVNode("option", { value: "" }, "请选择字段", -1)),
|
|
1400
|
+
_cache[45] || (_cache[45] = vue.createElementVNode("option", { value: "avatar" }, "头像 (avatar)", -1)),
|
|
1401
|
+
_cache[46] || (_cache[46] = vue.createElementVNode("option", { value: "photo" }, "照片 (photo)", -1)),
|
|
1402
|
+
_cache[47] || (_cache[47] = vue.createElementVNode("option", { value: "headImage" }, "头像图片 (headImage)", -1)),
|
|
1403
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.systemFields, (field) => {
|
|
1404
|
+
return vue.openBlock(), vue.createElementBlock("option", {
|
|
1405
|
+
key: field.key,
|
|
1406
|
+
value: field.key
|
|
1407
|
+
}, vue.toDisplayString(field.label) + " (" + vue.toDisplayString(field.placeholder) + ") ", 9, _hoisted_26);
|
|
1408
|
+
}), 128))
|
|
1409
|
+
], 544), [
|
|
1410
|
+
[vue.vModelSelect, localImageField.value]
|
|
1411
|
+
]),
|
|
1412
|
+
localImageField.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_27, " 字段: " + vue.toDisplayString(getFieldLabel(localImageField.value)), 1)) : vue.createCommentVNode("", true)
|
|
1413
|
+
])) : vue.createCommentVNode("", true)
|
|
1414
|
+
])) : vue.createCommentVNode("", true),
|
|
1415
|
+
__props.element.type === "qrcode" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_28, [
|
|
1416
|
+
_cache[57] || (_cache[57] = vue.createElementVNode("div", { class: "section-title" }, "二维码设置", -1)),
|
|
1417
|
+
vue.createElementVNode("div", _hoisted_29, [
|
|
1418
|
+
_cache[52] || (_cache[52] = vue.createElementVNode("label", { class: "form-label" }, "二维码来源", -1)),
|
|
1419
|
+
vue.createElementVNode("div", _hoisted_30, [
|
|
1420
|
+
vue.createElementVNode("label", _hoisted_31, [
|
|
1421
|
+
vue.withDirectives(vue.createElementVNode("input", {
|
|
1422
|
+
type: "radio",
|
|
1423
|
+
value: "url",
|
|
1424
|
+
"onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => localQrcodeSource.value = $event),
|
|
1425
|
+
onChange: handleQrcodeSourceChange
|
|
1426
|
+
}, null, 544), [
|
|
1427
|
+
[vue.vModelRadio, localQrcodeSource.value]
|
|
1428
|
+
]),
|
|
1429
|
+
_cache[50] || (_cache[50] = vue.createElementVNode("span", null, "URL/内容", -1))
|
|
1430
|
+
]),
|
|
1431
|
+
vue.createElementVNode("label", _hoisted_32, [
|
|
1432
|
+
vue.withDirectives(vue.createElementVNode("input", {
|
|
1433
|
+
type: "radio",
|
|
1434
|
+
value: "field",
|
|
1435
|
+
"onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => localQrcodeSource.value = $event),
|
|
1436
|
+
onChange: handleQrcodeSourceChange
|
|
1437
|
+
}, null, 544), [
|
|
1438
|
+
[vue.vModelRadio, localQrcodeSource.value]
|
|
1439
|
+
]),
|
|
1440
|
+
_cache[51] || (_cache[51] = vue.createElementVNode("span", null, "关联字段", -1))
|
|
1441
|
+
])
|
|
1442
|
+
])
|
|
1443
|
+
]),
|
|
1444
|
+
localQrcodeSource.value === "url" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_33, [
|
|
1445
|
+
_cache[54] || (_cache[54] = vue.createElementVNode("label", { class: "form-label" }, "二维码内容/图片URL", -1)),
|
|
1446
|
+
vue.createElementVNode("div", _hoisted_34, [
|
|
1447
|
+
vue.createElementVNode("input", {
|
|
1448
|
+
ref_key: "qrcodeFileInputRef",
|
|
1449
|
+
ref: qrcodeFileInputRef,
|
|
1450
|
+
type: "file",
|
|
1451
|
+
accept: "image/jpeg,image/jpg,image/png",
|
|
1452
|
+
onChange: handleQrcodeUpload,
|
|
1453
|
+
style: { "display": "none" }
|
|
1454
|
+
}, null, 544),
|
|
1455
|
+
vue.createElementVNode("button", {
|
|
1456
|
+
class: "upload-btn",
|
|
1457
|
+
onClick: triggerQrcodeUpload
|
|
1458
|
+
}, [..._cache[53] || (_cache[53] = [
|
|
1459
|
+
vue.createElementVNode("span", null, "📁", -1),
|
|
1460
|
+
vue.createElementVNode("span", null, "本地上传", -1)
|
|
1461
|
+
])]),
|
|
1462
|
+
vue.withDirectives(vue.createElementVNode("input", {
|
|
1463
|
+
type: "text",
|
|
1464
|
+
"onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => localQrcodeContent.value = $event),
|
|
1465
|
+
onInput: updateElement,
|
|
1466
|
+
placeholder: "请输入二维码内容或图片URL",
|
|
1467
|
+
class: "qrcode-input"
|
|
1468
|
+
}, null, 544), [
|
|
1469
|
+
[vue.vModelText, localQrcodeContent.value]
|
|
1470
|
+
]),
|
|
1471
|
+
localQrcodeContent.value ? (vue.openBlock(), vue.createElementBlock("button", {
|
|
1472
|
+
key: 0,
|
|
1473
|
+
class: "remove-btn",
|
|
1474
|
+
onClick: removeQrcode
|
|
1475
|
+
}, "移除")) : vue.createCommentVNode("", true)
|
|
1476
|
+
]),
|
|
1477
|
+
localQrcodeContent.value && isImageUrl(localQrcodeContent.value) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_35, [
|
|
1478
|
+
vue.createElementVNode("img", {
|
|
1479
|
+
src: localQrcodeContent.value,
|
|
1480
|
+
alt: "预览"
|
|
1481
|
+
}, null, 8, _hoisted_36)
|
|
1482
|
+
])) : vue.createCommentVNode("", true)
|
|
1483
|
+
])) : vue.createCommentVNode("", true),
|
|
1484
|
+
localQrcodeSource.value === "field" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_37, [
|
|
1485
|
+
_cache[56] || (_cache[56] = vue.createElementVNode("label", { class: "form-label" }, "关联字段", -1)),
|
|
1486
|
+
vue.withDirectives(vue.createElementVNode("select", {
|
|
1487
|
+
"onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => localQrcodeField.value = $event),
|
|
1488
|
+
onChange: updateElement,
|
|
1489
|
+
class: "form-select"
|
|
1490
|
+
}, [
|
|
1491
|
+
_cache[55] || (_cache[55] = vue.createStaticVNode('<option value="" data-v-7662a3c6>请选择字段</option><option value="certificateNumber" data-v-7662a3c6>证书编号 (certificateNumber)</option><option value="idNumber" data-v-7662a3c6>身份证号 (idNumber)</option><option value="url" data-v-7662a3c6>链接地址 (url)</option><option value="examName" data-v-7662a3c6>考试名称 (examName)</option>', 5)),
|
|
1492
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.systemFields, (field) => {
|
|
1493
|
+
return vue.openBlock(), vue.createElementBlock("option", {
|
|
1494
|
+
key: field.key,
|
|
1495
|
+
value: field.key
|
|
1496
|
+
}, vue.toDisplayString(field.label) + " (" + vue.toDisplayString(field.placeholder) + ") ", 9, _hoisted_38);
|
|
1497
|
+
}), 128))
|
|
1498
|
+
], 544), [
|
|
1499
|
+
[vue.vModelSelect, localQrcodeField.value]
|
|
1500
|
+
]),
|
|
1501
|
+
localQrcodeField.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_39, " 字段: " + vue.toDisplayString(getFieldLabel(localQrcodeField.value)), 1)) : vue.createCommentVNode("", true)
|
|
1502
|
+
])) : vue.createCommentVNode("", true)
|
|
1503
|
+
])) : vue.createCommentVNode("", true),
|
|
1504
|
+
vue.createElementVNode("div", _hoisted_40, [
|
|
1505
|
+
_cache[62] || (_cache[62] = vue.createElementVNode("div", { class: "section-title" }, "位置和尺寸", -1)),
|
|
1506
|
+
vue.createElementVNode("div", _hoisted_41, [
|
|
1507
|
+
vue.createElementVNode("div", _hoisted_42, [
|
|
1508
|
+
_cache[58] || (_cache[58] = vue.createElementVNode("label", { class: "form-label" }, "X", -1)),
|
|
1509
|
+
vue.withDirectives(vue.createElementVNode("input", {
|
|
1510
|
+
type: "number",
|
|
1511
|
+
"onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => __props.element.x = $event),
|
|
1512
|
+
onInput: updateElement,
|
|
1513
|
+
class: "form-input"
|
|
1514
|
+
}, null, 544), [
|
|
1515
|
+
[
|
|
1516
|
+
vue.vModelText,
|
|
1517
|
+
__props.element.x,
|
|
1518
|
+
void 0,
|
|
1519
|
+
{ number: true }
|
|
1520
|
+
]
|
|
1521
|
+
])
|
|
1522
|
+
]),
|
|
1523
|
+
vue.createElementVNode("div", _hoisted_43, [
|
|
1524
|
+
_cache[59] || (_cache[59] = vue.createElementVNode("label", { class: "form-label" }, "Y", -1)),
|
|
1525
|
+
vue.withDirectives(vue.createElementVNode("input", {
|
|
1526
|
+
type: "number",
|
|
1527
|
+
"onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => __props.element.y = $event),
|
|
1528
|
+
onInput: updateElement,
|
|
1529
|
+
class: "form-input"
|
|
1530
|
+
}, null, 544), [
|
|
1531
|
+
[
|
|
1532
|
+
vue.vModelText,
|
|
1533
|
+
__props.element.y,
|
|
1534
|
+
void 0,
|
|
1535
|
+
{ number: true }
|
|
1536
|
+
]
|
|
1537
|
+
])
|
|
1538
|
+
])
|
|
1539
|
+
]),
|
|
1540
|
+
vue.createElementVNode("div", _hoisted_44, [
|
|
1541
|
+
vue.createElementVNode("div", _hoisted_45, [
|
|
1542
|
+
_cache[60] || (_cache[60] = vue.createElementVNode("label", { class: "form-label" }, "宽度", -1)),
|
|
1543
|
+
vue.withDirectives(vue.createElementVNode("input", {
|
|
1544
|
+
type: "number",
|
|
1545
|
+
"onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => __props.element.width = $event),
|
|
1546
|
+
onInput: updateElement,
|
|
1547
|
+
class: "form-input"
|
|
1548
|
+
}, null, 544), [
|
|
1549
|
+
[
|
|
1550
|
+
vue.vModelText,
|
|
1551
|
+
__props.element.width,
|
|
1552
|
+
void 0,
|
|
1553
|
+
{ number: true }
|
|
1554
|
+
]
|
|
1555
|
+
])
|
|
1556
|
+
]),
|
|
1557
|
+
vue.createElementVNode("div", _hoisted_46, [
|
|
1558
|
+
_cache[61] || (_cache[61] = vue.createElementVNode("label", { class: "form-label" }, "高度", -1)),
|
|
1559
|
+
vue.withDirectives(vue.createElementVNode("input", {
|
|
1560
|
+
type: "number",
|
|
1561
|
+
"onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => __props.element.height = $event),
|
|
1562
|
+
onInput: updateElement,
|
|
1563
|
+
class: "form-input"
|
|
1564
|
+
}, null, 544), [
|
|
1565
|
+
[
|
|
1566
|
+
vue.vModelText,
|
|
1567
|
+
__props.element.height,
|
|
1568
|
+
void 0,
|
|
1569
|
+
{ number: true }
|
|
1570
|
+
]
|
|
1571
|
+
])
|
|
1572
|
+
])
|
|
1573
|
+
])
|
|
1574
|
+
])
|
|
1575
|
+
]),
|
|
1576
|
+
vue.createVNode(FieldDialog, {
|
|
1577
|
+
visible: showFieldDialog.value,
|
|
1578
|
+
"current-text": localContent.value,
|
|
1579
|
+
"selection-start": selectionStart.value,
|
|
1580
|
+
"selection-end": selectionEnd.value,
|
|
1581
|
+
"system-fields": __props.systemFields,
|
|
1582
|
+
onClose: _cache[24] || (_cache[24] = ($event) => showFieldDialog.value = false),
|
|
1583
|
+
onInsert: handleInsertField
|
|
1584
|
+
}, null, 8, ["visible", "current-text", "selection-start", "selection-end", "system-fields"])
|
|
1585
|
+
]);
|
|
1586
|
+
};
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1589
|
+
const PropertiesPanel = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-7662a3c6"]]);
|
|
1590
|
+
const _hoisted_1$2 = { class: "field-data-panel" };
|
|
1591
|
+
const _hoisted_2$2 = { class: "panel-content" };
|
|
1592
|
+
const _hoisted_3$2 = { class: "category-title" };
|
|
1593
|
+
const _hoisted_4$2 = { class: "fields-list" };
|
|
1594
|
+
const _hoisted_5$1 = { class: "field-label" };
|
|
1595
|
+
const _hoisted_6$1 = ["onUpdate:modelValue", "placeholder"];
|
|
1596
|
+
const _hoisted_7$1 = { class: "field-hint" };
|
|
1597
|
+
const _sfc_main$2 = {
|
|
1598
|
+
__name: "FieldDataPanel",
|
|
1599
|
+
props: {
|
|
1600
|
+
fieldData: {
|
|
1601
|
+
type: Object,
|
|
1602
|
+
default: () => ({})
|
|
1603
|
+
}
|
|
1604
|
+
},
|
|
1605
|
+
emits: ["update-field-data"],
|
|
1606
|
+
setup(__props, { emit: __emit }) {
|
|
1607
|
+
const props = __props;
|
|
1608
|
+
const emit = __emit;
|
|
1609
|
+
const localFieldData = vue.ref({ ...props.fieldData });
|
|
1610
|
+
const fieldsByCategory = vue.computed(() => FIELDS_BY_CATEGORY);
|
|
1611
|
+
vue.watch(() => props.fieldData, (newData) => {
|
|
1612
|
+
localFieldData.value = { ...newData };
|
|
1613
|
+
}, { deep: true });
|
|
1614
|
+
const updateFieldData = () => {
|
|
1615
|
+
emit("update-field-data", { ...localFieldData.value });
|
|
1616
|
+
};
|
|
1617
|
+
const resetData = () => {
|
|
1618
|
+
localFieldData.value = { ...DEFAULT_FIELD_DATA };
|
|
1619
|
+
updateFieldData();
|
|
1620
|
+
};
|
|
1621
|
+
return (_ctx, _cache) => {
|
|
1622
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
|
|
1623
|
+
vue.createElementVNode("div", { class: "panel-header" }, [
|
|
1624
|
+
_cache[0] || (_cache[0] = vue.createElementVNode("h3", null, "字段数据", -1)),
|
|
1625
|
+
vue.createElementVNode("button", {
|
|
1626
|
+
class: "reset-btn",
|
|
1627
|
+
onClick: resetData
|
|
1628
|
+
}, "重置")
|
|
1629
|
+
]),
|
|
1630
|
+
vue.createElementVNode("div", _hoisted_2$2, [
|
|
1631
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(fieldsByCategory.value, (fields, category) => {
|
|
1632
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
1633
|
+
key: category,
|
|
1634
|
+
class: "field-category"
|
|
1635
|
+
}, [
|
|
1636
|
+
vue.createElementVNode("div", _hoisted_3$2, vue.toDisplayString(category), 1),
|
|
1637
|
+
vue.createElementVNode("div", _hoisted_4$2, [
|
|
1638
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(fields, (field) => {
|
|
1639
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
1640
|
+
key: field.key,
|
|
1641
|
+
class: "field-item"
|
|
1642
|
+
}, [
|
|
1643
|
+
vue.createElementVNode("label", _hoisted_5$1, vue.toDisplayString(field.label), 1),
|
|
1644
|
+
vue.withDirectives(vue.createElementVNode("input", {
|
|
1645
|
+
"onUpdate:modelValue": ($event) => localFieldData.value[field.key] = $event,
|
|
1646
|
+
onInput: updateFieldData,
|
|
1647
|
+
type: "text",
|
|
1648
|
+
class: "field-input",
|
|
1649
|
+
placeholder: field.placeholder
|
|
1650
|
+
}, null, 40, _hoisted_6$1), [
|
|
1651
|
+
[vue.vModelText, localFieldData.value[field.key]]
|
|
1652
|
+
]),
|
|
1653
|
+
vue.createElementVNode("div", _hoisted_7$1, vue.toDisplayString(field.description), 1)
|
|
1654
|
+
]);
|
|
1655
|
+
}), 128))
|
|
1656
|
+
])
|
|
1657
|
+
]);
|
|
1658
|
+
}), 128))
|
|
1659
|
+
])
|
|
1660
|
+
]);
|
|
1661
|
+
};
|
|
1662
|
+
}
|
|
1663
|
+
};
|
|
1664
|
+
const FieldDataPanel = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-33e53b63"]]);
|
|
1665
|
+
const _hoisted_1$1 = { class: "preview-dialog" };
|
|
1666
|
+
const _hoisted_2$1 = { class: "preview-content" };
|
|
1667
|
+
const _hoisted_3$1 = { class: "preview-canvas-wrapper" };
|
|
1668
|
+
const _hoisted_4$1 = {
|
|
1669
|
+
key: 0,
|
|
1670
|
+
class: "preview-text-content"
|
|
1671
|
+
};
|
|
1672
|
+
const _hoisted_5 = ["innerHTML"];
|
|
1673
|
+
const _hoisted_6 = {
|
|
1674
|
+
key: 1,
|
|
1675
|
+
class: "preview-image-element"
|
|
1676
|
+
};
|
|
1677
|
+
const _hoisted_7 = ["src"];
|
|
1678
|
+
const _hoisted_8 = {
|
|
1679
|
+
key: 2,
|
|
1680
|
+
class: "preview-qrcode-element"
|
|
1681
|
+
};
|
|
1682
|
+
const _hoisted_9 = ["src"];
|
|
1683
|
+
const _hoisted_10 = {
|
|
1684
|
+
key: 1,
|
|
1685
|
+
class: "preview-qrcode-text"
|
|
1686
|
+
};
|
|
1687
|
+
const _sfc_main$1 = {
|
|
1688
|
+
__name: "CertificatePreview",
|
|
1689
|
+
props: {
|
|
1690
|
+
visible: {
|
|
1691
|
+
type: Boolean,
|
|
1692
|
+
default: false
|
|
1693
|
+
},
|
|
1694
|
+
elements: {
|
|
1695
|
+
type: Array,
|
|
1696
|
+
default: () => []
|
|
1697
|
+
},
|
|
1698
|
+
template: {
|
|
1699
|
+
type: Object,
|
|
1700
|
+
default: null
|
|
1701
|
+
},
|
|
1702
|
+
fieldData: {
|
|
1703
|
+
type: Object,
|
|
1704
|
+
default: () => ({})
|
|
1705
|
+
},
|
|
1706
|
+
systemFields: {
|
|
1707
|
+
type: Array,
|
|
1708
|
+
default: () => SYSTEM_FIELDS
|
|
1709
|
+
}
|
|
1710
|
+
},
|
|
1711
|
+
emits: ["close"],
|
|
1712
|
+
setup(__props, { emit: __emit }) {
|
|
1713
|
+
const props = __props;
|
|
1714
|
+
const emit = __emit;
|
|
1715
|
+
const handleClose = () => {
|
|
1716
|
+
emit("close");
|
|
1717
|
+
};
|
|
1718
|
+
const getCanvasStyle = () => {
|
|
1719
|
+
const baseStyle = {};
|
|
1720
|
+
if (props.template) {
|
|
1721
|
+
baseStyle.width = `${props.template.width}px`;
|
|
1722
|
+
baseStyle.height = `${props.template.height}px`;
|
|
1723
|
+
} else {
|
|
1724
|
+
baseStyle.width = "800px";
|
|
1725
|
+
baseStyle.height = "1000px";
|
|
1726
|
+
}
|
|
1727
|
+
if (props.template && props.template.background) {
|
|
1728
|
+
if (props.template.background.startsWith("data:") || props.template.background.startsWith("http")) {
|
|
1729
|
+
baseStyle.backgroundImage = `url(${props.template.background})`;
|
|
1730
|
+
baseStyle.backgroundSize = "100% 100%";
|
|
1731
|
+
baseStyle.backgroundPosition = "center";
|
|
1732
|
+
baseStyle.backgroundRepeat = "no-repeat";
|
|
1733
|
+
} else {
|
|
1734
|
+
baseStyle.background = props.template.background;
|
|
1735
|
+
baseStyle.backgroundSize = "100% 100%";
|
|
1736
|
+
baseStyle.backgroundPosition = "center";
|
|
1737
|
+
baseStyle.backgroundRepeat = "no-repeat";
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
return baseStyle;
|
|
1741
|
+
};
|
|
1742
|
+
const getElementStyle = (element) => {
|
|
1743
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1744
|
+
const baseStyle = {
|
|
1745
|
+
position: "absolute",
|
|
1746
|
+
left: `${element.x}px`,
|
|
1747
|
+
top: `${element.y}px`,
|
|
1748
|
+
width: `${element.width}px`,
|
|
1749
|
+
minHeight: `${element.height}px`
|
|
1750
|
+
};
|
|
1751
|
+
if (element.type === "text" || element.type === "longtext") {
|
|
1752
|
+
return {
|
|
1753
|
+
...baseStyle,
|
|
1754
|
+
fontSize: `${((_a = element.style) == null ? void 0 : _a.fontSize) || 18}px`,
|
|
1755
|
+
fontFamily: ((_b = element.style) == null ? void 0 : _b.fontFamily) || "方正书宋简体",
|
|
1756
|
+
fontWeight: ((_c = element.style) == null ? void 0 : _c.fontWeight) || "normal",
|
|
1757
|
+
fontStyle: ((_d = element.style) == null ? void 0 : _d.fontStyle) || "normal",
|
|
1758
|
+
textDecoration: ((_e = element.style) == null ? void 0 : _e.textDecoration) || "none",
|
|
1759
|
+
color: ((_f = element.style) == null ? void 0 : _f.color) || "#000000",
|
|
1760
|
+
textAlign: ((_g = element.style) == null ? void 0 : _g.textAlign) || "left",
|
|
1761
|
+
lineHeight: ((_h = element.style) == null ? void 0 : _h.lineHeight) || 1.2
|
|
1762
|
+
};
|
|
1763
|
+
}
|
|
1764
|
+
return baseStyle;
|
|
1765
|
+
};
|
|
1766
|
+
const renderTextWithFields = (text) => {
|
|
1767
|
+
if (!text) return "";
|
|
1768
|
+
const fieldData = props.fieldData || {};
|
|
1769
|
+
let result = text;
|
|
1770
|
+
props.systemFields.forEach((field) => {
|
|
1771
|
+
const placeholder = field.placeholder;
|
|
1772
|
+
const value = fieldData[field.key] || placeholder;
|
|
1773
|
+
const regex = new RegExp(placeholder.replace(/[{}]/g, "\\$&"), "g");
|
|
1774
|
+
result = result.replace(regex, value);
|
|
1775
|
+
});
|
|
1776
|
+
return result;
|
|
1777
|
+
};
|
|
1778
|
+
const getImageSrc = (element) => {
|
|
1779
|
+
if (!element) return null;
|
|
1780
|
+
if (element.imageSource === "field") {
|
|
1781
|
+
const fieldKey = element.imageField;
|
|
1782
|
+
if (fieldKey && props.fieldData && props.fieldData[fieldKey]) {
|
|
1783
|
+
return props.fieldData[fieldKey];
|
|
1784
|
+
}
|
|
1785
|
+
return null;
|
|
1786
|
+
} else {
|
|
1787
|
+
return element.imageUrl || null;
|
|
1788
|
+
}
|
|
1789
|
+
};
|
|
1790
|
+
const getQrcodeContent = (element) => {
|
|
1791
|
+
if (!element) return null;
|
|
1792
|
+
if (element.qrcodeSource === "field") {
|
|
1793
|
+
const fieldKey = element.qrcodeField;
|
|
1794
|
+
if (fieldKey && props.fieldData && props.fieldData[fieldKey]) {
|
|
1795
|
+
return props.fieldData[fieldKey];
|
|
1796
|
+
}
|
|
1797
|
+
return null;
|
|
1798
|
+
} else {
|
|
1799
|
+
return element.qrcodeContent || null;
|
|
1800
|
+
}
|
|
1801
|
+
};
|
|
1802
|
+
const isImageUrl = (url) => {
|
|
1803
|
+
if (!url) return false;
|
|
1804
|
+
if (url.startsWith("data:image/")) return true;
|
|
1805
|
+
if (url.startsWith("http://") || url.startsWith("https://")) {
|
|
1806
|
+
const imageExtensions = [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg", ".bmp"];
|
|
1807
|
+
const lowerUrl = url.toLowerCase();
|
|
1808
|
+
return imageExtensions.some((ext) => lowerUrl.includes(ext));
|
|
1809
|
+
}
|
|
1810
|
+
return false;
|
|
1811
|
+
};
|
|
1812
|
+
return (_ctx, _cache) => {
|
|
1813
|
+
return __props.visible ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
1814
|
+
key: 0,
|
|
1815
|
+
class: "preview-overlay",
|
|
1816
|
+
onClick: vue.withModifiers(handleClose, ["self"])
|
|
1817
|
+
}, [
|
|
1818
|
+
vue.createElementVNode("div", _hoisted_1$1, [
|
|
1819
|
+
vue.createElementVNode("div", { class: "preview-header" }, [
|
|
1820
|
+
_cache[0] || (_cache[0] = vue.createElementVNode("h3", null, "证书预览", -1)),
|
|
1821
|
+
vue.createElementVNode("button", {
|
|
1822
|
+
class: "close-btn",
|
|
1823
|
+
onClick: handleClose
|
|
1824
|
+
}, "×")
|
|
1825
|
+
]),
|
|
1826
|
+
vue.createElementVNode("div", _hoisted_2$1, [
|
|
1827
|
+
vue.createElementVNode("div", _hoisted_3$1, [
|
|
1828
|
+
vue.createElementVNode("div", {
|
|
1829
|
+
class: "preview-canvas",
|
|
1830
|
+
style: vue.normalizeStyle(getCanvasStyle())
|
|
1831
|
+
}, [
|
|
1832
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.elements, (element) => {
|
|
1833
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
1834
|
+
key: element.id,
|
|
1835
|
+
class: vue.normalizeClass(["preview-element", element.type]),
|
|
1836
|
+
style: vue.normalizeStyle(getElementStyle(element))
|
|
1837
|
+
}, [
|
|
1838
|
+
element.type === "text" || element.type === "longtext" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$1, [
|
|
1839
|
+
vue.createElementVNode("span", {
|
|
1840
|
+
innerHTML: renderTextWithFields(element.content)
|
|
1841
|
+
}, null, 8, _hoisted_5)
|
|
1842
|
+
])) : element.type === "image" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
|
|
1843
|
+
getImageSrc(element) ? (vue.openBlock(), vue.createElementBlock("img", {
|
|
1844
|
+
key: 0,
|
|
1845
|
+
src: getImageSrc(element),
|
|
1846
|
+
alt: "图片",
|
|
1847
|
+
class: "preview-element-image"
|
|
1848
|
+
}, null, 8, _hoisted_7)) : vue.createCommentVNode("", true)
|
|
1849
|
+
])) : element.type === "qrcode" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
|
|
1850
|
+
getQrcodeContent(element) && isImageUrl(getQrcodeContent(element)) ? (vue.openBlock(), vue.createElementBlock("img", {
|
|
1851
|
+
key: 0,
|
|
1852
|
+
src: getQrcodeContent(element),
|
|
1853
|
+
alt: "二维码",
|
|
1854
|
+
class: "preview-element-image"
|
|
1855
|
+
}, null, 8, _hoisted_9)) : getQrcodeContent(element) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10, vue.toDisplayString(getQrcodeContent(element)), 1)) : vue.createCommentVNode("", true)
|
|
1856
|
+
])) : vue.createCommentVNode("", true)
|
|
1857
|
+
], 6);
|
|
1858
|
+
}), 128))
|
|
1859
|
+
], 4)
|
|
1860
|
+
])
|
|
1861
|
+
])
|
|
1862
|
+
])
|
|
1863
|
+
])) : vue.createCommentVNode("", true);
|
|
1864
|
+
};
|
|
1865
|
+
}
|
|
1866
|
+
};
|
|
1867
|
+
const CertificatePreview = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-813a5922"]]);
|
|
1868
|
+
const _hoisted_1 = { class: "certificate-editor" };
|
|
1869
|
+
const _hoisted_2 = { class: "toolbar" };
|
|
1870
|
+
const _hoisted_3 = { class: "certificate-editor-content" };
|
|
1871
|
+
const _hoisted_4 = { class: "right-panel" };
|
|
1872
|
+
const _sfc_main = {
|
|
1873
|
+
__name: "CertificateEditor",
|
|
1874
|
+
props: {
|
|
1875
|
+
systemFields: {
|
|
1876
|
+
type: Array,
|
|
1877
|
+
default: () => SYSTEM_FIELDS
|
|
1878
|
+
}
|
|
1879
|
+
},
|
|
1880
|
+
emits: ["save"],
|
|
1881
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
1882
|
+
const emit = __emit;
|
|
1883
|
+
const elements = vue.ref([]);
|
|
1884
|
+
const selectedElement = vue.ref(null);
|
|
1885
|
+
const fieldData = vue.ref({});
|
|
1886
|
+
const showPreview = vue.ref(false);
|
|
1887
|
+
const currentTemplate = vue.ref(PRESET_TEMPLATES.find((t) => t.type === "vertical") || PRESET_TEMPLATES[0]);
|
|
1888
|
+
vue.onMounted(() => {
|
|
1889
|
+
elements.value = [
|
|
1890
|
+
{
|
|
1891
|
+
id: 1,
|
|
1892
|
+
type: "text",
|
|
1893
|
+
x: 115,
|
|
1894
|
+
y: 466,
|
|
1895
|
+
width: 698,
|
|
1896
|
+
height: 29,
|
|
1897
|
+
content: "{{姓名}} ({{性别称呼}})",
|
|
1898
|
+
style: {
|
|
1899
|
+
fontSize: 18,
|
|
1900
|
+
fontFamily: "方正书宋简体",
|
|
1901
|
+
fontWeight: "normal",
|
|
1902
|
+
fontStyle: "normal",
|
|
1903
|
+
textDecoration: "none",
|
|
1904
|
+
color: "#000000",
|
|
1905
|
+
textAlign: "left",
|
|
1906
|
+
lineHeight: 1.2
|
|
1907
|
+
}
|
|
1908
|
+
},
|
|
1909
|
+
{
|
|
1910
|
+
id: 2,
|
|
1911
|
+
type: "longtext",
|
|
1912
|
+
x: 115,
|
|
1913
|
+
y: 520,
|
|
1914
|
+
width: 698,
|
|
1915
|
+
height: 80,
|
|
1916
|
+
content: '您参加了"{{考试名称}}"考试,成绩: {{成绩等级}},经审定,准予颁发考试证书!',
|
|
1917
|
+
style: {
|
|
1918
|
+
fontSize: 18,
|
|
1919
|
+
fontFamily: "方正书宋简体",
|
|
1920
|
+
fontWeight: "normal",
|
|
1921
|
+
fontStyle: "normal",
|
|
1922
|
+
textDecoration: "none",
|
|
1923
|
+
color: "#000000",
|
|
1924
|
+
textAlign: "left",
|
|
1925
|
+
lineHeight: 1.2
|
|
1926
|
+
}
|
|
1927
|
+
},
|
|
1928
|
+
{
|
|
1929
|
+
id: 3,
|
|
1930
|
+
type: "text",
|
|
1931
|
+
x: 115,
|
|
1932
|
+
y: 620,
|
|
1933
|
+
width: 698,
|
|
1934
|
+
height: 29,
|
|
1935
|
+
content: "证书编号: {{证书编号}}",
|
|
1936
|
+
style: {
|
|
1937
|
+
fontSize: 18,
|
|
1938
|
+
fontFamily: "方正书宋简体",
|
|
1939
|
+
fontWeight: "normal",
|
|
1940
|
+
fontStyle: "normal",
|
|
1941
|
+
textDecoration: "none",
|
|
1942
|
+
color: "#000000",
|
|
1943
|
+
textAlign: "left",
|
|
1944
|
+
lineHeight: 1.2
|
|
1945
|
+
}
|
|
1946
|
+
},
|
|
1947
|
+
{
|
|
1948
|
+
id: 4,
|
|
1949
|
+
type: "text",
|
|
1950
|
+
x: 115,
|
|
1951
|
+
y: 660,
|
|
1952
|
+
width: 698,
|
|
1953
|
+
height: 29,
|
|
1954
|
+
content: "有效期: {{有效期}}",
|
|
1955
|
+
style: {
|
|
1956
|
+
fontSize: 18,
|
|
1957
|
+
fontFamily: "方正书宋简体",
|
|
1958
|
+
fontWeight: "normal",
|
|
1959
|
+
fontStyle: "normal",
|
|
1960
|
+
textDecoration: "none",
|
|
1961
|
+
color: "#000000",
|
|
1962
|
+
textAlign: "left",
|
|
1963
|
+
lineHeight: 1.2
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
];
|
|
1967
|
+
});
|
|
1968
|
+
const handleAddElement = (type) => {
|
|
1969
|
+
const newElement = {
|
|
1970
|
+
id: Date.now(),
|
|
1971
|
+
type,
|
|
1972
|
+
x: 100,
|
|
1973
|
+
y: 100,
|
|
1974
|
+
width: type === "text" ? 200 : type === "qrcode" ? 100 : 150,
|
|
1975
|
+
height: type === "text" ? 50 : type === "qrcode" ? 100 : 150,
|
|
1976
|
+
content: type === "text" ? "新文本" : "",
|
|
1977
|
+
style: {
|
|
1978
|
+
fontSize: 18,
|
|
1979
|
+
fontFamily: "方正书宋简体",
|
|
1980
|
+
fontWeight: "normal",
|
|
1981
|
+
fontStyle: "normal",
|
|
1982
|
+
textDecoration: "none",
|
|
1983
|
+
color: "#000000",
|
|
1984
|
+
textAlign: "left",
|
|
1985
|
+
lineHeight: 1.2
|
|
1986
|
+
}
|
|
1987
|
+
};
|
|
1988
|
+
if (type === "image") {
|
|
1989
|
+
newElement.imageSource = "url";
|
|
1990
|
+
newElement.imageUrl = "";
|
|
1991
|
+
newElement.imageField = "";
|
|
1992
|
+
}
|
|
1993
|
+
if (type === "qrcode") {
|
|
1994
|
+
newElement.qrcodeSource = "url";
|
|
1995
|
+
newElement.qrcodeContent = "";
|
|
1996
|
+
newElement.qrcodeField = "";
|
|
1997
|
+
}
|
|
1998
|
+
elements.value.push(newElement);
|
|
1999
|
+
selectedElement.value = newElement;
|
|
2000
|
+
};
|
|
2001
|
+
const handleSelectElement = (element) => {
|
|
2002
|
+
selectedElement.value = element;
|
|
2003
|
+
};
|
|
2004
|
+
const handleUpdateElement = (updatedElement) => {
|
|
2005
|
+
const index = elements.value.findIndex((el) => el.id === updatedElement.id);
|
|
2006
|
+
if (index !== -1) {
|
|
2007
|
+
elements.value[index] = { ...updatedElement };
|
|
2008
|
+
selectedElement.value = elements.value[index];
|
|
2009
|
+
}
|
|
2010
|
+
};
|
|
2011
|
+
const handleDeleteElement = (elementId) => {
|
|
2012
|
+
var _a;
|
|
2013
|
+
elements.value = elements.value.filter((el) => el.id !== elementId);
|
|
2014
|
+
if (((_a = selectedElement.value) == null ? void 0 : _a.id) === elementId) {
|
|
2015
|
+
selectedElement.value = null;
|
|
2016
|
+
}
|
|
2017
|
+
};
|
|
2018
|
+
const handleUpdateFieldData = (newFieldData) => {
|
|
2019
|
+
fieldData.value = { ...newFieldData };
|
|
2020
|
+
};
|
|
2021
|
+
const handleSelectTemplate = (template) => {
|
|
2022
|
+
currentTemplate.value = template;
|
|
2023
|
+
};
|
|
2024
|
+
const handleUploadTemplate = (template) => {
|
|
2025
|
+
currentTemplate.value = template;
|
|
2026
|
+
};
|
|
2027
|
+
const getCertificateData = () => {
|
|
2028
|
+
return {
|
|
2029
|
+
template: currentTemplate.value,
|
|
2030
|
+
elements: elements.value,
|
|
2031
|
+
fieldData: fieldData.value,
|
|
2032
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
2033
|
+
};
|
|
2034
|
+
};
|
|
2035
|
+
const handleSave = () => {
|
|
2036
|
+
const certificateConfig = getCertificateData();
|
|
2037
|
+
console.log("=== 证书配置数据 ===");
|
|
2038
|
+
console.log(JSON.stringify(certificateConfig, null, 2));
|
|
2039
|
+
console.log("==================");
|
|
2040
|
+
emit("save", certificateConfig);
|
|
2041
|
+
alert("证书配置已保存,数据已传递给父组件");
|
|
2042
|
+
};
|
|
2043
|
+
__expose({
|
|
2044
|
+
getCertificateData
|
|
2045
|
+
});
|
|
2046
|
+
return (_ctx, _cache) => {
|
|
2047
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
2048
|
+
vue.createElementVNode("div", _hoisted_2, [
|
|
2049
|
+
vue.createElementVNode("button", {
|
|
2050
|
+
class: "toolbar-btn preview-btn",
|
|
2051
|
+
onClick: _cache[0] || (_cache[0] = ($event) => showPreview.value = true)
|
|
2052
|
+
}, [..._cache[2] || (_cache[2] = [
|
|
2053
|
+
vue.createElementVNode("span", null, "👁️", -1),
|
|
2054
|
+
vue.createElementVNode("span", null, "预览", -1)
|
|
2055
|
+
])]),
|
|
2056
|
+
vue.createElementVNode("button", {
|
|
2057
|
+
class: "toolbar-btn save-btn",
|
|
2058
|
+
onClick: handleSave
|
|
2059
|
+
}, [..._cache[3] || (_cache[3] = [
|
|
2060
|
+
vue.createElementVNode("span", null, "💾", -1),
|
|
2061
|
+
vue.createElementVNode("span", null, "保存", -1)
|
|
2062
|
+
])])
|
|
2063
|
+
]),
|
|
2064
|
+
vue.createElementVNode("div", _hoisted_3, [
|
|
2065
|
+
vue.createVNode(DesignPanel, {
|
|
2066
|
+
onAddElement: handleAddElement,
|
|
2067
|
+
onSelectTemplate: handleSelectTemplate,
|
|
2068
|
+
onUploadTemplate: handleUploadTemplate,
|
|
2069
|
+
class: "left-panel"
|
|
2070
|
+
}),
|
|
2071
|
+
vue.createVNode(CanvasArea, {
|
|
2072
|
+
elements: elements.value,
|
|
2073
|
+
"selected-element": selectedElement.value,
|
|
2074
|
+
"field-data": fieldData.value,
|
|
2075
|
+
template: currentTemplate.value,
|
|
2076
|
+
"system-fields": __props.systemFields,
|
|
2077
|
+
onSelectElement: handleSelectElement,
|
|
2078
|
+
onUpdateElement: handleUpdateElement,
|
|
2079
|
+
onDeleteElement: handleDeleteElement,
|
|
2080
|
+
class: "canvas-area"
|
|
2081
|
+
}, null, 8, ["elements", "selected-element", "field-data", "template", "system-fields"]),
|
|
2082
|
+
vue.createElementVNode("div", _hoisted_4, [
|
|
2083
|
+
selectedElement.value ? (vue.openBlock(), vue.createBlock(PropertiesPanel, {
|
|
2084
|
+
key: 0,
|
|
2085
|
+
element: selectedElement.value,
|
|
2086
|
+
"system-fields": __props.systemFields,
|
|
2087
|
+
onUpdateElement: handleUpdateElement,
|
|
2088
|
+
class: "properties-section"
|
|
2089
|
+
}, null, 8, ["element", "system-fields"])) : vue.createCommentVNode("", true),
|
|
2090
|
+
vue.createVNode(FieldDataPanel, {
|
|
2091
|
+
"field-data": fieldData.value,
|
|
2092
|
+
onUpdateFieldData: handleUpdateFieldData,
|
|
2093
|
+
class: "field-data-section"
|
|
2094
|
+
}, null, 8, ["field-data"])
|
|
2095
|
+
])
|
|
2096
|
+
]),
|
|
2097
|
+
vue.createVNode(CertificatePreview, {
|
|
2098
|
+
visible: showPreview.value,
|
|
2099
|
+
elements: elements.value,
|
|
2100
|
+
template: currentTemplate.value,
|
|
2101
|
+
"field-data": fieldData.value,
|
|
2102
|
+
"system-fields": __props.systemFields,
|
|
2103
|
+
onClose: _cache[1] || (_cache[1] = ($event) => showPreview.value = false)
|
|
2104
|
+
}, null, 8, ["visible", "elements", "template", "field-data", "system-fields"])
|
|
2105
|
+
]);
|
|
2106
|
+
};
|
|
2107
|
+
}
|
|
2108
|
+
};
|
|
2109
|
+
const CertificateEditor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8565cf9a"]]);
|
|
2110
|
+
exports2.CanvasArea = CanvasArea;
|
|
2111
|
+
exports2.CertificateEditor = CertificateEditor;
|
|
2112
|
+
exports2.CertificatePreview = CertificatePreview;
|
|
2113
|
+
exports2.DEFAULT_FIELD_DATA = DEFAULT_FIELD_DATA;
|
|
2114
|
+
exports2.DesignPanel = DesignPanel;
|
|
2115
|
+
exports2.FieldDataPanel = FieldDataPanel;
|
|
2116
|
+
exports2.FieldDialog = FieldDialog;
|
|
2117
|
+
exports2.PRESET_TEMPLATES = PRESET_TEMPLATES;
|
|
2118
|
+
exports2.PropertiesPanel = PropertiesPanel;
|
|
2119
|
+
exports2.SYSTEM_FIELDS = SYSTEM_FIELDS;
|
|
2120
|
+
exports2.default = CertificateEditor;
|
|
2121
|
+
exports2.extractFields = extractFields;
|
|
2122
|
+
exports2.fileToBase64 = fileToBase64;
|
|
2123
|
+
exports2.getFieldByKey = getFieldByKey;
|
|
2124
|
+
exports2.getPlaceholderByKey = getPlaceholderByKey;
|
|
2125
|
+
exports2.getTemplateSizeSuggestion = getTemplateSizeSuggestion;
|
|
2126
|
+
exports2.hasFields = hasFields;
|
|
2127
|
+
exports2.replaceFields = replaceFields;
|
|
2128
|
+
exports2.validateImageFile = validateImageFile;
|
|
2129
|
+
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
2130
|
+
});
|
|
2131
|
+
//# sourceMappingURL=z-certificate-editor.umd.js.map
|