index.vue 6.6 KB

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