index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <script setup lang="ts">
  2. import { markRaw, ref } from 'vue'
  3. import WeatherService from '@/services/weather.service'
  4. import homePage from './components/HomePage.vue'
  5. import cehicleOperation from './components/CehicleOperation.vue'
  6. import lineAnalysis from './components/LineAnalysis.vue'
  7. import maintenanceDynamics from './components/MaintenanceDynamics.vue'
  8. import facilityManagement from './components/FacilityManagement.vue'
  9. import stationManagement from './components/StationManagement.vue'
  10. import passengerFlow from './components/PassengerFlow.vue'
  11. const weatherService = new WeatherService()
  12. const menus = [
  13. { name: '主页', component: markRaw(homePage) },
  14. { name: '线路运营', component: markRaw(cehicleOperation) },
  15. { name: '客流分析', component: markRaw(passengerFlow) },
  16. { name: '维保动态', component: markRaw(maintenanceDynamics) },
  17. { name: '设施管理', component: markRaw(facilityManagement) },
  18. { name: '场站管理', component: markRaw(stationManagement) },
  19. { name: '线路分析', component: markRaw(lineAnalysis) }
  20. ]
  21. const active = ref(0)
  22. const currentComponent = ref(menus[active.value].component)
  23. const weather = ref()
  24. function changMenu(_id: number) {
  25. active.value = _id
  26. currentComponent.value = menus[_id].component
  27. }
  28. weatherService.getWeather().then((res) => { weather.value = res })
  29. </script>
  30. <template>
  31. <div class="home">
  32. <div class="home-top">
  33. <!-- <img src="../../../assets/img/6.svg"> -->
  34. <div class="home-top-user">
  35. <div>安全运营<span>100</span>天</div>
  36. <div v-if="weather">
  37. <img :src="weather.icon">
  38. {{ weather.weather }}
  39. <span>{{ weather.temperature }}℃</span>
  40. </div>
  41. <div>
  42. <img src="../../../assets/img/10.svg">
  43. 你的名称
  44. </div>
  45. </div>
  46. </div>
  47. <div class="home-content">
  48. <div class="home-content-top">
  49. <div class="home-content-top-menus">
  50. <template
  51. v-for="(item, index) in menus"
  52. :key="index"
  53. >
  54. <div
  55. :class="{ active: index === active }"
  56. @click="changMenu(index)"
  57. >
  58. {{ item.name }}
  59. </div>
  60. </template>
  61. </div>
  62. </div>
  63. <div class="home-content-left" />
  64. <div class="home-content-right" />
  65. <component :is="currentComponent" />
  66. </div>
  67. <div class="home-bottom">
  68. xxxx
  69. <!-- 雅安市公共交通集团有限公司 -->
  70. </div>
  71. </div>
  72. </template>
  73. <style lang="scss" scoped>
  74. .home {
  75. height: 1456px;
  76. width: 4784px;
  77. background: #030E25;
  78. &-top {
  79. height: 160px;
  80. background: url(../../../assets//img/2.svg) no-repeat top center;
  81. background-size: cover;
  82. text-align: center;
  83. position: relative;
  84. &>img {
  85. width: 900px;
  86. height: 130px;
  87. }
  88. &-user {
  89. position: absolute;
  90. display: flex;
  91. align-items: center;
  92. right: 30px;
  93. top: 30px;
  94. &>div {
  95. margin: 0 25px;
  96. font-size: 24px;
  97. &:first-child {
  98. font-weight: 400;
  99. color: #80FFFF;
  100. span {
  101. color: white;
  102. font-weight: 700;
  103. font-size: 50px;
  104. margin: 0 5px;
  105. }
  106. }
  107. &:last-child {
  108. color: white;
  109. display: flex;
  110. align-items: center;
  111. margin-right: 0;
  112. img {
  113. border-radius: 50%;
  114. width: 80px;
  115. height: 80px;
  116. overflow: hidden;
  117. margin-right: 15px;
  118. }
  119. }
  120. &:nth-child(2) {
  121. display: flex;
  122. align-items: flex-end;
  123. color: white;
  124. img {
  125. width: 56px;
  126. height: 56px;
  127. margin-right: 10px;
  128. }
  129. span {
  130. color: #80FFFF;
  131. margin-left: 10px;
  132. }
  133. }
  134. }
  135. }
  136. }
  137. &-content {
  138. height: calc(1456px - 160px - 72px);
  139. position: relative;
  140. &-top {
  141. position: absolute;
  142. left: 50%;
  143. top: -30px;
  144. transform: translate(-50%, 0);
  145. height: 185px;
  146. width: calc(100% - 1370px - 1370px);
  147. background: url(../../../assets//img/5.svg) no-repeat center;
  148. background-size: cover;
  149. z-index: 2;
  150. &-menus {
  151. display: flex;
  152. align-items: center;
  153. justify-content: space-evenly;
  154. padding: 0 410px;
  155. &>div {
  156. text-shadow: 1px 1px 10px rgba(0, 0, 0, 0.698);
  157. font-family: Arial Normal;
  158. font-size: 24px;
  159. text-align: center;
  160. letter-spacing: 0px;
  161. color: #D7D7D7;
  162. cursor: pointer;
  163. height: 111px;
  164. width: 175px;
  165. line-height: 111px;
  166. }
  167. .active {
  168. color: white;
  169. background: url(../../../assets/img/7.svg) no-repeat center;
  170. background-size: cover;
  171. }
  172. }
  173. }
  174. &-left,
  175. &-right {
  176. position: absolute;
  177. height: 110%;
  178. width: 40px;
  179. top: -117px;
  180. }
  181. &-left {
  182. left: 7px;
  183. background: url(../../../assets/img/8.svg) no-repeat left top;
  184. background-size: cover;
  185. }
  186. &-right {
  187. right: 7px;
  188. background: url(../../../assets/img/9.svg) no-repeat left top;
  189. background-size: cover;
  190. }
  191. }
  192. &-bottom {
  193. height: 72px;
  194. background: url(../../../assets/img/3.svg) no-repeat center;
  195. background-size: cover;
  196. text-align: center;
  197. line-height: 72px;
  198. color: white;
  199. font-size: 20px;
  200. letter-spacing: 20px;
  201. text-shadow: 1px 1px 5px rgba(0, 255, 255, 0.6);
  202. }
  203. }
  204. </style>