Skip to content

Commit c441f1e

Browse files
committed
feat: 在主頁加入 QR Code 功能
- 新增 QR Code 顯示區塊,方便手機掃描快速存取 - 引入 qrcodejs 函式庫自動生成 QR Code - 美化 QR Code 顯示樣式,整合至頁面設計
1 parent f9bea5f commit c441f1e

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

index.html

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,34 @@
233233
margin-top: 30px;
234234
}
235235

236+
/* QR Code 樣式 */
237+
.qr-code-section {
238+
text-align: center;
239+
margin: 30px 0;
240+
padding: 30px;
241+
background: #f0f0f0;
242+
border-radius: 10px;
243+
}
244+
245+
.qr-code-section h3 {
246+
color: #667eea;
247+
margin-bottom: 20px;
248+
}
249+
250+
#qrcode {
251+
display: inline-block;
252+
padding: 20px;
253+
background: white;
254+
border-radius: 10px;
255+
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
256+
}
257+
258+
.qr-note {
259+
margin-top: 15px;
260+
color: #666;
261+
font-size: 0.9rem;
262+
}
263+
236264
@media (max-width: 768px) {
237265
.header h1 {
238266
font-size: 2rem;
@@ -248,6 +276,7 @@
248276
}
249277
</style>
250278
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
279+
<script src="https://cdn.jsdelivr.net/npm/qrcodejs@1.0.0/qrcode.min.js"></script>
251280
<style>
252281
/* Markdown 內容樣式 */
253282
.markdown-modal {
@@ -455,6 +484,12 @@ <h3>🚀 快速開始</h3>
455484
</div>
456485
</div>
457486

487+
<div class="qr-code-section">
488+
<h3>📱 手機掃描 QR Code 快速存取</h3>
489+
<div id="qrcode"></div>
490+
<p class="qr-note">掃描 QR Code 即可在手機上瀏覽完整教學內容</p>
491+
</div>
492+
458493
<div class="scenarios">
459494
<h2>📚 8 個學習場景</h2>
460495
<div class="scenario-list">
@@ -720,6 +755,22 @@ <h2>❌ 載入失敗</h2>
720755
block.appendChild(buttonContainer);
721756
});
722757
}
758+
759+
// 生成 QR Code
760+
window.onload = function() {
761+
const currentUrl = window.location.href;
762+
const qrcodeContainer = document.getElementById('qrcode');
763+
764+
// 生成 QR Code
765+
new QRCode(qrcodeContainer, {
766+
text: currentUrl,
767+
width: 200,
768+
height: 200,
769+
colorDark: "#000000",
770+
colorLight: "#ffffff",
771+
correctLevel: QRCode.CorrectLevel.H
772+
});
773+
}
723774
</script>
724775
</body>
725776
</html>

0 commit comments

Comments
 (0)