123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279 |
- <template>
- <div class="container-box" ref="editor">
- <div class="top">
- <div class="logo">
- <div>
- <img
- src="@/assets/img2/综合总览/编组.png"
- alt=""
- class="mt-20px ml-36px"
- />
- </div>
- <div>
- <img
- src="@/assets/img2/综合总览/编组 23备份.png"
- alt=""
- class="ml-36px"
- />
- </div>
- </div>
- <div class="tabsBox mt-36px ml-50px">
- <div class="tabs">
- <div
- :class="[`tab-item`, { cur: index === tabs.index }]"
- :key="item"
- @click="tabs.index = index"
- v-for="(item, index) in tabs.list"
- >
- {{ item }}
- </div>
- </div>
- </div>
- <div class="tipsBox">
- <div class="dateBox center">
- <div class="time font-size-22px">{{ dateBox.time }}</div>
- <div class="date font-size-16px">{{ dateBox.date }}</div>
- </div>
- <div class="line"></div>
- <div class="weather">
- <i :class="[`iconfont`, weather.天气图标]"></i>
- </div>
- <div class="temperature">
- <img class="pl-20px" src="@/assets/img2/综合总览/编组 6.png" alt="" />
- <span class="font-size-30px pl-20px">{{ weather.温度 }}</span>
- <img src="@/assets/img2/综合总览/编组 8.png" alt="" />
- </div>
- <div class="line"></div>
- <div class="headPortrait">
- <img src="https://httpbin.org/image/png" class="w-44px" alt="" />
- </div>
- </div>
- </div>
- <div class="box">
- <slot>内容区</slot>
- </div>
- <div :class="[`bg`, bgType]"></div>
- </div>
- </template>
- <script>
- import { screenSize } from '@/assets/js/utils'
- const apiList = [
- {
- key: `currentWeather`,
- fn(data, arg) {
- const item =
- [
- {
- name: `云`,
- icon: `icon-duoyun`,
- },
- {
- name: `雪`,
- icon: `icon-xue`,
- },
- {
- name: `晴`,
- icon: `icon-qing`,
- },
- {
- name: `雨`,
- icon: `icon-yu`,
- },
- {
- name: `雪`,
- icon: `icon-xue`,
- },
- {
- name: `雾`,
- icon: `icon-wu`,
- },
- {
- name: `雷`,
- icon: `icon-leidian`,
- },
- {
- name: `风`,
- icon: `icon-feng`,
- },
- ].find((item) => data.天气.includes(item.name)) || {}
- this.weather = data
- this.weather.天气图标 = item.icon || `icon-duoyun`
- },
- },
- {
- key: `currentTime`,
- fn(data, arg) {
- this.dateBox = data
- },
- },
- ]
- export default {
- components: {},
- data() {
- return {
- tabs: {
- index: this.$props.tabIndex,
- list: [`综合总览`, `移栽分析`],
- },
- dateBox: {
- time: ``,
- date: ``,
- },
- weather: {
- 温度: ``,
- 天气: ``,
- 天气图标: ``,
- },
- }
- },
- props: {
- tabChange: {
- type: Function,
- default: undefined,
- },
- tabIndex: {
- type: Number,
- default: 0,
- },
- bgType: {
- type: String,
- default: `g-bg1`,
- },
- },
- watch: {
- 'tabs.index'(val) {
- this.tabChange && this.tabChange(val)
- },
- },
- computed: {},
- created() {
- console.log(`进入了`)
- apiList.forEach((item) => {
- this.$bus.$on(item.key, (data) => {
- item.fn.call(this, data)
- })
- })
- },
- mounted() {
- screenSize(this.$refs.editor)
- },
- beforeDestroy() {
- apiList.forEach((item) => {
- console.log(`销毁了`, item.key)
- this.$bus.$off(item.key)
- })
- },
- methods: {},
- }
- </script>
- <style lang="less" scoped>
- .container-box {
- transform-origin: 0 0 0;
- position: relative;
- color: #fff;
- font-family: PingFang SC, PingFang SC-Regular;
- .top {
- position: absolute;
- display: flex;
- width: 100%;
- .line {
- width: 0px;
- height: 41px;
- margin: 0 20px;
- border: 1px solid rgba(255, 255, 255, 0.3);
- }
- .tabs {
- font-size: 25px;
- text-align: center;
- display: flex;
- background-image: url('~@/assets/img2/综合总览/编组 9.png');
- background-repeat: no-repeat;
- background-position: center bottom;
- width: 766px;
- .tab-item {
- line-height: 56px;
- margin-right: 32px;
- color: rgba(255, 255, 255, 0.6);
- position: relative;
- cursor: pointer;
- &.cur {
- color: #fbfdff;
- &::before {
- content: '';
- display: block;
- position: absolute;
- width: 100%;
- height: 4px;
- background: linear-gradient(333deg, #158d8c 11%, #29f0f0 90%);
- bottom: 0px;
- }
- }
- &:first-child {
- margin-left: 40px;
- }
- &:not(:last-child)::after {
- content: '';
- display: block;
- width: 2px;
- height: 25px;
- background-color: rgba(255, 255, 255, 0.3);
- position: absolute;
- top: 28%;
- right: -16px;
- }
- }
- }
- .tipsBox {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- width: 100%;
- padding-right: 77px;
- .dateBox {
- .date {
- color: rgba(255, 255, 255, 0.6);
- }
- }
- .weather {
- i {
- font-size: 44px;
- }
- }
- .temperature {
- // img {
- // padding: 0 20px;
- // }
- }
- .headPortrait {
- width: 44px;
- height: 44px;
- border-radius: 50%;
- overflow: hidden;
- cursor: pointer;
- }
- }
- }
- .bg {
- pointer-events: none;
- }
- & > .box {
- position: absolute;
- top: 90px;
- width: 100%;
- box-sizing: border-box;
- padding: 40px;
- }
- }
- </style>
|