| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>生成占位二维码</title>
- <style>
- body {
- display: flex;
- justify-content: center;
- align-items: center;
- min-height: 100vh;
- background: #f5f5f5;
- font-family: Arial, sans-serif;
- }
- .container {
- text-align: center;
- background: white;
- padding: 40px;
- border-radius: 10px;
- box-shadow: 0 2px 10px rgba(0,0,0,0.1);
- }
- canvas {
- border: 1px solid #ddd;
- margin: 20px 0;
- }
- button {
- padding: 10px 20px;
- background: #4caf50;
- color: white;
- border: none;
- border-radius: 5px;
- cursor: pointer;
- font-size: 16px;
- }
- button:hover {
- background: #45a049;
- }
- .note {
- margin-top: 20px;
- color: #666;
- font-size: 14px;
- }
- </style>
- </head>
- <body>
- <div class="container">
- <h2>生成占位二维码图片</h2>
- <canvas id="canvas" width="200" height="200"></canvas>
- <br>
- <button onclick="downloadImage()">下载为 payment-qrcode.png</button>
- <div class="note">
- <p>这是一个占位图片,请替换为你的真实支付二维码</p>
- <p>下载后放在 images 文件夹中即可</p>
- </div>
- </div>
- <script>
- // 绘制占位二维码
- const canvas = document.getElementById('canvas');
- const ctx = canvas.getContext('2d');
-
- // 背景
- ctx.fillStyle = '#ffffff';
- ctx.fillRect(0, 0, 200, 200);
-
- // 边框
- ctx.strokeStyle = '#333';
- ctx.lineWidth = 2;
- ctx.strokeRect(10, 10, 180, 180);
-
- // 文字
- ctx.fillStyle = '#333';
- ctx.font = 'bold 16px Arial';
- ctx.textAlign = 'center';
- ctx.fillText('支付二维码', 100, 90);
- ctx.font = '12px Arial';
- ctx.fillText('请替换为真实二维码', 100, 110);
-
- // 简单的二维码图案
- ctx.fillStyle = '#333';
- for (let i = 0; i < 8; i++) {
- for (let j = 0; j < 8; j++) {
- if ((i + j) % 2 === 0) {
- ctx.fillRect(50 + i * 12, 120 + j * 8, 10, 6);
- }
- }
- }
-
- function downloadImage() {
- const link = document.createElement('a');
- link.download = 'payment-qrcode.png';
- link.href = canvas.toDataURL('image/png');
- link.click();
- }
- </script>
- </body>
- </html>
|