index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <div class="container-box" ref="editor">
  3. <div class="top">
  4. <div class="logo">
  5. <div>
  6. <img
  7. src="@/assets/img2/综合总览/编组.png"
  8. alt=""
  9. class="mt-20px ml-36px"
  10. />
  11. </div>
  12. <div>
  13. <img
  14. src="@/assets/img2/综合总览/编组 23备份.png"
  15. alt=""
  16. class="ml-36px"
  17. />
  18. </div>
  19. </div>
  20. <div class="tabsBox mt-36px ml-50px">
  21. <div class="tabs">
  22. <div
  23. :class="[`tab-item`, { cur: index === tabs.index }]"
  24. :key="item"
  25. @click="tabs.index = index"
  26. v-for="(item, index) in tabs.list"
  27. >
  28. {{ item }}
  29. </div>
  30. </div>
  31. </div>
  32. <div class="tipsBox">
  33. <div class="dateBox center">
  34. <div class="time font-size-22px">{{ dateBox.time }}</div>
  35. <div class="date font-size-16px">{{ dateBox.date }}</div>
  36. </div>
  37. <div class="line"></div>
  38. <div class="weather">
  39. <i :class="[`iconfont`, weather.天气图标]"></i>
  40. </div>
  41. <div class="temperature">
  42. <img class="pl-20px" src="@/assets/img2/综合总览/编组 6.png" alt="" />
  43. <span class="font-size-30px pl-20px">{{ weather.温度 }}</span>
  44. <img src="@/assets/img2/综合总览/编组 8.png" alt="" />
  45. </div>
  46. <div class="line"></div>
  47. <div class="headPortrait">
  48. <img src="https://httpbin.org/image/png" class="w-44px" alt="" />
  49. </div>
  50. </div>
  51. </div>
  52. <div class="box">
  53. <slot>内容区</slot>
  54. </div>
  55. <div :class="[`bg`, bgType]"></div>
  56. </div>
  57. </template>
  58. <script>
  59. import { screenSize, getWeather } from '@/assets/js/utils'
  60. import dayjs from 'dayjs'
  61. export default {
  62. components: {},
  63. data() {
  64. return {
  65. tabs: {
  66. index: this.$props.tabIndex,
  67. list: [`综合总览`, `移栽分析`],
  68. },
  69. dateBox: {
  70. time: ``,
  71. date: ``,
  72. },
  73. weather: {
  74. 温度: ``,
  75. 天气: ``,
  76. 天气图标: ``,
  77. },
  78. }
  79. },
  80. props: {
  81. tabChange: {
  82. type: Function,
  83. default: undefined,
  84. },
  85. tabIndex: {
  86. type: Number,
  87. default: 0,
  88. },
  89. bgType: {
  90. type: String,
  91. default: `g-bg1`,
  92. },
  93. },
  94. watch: {
  95. 'tabs.index'(val) {
  96. this.tabChange && this.tabChange(val)
  97. },
  98. },
  99. computed: {},
  100. created() {
  101. this.$util.autoVueFn(
  102. [
  103. {
  104. time: 1000,
  105. fn: this.currentTime,
  106. },
  107. {
  108. time: 1000 * 5,
  109. fn: this.currentWeather,
  110. },
  111. ],
  112. this
  113. )
  114. },
  115. mounted() {
  116. screenSize(this.$refs.editor)
  117. },
  118. methods: {
  119. async currentWeather() {
  120. const data = await this.$http.get(`/api/currentWeather`)
  121. const item = getWeather(data.天气)
  122. this.weather = data
  123. this.weather.天气图标 = item.icon || `icon-duoyun`
  124. },
  125. async currentTime() {
  126. const data = {
  127. date: dayjs(Date.now()).format(`YYYY/MM/DD`),
  128. time: dayjs(Date.now()).format(`HH:mm:ss`),
  129. }
  130. this.dateBox = data
  131. },
  132. },
  133. }
  134. </script>
  135. <style lang="less" scoped>
  136. .container-box {
  137. width: 1920px;
  138. height: 1080px;
  139. transform-origin: 0 0 0;
  140. position: relative;
  141. color: #fff;
  142. font-family: PingFang SC, PingFang SC-Regular;
  143. .top {
  144. position: absolute;
  145. display: flex;
  146. width: 100%;
  147. z-index: 10;
  148. .line {
  149. width: 0px;
  150. height: 41px;
  151. margin: 0 20px;
  152. border: 1px solid rgba(255, 255, 255, 0.3);
  153. }
  154. .tabs {
  155. font-size: 25px;
  156. text-align: center;
  157. display: flex;
  158. background-image: url('~@/assets/img2/综合总览/编组 9.png');
  159. background-repeat: no-repeat;
  160. background-position: center bottom;
  161. width: 766px;
  162. .tab-item {
  163. line-height: 56px;
  164. margin-right: 32px;
  165. color: rgba(255, 255, 255, 0.6);
  166. position: relative;
  167. cursor: pointer;
  168. &.cur {
  169. color: #fbfdff;
  170. &::before {
  171. content: '';
  172. display: block;
  173. position: absolute;
  174. width: 100%;
  175. height: 4px;
  176. background: linear-gradient(333deg, #158d8c 11%, #29f0f0 90%);
  177. bottom: 0px;
  178. }
  179. }
  180. &:first-child {
  181. margin-left: 40px;
  182. }
  183. &:not(:last-child)::after {
  184. content: '';
  185. display: block;
  186. width: 2px;
  187. height: 25px;
  188. background-color: rgba(255, 255, 255, 0.3);
  189. position: absolute;
  190. top: 28%;
  191. right: -16px;
  192. }
  193. }
  194. }
  195. .tipsBox {
  196. display: flex;
  197. align-items: center;
  198. justify-content: flex-end;
  199. width: 100%;
  200. padding-right: 77px;
  201. .dateBox {
  202. .date {
  203. color: rgba(255, 255, 255, 0.6);
  204. }
  205. }
  206. .weather {
  207. i {
  208. font-size: 44px;
  209. }
  210. }
  211. .temperature {
  212. // img {
  213. // padding: 0 20px;
  214. // }
  215. }
  216. .headPortrait {
  217. width: 44px;
  218. height: 44px;
  219. border-radius: 50%;
  220. overflow: hidden;
  221. cursor: pointer;
  222. }
  223. }
  224. }
  225. .bg {
  226. pointer-events: none;
  227. }
  228. & > .box {
  229. transform-origin: 0 0 0;
  230. position: absolute;
  231. top: 90px;
  232. width: 100%;
  233. box-sizing: border-box;
  234. padding: 40px;
  235. left: 0;
  236. top: 0;
  237. padding: 0;
  238. z-index: 9;
  239. }
  240. }
  241. </style>