You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

225 lines
5.2 KiB

4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
4 weeks ago
  1. <script setup>
  2. import { onMounted, ref, computed, onUnmounted } from 'vue'
  3. import { useRouter } from 'vue-router'
  4. import bgImageSmall from '@/assets/img/DBQBmodel/-s-bg.png'
  5. import bgImageLarge from '@/assets/img/DBQBmodel/bg.png'
  6. import topIcon from '@/assets/img/DBQBmodel/大标题.png'
  7. import subtitle from '@/assets/img/DBQBmodel/-s-构建场景.png'
  8. import text1 from '@/assets/img/DBQBmodel/-s-数据可计算.png'
  9. import text2 from '@/assets/img/DBQBmodel/-s-场景可预演.png'
  10. import text3 from '@/assets/img/DBQBmodel/-s-交易可掌控.png'
  11. import btnIcon from '@/assets/img/DBQBmodel/-s-开启财运.png'
  12. import { setHeight } from '@/utils/setHeight'
  13. const router = useRouter()
  14. const pageRef = ref(null)
  15. const windowWidth = ref(window.innerWidth)
  16. // 响应式计算背景图片
  17. const bgImage = computed(() => {
  18. return windowWidth.value > 1024 ? bgImageLarge : bgImageSmall
  19. })
  20. // 监听窗口大小变化
  21. const handleResize = () => {
  22. windowWidth.value = window.innerWidth
  23. }
  24. onMounted(() => {
  25. setHeight(pageRef.value)
  26. window.addEventListener('resize', handleResize)
  27. })
  28. onUnmounted(() => {
  29. window.removeEventListener('resize', handleResize)
  30. })
  31. const goToHomePage = () => {
  32. // 设置 sessionStorage 控制 homepage.vue 激活 AiEmotion tab
  33. sessionStorage.setItem("activeTabAI", "AIchat")
  34. sessionStorage.setItem("activeIndexAI", "0")
  35. router.push("/homePage")
  36. }
  37. </script>
  38. <template>
  39. <div ref="pageRef" class="homepage" :style="{ backgroundImage: `url(${bgImage})` }">
  40. <!-- 顶部图标 -->
  41. <img class="top-icon" :src="topIcon" alt="顶部图标" />
  42. <!-- 副标题 -->
  43. <img class="sub-title" :src="subtitle" alt="构建场景化交易" />
  44. <!-- 中间文字 -->
  45. <div class="content-text">
  46. <img class="content-text1" :src="text1" alt=" 数据可计算" />
  47. <img class="content-text2" :src="text2" alt=" 场景可预演" />
  48. <img class="content-text3" :src="text3" alt=" 交易可掌控" />
  49. </div>
  50. <!-- 底部按钮 -->
  51. <div class="buttons-container">
  52. <button class="btn-item" @click="goToHomePage">
  53. <img :src="btnIcon" alt="按钮图片" />
  54. </button>
  55. </div>
  56. </div>
  57. </template>
  58. <style scoped>
  59. .homepage {
  60. /* background-image: url("@/assets/img/DBQBmodel/bg.png"); */
  61. /* width: 100vw; */
  62. min-height: 100vh;
  63. background-size: cover;
  64. background-position: center;
  65. background-repeat: no-repeat;
  66. display: flex;
  67. flex-direction: column;
  68. align-items: center;
  69. padding: 40px 20px;
  70. box-sizing: border-box;
  71. }
  72. /* 顶部标题图 */
  73. .top-icon {
  74. width: 80%;
  75. max-width: 500px;
  76. height: auto;
  77. margin-top: 20px;
  78. }
  79. /* 副标题 */
  80. .sub-title {
  81. padding-top: 40px;
  82. width: 100%;
  83. max-width: 350px;
  84. height: auto;
  85. margin: 30px 0;
  86. }
  87. /* 中间三个描述图 */
  88. .content-text {
  89. padding-top: 30px;
  90. display: flex;
  91. flex-direction: row; /* 改为横向排列 */
  92. align-items: center;
  93. justify-content: center; /* 添加水平居中 */
  94. gap: 23px;
  95. margin-bottom: 10px;
  96. flex-wrap: wrap; /* 添加换行支持,防止小屏幕溢出 */
  97. }
  98. .content-text img {
  99. width: 80%;
  100. max-width: 300px;
  101. height: auto;
  102. flex: 1; /* 让图片平均分配空间 */
  103. min-width: 200px; /* 设置最小宽度 */
  104. }
  105. /* 按钮区 */
  106. .buttons-container {
  107. align-items: center;
  108. }
  109. .btn-item {
  110. height: 300px;
  111. width: auto ;
  112. background: none;
  113. border: none;
  114. padding: 0;
  115. cursor: pointer;
  116. }
  117. .btn-item img {
  118. width: 200%;
  119. max-width:350px;
  120. height: 120px;
  121. }
  122. /* 手机适配 - 小屏幕时保持纵向排列 */
  123. @media screen and (max-width: 600px) {
  124. .homepage {
  125. padding: 20px 10px;
  126. }
  127. .top-icon {
  128. margin-top: 6rem;
  129. width: 90%;
  130. }
  131. .sub-title {
  132. width: 80%;
  133. margin: 20px 0;
  134. }
  135. .content-text {
  136. flex-direction: column; /* 小屏幕时恢复纵向排列 */
  137. }
  138. .content-text img {
  139. width: 70%;
  140. flex: none; /* 取消flex布局 */
  141. }
  142. .btn-item img {
  143. width: 300px;
  144. }
  145. }
  146. /* 平板适配 */
  147. @media screen and (min-width: 601px) and (max-width: 1024px) {
  148. .homepage {
  149. background-position: center 20%;
  150. }
  151. .top-icon {
  152. margin-top: 190px;
  153. width: 100%;
  154. }
  155. .sub-title {
  156. width: 85%;
  157. }
  158. .content-text {
  159. flex-direction: row; /* 平板及以上保持横向排列 */
  160. }
  161. .content-text img {
  162. width: 30%; /* 调整宽度适应横向布局 */
  163. max-width: 250px;
  164. }
  165. .btn-item img {
  166. width: 300px;
  167. }
  168. }
  169. /* 桌面端适配 */
  170. @media screen and (min-width: 1025px) {
  171. .content-text img {
  172. width: 25%; /* 桌面端进一步调整宽度 */
  173. max-width: 280px;
  174. }
  175. /* 顶部标题图 */
  176. .top-icon {
  177. width: 35vw;
  178. max-width: 500vw;
  179. height: auto;
  180. margin-top: 8vw;
  181. }
  182. }
  183. @media screen and (min-width: 1024px) and (max-width: 2000px){
  184. /* 顶部标题图 */
  185. .top-icon {
  186. width: 50vw;
  187. max-width: 500vw;
  188. height: auto;
  189. margin-top: 15vw;
  190. }
  191. }
  192. </style>