test-chat-activation-wxwork.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  15. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  16. min-height: 100vh;
  17. display: flex;
  18. align-items: center;
  19. justify-content: center;
  20. padding: 20px;
  21. }
  22. .container {
  23. background: white;
  24. border-radius: 20px;
  25. box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  26. padding: 40px;
  27. max-width: 600px;
  28. width: 100%;
  29. }
  30. .header {
  31. text-align: center;
  32. margin-bottom: 30px;
  33. }
  34. .header h1 {
  35. font-size: 28px;
  36. color: #333;
  37. margin-bottom: 10px;
  38. }
  39. .header p {
  40. color: #666;
  41. font-size: 14px;
  42. }
  43. .section {
  44. margin-bottom: 30px;
  45. }
  46. .section-title {
  47. font-size: 18px;
  48. font-weight: 600;
  49. color: #333;
  50. margin-bottom: 15px;
  51. display: flex;
  52. align-items: center;
  53. gap: 8px;
  54. }
  55. .form-group {
  56. margin-bottom: 20px;
  57. }
  58. .form-group label {
  59. display: block;
  60. font-size: 14px;
  61. font-weight: 500;
  62. color: #555;
  63. margin-bottom: 8px;
  64. }
  65. .form-group input {
  66. width: 100%;
  67. padding: 12px 16px;
  68. border: 2px solid #e0e0e0;
  69. border-radius: 8px;
  70. font-size: 14px;
  71. transition: all 0.3s;
  72. }
  73. .form-group input:focus {
  74. outline: none;
  75. border-color: #667eea;
  76. box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  77. }
  78. .hint {
  79. font-size: 12px;
  80. color: #999;
  81. margin-top: 5px;
  82. }
  83. .btn-group {
  84. display: flex;
  85. gap: 10px;
  86. margin-top: 20px;
  87. }
  88. .btn {
  89. flex: 1;
  90. padding: 14px 24px;
  91. border: none;
  92. border-radius: 8px;
  93. font-size: 16px;
  94. font-weight: 600;
  95. cursor: pointer;
  96. transition: all 0.3s;
  97. display: flex;
  98. align-items: center;
  99. justify-content: center;
  100. gap: 8px;
  101. }
  102. .btn-primary {
  103. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  104. color: white;
  105. }
  106. .btn-primary:hover {
  107. transform: translateY(-2px);
  108. box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
  109. }
  110. .btn-secondary {
  111. background: #f5f5f5;
  112. color: #333;
  113. }
  114. .btn-secondary:hover {
  115. background: #e0e0e0;
  116. }
  117. .info-box {
  118. background: #f8f9fa;
  119. border-left: 4px solid #667eea;
  120. padding: 15px;
  121. border-radius: 8px;
  122. margin-top: 20px;
  123. }
  124. .info-box-title {
  125. font-weight: 600;
  126. color: #333;
  127. margin-bottom: 10px;
  128. }
  129. .info-box-content {
  130. font-size: 14px;
  131. color: #666;
  132. line-height: 1.6;
  133. }
  134. .url-display {
  135. background: #fff;
  136. border: 2px solid #e0e0e0;
  137. border-radius: 8px;
  138. padding: 15px;
  139. margin-top: 15px;
  140. font-family: 'Courier New', monospace;
  141. font-size: 13px;
  142. color: #667eea;
  143. word-break: break-all;
  144. cursor: pointer;
  145. transition: all 0.3s;
  146. }
  147. .url-display:hover {
  148. border-color: #667eea;
  149. background: #f8f9fa;
  150. }
  151. .method-card {
  152. background: white;
  153. border: 2px solid #e0e0e0;
  154. border-radius: 12px;
  155. padding: 20px;
  156. margin-bottom: 15px;
  157. transition: all 0.3s;
  158. }
  159. .method-card:hover {
  160. border-color: #667eea;
  161. box-shadow: 0 5px 15px rgba(102, 126, 234, 0.1);
  162. }
  163. .method-card h3 {
  164. font-size: 16px;
  165. color: #333;
  166. margin-bottom: 10px;
  167. display: flex;
  168. align-items: center;
  169. gap: 8px;
  170. }
  171. .method-card p {
  172. font-size: 14px;
  173. color: #666;
  174. line-height: 1.6;
  175. }
  176. .badge {
  177. display: inline-block;
  178. padding: 4px 12px;
  179. border-radius: 12px;
  180. font-size: 12px;
  181. font-weight: 600;
  182. }
  183. .badge-recommended {
  184. background: #4caf50;
  185. color: white;
  186. }
  187. .badge-test {
  188. background: #ff9800;
  189. color: white;
  190. }
  191. @media (max-width: 600px) {
  192. .container {
  193. padding: 30px 20px;
  194. }
  195. .btn-group {
  196. flex-direction: column;
  197. }
  198. }
  199. </style>
  200. </head>
  201. <body>
  202. <div class="container">
  203. <div class="header">
  204. <h1>🎯 会话激活页面测试</h1>
  205. <p>企微侧边栏集成版 - 支持自动获取群聊上下文</p>
  206. </div>
  207. <div class="section">
  208. <div class="section-title">
  209. <svg width="20" height="20" viewBox="0 0 512 512" fill="currentColor">
  210. <path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200z"/>
  211. </svg>
  212. 访问方式
  213. </div>
  214. <div class="method-card">
  215. <h3>
  216. <span class="badge badge-recommended">推荐</span>
  217. 方式一:企微侧边栏打开
  218. </h3>
  219. <p>
  220. 在企微群聊中打开侧边栏,选择"会话激活"工具。<br>
  221. 系统会自动获取当前群聊ID,无需手动传参。<br><br>
  222. <strong>URL:</strong> <code>/wxwork/:cid/chat-activation</code>
  223. </p>
  224. </div>
  225. <div class="method-card">
  226. <h3>
  227. <span class="badge badge-test">测试</span>
  228. 方式二:直接URL访问
  229. </h3>
  230. <p>
  231. 在浏览器中直接访问,需要手动传递群聊ID。<br>
  232. 适用于开发测试,不推荐生产环境使用。<br><br>
  233. <strong>URL:</strong> <code>/wxwork/:cid/chat-activation/:chatId</code>
  234. </p>
  235. </div>
  236. </div>
  237. <div class="section">
  238. <div class="section-title">
  239. <svg width="20" height="20" viewBox="0 0 512 512" fill="currentColor">
  240. <path d="M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z"/>
  241. </svg>
  242. 测试参数配置
  243. </div>
  244. <div class="form-group">
  245. <label for="cid">公司ID (cid)</label>
  246. <input
  247. type="text"
  248. id="cid"
  249. placeholder="例如: cDL6R1hgSi"
  250. value="cDL6R1hgSi"
  251. />
  252. <p class="hint">企业微信公司标识符</p>
  253. </div>
  254. <div class="form-group">
  255. <label for="chatId">群聊ID (chatId) - 可选</label>
  256. <input
  257. type="text"
  258. id="chatId"
  259. placeholder="例如: wrgKCxBwAALwOgUC9jMwdHiVTFmyXs_A"
  260. value="wrgKCxBwAALwOgUC9jMwdHiVTFmyXs_A"
  261. />
  262. <p class="hint">企微chat_id或Parse objectId(从侧边栏打开时无需填写)</p>
  263. </div>
  264. </div>
  265. <div class="btn-group">
  266. <button class="btn btn-primary" onclick="openWithoutChatId()">
  267. <svg width="20" height="20" viewBox="0 0 512 512" fill="currentColor">
  268. <path d="M256 8C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 448c-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200 110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200zm107.351-101.064c-9.614 9.712-45.53 41.396-104.065 41.396-82.43 0-140.484-61.425-140.484-141.567 0-79.152 60.275-139.401 139.762-139.401 55.531 0 88.738 26.62 97.593 34.779a11.965 11.965 0 0 1 1.936 15.322l-18.155 28.113c-3.841 5.95-11.966 7.282-17.499 2.921-8.595-6.775-31.814-22.538-61.708-22.538-48.303 0-77.916 35.33-77.916 80.082 0 41.589 26.888 83.692 78.277 83.692 32.657 0 56.843-19.039 65.726-27.225 5.27-4.857 13.596-4.039 17.82 1.738l19.865 27.17a11.947 11.947 0 0 1-1.152 15.518z"/>
  269. </svg>
  270. 侧边栏模式(无chatId)
  271. </button>
  272. <button class="btn btn-secondary" onclick="openWithChatId()">
  273. <svg width="20" height="20" viewBox="0 0 512 512" fill="currentColor">
  274. <path d="M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"/>
  275. </svg>
  276. 直接URL(带chatId)
  277. </button>
  278. </div>
  279. <div class="info-box">
  280. <div class="info-box-title">💡 使用提示</div>
  281. <div class="info-box-content">
  282. <strong>侧边栏模式(推荐):</strong><br>
  283. • 需要在企微侧边栏中打开<br>
  284. • 自动获取当前群聊ID<br>
  285. • 自动同步群聊数据<br>
  286. • 最佳用户体验<br><br>
  287. <strong>直接URL模式(测试):</strong><br>
  288. • 可以在浏览器中直接访问<br>
  289. • 需要手动提供群聊ID<br>
  290. • 适用于开发调试<br>
  291. • 可能无法获取企微上下文
  292. </div>
  293. <div class="url-display" id="urlDisplay">
  294. URL将在这里显示...
  295. </div>
  296. </div>
  297. </div>
  298. <script>
  299. function openWithoutChatId() {
  300. const cid = document.getElementById('cid').value.trim();
  301. if (!cid) {
  302. alert('请输入公司ID (cid)');
  303. return;
  304. }
  305. const url = `http://localhost:4200/wxwork/${cid}/chat-activation`;
  306. document.getElementById('urlDisplay').textContent = url;
  307. console.log('🚀 打开侧边栏模式:', url);
  308. window.open(url, '_blank');
  309. }
  310. function openWithChatId() {
  311. const cid = document.getElementById('cid').value.trim();
  312. const chatId = document.getElementById('chatId').value.trim();
  313. if (!cid) {
  314. alert('请输入公司ID (cid)');
  315. return;
  316. }
  317. if (!chatId) {
  318. alert('请输入群聊ID (chatId)');
  319. return;
  320. }
  321. const url = `http://localhost:4200/wxwork/${cid}/chat-activation/${chatId}`;
  322. document.getElementById('urlDisplay').textContent = url;
  323. console.log('🚀 打开直接URL模式:', url);
  324. window.open(url, '_blank');
  325. }
  326. // 页面加载时显示默认URL
  327. window.addEventListener('load', () => {
  328. const cid = document.getElementById('cid').value.trim();
  329. const url = `http://localhost:4200/wxwork/${cid}/chat-activation`;
  330. document.getElementById('urlDisplay').textContent = `侧边栏模式: ${url}`;
  331. });
  332. // 点击URL复制到剪贴板
  333. document.getElementById('urlDisplay').addEventListener('click', function() {
  334. const text = this.textContent;
  335. navigator.clipboard.writeText(text).then(() => {
  336. const original = this.textContent;
  337. this.textContent = '✅ 已复制到剪贴板!';
  338. setTimeout(() => {
  339. this.textContent = original;
  340. }, 2000);
  341. });
  342. });
  343. </script>
  344. </body>
  345. </html>