From 02f3adb936590dcc6ed7e346e3d5d5a3b526df59 Mon Sep 17 00:00:00 2001 From: Zhukj <3262118957> Date: Sat, 25 Apr 2026 15:13:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=82=80=E8=AF=B7=E5=87=BD):=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=BA=8C=E7=BB=B4=E7=A0=81=E7=94=9F=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增二维码按钮及弹窗界面 - 实现二维码生成、预览和添加到画布功能 - 支持二维码在画布上的拖拽操作 - 添加相关样式和事件处理 --- css/qr.css | 136 ++++++++++++++++++++++++++++++++++++++ index.html | 22 +++++++ js/qr.js | 179 +++++++++++++++++++++++++++++++++++++++++++++++++++ js/script.js | 29 +++++++++ 4 files changed, 366 insertions(+) create mode 100644 css/qr.css create mode 100644 js/qr.js diff --git a/css/qr.css b/css/qr.css new file mode 100644 index 0000000..fe0dc40 --- /dev/null +++ b/css/qr.css @@ -0,0 +1,136 @@ +/* 二维码功能样式 */ + +/* 悬浮按钮 */ +#qr-btn { + position: fixed; + bottom: 100px; + left: 20px; + width: 44px; + height: 44px; + padding: 0; + border-radius: 50%; + background: #4a90e2; + color: #fff; + border: none; + font-size: 12px; + font-weight: bold; + cursor: pointer; + box-shadow: 0 2px 8px rgba(0,0,0,0.3); + z-index: 1000; + display: none; + white-space: nowrap; +} + +#qr-btn.show { + display: block; +} + +#qr-btn:hover { + background: #3a7bc8; +} + +/* 弹窗 */ +#qr-modal { + display: none; + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(0,0,0,0.5); + z-index: 10000; + justify-content: center; + align-items: center; +} + +#qr-modal.active { + display: flex; +} + +.qr-box { + background: #fff; + border-radius: 8px; + width: 320px; + max-width: 90%; +} + +.qr-header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 15px 20px; + border-bottom: 1px solid #eee; +} + +.qr-header h3 { + margin: 0; + font-size: 16px; +} + +.qr-close { + background: none; + border: none; + font-size: 24px; + color: #999; + cursor: pointer; +} + +.qr-body { + padding: 20px; +} + +#qr-input { + width: 100%; + padding: 10px; + border: 1px solid #ddd; + border-radius: 4px; + font-size: 14px; + box-sizing: border-box; +} + +#qr-preview { + margin-top: 15px; + min-height: 128px; + display: flex; + justify-content: center; + align-items: center; + background: #f5f5f5; + border-radius: 4px; +} + +#qr-preview canvas { + display: block; +} + +.qr-footer { + display: flex; + justify-content: flex-end; + gap: 10px; + padding: 15px 20px; + border-top: 1px solid #eee; +} + +.qr-btn { + padding: 8px 16px; + border: none; + border-radius: 4px; + cursor: pointer; + font-size: 14px; +} + +.qr-cancel { + background: #f0f0f0; + color: #333; +} + +.qr-ok { + background: #4a90e2; + color: #fff; +} + +/* 画布上的二维码 */ +.qr-item { + position: absolute; + cursor: move; + user-select: none; +} diff --git a/index.html b/index.html index 6da74b6..b6d58ce 100644 --- a/index.html +++ b/index.html @@ -5,6 +5,7 @@