| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341 |
- <!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>
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- body {
- width: 500px;
- min-height: 400px;
- font-family: "Microsoft YaHei", Arial, sans-serif;
- background-color: #f5f5f5;
- }
- .header {
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- color: white;
- padding: 20px;
- text-align: center;
- }
- .header h1 {
- font-size: 20px;
- margin-bottom: 5px;
- }
- .header p {
- font-size: 12px;
- opacity: 0.9;
- }
- .container {
- padding: 20px;
- }
- .section {
- background: white;
- border-radius: 8px;
- padding: 15px;
- margin-bottom: 15px;
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
- }
- .section-title {
- font-size: 16px;
- font-weight: bold;
- color: #333;
- margin-bottom: 10px;
- display: flex;
- align-items: center;
- gap: 8px;
- }
- .config-item {
- margin-bottom: 15px;
- padding: 12px;
- background: #f9f9f9;
- border-radius: 6px;
- border-left: 3px solid #4CAF50;
- }
- .config-item-title {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 8px;
- }
- .config-url {
- font-weight: bold;
- color: #333;
- font-size: 14px;
- }
- .config-actions button {
- padding: 4px 8px;
- font-size: 12px;
- margin-left: 5px;
- border: none;
- border-radius: 4px;
- cursor: pointer;
- }
- .btn-edit {
- background-color: #2196F3;
- color: white;
- }
- .btn-delete {
- background-color: #f44336;
- color: white;
- }
- .config-details {
- font-size: 12px;
- color: #666;
- line-height: 1.6;
- }
- .config-details div {
- margin-bottom: 4px;
- }
- .add-button {
- width: 100%;
- padding: 12px;
- background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
- color: white;
- border: none;
- border-radius: 6px;
- font-size: 14px;
- font-weight: bold;
- cursor: pointer;
- transition: all 0.3s;
- }
- .add-button:hover {
- transform: translateY(-2px);
- box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
- }
- .empty-state {
- text-align: center;
- padding: 40px 20px;
- color: #999;
- }
- .empty-state svg {
- width: 60px;
- height: 60px;
- margin-bottom: 10px;
- opacity: 0.5;
- }
- /* Modal styles */
- .modal-overlay {
- display: none;
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background: rgba(0, 0, 0, 0.5);
- z-index: 1000;
- }
- .modal {
- background: white;
- border-radius: 8px;
- width: 90%;
- max-width: 450px;
- margin: 50px auto;
- padding: 20px;
- box-shadow: 0 4px 20px rgba(0,0,0,0.2);
- }
- .modal-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 20px;
- }
- .modal-header h2 {
- font-size: 18px;
- color: #333;
- }
- .close-button {
- background: none;
- border: none;
- font-size: 24px;
- cursor: pointer;
- color: #999;
- }
- .close-button:hover {
- color: #333;
- }
- .form-group {
- margin-bottom: 15px;
- }
- .form-group label {
- display: block;
- margin-bottom: 5px;
- font-size: 13px;
- font-weight: bold;
- color: #555;
- }
- .form-group input,
- .form-group select,
- .form-group textarea {
- width: 100%;
- padding: 8px 12px;
- border: 1px solid #ddd;
- border-radius: 4px;
- font-size: 13px;
- font-family: inherit;
- }
- .form-group textarea {
- min-height: 80px;
- resize: vertical;
- }
- .form-group .hint {
- font-size: 11px;
- color: #999;
- margin-top: 4px;
- }
- .modal-footer {
- display: flex;
- gap: 10px;
- margin-top: 20px;
- }
- .btn-cancel {
- flex: 1;
- padding: 10px;
- background: #f5f5f5;
- border: none;
- border-radius: 4px;
- cursor: pointer;
- font-size: 14px;
- }
- .btn-save {
- flex: 2;
- padding: 10px;
- background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
- color: white;
- border: none;
- border-radius: 4px;
- cursor: pointer;
- font-size: 14px;
- font-weight: bold;
- }
- .current-url {
- background: #e3f2fd;
- padding: 10px;
- border-radius: 4px;
- font-size: 12px;
- color: #1976D2;
- margin-bottom: 15px;
- word-break: break-all;
- }
- </style>
- </head>
- <body>
- <div class="header">
- <h1>🎤 医生语音助手</h1>
- <p>多页面配置管理</p>
- </div>
- <div class="container">
- <!-- 当前页面 URL -->
- <div class="current-url" id="currentUrl">
- <strong>当前页面:</strong><span id="urlText">正在获取...</span>
- </div>
- <!-- 配置列表 -->
- <div class="section">
- <div class="section-title">
- <span>📋 页面配置列表</span>
- </div>
- <div id="configList">
- <div class="empty-state">
- <div style="font-size: 40px; margin-bottom: 10px;">📝</div>
- <div>暂无配置</div>
- <div style="font-size: 12px; margin-top: 5px;">点击下方按钮添加新配置</div>
- </div>
- </div>
- </div>
- <!-- 添加按钮 -->
- <button class="add-button" id="addConfigBtn">
- ➕ 添加页面配置
- </button>
- </div>
- <!-- 添加/编辑配置模态框 -->
- <div class="modal-overlay" id="configModal">
- <div class="modal">
- <div class="modal-header">
- <h2 id="modalTitle">添加页面配置</h2>
- <button class="close-button" id="closeModal">×</button>
- </div>
- <form id="configForm">
- <input type="hidden" id="configId">
- <div class="form-group">
- <label for="urlPattern">URL 匹配规则 *</label>
- <input type="text" id="urlPattern" placeholder="例如: localhost:8080/*" required>
- <div class="hint">支持通配符 *,例如: his.com/patient/*</div>
- </div>
- <div class="form-group">
- <label for="promptTemplate">提示词模板 ID *</label>
- <select id="promptTemplate" required>
- <option value="">请选择提示词模板</option>
- <option value="medical-basic">基础医疗信息提取</option>
- <option value="medical-detail">详细医疗信息提取</option>
- <option value="medical-emergency">急诊快速录入</option>
- </select>
- <div class="hint">不同模板适用于不同场景</div>
- </div>
- <div class="form-group">
- <label for="fieldMapping">字段映射配置 (JSON)</label>
- <textarea id="fieldMapping" placeholder='{"patientName": ["name", "姓名"], ...}'></textarea>
- <div class="hint">JSON 格式,定义后端字段到前端字段的映射关系</div>
- </div>
- <div class="form-group">
- <label>配置说明</label>
- <input type="text" id="configDescription" placeholder="例如: 门诊患者信息录入">
- </div>
- <div class="modal-footer">
- <button type="button" class="btn-cancel" id="cancelBtn">取消</button>
- <button type="submit" class="btn-save">保存配置</button>
- </div>
- </form>
- </div>
- </div>
- <script src="popup.js"></script>
- </body>
- </html>
|