index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
  5. <el-image class="video" :src="siteInfo.videoUrl" fit="fill" />
  6. <div class="content">
  7. <div class="one">
  8. <el-row>
  9. <el-col :span="14" class="left">
  10. <el-image class="image" :src="siteInfo.logoUrl" fit="fill" />
  11. <div class="left_1">
  12. <div class="title">{{ siteInfo.zhTitle }}</div>
  13. <div class="English">{{ siteInfo.zhEnglish }}</div>
  14. </div>
  15. </el-col>
  16. <el-col :span="10" class="right">
  17. <el-row align="middle">
  18. <el-col :span="6" class="right_1" @click="toCommon(0)">帮助中心</el-col>
  19. <el-col :span="14" class="right_2">
  20. <a-input-search
  21. v-model:value="searchValue"
  22. placeholder="请输入您想要搜索的内容"
  23. style="width: 240px"
  24. enter-button
  25. @search="onSearch"
  26. />
  27. </el-col>
  28. <el-col :span="4" v-if="user && user._id" class="right_3">
  29. <el-dropdown>
  30. <el-button type="primary" size="mini">
  31. {{ user.nick_name || '游客' }}
  32. </el-button>
  33. <template #dropdown>
  34. <el-dropdown-menu>
  35. <el-dropdown-menu>
  36. <el-dropdown-item @click="toOpen">管理中心</el-dropdown-item>
  37. <el-dropdown-item @click="toCenter">个人中心</el-dropdown-item>
  38. <el-dropdown-item @click="toLogout">注销</el-dropdown-item>
  39. </el-dropdown-menu>
  40. </el-dropdown-menu>
  41. </template>
  42. </el-dropdown>
  43. </el-col>
  44. <el-col :span="4" v-else class="right_3">
  45. <el-button @click="toCommon(1)" type="primary" size="small">登录</el-button>
  46. <el-button @click="toCommon(2)" type="primary" size="small">注册</el-button>
  47. </el-col>
  48. </el-row>
  49. </el-col>
  50. </el-row>
  51. </div>
  52. <div class="two">
  53. <el-row justify="center" align="middle">
  54. <el-col class="list" :span="8" @click="switchMenu('one')">
  55. <div class="bg"></div>
  56. <div class="two_1">
  57. <text>{{ siteInfo.zhTitle }}</text>
  58. </div>
  59. </el-col>
  60. </el-row>
  61. </div>
  62. <div class="thr">
  63. <el-row justify="center" align="middle">
  64. <el-col
  65. class="list"
  66. :span="4"
  67. v-for="(item, index) in menu"
  68. :key="index"
  69. @click="switchMenu(item.href)"
  70. >
  71. <div class="thr_1">
  72. <div class="title">{{ item.title }}</div>
  73. <div class="English">{{ item.English }}</div>
  74. </div>
  75. </el-col>
  76. </el-row>
  77. </div>
  78. <div class="four">
  79. {{ footInfo.Copyright }}
  80. </div>
  81. </div>
  82. </el-col>
  83. </el-row>
  84. </div>
  85. </template>
  86. <script setup>
  87. // 基础
  88. import { siteInfo, footInfo, menuList } from '@/layout/site'
  89. import { UserStore } from '@/store/user'
  90. const userStore = UserStore()
  91. const user = computed(() => userStore.user)
  92. // 加载中
  93. const loading = ref(false)
  94. // 路由
  95. const router = useRouter()
  96. // 搜索
  97. const searchValue = ref('')
  98. const menu = ref(menuList)
  99. // 请求
  100. onMounted(async () => {
  101. loading.value = true
  102. search()
  103. loading.value = false
  104. })
  105. const search = async () => {}
  106. // 搜索
  107. const onSearch = (data) => {
  108. const query = { type: 'search' }
  109. if (data) query.searchValue = data
  110. router.push({ path: '/search', query })
  111. }
  112. const toCommon = (type) => {
  113. if (type === 0) router.push({ path: '/help' })
  114. else if (type === 1) router.push({ path: '/login' })
  115. else router.push({ path: '/register' })
  116. }
  117. // 点击指定模块
  118. const switchMenu = async (item) => {
  119. router.push({ path: `/${item}` })
  120. }
  121. // 打开管理端
  122. const toOpen = async () => {
  123. window.location.href = import.meta.env.VITE_APP_HOME
  124. }
  125. // 基础跳转
  126. const toCenter = () => {
  127. router.push('/center')
  128. }
  129. // 退出登录
  130. const toLogout = () => {
  131. userStore.logOut()
  132. router.push('/login')
  133. }
  134. </script>
  135. <style scoped lang="scss">
  136. .main {
  137. height: 100vh;
  138. min-width: 1200px;
  139. .video {
  140. position: absolute;
  141. top: 0px;
  142. width: 100%;
  143. height: 100%;
  144. object-fit: cover;
  145. z-index: 0;
  146. }
  147. .content {
  148. position: absolute;
  149. top: 0px;
  150. width: 100%;
  151. height: 100%;
  152. z-index: 0;
  153. color: #ffffff;
  154. .one {
  155. width: 1200px;
  156. min-width: 1200px;
  157. margin: 0 auto;
  158. padding-top: 32px;
  159. padding-bottom: 12px;
  160. .left {
  161. display: flex;
  162. align-items: center;
  163. .image {
  164. height: 45px;
  165. width: 45px;
  166. margin: 0 10px 0 0;
  167. }
  168. .left_1 {
  169. margin: 0 0 0 5px;
  170. .title {
  171. margin: 0 0 5px 0;
  172. font-size: 23px;
  173. font-weight: bold;
  174. }
  175. .English {
  176. font-size: 12px;
  177. color: #fff;
  178. }
  179. }
  180. }
  181. .right {
  182. font-size: 16px;
  183. letter-spacing: 0;
  184. color: #fff;
  185. font-weight: 500;
  186. .right_3 {
  187. display: flex;
  188. justify-content: space-between;
  189. .example-showcase .el-dropdown-link {
  190. cursor: pointer;
  191. color: #1c66e7;
  192. display: flex;
  193. align-items: center;
  194. }
  195. }
  196. }
  197. }
  198. .two {
  199. width: 1200px;
  200. min-width: 1200px;
  201. margin: 0 auto;
  202. width: 100%;
  203. position: absolute;
  204. left: 50%;
  205. top: 45%;
  206. transform: translate(-50%, -50%);
  207. .list {
  208. position: relative;
  209. display: flex;
  210. justify-content: center;
  211. .bg {
  212. margin: 10px;
  213. width: 400px;
  214. height: 400px;
  215. z-index: 1;
  216. background-image: url(/images/homebg.png);
  217. background-position: center center;
  218. background-repeat: no-repeat;
  219. background-size: contain;
  220. animation: animationName 5s linear infinite;
  221. }
  222. .two_1 {
  223. position: absolute;
  224. top: 45%;
  225. left: 35%;
  226. display: flex;
  227. flex-direction: column;
  228. align-items: center;
  229. z-index: 999;
  230. width: 200px;
  231. text {
  232. font-size: 20px;
  233. color: #ffffff;
  234. text-align: center;
  235. }
  236. }
  237. @keyframes animationName {
  238. 100% {
  239. transform: rotate(1turn);
  240. }
  241. }
  242. }
  243. }
  244. .thr {
  245. position: absolute;
  246. left: 10%;
  247. bottom: 90px;
  248. .list {
  249. margin: 10px 0;
  250. .thr_1 {
  251. font-family: PingFangSC-Semibold;
  252. color: #fff;
  253. margin-left: 14px;
  254. text-align: center;
  255. .title {
  256. font-size: 19px;
  257. font-weight: 600;
  258. }
  259. .English {
  260. font-size: 12px;
  261. font-weight: 400;
  262. }
  263. }
  264. }
  265. }
  266. .four {
  267. width: 100%;
  268. position: absolute;
  269. bottom: 20px;
  270. text-align: center;
  271. font-size: 12px;
  272. color: #fff;
  273. }
  274. }
  275. }
  276. </style>