detail.html 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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, user-scalable=no">
  6. <title>活动详情</title>
  7. <style>
  8. body { margin: 0; padding: 0; font-family: -apple-system, sans-serif; background-color: white; }
  9. .hero { width: 100%; height: 200px; background: #ddd url('https://via.placeholder.com/400x200/007aff/ffffff?text=Activity') center/cover; position: relative; }
  10. .back-btn { position: absolute; top: 40px; left: 20px; width: 32px; height: 32px; background: rgba(0,0,0,0.5); border-radius: 50%; color: white; display: flex; align-items: center; justify-content: center; font-size: 18px; cursor: pointer; }
  11. .content { padding: 20px; }
  12. .title { font-size: 24px; font-weight: bold; margin-bottom: 10px; }
  13. .tags { display: flex; gap: 10px; margin-bottom: 20px; }
  14. .tag { background: #f0f2f5; color: #666; padding: 4px 8px; border-radius: 4px; font-size: 12px; }
  15. .desc { color: #666; line-height: 1.6; margin-bottom: 30px; }
  16. .action-bar { position: fixed; bottom: 0; left: 0; width: 100%; padding: 10px 20px; background: white; box-shadow: 0 -2px 10px rgba(0,0,0,0.05); box-sizing: border-box; display: flex; gap: 10px; }
  17. .btn { flex: 1; padding: 12px; border-radius: 24px; text-align: center; font-weight: bold; font-size: 16px; cursor: pointer; }
  18. .btn-primary { background: #007aff; color: white; }
  19. .btn-outline { border: 1px solid #ddd; color: #333; background: white; }
  20. </style>
  21. <!-- SDK -->
  22. <script src="./mock_flutter.js"></script>
  23. <script src="./bridge.js"></script>
  24. </head>
  25. <body>
  26. <div class="hero">
  27. <div class="back-btn" onclick="Bridge.back()">←</div>
  28. </div>
  29. <div class="content">
  30. <div class="title" id="title">活动标题</div>
  31. <div class="tags">
  32. <div class="tag">线下活动</div>
  33. <div class="tag">2025.11.26</div>
  34. </div>
  35. <div class="desc">
  36. 这是一个非常精彩的线下活动。通过这个页面,演示了如何调用 App 原生的能力。<br><br>
  37. 1. 点击左上角返回按钮,调用 Bridge.back()<br>
  38. 2. 点击底部“导航”,调用 Bridge.openMap()<br>
  39. 3. 点击底部“详情”,调用 Bridge.openMatch() 跳转原生页面
  40. </div>
  41. <div style="text-align: center; margin-top: 20px;">
  42. <button onclick="doShare()" style="padding: 8px 20px; background: #4cd964; color: white; border: none; border-radius: 20px;">分享给朋友</button>
  43. </div>
  44. </div>
  45. <div class="action-bar">
  46. <div class="btn btn-outline" onclick="doNav()">🗺️ 导航</div>
  47. <div class="btn btn-primary" onclick="doNativeDetail()">📱 原生详情</div>
  48. </div>
  49. <script>
  50. // 获取 URL 参数
  51. function getQuery(name) {
  52. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  53. var r = window.location.search.substr(1).match(reg);
  54. if (r != null) return decodeURIComponent(r[2]); return null;
  55. }
  56. var id = getQuery('id') || '0';
  57. var name = getQuery('name') || '未知活动';
  58. document.getElementById('title').innerText = name;
  59. function doNav() {
  60. // 调用地图
  61. Bridge.openMap(39.9042, 116.4074, name);
  62. }
  63. function doNativeDetail() {
  64. // 跳转 App 原生详情页
  65. // type=1: 普通活动
  66. Bridge.openMatch(id, 1);
  67. }
  68. function doShare() {
  69. Bridge.shareWx({
  70. title: '快来参加: ' + name,
  71. url: window.location.href,
  72. image: 'https://via.placeholder.com/100'
  73. });
  74. }
  75. </script>
  76. </body>
  77. </html>