index copy.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  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. const menuList = menu.value.filter((item) => {
  107. if (item.href != 'one') return item
  108. })
  109. menu.value = menuList
  110. }
  111. // 搜索
  112. const onSearch = (data) => {
  113. const query = { type: 'search' }
  114. if (data) query.searchValue = data
  115. router.push({ path: '/search', query })
  116. }
  117. const toCommon = (type) => {
  118. if (type === 0) router.push({ path: '/help' })
  119. else if (type === 1) router.push({ path: '/login' })
  120. else router.push({ path: '/register' })
  121. }
  122. // 点击指定模块
  123. const switchMenu = async (item) => {
  124. router.push({ path: `/${item}` })
  125. }
  126. // 打开管理端
  127. const toOpen = async () => {
  128. window.location.href = import.meta.env.VITE_APP_HOME
  129. }
  130. // 基础跳转
  131. const toCenter = () => {
  132. router.push('/center')
  133. }
  134. // 退出登录
  135. const toLogout = () => {
  136. userStore.logOut()
  137. router.push('/login')
  138. }
  139. </script>
  140. <style scoped lang="scss">
  141. .main {
  142. height: 100vh;
  143. min-width: 1200px;
  144. .video {
  145. position: absolute;
  146. top: 0px;
  147. width: 100%;
  148. height: 100%;
  149. object-fit: cover;
  150. z-index: 0;
  151. }
  152. .content {
  153. position: absolute;
  154. top: 0px;
  155. width: 100%;
  156. height: 100%;
  157. z-index: 0;
  158. color: #ffffff;
  159. .one {
  160. width: 1200px;
  161. min-width: 1200px;
  162. margin: 0 auto;
  163. padding-top: 32px;
  164. padding-bottom: 12px;
  165. .left {
  166. display: flex;
  167. align-items: center;
  168. .image {
  169. height: 45px;
  170. width: 45px;
  171. margin: 0 10px 0 0;
  172. }
  173. .left_1 {
  174. margin: 0 0 0 5px;
  175. .title {
  176. margin: 0 0 5px 0;
  177. font-size: 23px;
  178. font-weight: bold;
  179. }
  180. .English {
  181. font-size: 12px;
  182. color: #fff;
  183. }
  184. }
  185. }
  186. .right {
  187. font-size: 16px;
  188. letter-spacing: 0;
  189. color: #fff;
  190. font-weight: 500;
  191. .right_3 {
  192. display: flex;
  193. justify-content: space-between;
  194. .example-showcase .el-dropdown-link {
  195. cursor: pointer;
  196. color: #1c66e7;
  197. display: flex;
  198. align-items: center;
  199. }
  200. }
  201. }
  202. }
  203. .two {
  204. width: 1200px;
  205. min-width: 1200px;
  206. margin: 0 auto;
  207. width: 100%;
  208. position: absolute;
  209. left: 50%;
  210. top: 45%;
  211. transform: translate(-50%, -50%);
  212. .list {
  213. position: relative;
  214. display: flex;
  215. justify-content: center;
  216. .bg {
  217. margin: 10px;
  218. width: 400px;
  219. height: 400px;
  220. z-index: 1;
  221. background-image: url(/images/homebg.png);
  222. background-position: center center;
  223. background-repeat: no-repeat;
  224. background-size: contain;
  225. animation: animationName 5s linear infinite;
  226. }
  227. .two_1 {
  228. position: absolute;
  229. top: 45%;
  230. left: 35%;
  231. display: flex;
  232. flex-direction: column;
  233. align-items: center;
  234. z-index: 999;
  235. width: 200px;
  236. text {
  237. font-size: 20px;
  238. color: #ffffff;
  239. text-align: center;
  240. }
  241. }
  242. @keyframes animationName {
  243. 100% {
  244. transform: rotate(1turn);
  245. }
  246. }
  247. }
  248. }
  249. .thr {
  250. position: absolute;
  251. left: 10%;
  252. bottom: 10%;
  253. .list {
  254. margin: 10px 0;
  255. .thr_1 {
  256. font-family: PingFangSC-Semibold;
  257. color: #fff;
  258. margin-left: 14px;
  259. text-align: center;
  260. .title {
  261. font-size: 19px;
  262. font-weight: 600;
  263. }
  264. .English {
  265. font-size: 12px;
  266. font-weight: 400;
  267. }
  268. }
  269. }
  270. }
  271. .four {
  272. width: 100%;
  273. position: absolute;
  274. bottom: 20px;
  275. text-align: center;
  276. font-size: 12px;
  277. color: #fff;
  278. }
  279. }
  280. }
  281. </style>