custom-layout.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <div id="c-layout">
  3. <div class="header">
  4. <el-col :span="24" class="header_1">
  5. <div class="left">
  6. <el-image class="image" :src="siteInfo.logoUrl" fit="fill" />
  7. <div class="content">
  8. <text class="title">{{ siteInfo.zhTitle }}</text>
  9. </div>
  10. </div>
  11. <div class="right">
  12. <div class="right_1">
  13. <span @click="toLogin('0')">注册</span>
  14. <span>|</span>
  15. <span @click="toLogin('1')">登录</span>
  16. </div>
  17. <div class="right_2" @click="toChat">
  18. <el-icon><Bell /></el-icon>
  19. <span>消息</span>
  20. </div>
  21. </div>
  22. </el-col>
  23. <el-col :span="24" class="header_2">
  24. <el-col :span="24" class="list">
  25. <div
  26. class="text"
  27. v-for="(item, index) in data"
  28. @click="selectMenu(item.route)"
  29. :style="{
  30. backgroundColor: item.hover ? '#1073ff' : 'transparent',
  31. color: item.hover ? '#ffffff' : ''
  32. }"
  33. :key="index"
  34. @mouseover="handleMouseOver(index)"
  35. @mouseout="handleMousOut(index)"
  36. >
  37. <span>{{ item.title }}</span>
  38. </div>
  39. </el-col>
  40. <el-col :span="24" class="info">
  41. <div class="info_1" v-if="info.key == '3'">
  42. <el-col :span="12" class="list_1" v-for="(agg, index) in info.children" :key="index">
  43. <div class="title">{{ agg.title }}</div>
  44. <div class="list_1_1">
  45. <div v-for="(tag, indexs) in agg.children" :key="indexs" class="title1" @click="selectMenu(tag.route)">
  46. {{ tag.title }}
  47. </div>
  48. </div>
  49. </el-col>
  50. </div>
  51. <div class="info_2" v-if="info.key == '10'">
  52. <el-col :span="24" class="list_2">
  53. <div v-for="(tag, indexs) in info.children" :key="indexs" class="title1" @click="selectMenu(tag.route)">
  54. {{ tag.title }}
  55. </div>
  56. </el-col>
  57. </div>
  58. </el-col>
  59. </el-col>
  60. </div>
  61. <div class="main">
  62. <slot></slot>
  63. </div>
  64. <div class="footer" v-if="is_foot">
  65. <div class="footer_1">
  66. <div class="left">
  67. <el-image class="image" :src="footInfo.Logo" fit="fill" />
  68. <div class="title">电话:{{ footInfo.Phone }}</div>
  69. <div class="title">邮箱:{{ footInfo.Email }}</div>
  70. <div class="title">地址:{{ footInfo.Address }}</div>
  71. </div>
  72. <div class="right">
  73. <el-image class="image" :src="footInfo.Code" fit="fill" />
  74. <div class="title" @click="toHelp">关于我们</div>
  75. </div>
  76. </div>
  77. <div class="footer_2">
  78. {{ footInfo.Copyright }}
  79. </div>
  80. </div>
  81. </div>
  82. </template>
  83. <script setup>
  84. import { siteInfo, footInfo, menuList } from '@/layout/site'
  85. // 接口
  86. import { DesignStore } from '@/store/api/platform/design'
  87. const designStore = DesignStore()
  88. const router = useRouter()
  89. const route = useRoute()
  90. const $checkRes = inject('$checkRes')
  91. const props = defineProps({
  92. is_foot: { type: Boolean, default: () => true }
  93. })
  94. const configInfo = ref({})
  95. const data = ref([])
  96. const info = ref({})
  97. // 请求
  98. onMounted(async () => {
  99. search()
  100. })
  101. const search = async () => {
  102. for (const val of menuList) {
  103. if (route.name === val.route) val.hover = true
  104. else val.hover = false
  105. }
  106. data.value = menuList
  107. // // 基础设置
  108. // const result = await designStore.query({})
  109. // if ($checkRes(result)) configInfo.value = result.data[0] || {}
  110. }
  111. // 登录|注册
  112. const toLogin = (status) => {
  113. router.push({ path: '/login', query: { status } })
  114. }
  115. const selectMenu = (item, query) => {
  116. for (const val of data.value) {
  117. if (route.name === val.route) val.hover = true
  118. else val.hover = false
  119. }
  120. router.push({ path: `/${item}`, query })
  121. }
  122. // 关于我们
  123. const toHelp = () => {
  124. router.push({ path: `/help` })
  125. }
  126. // 消息
  127. const toChat = () => {
  128. router.push({ path: `/chat` })
  129. }
  130. const handleMouseOver = (index) => {
  131. data.value[index].hover = true
  132. info.value = data.value[index]
  133. }
  134. const handleMousOut = (index) => {
  135. data.value[index].hover = false
  136. const arr = data.value.every((i) => i.hover === false)
  137. if (arr) {
  138. for (const val of data.value) {
  139. if (route.name === val.route) val.hover = true
  140. else val.hover = false
  141. }
  142. }
  143. }
  144. </script>
  145. <style lang="scss" scoped>
  146. #c-layout {
  147. .header {
  148. padding: 0;
  149. position: sticky;
  150. top: 0;
  151. z-index: 1000;
  152. padding: 5px 0;
  153. background: $global-color-fff;
  154. .header_1 {
  155. display: flex;
  156. justify-content: space-between;
  157. .left {
  158. display: flex;
  159. .image {
  160. height: 60px;
  161. width: 240px;
  162. margin: 0 5px 0 0;
  163. }
  164. .content {
  165. padding: 10px 0 0 0;
  166. font-size: $global-font-size-34;
  167. font-family: 'Comic Sans MS', cursive;
  168. }
  169. }
  170. .right {
  171. display: flex;
  172. font-size: $global-font-size-18;
  173. cursor: pointer; /* 改变鼠标样式为手形 */
  174. .right_1 {
  175. display: flex;
  176. align-items: center;
  177. color: $global-color-107;
  178. margin: 0 10px 0 0;
  179. span {
  180. margin: 0 5px;
  181. }
  182. }
  183. .right_2 {
  184. display: flex;
  185. align-items: center;
  186. margin: 0 5px;
  187. span {
  188. margin: 0 0 0 5px;
  189. }
  190. }
  191. }
  192. }
  193. .header_2 {
  194. .list {
  195. display: flex;
  196. justify-content: space-around;
  197. .text {
  198. text-align: center;
  199. padding: 0 10px;
  200. height: 58px;
  201. line-height: 58px;
  202. font-family: Microsoft YaHei;
  203. font-size: $global-font-size-24;
  204. color: #333333;
  205. cursor: pointer; /* 改变鼠标样式为手形 */
  206. }
  207. }
  208. .info {
  209. display: none;
  210. .info_1 {
  211. position: absolute;
  212. left: 0;
  213. top: 128px;
  214. display: flex;
  215. padding: 10px 0;
  216. background: $global-color-107;
  217. width: 700px;
  218. .list_1 {
  219. margin: 0 10px 0 0;
  220. .title {
  221. margin: 5px 0;
  222. font-size: $global-font-size-20;
  223. font-weight: 600;
  224. text-align: center;
  225. color: #fff;
  226. cursor: pointer; /* 改变鼠标样式为手形 */
  227. }
  228. .list_1_1 {
  229. display: flex;
  230. flex-wrap: wrap;
  231. justify-content: center;
  232. margin: 5px 0;
  233. .title1 {
  234. width: 120px;
  235. margin: 5px;
  236. padding: 5px;
  237. text-align: center;
  238. color: #ffffff;
  239. font-size: $global-font-size-18;
  240. cursor: pointer; /* 改变鼠标样式为手形 */
  241. }
  242. }
  243. }
  244. }
  245. .info_2 {
  246. position: absolute;
  247. left: 68.1%;
  248. top: 128px;
  249. display: flex;
  250. padding: 10px 0;
  251. background: $global-color-107;
  252. width: 145px;
  253. .list_2 {
  254. display: flex;
  255. flex-direction: column;
  256. align-items: center;
  257. margin: 5px 0;
  258. .title1 {
  259. width: 110px;
  260. margin: 5px;
  261. padding: 5px;
  262. text-align: center;
  263. color: #ffffff;
  264. font-size: $global-font-size-18;
  265. cursor: pointer; /* 改变鼠标样式为手形 */
  266. }
  267. }
  268. }
  269. }
  270. }
  271. }
  272. .header:hover {
  273. .header_2 {
  274. .info {
  275. display: block !important;
  276. }
  277. }
  278. }
  279. .main {
  280. min-height: 62vh;
  281. }
  282. .footer {
  283. padding: 0 5px 10px 5px;
  284. background-color: $global-color-2D2;
  285. color: $global-color-fff;
  286. font-size: $global-font-size-18;
  287. .footer_1 {
  288. padding: 10px 0;
  289. display: flex;
  290. justify-content: space-between;
  291. border-bottom: 1px solid $global-color-bbb;
  292. .left {
  293. .image {
  294. width: 393px;
  295. height: 70px;
  296. }
  297. .title {
  298. margin: 5px 0 0 0;
  299. }
  300. }
  301. .right {
  302. text-align: center;
  303. .image {
  304. width: 130px;
  305. height: 130px;
  306. }
  307. .title {
  308. margin: 5px 0 0 0;
  309. }
  310. }
  311. }
  312. .footer_2 {
  313. padding: 10px 0 0 0;
  314. }
  315. }
  316. }
  317. @media screen and (max-width: 1280px) {
  318. #c-layout {
  319. min-width: 1920px;
  320. margin: 0 auto;
  321. }
  322. }
  323. @media screen and (min-width: 1921px) {
  324. #c-layout {
  325. max-width: 1920px;
  326. margin: 0 auto;
  327. }
  328. }
  329. </style>