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.

315 lines
7.3 KiB

6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 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: 100%;
  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. overflow-x: hidden;
  130. }
  131. /* 顶部标题图 */
  132. .top-icon {
  133. width: 80%;
  134. max-width: 500px;
  135. height: auto;
  136. /* margin-top: 20px; */
  137. position: absolute;
  138. top: 11vh;
  139. }
  140. .bottom-icon {
  141. width: 100%;
  142. display: flex;
  143. flex-direction: column;
  144. position: absolute;
  145. bottom: 10vh;
  146. left: 0;
  147. right: 0;
  148. margin: 0 auto;
  149. align-items: center;
  150. }
  151. /* 副标题 */
  152. .sub-title {
  153. /* padding-top: 40px; */
  154. width: 100%;
  155. max-width: 350px;
  156. height: auto;
  157. /* margin-top: 18rem; */
  158. }
  159. /* 中间三个描述图 */
  160. .content-text {
  161. display: flex;
  162. flex-direction: row;
  163. /* 改为横向排列 */
  164. align-items: center;
  165. justify-content: center;
  166. /* 添加水平居中 */
  167. /* gap: 23px; */
  168. margin-bottom: 10px;
  169. flex-wrap: wrap;
  170. /* 添加换行支持,防止小屏幕溢出 */
  171. }
  172. .content-text img {
  173. width: 80%;
  174. max-width: 300px;
  175. height: auto;
  176. flex: 1;
  177. /* 让图片平均分配空间 */
  178. min-width: 200px;
  179. /* 设置最小宽度 */
  180. }
  181. /* 按钮区 */
  182. .buttons-container {
  183. align-items: center;
  184. }
  185. .btn-item {
  186. width: auto;
  187. background: none;
  188. border: none;
  189. padding: 0;
  190. cursor: pointer;
  191. animation: breathing 3s ease-in-out infinite;
  192. }
  193. @keyframes breathing {
  194. 0% {
  195. transform: scale(1);
  196. opacity: 0.8;
  197. }
  198. 50% {
  199. transform: scale(1.1);
  200. opacity: 1;
  201. }
  202. 100% {
  203. transform: scale(1);
  204. opacity: 0.8;
  205. }
  206. }
  207. .btn-item img {
  208. width: 200%;
  209. max-width: 350px;
  210. height: auto;
  211. }
  212. .noPermissionDialog {
  213. width: 100%;
  214. display: flex;
  215. justify-content: center;
  216. align-items: center;
  217. position: fixed;
  218. bottom: 15%;
  219. left: 0;
  220. right: 0;
  221. /* margin: auto auto; */
  222. color: white;
  223. }
  224. .noPermissionCloseBtn {
  225. border-radius: 5px;
  226. border: 1px solid white;
  227. background-color: #8621d9;
  228. padding: 2px;
  229. display: flex;
  230. justify-content: center;
  231. align-items: center;
  232. position: absolute;
  233. top: -10px;
  234. right: -10px;
  235. }
  236. .noPermissionContent {
  237. position: relative;
  238. border-radius: 5px;
  239. border: 1px solid white;
  240. padding: 10px 30px;
  241. background-color: #261176;
  242. display: flex;
  243. justify-content: center;
  244. align-items: center;
  245. }
  246. /* 手机适配 - 小屏幕时保持纵向排列 */
  247. @media screen and (max-width: 768px) {
  248. .homepage {
  249. width: 100%;
  250. overflow-x: hidden;
  251. }
  252. .top-icon {
  253. margin-top: 12%;
  254. width: 90%;
  255. }
  256. .sub-title {
  257. width: 80%;
  258. margin-top: 25%;
  259. }
  260. .content-text {
  261. flex-direction: column;
  262. /* 小屏幕时恢复纵向排列 */
  263. }
  264. .content-text img {
  265. width: 70%;
  266. flex: none;
  267. /* 取消flex布局 */
  268. }
  269. .btn-item img {
  270. width: 50%;
  271. /* margin-top: 20px; */
  272. }
  273. }
  274. @media screen and (min-width: 375px) and (max-width: 400px) {
  275. .top-icon {
  276. margin-top: 2%;
  277. width: 90%;
  278. }
  279. }
  280. </style>