index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <div class="large-screen" id="largeScreen">
  3. <div class="header">
  4. <span class="header-name">常泰大桥服务区智慧能源管理平台</span>
  5. </div>
  6. <div class="left-sidebar-container">
  7. <div class="top-info-area">
  8. <div class="info-block">
  9. <img src="@/assets/images/home/tianqi.svg" alt="">
  10. <span>{{weather.text}}</span>
  11. <span>{{weather.temperature}}</span>
  12. </div>
  13. </div>
  14. <router-view class="sidebar-router-view" name="left"></router-view>
  15. </div>
  16. <router-view class="center"></router-view>
  17. <div class="right-sidebar-container">
  18. <div class="top-info-area">
  19. <div class="info-block ">
  20. <span class="date-info">
  21. <span>{{nowDay.currentTime}}</span>
  22. <span>{{nowDay.week}}</span>
  23. </span>
  24. </div>
  25. </div>
  26. <router-view class="sidebar-router-view" name="right"></router-view>
  27. </div>
  28. <div class="footer-container">
  29. <Footer></Footer>
  30. </div>
  31. </div>
  32. </template>
  33. <script>
  34. import autofit from 'autofit.js'
  35. import Footer from './footer.vue';
  36. import {dateFormat} from '@/utils/index.js'
  37. import axios from 'axios';
  38. export default {
  39. name: 'LargeScreen',
  40. data () {
  41. return {
  42. nowDay: {
  43. currentTime: '',
  44. week: '',
  45. },
  46. timer: null,
  47. weather: {
  48. text: '',
  49. temperature:''
  50. }
  51. };
  52. },
  53. components: {
  54. Footer
  55. },
  56. computed: {},
  57. mounted () {
  58. autofit.init({
  59. designHeight: 1080,
  60. designWidth: 1920,
  61. renderDom: "#largeScreen",
  62. resize: true
  63. })
  64. this.getDate();
  65. this.getWeather()
  66. this.timer = setInterval(() => {
  67. this.getDate();
  68. }, 1000);
  69. },
  70. beforeDestroy () {
  71. clearInterval(this.timer)
  72. this.timer=null
  73. },
  74. methods: {
  75. getDate () {
  76. let nowTime = new Date();
  77. this.nowDay.week = "星期" + "日一二三四五六".charAt(nowTime.getDay());
  78. this.nowDay.currentTime =dateFormat(nowTime,'yyyy-MM-dd HH:mm:ss')
  79. },
  80. getWeather () {
  81. axios.get('https://api.seniverse.com/v3/weather/now.json?key=SoZVeNXSD1AlWok1V&location=nanjing&language=zh-Hans&unit=c').then(({data: { results}}) => {
  82. if (results && results.length) {
  83. this.weather.text = results[0].now.text
  84. this.weather.temperature = `${results[0].now.temperature}°C`
  85. }
  86. })
  87. }
  88. }
  89. }
  90. </script>
  91. <style lang='scss' scoped>
  92. .large-screen {
  93. background: #000;
  94. width: 100%;
  95. height: 100%;
  96. color: #fff;
  97. font-size: 18px;
  98. display: flex;
  99. }
  100. .header {
  101. width: 100%;
  102. z-index: 40;
  103. position: absolute;
  104. top: 0;
  105. height: 230px;
  106. text-align: center;
  107. background-image: url('~@/assets/images/layout/head.png');
  108. background-position: center;
  109. background-repeat: no-repeat;
  110. .header-name {
  111. font-size: 32px;
  112. font-weight: bold;
  113. letter-spacing: 0.1em;
  114. background-clip: text;
  115. color: transparent;
  116. line-height: 70px;
  117. background-image: linear-gradient(to bottom,
  118. white 30%,
  119. #75bfe9 100%);
  120. }
  121. }
  122. // 左侧栏的容器样式
  123. .left-sidebar-container {
  124. position: absolute;
  125. z-index: 50;
  126. top: 0;
  127. left: 0;
  128. width: 403px;
  129. height: 1081px;
  130. background-image: url('~@/assets/images/layout/left.png');
  131. background-repeat: no-repeat;
  132. padding-left: 7px;
  133. padding-right: 6px;
  134. padding-top: 4px;
  135. padding-bottom: 20px;
  136. pointer-events: auto;
  137. // 顶部信息区域样式
  138. .top-info-area {
  139. height: 10%;
  140. display: flex;
  141. flex-direction: column;
  142. justify-content: space-between;
  143. font-size: 18px;
  144. }
  145. // 信息块样式
  146. .info-block {
  147. display: flex;
  148. align-items: center;
  149. padding-left: 25px;
  150. color: #B3E3E8;
  151. margin-top: 8px;
  152. height: 38px;
  153. img {
  154. height: 24px;
  155. margin-right: 5px;
  156. }
  157. span {
  158. margin-right: 5px;
  159. }
  160. }
  161. // 路由视图容器样式
  162. .sidebar-router-view {
  163. height: 90%;
  164. }
  165. }
  166. // 右侧栏的容器样式
  167. .right-sidebar-container {
  168. position: absolute;
  169. z-index: 40;
  170. top: 0;
  171. right: 0;
  172. width: 403px;
  173. height: 1081px;
  174. background-image: url('~@/assets/images/layout/right.png');
  175. background-repeat: no-repeat;
  176. padding-left: 6px;
  177. padding-right: 7px;
  178. padding-top: 4px;
  179. padding-bottom: 20px;
  180. pointer-events: auto;
  181. // 顶部信息区域样式
  182. .top-info-area {
  183. height: 10%;
  184. display: flex;
  185. flex-direction: column;
  186. justify-content: space-between;
  187. text-align: right;
  188. }
  189. // 信息块样式
  190. .info-block {
  191. display: flex;
  192. align-items: center;
  193. height: 38px;
  194. background-repeat: no-repeat;
  195. justify-content: flex-end;
  196. padding-right: 25px;
  197. margin-top: 8px;
  198. }
  199. // 日期数据样式
  200. .date-info {
  201. color: #B3E3E8;
  202. display: flex;
  203. align-items: center;
  204. span {
  205. margin-left: 5px;
  206. }
  207. }
  208. // 路由视图容器样式
  209. .sidebar-router-view {
  210. height: 90%;
  211. }
  212. }
  213. // 底部栏的容器样式
  214. .footer-container {
  215. display: flex;
  216. align-items: flex-end;
  217. justify-content: center;
  218. width: 100%;
  219. position: absolute;
  220. bottom: 0;
  221. height: 230px;
  222. pointer-events: none;
  223. background-image: url('~@/assets/images/layout/footer.png');
  224. background-position: center;
  225. background-repeat: no-repeat;
  226. }
  227. </style>