index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  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 } from '@/assets/js/utils'
  60. const apiList = [
  61. {
  62. key: `currentWeather`,
  63. fn(data, arg) {
  64. const item =
  65. [
  66. {
  67. name: `云`,
  68. icon: `icon-duoyun`,
  69. },
  70. {
  71. name: `雪`,
  72. icon: `icon-xue`,
  73. },
  74. {
  75. name: `晴`,
  76. icon: `icon-qing`,
  77. },
  78. {
  79. name: `雨`,
  80. icon: `icon-yu`,
  81. },
  82. {
  83. name: `雪`,
  84. icon: `icon-xue`,
  85. },
  86. {
  87. name: `雾`,
  88. icon: `icon-wu`,
  89. },
  90. {
  91. name: `雷`,
  92. icon: `icon-leidian`,
  93. },
  94. {
  95. name: `风`,
  96. icon: `icon-feng`,
  97. },
  98. ].find((item) => data.天气.includes(item.name)) || {}
  99. this.weather = data
  100. this.weather.天气图标 = item.icon || `icon-duoyun`
  101. },
  102. },
  103. {
  104. key: `currentTime`,
  105. fn(data, arg) {
  106. this.dateBox = data
  107. },
  108. },
  109. ]
  110. export default {
  111. components: {},
  112. data() {
  113. return {
  114. tabs: {
  115. index: this.$props.tabIndex,
  116. list: [`综合总览`, `移栽分析`],
  117. },
  118. dateBox: {
  119. time: ``,
  120. date: ``,
  121. },
  122. weather: {
  123. 温度: ``,
  124. 天气: ``,
  125. 天气图标: ``,
  126. },
  127. }
  128. },
  129. props: {
  130. tabChange: {
  131. type: Function,
  132. default: undefined,
  133. },
  134. tabIndex: {
  135. type: Number,
  136. default: 0,
  137. },
  138. bgType: {
  139. type: String,
  140. default: `g-bg1`,
  141. },
  142. },
  143. watch: {
  144. 'tabs.index'(val) {
  145. this.tabChange && this.tabChange(val)
  146. },
  147. },
  148. computed: {},
  149. created() {
  150. console.log(`进入了`)
  151. apiList.forEach((item) => {
  152. this.$bus.$on(item.key, (data) => {
  153. item.fn.call(this, data)
  154. })
  155. })
  156. },
  157. mounted() {
  158. screenSize(this.$refs.editor)
  159. },
  160. beforeDestroy() {
  161. apiList.forEach((item) => {
  162. console.log(`销毁了`, item.key)
  163. this.$bus.$off(item.key)
  164. })
  165. },
  166. methods: {},
  167. }
  168. </script>
  169. <style lang="less" scoped>
  170. .container-box {
  171. transform-origin: 0 0 0;
  172. position: relative;
  173. color: #fff;
  174. font-family: PingFang SC, PingFang SC-Regular;
  175. .top {
  176. position: absolute;
  177. display: flex;
  178. width: 100%;
  179. .line {
  180. width: 0px;
  181. height: 41px;
  182. margin: 0 20px;
  183. border: 1px solid rgba(255, 255, 255, 0.3);
  184. }
  185. .tabs {
  186. font-size: 25px;
  187. text-align: center;
  188. display: flex;
  189. background-image: url('~@/assets/img2/综合总览/编组 9.png');
  190. background-repeat: no-repeat;
  191. background-position: center bottom;
  192. width: 766px;
  193. .tab-item {
  194. line-height: 56px;
  195. margin-right: 32px;
  196. color: rgba(255, 255, 255, 0.6);
  197. position: relative;
  198. cursor: pointer;
  199. &.cur {
  200. color: #fbfdff;
  201. &::before {
  202. content: '';
  203. display: block;
  204. position: absolute;
  205. width: 100%;
  206. height: 4px;
  207. background: linear-gradient(333deg, #158d8c 11%, #29f0f0 90%);
  208. bottom: 0px;
  209. }
  210. }
  211. &:first-child {
  212. margin-left: 40px;
  213. }
  214. &:not(:last-child)::after {
  215. content: '';
  216. display: block;
  217. width: 2px;
  218. height: 25px;
  219. background-color: rgba(255, 255, 255, 0.3);
  220. position: absolute;
  221. top: 28%;
  222. right: -16px;
  223. }
  224. }
  225. }
  226. .tipsBox {
  227. display: flex;
  228. align-items: center;
  229. justify-content: flex-end;
  230. width: 100%;
  231. padding-right: 77px;
  232. .dateBox {
  233. .date {
  234. color: rgba(255, 255, 255, 0.6);
  235. }
  236. }
  237. .weather {
  238. i {
  239. font-size: 44px;
  240. }
  241. }
  242. .temperature {
  243. // img {
  244. // padding: 0 20px;
  245. // }
  246. }
  247. .headPortrait {
  248. width: 44px;
  249. height: 44px;
  250. border-radius: 50%;
  251. overflow: hidden;
  252. cursor: pointer;
  253. }
  254. }
  255. }
  256. .bg {
  257. pointer-events: none;
  258. }
  259. & > .box {
  260. position: absolute;
  261. top: 90px;
  262. width: 100%;
  263. box-sizing: border-box;
  264. padding: 40px;
  265. }
  266. }
  267. </style>