popup.html 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>医生语音助手 - 配置</title>
  7. <style>
  8. * {
  9. margin: 0;
  10. padding: 0;
  11. box-sizing: border-box;
  12. }
  13. body {
  14. width: 500px;
  15. min-height: 400px;
  16. font-family: "Microsoft YaHei", Arial, sans-serif;
  17. background-color: #f5f5f5;
  18. }
  19. .header {
  20. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  21. color: white;
  22. padding: 20px;
  23. text-align: center;
  24. }
  25. .header h1 {
  26. font-size: 20px;
  27. margin-bottom: 5px;
  28. }
  29. .header p {
  30. font-size: 12px;
  31. opacity: 0.9;
  32. }
  33. .container {
  34. padding: 20px;
  35. }
  36. .section {
  37. background: white;
  38. border-radius: 8px;
  39. padding: 15px;
  40. margin-bottom: 15px;
  41. box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  42. }
  43. .section-title {
  44. font-size: 16px;
  45. font-weight: bold;
  46. color: #333;
  47. margin-bottom: 10px;
  48. display: flex;
  49. align-items: center;
  50. gap: 8px;
  51. }
  52. .config-item {
  53. margin-bottom: 15px;
  54. padding: 12px;
  55. background: #f9f9f9;
  56. border-radius: 6px;
  57. border-left: 3px solid #4CAF50;
  58. }
  59. .config-item-title {
  60. display: flex;
  61. justify-content: space-between;
  62. align-items: center;
  63. margin-bottom: 8px;
  64. }
  65. .config-url {
  66. font-weight: bold;
  67. color: #333;
  68. font-size: 14px;
  69. }
  70. .config-actions button {
  71. padding: 4px 8px;
  72. font-size: 12px;
  73. margin-left: 5px;
  74. border: none;
  75. border-radius: 4px;
  76. cursor: pointer;
  77. }
  78. .btn-edit {
  79. background-color: #2196F3;
  80. color: white;
  81. }
  82. .btn-delete {
  83. background-color: #f44336;
  84. color: white;
  85. }
  86. .config-details {
  87. font-size: 12px;
  88. color: #666;
  89. line-height: 1.6;
  90. }
  91. .config-details div {
  92. margin-bottom: 4px;
  93. }
  94. .add-button {
  95. width: 100%;
  96. padding: 12px;
  97. background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  98. color: white;
  99. border: none;
  100. border-radius: 6px;
  101. font-size: 14px;
  102. font-weight: bold;
  103. cursor: pointer;
  104. transition: all 0.3s;
  105. }
  106. .add-button:hover {
  107. transform: translateY(-2px);
  108. box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
  109. }
  110. .empty-state {
  111. text-align: center;
  112. padding: 40px 20px;
  113. color: #999;
  114. }
  115. .empty-state svg {
  116. width: 60px;
  117. height: 60px;
  118. margin-bottom: 10px;
  119. opacity: 0.5;
  120. }
  121. /* Modal styles */
  122. .modal-overlay {
  123. display: none;
  124. position: fixed;
  125. top: 0;
  126. left: 0;
  127. width: 100%;
  128. height: 100%;
  129. background: rgba(0, 0, 0, 0.5);
  130. z-index: 1000;
  131. }
  132. .modal {
  133. background: white;
  134. border-radius: 8px;
  135. width: 90%;
  136. max-width: 450px;
  137. margin: 50px auto;
  138. padding: 20px;
  139. box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  140. }
  141. .modal-header {
  142. display: flex;
  143. justify-content: space-between;
  144. align-items: center;
  145. margin-bottom: 20px;
  146. }
  147. .modal-header h2 {
  148. font-size: 18px;
  149. color: #333;
  150. }
  151. .close-button {
  152. background: none;
  153. border: none;
  154. font-size: 24px;
  155. cursor: pointer;
  156. color: #999;
  157. }
  158. .close-button:hover {
  159. color: #333;
  160. }
  161. .form-group {
  162. margin-bottom: 15px;
  163. }
  164. .form-group label {
  165. display: block;
  166. margin-bottom: 5px;
  167. font-size: 13px;
  168. font-weight: bold;
  169. color: #555;
  170. }
  171. .form-group input,
  172. .form-group select,
  173. .form-group textarea {
  174. width: 100%;
  175. padding: 8px 12px;
  176. border: 1px solid #ddd;
  177. border-radius: 4px;
  178. font-size: 13px;
  179. font-family: inherit;
  180. }
  181. .form-group textarea {
  182. min-height: 80px;
  183. resize: vertical;
  184. }
  185. .form-group .hint {
  186. font-size: 11px;
  187. color: #999;
  188. margin-top: 4px;
  189. }
  190. .modal-footer {
  191. display: flex;
  192. gap: 10px;
  193. margin-top: 20px;
  194. }
  195. .btn-cancel {
  196. flex: 1;
  197. padding: 10px;
  198. background: #f5f5f5;
  199. border: none;
  200. border-radius: 4px;
  201. cursor: pointer;
  202. font-size: 14px;
  203. }
  204. .btn-save {
  205. flex: 2;
  206. padding: 10px;
  207. background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  208. color: white;
  209. border: none;
  210. border-radius: 4px;
  211. cursor: pointer;
  212. font-size: 14px;
  213. font-weight: bold;
  214. }
  215. .current-url {
  216. background: #e3f2fd;
  217. padding: 10px;
  218. border-radius: 4px;
  219. font-size: 12px;
  220. color: #1976D2;
  221. margin-bottom: 15px;
  222. word-break: break-all;
  223. }
  224. </style>
  225. </head>
  226. <body>
  227. <div class="header">
  228. <h1>🎤 医生语音助手</h1>
  229. <p>多页面配置管理</p>
  230. </div>
  231. <div class="container">
  232. <!-- 当前页面 URL -->
  233. <div class="current-url" id="currentUrl">
  234. <strong>当前页面:</strong><span id="urlText">正在获取...</span>
  235. </div>
  236. <!-- 配置列表 -->
  237. <div class="section">
  238. <div class="section-title">
  239. <span>📋 页面配置列表</span>
  240. </div>
  241. <div id="configList">
  242. <div class="empty-state">
  243. <div style="font-size: 40px; margin-bottom: 10px;">📝</div>
  244. <div>暂无配置</div>
  245. <div style="font-size: 12px; margin-top: 5px;">点击下方按钮添加新配置</div>
  246. </div>
  247. </div>
  248. </div>
  249. <!-- 添加按钮 -->
  250. <button class="add-button" id="addConfigBtn">
  251. ➕ 添加页面配置
  252. </button>
  253. </div>
  254. <!-- 添加/编辑配置模态框 -->
  255. <div class="modal-overlay" id="configModal">
  256. <div class="modal">
  257. <div class="modal-header">
  258. <h2 id="modalTitle">添加页面配置</h2>
  259. <button class="close-button" id="closeModal">&times;</button>
  260. </div>
  261. <form id="configForm">
  262. <input type="hidden" id="configId">
  263. <div class="form-group">
  264. <label for="urlPattern">URL 匹配规则 *</label>
  265. <input type="text" id="urlPattern" placeholder="例如: localhost:8080/*" required>
  266. <div class="hint">支持通配符 *,例如: his.com/patient/*</div>
  267. </div>
  268. <div class="form-group">
  269. <label for="promptTemplate">提示词模板 ID *</label>
  270. <select id="promptTemplate" required>
  271. <option value="">请选择提示词模板</option>
  272. <option value="medical-basic">基础医疗信息提取</option>
  273. <option value="medical-detail">详细医疗信息提取</option>
  274. <option value="medical-emergency">急诊快速录入</option>
  275. </select>
  276. <div class="hint">不同模板适用于不同场景</div>
  277. </div>
  278. <div class="form-group">
  279. <label for="fieldMapping">字段映射配置 (JSON)</label>
  280. <textarea id="fieldMapping" placeholder='{"patientName": ["name", "姓名"], ...}'></textarea>
  281. <div class="hint">JSON 格式,定义后端字段到前端字段的映射关系</div>
  282. </div>
  283. <div class="form-group">
  284. <label>配置说明</label>
  285. <input type="text" id="configDescription" placeholder="例如: 门诊患者信息录入">
  286. </div>
  287. <div class="modal-footer">
  288. <button type="button" class="btn-cancel" id="cancelBtn">取消</button>
  289. <button type="submit" class="btn-save">保存配置</button>
  290. </div>
  291. </form>
  292. </div>
  293. </div>
  294. <script src="popup.js"></script>
  295. </body>
  296. </html>