| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <!doctype html>
- <html lang="zh-CN">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title><%= title %></title>
- <link rel="stylesheet" href="/styles.css">
- </head>
- <body>
- <%- include('partials/nav') %>
- <main>
- <section class="hero tile-light compact page-intro">
- <p class="eyebrow">Mainland China Calendar</p>
- <h1>节假日导入</h1>
- <p class="lead">复制提示词给大模型,生成 JSON 后粘贴导入。</p>
- </section>
- <% if (message) { %><div class="notice"><%= message %></div><% } %>
- <% if (error) { %><div class="notice notice-error"><%= error %></div><% } %>
- <section class="tile-parchment compact two-col holiday-import-grid">
- <article class="utility-card holiday-card">
- <div class="holiday-card-header">
- <h2>生成节假日数据</h2>
- </div>
- <textarea class="holiday-textarea" id="prompt" readonly><%= prompt %></textarea>
- <button class="button-primary holiday-action" type="button" onclick="copyPrompt()">复制提示词</button>
- </article>
- <article class="utility-card holiday-card">
- <div class="holiday-card-header">
- <h2>粘贴并导入 JSON</h2>
- </div>
- <form method="post" action="/holidays/import" class="holiday-form">
- <textarea class="holiday-textarea" name="holiday_json" placeholder="把大模型生成的 JSON 粘贴到这里"></textarea>
- <button class="button-primary holiday-action">导入节假日</button>
- </form>
- </article>
- </section>
- <section class="tile-light compact">
- <div class="table-wrap utility-card wide">
- <div class="table-card-header">
- <h2>已导入数据</h2>
- <% if (rows.length) { %>
- <form method="post" action="/holidays/clear" onsubmit="return confirm('确定清空所有已导入的节假日数据吗?')">
- <button class="button-secondary small">清空数据</button>
- </form>
- <% } %>
- </div>
- <table>
- <thead><tr><th>年份</th><th>日期</th><th>名称</th><th>类型</th></tr></thead>
- <tbody>
- <% rows.forEach((row) => { %>
- <tr><td><%= row.year %></td><td><%= row.date %></td><td><%= row.name %></td><td><%= holidayTypeLabel(row.type) %></td></tr>
- <% }) %>
- </tbody>
- </table>
- </div>
- </section>
- </main>
- <script>
- async function copyPrompt() {
- const prompt = document.getElementById('prompt');
- try {
- await navigator.clipboard.writeText(prompt.value);
- } catch {
- prompt.select();
- document.execCommand('copy');
- }
- }
- </script>
- </body>
- </html>
|