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.

187 lines
4.3 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months 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/手机背景.png";
  5. import bgImageLarge from "@/assets/img/DBQBmodel/电脑背景.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
  40. ref="pageRef"
  41. class="homepage"
  42. :style="{ backgroundImage: `url(${bgImage})` }"
  43. >
  44. <div v-if="false"></div>
  45. <!-- 顶部图标 -->
  46. <img class="top-icon" :src="topIcon" alt="顶部图标" />
  47. <!-- 副标题 -->
  48. <div class="bottom-icon">
  49. <img class="sub-title" :src="subtitle" alt="构建场景化交易" />
  50. <!-- 中间文字 -->
  51. <div class="content-text">
  52. <img class="content-text1" :src="text1" alt=" 数据可计算" />
  53. <img class="content-text2" :src="text2" alt=" 场景可预演" />
  54. <img class="content-text3" :src="text3" alt=" 交易可掌控" />
  55. </div>
  56. <!-- 底部按钮 -->
  57. <div class="buttons-container">
  58. <button class="btn-item" @click="goToHomePage">
  59. <img :src="btnIcon" alt="按钮图片" />
  60. </button>
  61. </div>
  62. </div>
  63. </div>
  64. </template>
  65. <style scoped>
  66. .homepage {
  67. /* background-image: url("@/assets/img/DBQBmodel/bg.png"); */
  68. /* width: 100vw; */
  69. min-height: 100vh;
  70. background-size: cover;
  71. background-position: center;
  72. background-repeat: no-repeat;
  73. display: flex;
  74. flex-direction: column;
  75. align-items: center;
  76. }
  77. /* 顶部标题图 */
  78. .top-icon {
  79. width: 80%;
  80. max-width: 500px;
  81. height: auto;
  82. /* margin-top: 20px; */
  83. position: absolute;
  84. top: 11vh;
  85. }
  86. .bottom-icon {
  87. /* width: 100%; */
  88. display: flex;
  89. flex-direction: column;
  90. position: absolute;
  91. bottom: 10vh;
  92. align-items: center;
  93. }
  94. /* 副标题 */
  95. .sub-title {
  96. /* padding-top: 40px; */
  97. width: 100%;
  98. max-width: 350px;
  99. height: auto;
  100. /* margin-top: 18rem; */
  101. }
  102. /* 中间三个描述图 */
  103. .content-text {
  104. display: flex;
  105. flex-direction: row;
  106. /* 改为横向排列 */
  107. align-items: center;
  108. justify-content: center;
  109. /* 添加水平居中 */
  110. gap: 23px;
  111. margin-bottom: 10px;
  112. flex-wrap: wrap;
  113. /* 添加换行支持,防止小屏幕溢出 */
  114. }
  115. .content-text img {
  116. width: 80%;
  117. max-width: 300px;
  118. height: auto;
  119. flex: 1;
  120. /* 让图片平均分配空间 */
  121. min-width: 200px;
  122. /* 设置最小宽度 */
  123. }
  124. /* 按钮区 */
  125. .buttons-container {
  126. align-items: center;
  127. }
  128. .btn-item {
  129. width: auto;
  130. background: none;
  131. border: none;
  132. padding: 0;
  133. cursor: pointer;
  134. }
  135. .btn-item img {
  136. width: 200%;
  137. max-width: 350px;
  138. height: auto;
  139. }
  140. /* 手机适配 - 小屏幕时保持纵向排列 */
  141. @media screen and (max-width: 768px) {
  142. .top-icon {
  143. margin-top: 12%;
  144. width: 90%;
  145. }
  146. .sub-title {
  147. width: 80%;
  148. margin-top: 25%;
  149. }
  150. .content-text {
  151. flex-direction: column;
  152. /* 小屏幕时恢复纵向排列 */
  153. }
  154. .content-text img {
  155. width: 70%;
  156. flex: none;
  157. /* 取消flex布局 */
  158. }
  159. .btn-item img {
  160. width: 50%;
  161. margin-top: 20px;
  162. }
  163. }
  164. </style>