topMenu.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <div class="topMenu" v-loading="preLoading">
  3. <div class="topLogo">
  4. <img
  5. src="@/assets/images/new_text_log.png"
  6. style="width: 100%; height: 100%"
  7. />
  8. </div>
  9. <div class="menuSty">
  10. <el-dropdown
  11. v-for="(item,index) in menuList"
  12. style="margin-right: 40px"
  13. :key="index"
  14. >
  15. <span class="el-dropdown-link">
  16. {{ item.name }}<i class="el-icon-arrow-down el-icon--right"></i>
  17. </span>
  18. <el-dropdown-menu slot="dropdown">
  19. <el-dropdown-item v-for="(it,idx) in item.data" :key="idx">{{
  20. it.name
  21. }}
  22. </el-dropdown-item>
  23. </el-dropdown-menu>
  24. </el-dropdown>
  25. </div>
  26. <div class="topBtn">
  27. <span class="mobileSty">
  28. <i class="el-icon-phone-outline"></i>
  29. 0513-88888888
  30. </span>
  31. <el-button
  32. type="primary"
  33. class="btnSty"
  34. >注册
  35. </el-button
  36. >
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. import { getConfigData } from '@/api/infra/config'
  42. export default {
  43. name: 'topMenu',
  44. data() {
  45. return {
  46. menuList: [],
  47. preLoading: true
  48. }
  49. },
  50. created() {
  51. getConfigData('login_menu').then(res => {
  52. if (res.data) {
  53. this.menuList = JSON.parse(res.data.value)
  54. console.log('config', this.menuList)
  55. this.preLoading = false
  56. }
  57. })
  58. },
  59. beforeCreate() {
  60. },
  61. methods: {
  62. menuPre(data, index) {
  63. this.menuList.forEach(item => {
  64. item.data = []
  65. })
  66. this.menuList[index].data.push(data)
  67. console.log(this.menuList)
  68. },
  69. /**
  70. * 跳转登录页面
  71. */
  72. toLogin() {
  73. this.$router.push('/login').catch(() => {
  74. })
  75. },
  76. /**
  77. * 跳转注册页面
  78. */
  79. toRegister() {
  80. this.$router.push('/register').catch(() => {
  81. })
  82. }
  83. }
  84. }
  85. </script>
  86. <style scoped>
  87. .menuSty {
  88. float: left;
  89. width: 40%;
  90. height: 100%;
  91. display: flex;
  92. align-items: center;
  93. }
  94. .mobileSty {
  95. font-family: Microsoft YaHei, Microsoft YaHei;
  96. font-weight: 400;
  97. font-size: 18px;
  98. color: #333333;
  99. line-height: 18px;
  100. text-align: left;
  101. font-style: normal;
  102. text-transform: none;
  103. }
  104. .btnSty {
  105. font-size: 20px;
  106. width: 102px;
  107. height: 50px;
  108. margin-left: 3%;
  109. }
  110. .topBtn {
  111. float: left;
  112. width: 28%;
  113. height: 100%;
  114. display: flex;
  115. align-items: center;
  116. }
  117. .topLogo {
  118. float: left;
  119. width: 20%;
  120. height: 100%;
  121. margin-left: 12%;
  122. }
  123. .topMenu {
  124. background: #f0f7ff;
  125. height: 8vh;
  126. }
  127. .dropdown-link-text {
  128. font-size: 20px;
  129. font-weight: bold;
  130. }
  131. .el-dropdown-link {
  132. cursor: pointer;
  133. font-family: Microsoft YaHei, Microsoft YaHei;
  134. font-weight: 400;
  135. font-size: 16px;
  136. color: #333333;
  137. line-height: 18px;
  138. text-align: left;
  139. font-style: normal;
  140. text-transform: none;
  141. }
  142. .el-icon-arrow-down {
  143. font-size: 12px;
  144. }
  145. </style>