custom-layout.vue 8.0 KB

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