index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. <template>
  2. <div class="layout">
  3. <div class="top">
  4. <div class="w_1200">
  5. <el-row :gutter="20" align="middle">
  6. <el-col :span="12" class="top_1">
  7. <!-- <el-image class="images" :src="logoUrl" fit="fill" /> -->
  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="12" v-if="user && user.id" class="top_2">
  15. <el-dropdown>
  16. <el-button size="medium" :icon="User" type="primary">
  17. {{ user.nick_name || '游客' }}
  18. </el-button>
  19. <template #dropdown>
  20. <el-dropdown-menu>
  21. <el-dropdown-item @click="toOpen">管理中心</el-dropdown-item>
  22. <el-dropdown-item @click="toCommon(2)">个人中心</el-dropdown-item>
  23. <el-dropdown-item @click="toLogout">注销</el-dropdown-item>
  24. </el-dropdown-menu>
  25. </template>
  26. </el-dropdown>
  27. </el-col>
  28. <el-col :span="12" v-else class="top_2">
  29. <el-button @click="toLogin(2)" type="primary" size="medium">注册</el-button>
  30. <el-button @click="toLogin(1)" type="primary" size="medium">登录</el-button>
  31. </el-col>
  32. </el-row>
  33. </div>
  34. <div class="w_1200">
  35. <el-col :span="24" class="top_3">
  36. <el-col :span="24" class="list">
  37. <div
  38. class="text"
  39. v-for="(item, index) in data"
  40. :key="index"
  41. @click="selectMenu(item.route)"
  42. :style="{
  43. backgroundColor: item.hover ? '#2374ff' : 'transparent',
  44. color: item.hover ? '#ffffff' : ''
  45. }"
  46. @mouseover="handleMouseOver(index)"
  47. @mouseleave="handleMouseLeave(index)"
  48. >
  49. <div>{{ item.title }}</div>
  50. </div>
  51. </el-col>
  52. <div v-if="info && info.children" class="info">
  53. <el-row v-if="info.key == '3'" style="justify-content: center; margin: 10px 0 0 0">
  54. <el-col :span="11" class="list_1" v-for="(item, index) in info.children" :key="index">
  55. <div class="title">{{ item.title }}</div>
  56. <div class="list_1_1">
  57. <div
  58. v-for="(tag, indexs) in item.children"
  59. :key="indexs"
  60. class="title1"
  61. @click="selectMenu(tag.route)"
  62. >
  63. {{ tag.title }}
  64. </div>
  65. </div>
  66. </el-col>
  67. </el-row>
  68. <el-row v-else>
  69. <el-col :span="24" class="list_2">
  70. <div
  71. v-for="(item, index) in info.children"
  72. :key="index"
  73. class="title1"
  74. @click="selectMenu(item.route)"
  75. >
  76. {{ item.title }}
  77. </div>
  78. </el-col>
  79. </el-row>
  80. </div>
  81. </el-col>
  82. </div>
  83. </div>
  84. <div class="center">
  85. <el-col :span="24" class="container">
  86. <router-view :style="viewStyle"></router-view>
  87. </el-col>
  88. </div>
  89. <div class="bottom">
  90. <div class="w_1200 footflex">
  91. <!-- <el-row :span="24" class="footflex_1">
  92. <el-col :span="2" class="left"> 友情链接</el-col>
  93. <el-col :span="22" class="right">
  94. <span v-for="(item, index) in footInfo.linkList" :key="index" @click="toLink(item)">{{
  95. item.name
  96. }}</span>
  97. </el-col>
  98. </el-row> -->
  99. <el-row :span="24" class="footflex_2">
  100. <el-col :span="21" class="left">
  101. <el-col :span="24" class="left_1">
  102. <el-image class="images" :src="logoBottom" fit="fill" />
  103. </el-col>
  104. <el-col :span="24" class="left_2"> 电话:{{ footInfo.Phone }} </el-col>
  105. <el-col :span="24" class="left_2"> 邮箱:{{ footInfo.Email }} </el-col>
  106. <el-col :span="24" class="left_2"> 地址:{{ footInfo.Address }} </el-col>
  107. </el-col>
  108. <el-col :span="3" class="right">
  109. <el-col :span="24" class="right_1">
  110. <el-image class="images" :src="footInfo.Code" fit="fill" />
  111. </el-col>
  112. <el-col :span="24" class="right_2" @click="toHelp('1')">关于我们</el-col>
  113. </el-col>
  114. </el-row>
  115. <el-row :span="24" class="footflex_3">
  116. {{ footInfo.Copyright }}
  117. </el-row>
  118. </div>
  119. </div>
  120. </div>
  121. </template>
  122. <script setup>
  123. // 图片引入
  124. // import logoUrl from '/images/logo-jilin.png'
  125. import logoBottom from '/images/logo-jilinbai.png'
  126. import { siteInfo, footInfo, menuList } from '@/layout/site'
  127. // 接口
  128. import { TagsStore } from '@/store/api/system/tags'
  129. const store = TagsStore()
  130. import { DesignStore } from '@/store/api/platform/design'
  131. const designStore = DesignStore()
  132. const router = useRouter()
  133. const route = useRoute()
  134. import { UserStore } from '@/store/user'
  135. const userStore = UserStore()
  136. const user = computed(() => userStore.user)
  137. const data = ref([])
  138. const info = ref({})
  139. const configInfo = ref({ logoUrl: [], Unit: [], Code: [] })
  140. const foot = ref({})
  141. // 请求
  142. onMounted(async () => {
  143. await search()
  144. })
  145. const search = async () => {
  146. const res = await store.query({ is_use: '0' })
  147. // if (res.errcode == '0' && res.total > 0) data.value = res.data
  148. // else data.value = menuList
  149. for (const val of menuList) {
  150. if (route.name === val.route) val.hover = true
  151. else val.hover = false
  152. }
  153. data.value = menuList
  154. // 基础设置
  155. const result = await designStore.query({})
  156. if (res.errcode == '0' && res.total > 0) {
  157. configInfo.value = result.data[0] || {}
  158. foot.value = result.data[0].footInfo || {}
  159. }
  160. }
  161. const selectMenu = (item, query) => {
  162. for (const val of data.value) {
  163. if (route.name === val.route) val.hover = true
  164. else val.hover = false
  165. }
  166. router.push({ path: `/${item}`, query })
  167. }
  168. // 登录|注册
  169. const toLogin = (status) => {
  170. if (status === 1) router.push({ path: '/login' })
  171. else router.push({ path: '/register' })
  172. }
  173. // 帮助中心
  174. const toHelp = (type) => {
  175. router.push({ path: '/help', query: { type } })
  176. }
  177. // 打开管理端
  178. const toOpen = async () => {
  179. window.location.href = import.meta.env.VITE_APP_HOME
  180. }
  181. // 基础跳转
  182. const toCommon = (type) => {
  183. if (type == '1') router.push('/chat')
  184. else if (type == '2') router.push('/center')
  185. else if (type == '3') router.push('/sign')
  186. }
  187. const handleMouseOver = (index) => {
  188. data.value[index].hover = true
  189. info.value = data.value[index]
  190. }
  191. const handleMouseLeave = (index) => {
  192. data.value[index].hover = false
  193. // info.value = {}
  194. const arr = data.value.every((i) => i.hover === false)
  195. if (arr) {
  196. for (const val of data.value) {
  197. if (route.name === val.route) val.hover = true
  198. else val.hover = false
  199. }
  200. }
  201. }
  202. // 退出登录
  203. const toLogout = () => {
  204. userStore.logOut()
  205. router.push('/login')
  206. }
  207. watch(
  208. route,
  209. (newVal) => {
  210. if (newVal && newVal.name) {
  211. if (newVal.query?.type) selectMenu(newVal.name, newVal.query)
  212. else selectMenu(newVal.name)
  213. }
  214. },
  215. {
  216. immediate: true //初始化立即执行
  217. }
  218. )
  219. // provide
  220. provide('selectMenu', selectMenu)
  221. </script>
  222. <style scoped lang="scss">
  223. .layout {
  224. position: relative;
  225. .top {
  226. position: sticky;
  227. top: 0;
  228. padding: 5px 0;
  229. z-index: 1000;
  230. background: #ffffff;
  231. .current {
  232. border-bottom: 2px solid #409eff;
  233. background-color: #ecf5ff;
  234. :deep(.el-sub-menu__title) {
  235. color: #409eff !important;
  236. }
  237. }
  238. .top_1 {
  239. display: flex;
  240. align-items: center;
  241. margin: 10px 0 0 0;
  242. .image {
  243. height: 40px;
  244. width: 140px;
  245. margin: 0 5px 0 0;
  246. }
  247. .images {
  248. height: auto;
  249. width: 335px;
  250. }
  251. .content {
  252. margin: 0 0 0 5px;
  253. .title {
  254. margin: 0 0 5px 0;
  255. font-size: $global-font-size-24;
  256. font-weight: bold;
  257. }
  258. .english {
  259. margin: 0 0 0 5px;
  260. font-size: $global-font-size-14;
  261. opacity: 0.8;
  262. color: #1c66e7;
  263. }
  264. }
  265. }
  266. :deep(.ant-tabs-nav) {
  267. margin: 0 !important;
  268. }
  269. :deep(.ant-tabs-nav::before) {
  270. border: 0 !important;
  271. }
  272. :deep(.el-menu) {
  273. border: none !important;
  274. }
  275. .top_2 {
  276. display: flex;
  277. justify-content: flex-end;
  278. .example-showcase .el-dropdown-link {
  279. cursor: pointer;
  280. color: #1c66e7;
  281. display: flex;
  282. align-items: center;
  283. }
  284. }
  285. .top_3 {
  286. margin: 5px 0 0 0;
  287. .list {
  288. display: flex;
  289. padding: 10px 0;
  290. .text {
  291. margin: 0 2px 0 0;
  292. padding: 10px;
  293. font-family: Microsoft YaHei;
  294. font-size: $global-font-size-18;
  295. color: #333333;
  296. cursor: pointer; /* 改变鼠标样式为手形 */
  297. }
  298. }
  299. .info {
  300. width: 100%;
  301. position: absolute;
  302. left: 0;
  303. background: #ffffff;
  304. padding: 10px 0;
  305. .list_1 {
  306. margin: 0 10px 0 0;
  307. border: #e4e4e4 1px dashed;
  308. .title {
  309. margin: 5px 0;
  310. font-size: $global-font-size-18;
  311. font-weight: 600;
  312. text-align: center;
  313. color: #252f49;
  314. }
  315. .title::before {
  316. content: '';
  317. position: absolute;
  318. transform: translateY(-50%);
  319. top: 15px;
  320. margin-left: -70px;
  321. width: 40px;
  322. height: 1px;
  323. border-bottom: 1px #252f49 solid;
  324. }
  325. .title::after {
  326. content: '';
  327. position: absolute;
  328. transform: translateY(-50%);
  329. top: 15px;
  330. margin-left: 30px;
  331. width: 40px;
  332. height: 1px;
  333. border-bottom: 1px #252f49 solid;
  334. }
  335. .list_1_1 {
  336. display: flex;
  337. flex-wrap: wrap;
  338. justify-content: center;
  339. margin: 5px 0;
  340. .title1 {
  341. width: 110px;
  342. margin: 8px;
  343. padding: 5px;
  344. text-align: center;
  345. border: 1px #fff solid;
  346. background-image: linear-gradient(to bottom, #f8f3ff 0%, #e0e8fe 100%);
  347. border-radius: 4px;
  348. }
  349. .title1:hover {
  350. background: #2280ff;
  351. color: #ffffff;
  352. }
  353. }
  354. }
  355. .list_2 {
  356. display: flex;
  357. flex-wrap: wrap;
  358. justify-content: center;
  359. margin: 5px 0;
  360. .title1 {
  361. width: 110px;
  362. margin: 8px;
  363. padding: 5px;
  364. text-align: center;
  365. border: 1px #fff solid;
  366. background-image: linear-gradient(to bottom, #f8f3ff 0%, #e0e8fe 100%);
  367. border-radius: 4px;
  368. }
  369. .title1:hover {
  370. background: #2280ff;
  371. color: #ffffff;
  372. }
  373. }
  374. }
  375. }
  376. }
  377. .center {
  378. min-height: 74.2vh;
  379. }
  380. .bottom {
  381. position: relative;
  382. width: 100%;
  383. padding: 7px 0;
  384. font-size: $global-font-size-20;
  385. background-color: #2e3546;
  386. color: #f0f2f5;
  387. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
  388. 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
  389. 'Noto Color Emoji';
  390. font-variant: tabular-nums;
  391. line-height: 1.5715;
  392. font-feature-settings: 'tnum', 'tnum';
  393. .image {
  394. width: 78px;
  395. height: 78px;
  396. }
  397. .footTitle {
  398. margin: 5px 0 0 0;
  399. .footSpan {
  400. margin-bottom: 3px;
  401. }
  402. }
  403. .footTop {
  404. font-size: $global-font-size-20;
  405. margin-bottom: 12px;
  406. }
  407. }
  408. .footflex {
  409. .footflex_1 {
  410. display: flex;
  411. align-items: flex-end;
  412. padding: 30px 0;
  413. border-bottom: 1px solid #444444;
  414. .left {
  415. font-size: $global-font-size-20;
  416. font-family: 'Microsoft YaHei';
  417. color: rgb(255, 255, 255);
  418. }
  419. .right {
  420. color: #cccccc;
  421. font-family: microsoft yahei;
  422. font-size: $global-font-size-17;
  423. font-weight: normal;
  424. text-decoration: none;
  425. span {
  426. margin-right: 50px;
  427. }
  428. span:hover {
  429. color: rgb(255, 255, 255);
  430. cursor: pointer;
  431. }
  432. }
  433. }
  434. .footflex_2 {
  435. display: flex;
  436. padding: 10px 0;
  437. border-bottom: 1px solid #444444;
  438. .left {
  439. font-family: 'Microsoft YaHei';
  440. color: rgb(204, 204, 204);
  441. font-size: $global-font-size-18;
  442. .left_2 {
  443. margin: 5px 0 0 0;
  444. }
  445. }
  446. .right {
  447. text-align: center;
  448. .right_1 {
  449. .image {
  450. width: 130px;
  451. height: 130px;
  452. }
  453. }
  454. .right_2 {
  455. font-family: 'Microsoft YaHei';
  456. font-size: $global-font-size-18;
  457. color: rgb(204, 204, 204);
  458. }
  459. .right_2:hover {
  460. color: rgb(255, 255, 255);
  461. cursor: pointer;
  462. }
  463. }
  464. }
  465. .footflex_3 {
  466. padding: 10px 0;
  467. font-family: 'Microsoft YaHei';
  468. font-size: $global-font-size-18;
  469. color: rgb(204, 204, 204);
  470. }
  471. }
  472. }
  473. </style>