index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  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. </el-col>
  53. </div>
  54. </div>
  55. <div class="center">
  56. <el-col :span="24" class="container">
  57. <router-view :style="viewStyle"></router-view>
  58. </el-col>
  59. </div>
  60. <div class="bottom">
  61. <div class="w_1200 footflex">
  62. <!-- <el-row :span="24" class="footflex_1">
  63. <el-col :span="2" class="left"> 友情链接</el-col>
  64. <el-col :span="22" class="right">
  65. <span v-for="(item, index) in footInfo.linkList" :key="index" @click="toLink(item)">{{
  66. item.name
  67. }}</span>
  68. </el-col>
  69. </el-row> -->
  70. <el-row :span="24" class="footflex_2">
  71. <el-col :span="21" class="left">
  72. <el-col :span="24" class="left_1">
  73. <el-image class="images" :src="logoBottom" fit="fill" />
  74. </el-col>
  75. <el-col :span="24" class="left_2"> 电话:{{ footInfo.Phone }} </el-col>
  76. <el-col :span="24" class="left_2"> 邮箱:{{ footInfo.Email }} </el-col>
  77. <el-col :span="24" class="left_2"> 地址:{{ footInfo.Address }} </el-col>
  78. </el-col>
  79. <el-col :span="3" class="right">
  80. <el-col :span="24" class="right_1">
  81. <el-image class="images" :src="footInfo.Code" fit="fill" />
  82. </el-col>
  83. <el-col :span="24" class="right_2" @click="toHelp('1')">关于我们</el-col>
  84. </el-col>
  85. </el-row>
  86. <el-row :span="24" class="footflex_3">
  87. {{ footInfo.Copyright }}
  88. </el-row>
  89. </div>
  90. </div>
  91. </div>
  92. </template>
  93. <script setup>
  94. // 图片引入
  95. import logoUrl from '/images/logo-jilin.png'
  96. import logoBottom from '/images/logo-jilinbai.png'
  97. import { siteInfo, footInfo, menuList } from '@/layout/site'
  98. // 接口
  99. import { TagsStore } from '@/store/api/system/tags'
  100. const store = TagsStore()
  101. import { DesignStore } from '@/store/api/platform/design'
  102. const designStore = DesignStore()
  103. const router = useRouter()
  104. const route = useRoute()
  105. import { UserStore } from '@/store/user'
  106. const userStore = UserStore()
  107. const user = computed(() => userStore.user)
  108. const data = ref([])
  109. const info = ref({})
  110. const configInfo = ref({ logoUrl: [], Unit: [], Code: [] })
  111. const foot = ref({})
  112. // 请求
  113. onMounted(async () => {
  114. await search()
  115. })
  116. const search = async () => {
  117. const res = await store.query({ is_use: '0' })
  118. // if (res.errcode == '0' && res.total > 0) data.value = res.data
  119. // else data.value = menuList
  120. for (const val of menuList) {
  121. if (route.name === val.route) val.hover = true
  122. else val.hover = false
  123. }
  124. data.value = menuList
  125. // 基础设置
  126. const result = await designStore.query({})
  127. if (res.errcode == '0' && res.total > 0) {
  128. configInfo.value = result.data[0] || {}
  129. foot.value = result.data[0].footInfo || {}
  130. }
  131. }
  132. const selectMenu = (item, query) => {
  133. for (const val of data.value) {
  134. if (route.name === val.route) val.hover = true
  135. else val.hover = false
  136. }
  137. router.push({ path: `/${item}`, query })
  138. }
  139. // 登录|注册
  140. const toLogin = (status) => {
  141. if (status === 1) router.push({ path: '/login' })
  142. else router.push({ path: '/register' })
  143. }
  144. // 帮助中心
  145. const toHelp = (type) => {
  146. router.push({ path: '/help', query: { type } })
  147. }
  148. // 打开管理端
  149. const toOpen = async () => {
  150. window.location.href = import.meta.env.VITE_APP_HOME
  151. }
  152. // 基础跳转
  153. const toCommon = (type) => {
  154. if (type == '1') router.push('/chat')
  155. else if (type == '2') router.push('/center')
  156. else if (type == '3') router.push('/sign')
  157. }
  158. const handleMouseOver = (index) => {
  159. data.value[index].hover = true
  160. info.value = data.value[index]
  161. }
  162. const handleMouseLeave = (index) => {
  163. data.value[index].hover = false
  164. info.value = {}
  165. const arr = data.value.every((i) => i.hover === false)
  166. if (arr) {
  167. for (const val of data.value) {
  168. if (route.name === val.route) val.hover = true
  169. else val.hover = false
  170. }
  171. }
  172. }
  173. // 退出登录
  174. const toLogout = () => {
  175. userStore.logOut()
  176. router.push('/login')
  177. }
  178. const toLink = (item) => {
  179. window.open(item.href, '_blank') // 在新标签页中打开URL
  180. }
  181. watch(
  182. route,
  183. (newVal) => {
  184. if (newVal && newVal.name) {
  185. if (newVal.query?.type) selectMenu(newVal.name, newVal.query)
  186. else selectMenu(newVal.name)
  187. }
  188. },
  189. {
  190. immediate: true //初始化立即执行
  191. }
  192. )
  193. // provide
  194. provide('selectMenu', selectMenu)
  195. </script>
  196. <style scoped lang="scss">
  197. .layout {
  198. .top {
  199. position: sticky;
  200. top: 0;
  201. padding: 5px 0;
  202. z-index: 100;
  203. background: #ffffff;
  204. .current {
  205. border-bottom: 2px solid #409eff;
  206. background-color: #ecf5ff;
  207. :deep(.el-sub-menu__title) {
  208. color: #409eff !important;
  209. }
  210. }
  211. .top_1 {
  212. display: flex;
  213. align-items: center;
  214. margin: 10px 0 0 0;
  215. .image {
  216. height: 40px;
  217. width: 140px;
  218. margin: 0 5px 0 0;
  219. }
  220. .images {
  221. height: auto;
  222. width: 335px;
  223. }
  224. .content {
  225. margin: 0 0 0 5px;
  226. .title {
  227. margin: 0 0 5px 0;
  228. font-size: $global-font-size-22;
  229. font-weight: bold;
  230. }
  231. .english {
  232. margin: 0 0 0 5px;
  233. font-size: $global-font-size-14;
  234. opacity: 0.8;
  235. color: #1c66e7;
  236. }
  237. }
  238. }
  239. :deep(.ant-tabs-nav) {
  240. margin: 0 !important;
  241. }
  242. :deep(.ant-tabs-nav::before) {
  243. border: 0 !important;
  244. }
  245. :deep(.el-menu) {
  246. border: none !important;
  247. }
  248. .top_2 {
  249. display: flex;
  250. justify-content: flex-end;
  251. .example-showcase .el-dropdown-link {
  252. cursor: pointer;
  253. color: #1c66e7;
  254. display: flex;
  255. align-items: center;
  256. }
  257. }
  258. .top_3 {
  259. margin: 5px 0 0 0;
  260. .list {
  261. display: flex;
  262. padding: 10px 0;
  263. .text {
  264. margin: 0 2px 0 0;
  265. padding: 10px;
  266. font-family: Microsoft YaHei;
  267. font-size: $global-font-size-18;
  268. color: #333333;
  269. cursor: pointer; /* 改变鼠标样式为手形 */
  270. }
  271. }
  272. }
  273. }
  274. .center {
  275. min-height: 74.2vh;
  276. }
  277. .bottom {
  278. width: 100%;
  279. padding: 7px 0;
  280. font-size: $global-font-size-20;
  281. background-color: #2e3546;
  282. color: #f0f2f5;
  283. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
  284. 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
  285. 'Noto Color Emoji';
  286. font-variant: tabular-nums;
  287. line-height: 1.5715;
  288. font-feature-settings: 'tnum', 'tnum';
  289. .image {
  290. width: 78px;
  291. height: 78px;
  292. }
  293. .footTitle {
  294. margin: 5px 0 0 0;
  295. .footSpan {
  296. margin-bottom: 3px;
  297. }
  298. }
  299. .footTop {
  300. font-size: $global-font-size-20;
  301. margin-bottom: 12px;
  302. }
  303. }
  304. .footflex {
  305. .footflex_1 {
  306. display: flex;
  307. align-items: flex-end;
  308. padding: 30px 0;
  309. border-bottom: 1px solid #444444;
  310. .left {
  311. font-size: $global-font-size-20;
  312. font-family: 'Microsoft YaHei';
  313. color: rgb(255, 255, 255);
  314. }
  315. .right {
  316. color: #cccccc;
  317. font-family: microsoft yahei;
  318. font-size: $global-font-size-17;
  319. font-weight: normal;
  320. text-decoration: none;
  321. span {
  322. margin-right: 50px;
  323. }
  324. span:hover {
  325. color: rgb(255, 255, 255);
  326. cursor: pointer;
  327. }
  328. }
  329. }
  330. .footflex_2 {
  331. display: flex;
  332. padding: 10px 0;
  333. border-bottom: 1px solid #444444;
  334. .left {
  335. font-family: 'Microsoft YaHei';
  336. color: rgb(204, 204, 204);
  337. font-size: $global-font-size-18;
  338. .left_2 {
  339. margin: 5px 0 0 0;
  340. }
  341. }
  342. .right {
  343. text-align: center;
  344. .right_1 {
  345. .image {
  346. width: 130px;
  347. height: 130px;
  348. }
  349. }
  350. .right_2 {
  351. font-family: 'Microsoft YaHei';
  352. font-size: $global-font-size-18;
  353. color: rgb(204, 204, 204);
  354. }
  355. .right_2:hover {
  356. color: rgb(255, 255, 255);
  357. cursor: pointer;
  358. }
  359. }
  360. }
  361. .footflex_3 {
  362. padding: 10px 0;
  363. font-family: 'Microsoft YaHei';
  364. font-size: $global-font-size-18;
  365. color: rgb(204, 204, 204);
  366. }
  367. }
  368. }
  369. </style>