middle.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <div class="middle-container" :style="`background-image: url('${middleBackUrl}');`">
  3. <div class="middle-container-title">
  4. <img
  5. :src="`${middleLogo}`"
  6. height="46"
  7. style="position: relative; top: -2px"
  8. />
  9. {{middleTitle}}
  10. </div>
  11. <div class="middle-container-lists">
  12. <el-row>
  13. <el-col
  14. :xs="5"
  15. :md="3"
  16. :sm="4"
  17. :lg="3"
  18. :xl="3"
  19. class="list-one"
  20. v-for="item in middleList"
  21. :key="item"
  22. >
  23. <router-link :to="item.children[0].path">
  24. <div
  25. class="list-one-img"
  26. :style="`background-image:${
  27. item.children.length > 1
  28. ? item.meta.backgroundImage
  29. : item.children[0].meta.backgroundImage
  30. }`"
  31. >
  32. <img
  33. :src="`static/svgIcons/${
  34. item.children.length > 1
  35. ? item.meta.icon
  36. : item.children[0].meta.icon
  37. }.svg`"
  38. alt=""
  39. />
  40. </div>
  41. <p>
  42. {{
  43. item.children.length > 1
  44. ? item.meta.title
  45. : item.children[0].meta.title
  46. }}
  47. </p>
  48. </router-link>
  49. </el-col>
  50. </el-row>
  51. </div>
  52. <div class="middle-container-tips">上海永天科技股份有限公司</div>
  53. </div>
  54. </template>
  55. <script>
  56. // import * as api from '@/api/user.js'
  57. import { useStore } from 'vuex'
  58. import { defineComponent, onMounted ,ref} from 'vue'
  59. import * as api from '@/api/user.js'
  60. export default defineComponent({
  61. name: 'Middle',
  62. props: {
  63. // show_Dialog: Boolean,
  64. // dialogTitle: {
  65. // type: String,
  66. // default: '告警详情',
  67. // },
  68. // itemInfo: {
  69. // type: Object,
  70. // default: function () {
  71. // return {}
  72. // },
  73. // },
  74. },
  75. setup() {
  76. const store = useStore()
  77. const middleList = store.state.middleList
  78. const middleBackUrl=ref(require('@/assets/images/middle_background.png'))
  79. const middleLogo=ref(require('@/assets/logo2.png'))
  80. const middleTitle=ref('永天智慧电力平台')
  81. onMounted(() => {
  82. getMiddleConfig()
  83. var color = [
  84. 'linear-gradient(135deg, #64c3f5, #5590e9)',
  85. 'linear-gradient(135deg, #edb6b6, #edb6b6)',
  86. 'linear-gradient(135deg, #b4d0b3, #6acf7c)',
  87. 'linear-gradient(135deg, #e29d67, #d85f35)',
  88. 'linear-gradient(135deg, #dea8b9, #d65ab6)',
  89. 'linear-gradient(135deg, #eeda9e, #e4b166)',
  90. 'linear-gradient(135deg, #97a6f0, #4361ee)',
  91. 'linear-gradient(135deg, #89eee1, #56b1d2)',
  92. 'linear-gradient(135deg, #eeda9e, #e4b166)',
  93. ]
  94. middleList.forEach((item, index) => {
  95. index
  96. if (item.children.length > 1) {
  97. item.meta.backgroundImage = color[index]
  98. } else {
  99. item.children[0].meta.backgroundImage = color[index]
  100. }
  101. })
  102. console.log('修改后的middleList')
  103. console.log(middleList)
  104. })
  105. //根据不同的域名,显示不同的title和背景图
  106. function getMiddleConfig() {
  107. api
  108. .getMiddleConfig({}) .then((requset) => {
  109. if (requset.status === 'SUCCESS') {
  110. //有返回值用返回值配置,无返回值用默认配置
  111. middleBackUrl.value = requset.data[0].middleBackUrl?requset.data[0].middleBackUrl:require('@/assets/images/middle_background.png')
  112. middleLogo.value = requset.data[0].middleLogo?requset.data[0].middleLogo:require('@/assets/logo2.png')
  113. middleTitle.value = requset.data[0].middleTitle?requset.data[0].middleTitle:'永天智慧电力平台'
  114. } else {
  115. alert(requset.msg)
  116. }
  117. })
  118. }
  119. return {
  120. middleList,
  121. getMiddleConfig,
  122. middleBackUrl,
  123. middleLogo,
  124. middleTitle
  125. }
  126. },
  127. })
  128. </script>
  129. <style lang="less">
  130. .middle-container {
  131. width: 100%;
  132. background: url('~@/assets/images/middle_background.png');
  133. background-size: cover;
  134. background-color: #000000b3;
  135. margin: 0 auto;
  136. padding-top: 100px;
  137. color: #fff;
  138. text-align: center;
  139. background-position: center center;
  140. min-height: 100vh;
  141. &-title {
  142. font-size: 46px;
  143. font-weight: bold;
  144. letter-spacing: 3px;
  145. width: 100%;
  146. text-align: center;
  147. }
  148. &-lists {
  149. width: 80%;
  150. margin: 0 auto;
  151. margin-top: 80px;
  152. .list-one {
  153. margin-bottom: 60px;
  154. p {
  155. color: #fff;
  156. }
  157. .list-one-img {
  158. cursor: pointer;
  159. width: 65px;
  160. height: 65px;
  161. // background: #5c88fa;
  162. background-image: linear-gradient(135deg, #64c3f5, #5590e9);
  163. line-height: 65px;
  164. border-radius: 22px;
  165. margin: 0 auto;
  166. margin-bottom: 14px;
  167. img {
  168. width: 60%;
  169. transition: all 0.6s cubic-bezier(0.215, 0.61, 0.355, 1) 0s;
  170. -webkit-transition: all 0.6s cubic-bezier(0.215, 0.61, 0.355, 1) 0s;
  171. }
  172. img:hover {
  173. transform: scale(1.15);
  174. }
  175. }
  176. }
  177. }
  178. // &-form {
  179. // width: calc(100% - 40px);
  180. // min-width: 360px;
  181. // height: 440px;
  182. // padding: 4vh;
  183. // margin-top: calc((100vh - 380px) / 2);
  184. // margin-right: 20px;
  185. // margin-left: 20px;
  186. // background: url('~@/assets/login_images/login_form.png');
  187. // background-size: 100% 100%;
  188. // border-radius: 10px;
  189. // box-shadow: 0 2px 8px 0 rgba(7, 17, 27, 0.06);
  190. // }
  191. // &-hello {
  192. // font-size: 32px;
  193. // color: #fff;
  194. // }
  195. // &-title {
  196. // margin-bottom: 30px;
  197. // font-size: 20px;
  198. // color: #fff;
  199. // }
  200. &-tips {
  201. position: fixed;
  202. bottom: @vab-margin;
  203. width: 100%;
  204. height: 40px;
  205. color: rgba(255, 255, 255, 0.856);
  206. text-align: center;
  207. }
  208. .ant-col {
  209. width: 100%;
  210. padding: 0 10px 0 10px;
  211. }
  212. .ant-input {
  213. height: 35px;
  214. }
  215. .ant-btn {
  216. width: 100%;
  217. height: 45px;
  218. border-radius: 99px;
  219. }
  220. }
  221. </style>
  222. l