feat: 多模板支持,URL 查询参数 ?t= 切换不同邀请函配置
This commit is contained in:
95
js/config.js
95
js/config.js
@@ -2,40 +2,69 @@
|
||||
// 邀请函制作工具 - 全局配置文件
|
||||
// 修改以下数值即可调整外观,无需改动代码
|
||||
// ============================================
|
||||
//
|
||||
// 多模板支持:通过 URL 查询参数 ?t=模板名 切换
|
||||
// 例如:index.html?t=wedding
|
||||
// 不传参数时使用 default 模板
|
||||
|
||||
// -------- 默认背景图 --------
|
||||
// 修改为你的图片路径即可替换默认背景
|
||||
var DEFAULT_BG_IMAGE = './images/default-bg.jpg';
|
||||
var CONFIG = {
|
||||
// 默认模板名(URL 未指定或找不到时使用)
|
||||
defaultTemplate: 'default',
|
||||
|
||||
// -------- 三个预设输入框的初始位置与样式 --------
|
||||
var INPUTS_CONFIG = {
|
||||
"inputs": [
|
||||
{
|
||||
"id": "input1",
|
||||
"label": "企业",
|
||||
"left": 100,
|
||||
"top": 218.4,
|
||||
"fontWeight": 700,
|
||||
"placeholder": "请输入",
|
||||
"isLocked": false // true=锁定位置(不可拖动,仍可编辑), false=自由拖动
|
||||
},
|
||||
{
|
||||
"id": "input2",
|
||||
"label": "嘉宾",
|
||||
"left": 100,
|
||||
"top": 261.4,
|
||||
"fontWeight": 700,
|
||||
"placeholder": "请输入",
|
||||
"isLocked": false // true=锁定位置(不可拖动,仍可编辑), false=自由拖动
|
||||
},
|
||||
{
|
||||
"id": "input3",
|
||||
"label": "编号",
|
||||
"left": 100,
|
||||
"top": 308.1,
|
||||
"fontWeight": 700,
|
||||
"placeholder": "请输入",
|
||||
"isLocked": false // true=锁定位置(不可拖动,仍可编辑), false=自由拖动
|
||||
// ========== 所有模板 ==========
|
||||
templates: {
|
||||
|
||||
// -------- 默认模板 --------
|
||||
default: {
|
||||
title: '通用邀请函',
|
||||
bgImage: './images/default-bg.jpg',
|
||||
inputs: [
|
||||
{
|
||||
id: "input1",
|
||||
label: "企业",
|
||||
left: 100,
|
||||
top: 218.4,
|
||||
fontWeight: 700,
|
||||
placeholder: "请输入",
|
||||
isLocked: false
|
||||
},
|
||||
{
|
||||
id: "input2",
|
||||
label: "嘉宾",
|
||||
left: 100,
|
||||
top: 261.4,
|
||||
fontWeight: 700,
|
||||
placeholder: "请输入",
|
||||
isLocked: false
|
||||
},
|
||||
{
|
||||
id: "input3",
|
||||
label: "编号",
|
||||
left: 100,
|
||||
top: 308.1,
|
||||
fontWeight: 700,
|
||||
placeholder: "请输入",
|
||||
isLocked: false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
// -------- 在此下方添加更多模板 --------
|
||||
// 用法:浏览器打开 index.html?t=wedding
|
||||
//
|
||||
,wedding: {
|
||||
title: '婚礼邀请函',
|
||||
bgImage: './images/wedding-bg.jpg',
|
||||
inputs: [
|
||||
{ id: "input1", label: "新郎", left: 50, top: 200, fontWeight: 700, placeholder: "请输入新郎名" },
|
||||
{ id: "input2", label: "新娘", left: 50, top: 250, fontWeight: 700, placeholder: "请输入新娘名" },
|
||||
{ id: "input3", label: "婚期", left: 50, top: 300, fontWeight: 700, placeholder: "请输入日期" }
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
// -------- 兼容旧代码(由 script.js 内部使用) --------
|
||||
// 以下变量由 script.js 自动从 CONFIG 读取,无需手动修改
|
||||
var ACTIVE_TEMPLATE = null;
|
||||
|
||||
Reference in New Issue
Block a user