test1.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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>Test1 - 第二层页面</title>
  7. <!-- 微信 JS-SDK -->
  8. <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
  9. <!-- Vue 3 CDN -->
  10. <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
  11. <!-- H5工具函数库 -->
  12. <script src="../js/utils/h5-bridge.js"></script>
  13. </head>
  14. <body>
  15. <div id="app">
  16. <div class="container">
  17. <h1>📄 Test1 页面</h1>
  18. <p>这是第二层页面,可以继续跳转或返回</p>
  19. <div class="nav-info">
  20. <div class="breadcrumb">
  21. <span>Home</span> → <span class="current">Test1</span>
  22. </div>
  23. </div>
  24. <div class="button-group">
  25. <button class="btn primary" @click="goToTest2">
  26. ➡️ 进入Test2
  27. </button>
  28. <button class="btn secondary" @click="goBackToHome">
  29. ⬅️ 返回Home
  30. </button>
  31. <button class="btn warning" @click="handleScanCode">
  32. 📷 扫码测试
  33. </button>
  34. <button class="btn danger" @click="goBackToMiniProgram">
  35. 🔙 返回小程序
  36. </button>
  37. </div>
  38. </div>
  39. </div>
  40. <script>
  41. const { createApp } = Vue
  42. createApp({
  43. data() {
  44. return {}
  45. },
  46. mounted() {
  47. // 初始化页面,使用自定义结果处理
  48. // initPage('test1', this.handleResult)
  49. },
  50. methods: {
  51. // 处理操作结果
  52. handleResult(data) {
  53. const { action, success, result, error } = data
  54. if (success) {
  55. switch (action) {
  56. case 'scanCode':
  57. console.log(`📷 扫码成功: ${result}`)
  58. alert(`扫码结果: ${result}`)
  59. break
  60. default:
  61. console.log(`✅ ${action} 操作成功`)
  62. }
  63. } else {
  64. console.error(`❌ ${action} 操作失败: ${error}`)
  65. alert(`${action} 操作失败: ${error}`)
  66. }
  67. },
  68. // 跳转到Test2页面
  69. goToTest2() {
  70. navigateTo('test2', { from: 'test1' })
  71. },
  72. // 返回Home页面
  73. goBackToHome() {
  74. navigateTo('home', { from: 'test1' })
  75. },
  76. // 扫码测试
  77. handleScanCode() {
  78. scanCode('从Test1页面扫码')
  79. },
  80. // 返回小程序
  81. goBackToMiniProgram() {
  82. goBack('从Test1页面返回')
  83. },
  84. }
  85. }).mount('#app')
  86. </script>
  87. <style>
  88. * {
  89. margin: 0;
  90. padding: 0;
  91. box-sizing: border-box;
  92. }
  93. body {
  94. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  95. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  96. min-height: 100vh;
  97. padding: 20px;
  98. }
  99. .container {
  100. max-width: 600px;
  101. margin: 0 auto;
  102. background: white;
  103. border-radius: 12px;
  104. padding: 24px;
  105. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  106. }
  107. h1 {
  108. text-align: center;
  109. color: #333;
  110. margin-bottom: 8px;
  111. }
  112. p {
  113. text-align: center;
  114. color: #666;
  115. margin-bottom: 24px;
  116. }
  117. .nav-info {
  118. background: #f8f9fa;
  119. border-radius: 8px;
  120. padding: 16px;
  121. margin-bottom: 24px;
  122. }
  123. .breadcrumb {
  124. font-size: 14px;
  125. color: #666;
  126. }
  127. .breadcrumb .current {
  128. color: #007AFF;
  129. font-weight: 500;
  130. }
  131. .button-group {
  132. display: grid;
  133. grid-template-columns: 1fr 1fr;
  134. gap: 12px;
  135. margin-bottom: 32px;
  136. }
  137. .btn {
  138. padding: 12px 16px;
  139. border: none;
  140. border-radius: 8px;
  141. font-size: 14px;
  142. font-weight: 500;
  143. cursor: pointer;
  144. transition: all 0.2s;
  145. }
  146. .btn.primary { background: #007AFF; color: white; }
  147. .btn.secondary { background: #6c757d; color: white; }
  148. .btn.warning { background: #ffc107; color: #212529; }
  149. .btn.danger { background: #dc3545; color: white; }
  150. .btn:hover {
  151. transform: translateY(-1px);
  152. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  153. }
  154. @media (max-width: 480px) {
  155. .button-group {
  156. grid-template-columns: 1fr;
  157. }
  158. }
  159. </style>
  160. </body>
  161. </html>