gaosp
2024-03-09 95603bea1ab27824c2b4155d9d079a6c66d661b6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!--
 * @Date: 2024-01-04 19:40:32
 * @LastEditors: Sneed
 * @LastEditTime: 2024-03-09 12:58:30
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/mdc/src/components/home/index.vue
-->
<template>
    <div class="home">
        <div class="header">
            <img src="~@/assets/img/login/logo.png" alt="">
            <div class="menu">
              <slot name="menu"></slot>
            </div>
            <p v-if="showTime" class="time"><span>{{time1}}</span><span  style="position: relative;">{{time2}}</span></p>
        </div>
        <div class="content">
            <slot class="copy" name="content"></slot>
            <div class="footer">
            </div>
        </div>
        
    </div>
</template>
<script>
import dayjs from 'dayjs'
let timer
export default {
    data () {
      return {
        time1: '',
        time2: '',
        showTime: false
      }
    },
    watch: {
      $route: {
        handler (val) {
          // console.log('+++++++++++')
          // if (val.path !== '/') {
          //   this.showTime = false
          //   clearInterval(timer)
          // } else {
          //   // this.showTime = true
          //   // timer = setInterval(() => {
          //   //   this.time1 = dayjs().format('YYYY/MM/DD')
          //   //   this.time2 = dayjs().format('HH:mm:ss')
          //   // },1000)
          // }
        }
      },
      immediate:true,
      deep: true
    },
    mounted () {
      this.showTime = this.$route.path === '/'
      
      if (this.$route.path === '/') {
        timer = setInterval(() => {
          this.time1 = dayjs().format('YYYY/MM/DD')
          this.time2 = dayjs().format('HH:mm:ss')
        },1000)
      }
    },
    updated() {
      
    },
    beforeDestroy() {
      clearInterval(timer)
    }
}
</script>
<style lang="scss" scoped>
$bg:#2d3a4b;
$dark_gray:#889aa4;
$light_gray:#eee;
.home {
  /*position: relative;*/
  height: 100%;
  width: 100%;
  background-color: $bg;
  overflow: auto;
  display: flex;
  flex-direction: column;
  .header {
    position: relative;
    padding-left: 24px;
    padding-right: 24px;
    height: 94px;
    flex: 0 0 auto;
    background-image: url('~@/assets/img/login/top.png');
    background-size: contain;
    display: flex;
    align-items: center;
    // justify-content: space-between;
    & > img {
      flex: 0 0 auto;
      width: 599px;
      max-height: 91px;
      align-self: flex-start;
    }
    .menu {
      height: 50px;
      margin-left: 20px;
      flex: 1 1 auto;
    }
    .time {
      color: #fff;
      font-size: 20px;
      height: 30px;
      position: relative;
      span:first-child {
        // display: flex;
        position: absolute;
        top: 50%;
        transform: translate(0,-50%);
        left: -100px;
        font-size: 20px;
        line-height: 30px;
      }
      span:last-child {
        margin-left: 14px;
        font-family: digital;
        font-size: 30px;
        line-height: 30px;
      }
    }
  }
  .content {
    flex: 1 1 auto;
    background-image: url('~@/assets/img/login/bg.png');
    background-size: cover;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
    .workshop {
      height: calc(100% - 50px)!important;
    }
    .compName {
      font-size: 23px;
      color: #FFFFFF;
      line-height: 33px;
      position: absolute;
      left: 0;
      right: 0;
      text-align: center;
      bottom: 50px;
    }
  }
  .footer {
    position: absolute;
    width: 100%;
    bottom: 0;
    height: 46px;
    background-image: url('~@/assets/img/login/footer.png');
    background-size: cover;
    background-repeat: no-repeat;
    flex: 0 0 auto;
  }
}
</style>