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.

283 lines
6.8 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 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. import { checkStatusAPI } from "../api/AIxiaocaishen";
  14. import BackToHomeButton from "@/views/components/BackToHomeButton.vue";
  15. const router = useRouter();
  16. const pageRef = ref(null);
  17. const windowWidth = ref(window.innerWidth);
  18. // 响应式计算背景图片
  19. const bgImage = computed(() => {
  20. return windowWidth.value > 1024 ? bgImageLarge : bgImageSmall;
  21. });
  22. // 监听窗口大小变化
  23. const handleResize = () => {
  24. windowWidth.value = window.innerWidth;
  25. };
  26. onMounted(() => {
  27. setHeight(pageRef.value);
  28. window.addEventListener("resize", handleResize);
  29. });
  30. onUnmounted(() => {
  31. window.removeEventListener("resize", handleResize);
  32. });
  33. const noPermissonDialogVisible = ref(false);
  34. const noPermissonDialogObj = ref({});
  35. const goToHomePage = async () => {
  36. try {
  37. let params = {
  38. token: localStorage.getItem("localToken"),
  39. model: 1,
  40. };
  41. const userAgent = navigator.userAgent;
  42. let isMobile =
  43. /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
  44. userAgent
  45. );
  46. let Client = "pc";
  47. if (isMobile) {
  48. if (/iPhone|iPad|iPod/i.test(userAgent)) {
  49. Client = "ios";
  50. } else if (/Android/i.test(userAgent)) {
  51. Client = "android";
  52. } else {
  53. Client = "android"; // 其他移动设备
  54. }
  55. }
  56. let headers = {
  57. Client: Client,
  58. };
  59. const res = await checkStatusAPI(headers, params);
  60. if (res.code == 200) {
  61. // 设置 sessionStorage 控制 homepage.vue 激活 AiEmotion tab
  62. sessionStorage.setItem("activeTabAI", "AIchat");
  63. sessionStorage.setItem("activeIndexAI", "0");
  64. // 设置标记表示从外部页面跳转过来
  65. sessionStorage.setItem("fromExternalPage", "true");
  66. router.push("/homePage");
  67. } else {
  68. console.log("无权限");
  69. noPermissonDialogVisible.value = true;
  70. noPermissonDialogObj.value.msg = res.msg;
  71. console.log("noPermissonDialogVisible", noPermissonDialogVisible.value);
  72. console.log("noPermissonDialogObj", noPermissonDialogObj.value);
  73. }
  74. } catch (e) {
  75. console.error("获取权限失败", e);
  76. }
  77. };
  78. const closeNoPermissionDialog = () => {
  79. noPermissonDialogVisible.value = false;
  80. };
  81. </script>
  82. <template>
  83. <div
  84. ref="pageRef"
  85. class="homepage"
  86. :style="{ backgroundImage: `url(${bgImage})` }"
  87. >
  88. <BackToHomeButton />
  89. <div v-if="false"></div>
  90. <!-- 顶部图标 -->
  91. <img class="top-icon" :src="topIcon" alt="顶部图标" />
  92. <!-- 副标题 -->
  93. <div class="bottom-icon">
  94. <img class="sub-title" :src="subtitle" alt="构建场景化交易" />
  95. <!-- 中间文字 -->
  96. <div class="content-text">
  97. <img class="content-text1" :src="text1" alt=" 数据可计算" />
  98. <img class="content-text2" :src="text2" alt=" 场景可预演" />
  99. <img class="content-text3" :src="text3" alt=" 交易可掌控" />
  100. </div>
  101. <!-- 底部按钮 -->
  102. <div class="buttons-container">
  103. <button class="btn-item" @click="goToHomePage">
  104. <img :src="btnIcon" alt="按钮图片" />
  105. </button>
  106. </div>
  107. </div>
  108. </div>
  109. <div v-if="noPermissonDialogVisible" class="noPermissionDialog">
  110. <div class="noPermissionContent" @click="closeNoPermissionDialog">
  111. <div class="noPermissionCloseBtn">
  112. <el-icon class="noPermissionIcon"><Close /></el-icon>
  113. </div>
  114. {{ noPermissonDialogObj.msg }}
  115. </div>
  116. </div>
  117. </template>
  118. <style scoped>
  119. .homepage {
  120. /* background-image: url("@/assets/img/DBQBmodel/bg.png"); */
  121. /* width: 100vw; */
  122. min-height: 100vh;
  123. background-size: cover;
  124. background-position: center;
  125. background-repeat: no-repeat;
  126. display: flex;
  127. flex-direction: column;
  128. align-items: center;
  129. }
  130. /* 顶部标题图 */
  131. .top-icon {
  132. width: 80%;
  133. max-width: 500px;
  134. height: auto;
  135. /* margin-top: 20px; */
  136. position: absolute;
  137. top: 11vh;
  138. }
  139. .bottom-icon {
  140. /* width: 100%; */
  141. display: flex;
  142. flex-direction: column;
  143. position: absolute;
  144. bottom: 10vh;
  145. align-items: center;
  146. }
  147. /* 副标题 */
  148. .sub-title {
  149. /* padding-top: 40px; */
  150. width: 100%;
  151. max-width: 350px;
  152. height: auto;
  153. /* margin-top: 18rem; */
  154. }
  155. /* 中间三个描述图 */
  156. .content-text {
  157. display: flex;
  158. flex-direction: row;
  159. /* 改为横向排列 */
  160. align-items: center;
  161. justify-content: center;
  162. /* 添加水平居中 */
  163. /* gap: 23px; */
  164. margin-bottom: 10px;
  165. flex-wrap: wrap;
  166. /* 添加换行支持,防止小屏幕溢出 */
  167. }
  168. .content-text img {
  169. width: 80%;
  170. max-width: 300px;
  171. height: auto;
  172. flex: 1;
  173. /* 让图片平均分配空间 */
  174. min-width: 200px;
  175. /* 设置最小宽度 */
  176. }
  177. /* 按钮区 */
  178. .buttons-container {
  179. align-items: center;
  180. }
  181. .btn-item {
  182. width: auto;
  183. background: none;
  184. border: none;
  185. padding: 0;
  186. cursor: pointer;
  187. }
  188. .btn-item img {
  189. width: 200%;
  190. max-width: 350px;
  191. height: auto;
  192. }
  193. .noPermissionDialog {
  194. width: 100%;
  195. display: flex;
  196. justify-content: center;
  197. align-items: center;
  198. position: fixed;
  199. bottom: 15%;
  200. /* margin: auto auto; */
  201. color: white;
  202. }
  203. .noPermissionCloseBtn {
  204. border-radius: 5px;
  205. border: 1px solid white;
  206. background-color: #8621d9;
  207. padding: 2px;
  208. display: flex;
  209. justify-content: center;
  210. align-items: center;
  211. position: absolute;
  212. top: -10px;
  213. right: -10px;
  214. }
  215. .noPermissionContent {
  216. position: relative;
  217. border-radius: 5px;
  218. border: 1px solid white;
  219. padding: 10px 30px;
  220. background-color: #261176;
  221. display: flex;
  222. justify-content: center;
  223. align-items: center;
  224. }
  225. /* 手机适配 - 小屏幕时保持纵向排列 */
  226. @media screen and (max-width: 768px) {
  227. .top-icon {
  228. margin-top: 12%;
  229. width: 90%;
  230. }
  231. .sub-title {
  232. width: 80%;
  233. margin-top: 25%;
  234. }
  235. .content-text {
  236. flex-direction: column;
  237. /* 小屏幕时恢复纵向排列 */
  238. }
  239. .content-text img {
  240. width: 70%;
  241. flex: none;
  242. /* 取消flex布局 */
  243. }
  244. .btn-item img {
  245. width: 50%;
  246. /* margin-top: 20px; */
  247. }
  248. }
  249. </style>