feat: 优化三个文本框显示逻辑,改为添加背景图后自动显示
This commit is contained in:
@@ -414,6 +414,11 @@ html, body {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
/* 隐藏元素 */
|
||||
.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏空提示 */
|
||||
.empty-tip.hidden {
|
||||
display: none;
|
||||
|
||||
@@ -84,13 +84,13 @@
|
||||
<div class="guide-line guide-horizontal" id="guideH"></div>
|
||||
<div class="guide-line guide-vertical" id="guideV"></div>
|
||||
<!-- 输入框图层 -->
|
||||
<div class="preview-input-layer">
|
||||
<div class="preview-input-layer" id="previewInputLayer">
|
||||
<!-- 文字输入框1 - 企业 -->
|
||||
<div class="text-input" id="input1" contenteditable="false" style="left: 98px; top: 232.945px;">企业:</div>
|
||||
<div class="text-input hidden" id="input1" contenteditable="false" style="left: 98px; top: 232.945px;">企业:</div>
|
||||
<!-- 文字输入框2 - 姓名 -->
|
||||
<div class="text-input" id="input2" contenteditable="false" style="left: 98px; top: 275.555px;">姓名:</div>
|
||||
<div class="text-input hidden" id="input2" contenteditable="false" style="left: 98px; top: 275.555px;">姓名:</div>
|
||||
<!-- 文字输入框3 - 编号 -->
|
||||
<div class="text-input" id="input3" contenteditable="false" style="left: 98px; top: 317.548px;">编号:</div>
|
||||
<div class="text-input hidden" id="input3" contenteditable="false" style="left: 98px; top: 317.548px;">编号:</div>
|
||||
</div>
|
||||
<!-- 提示文字(最上层,层叠图之下) -->
|
||||
<div class="empty-tip" id="emptyTip">请点击上方「添加图片」按钮上传背景图</div>
|
||||
|
||||
12
js/script.js
12
js/script.js
@@ -239,11 +239,23 @@
|
||||
bgOpacitySlider.value = 100;
|
||||
bgOpacityValue.textContent = '100%';
|
||||
updateBgImage();
|
||||
|
||||
// 显示预设的文本输入框
|
||||
showPresetTextInputs();
|
||||
};
|
||||
img.src = e.target.result;
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
|
||||
// 显示预设的文本输入框
|
||||
function showPresetTextInputs() {
|
||||
[input1, input2, input3].forEach(inputEl => {
|
||||
if (inputEl) {
|
||||
inputEl.classList.remove('hidden');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 添加文本输入框
|
||||
function addTextInput() {
|
||||
|
||||
Reference in New Issue
Block a user