Blame view

src/components/appHeader/index.vue 3.66 KB
22fb20b3   songchongxian   城市停车运营监控
1
2
3
4
  <template>
    <div class="app-headBox">
      <span class="head-inner">
        <div class="head-name"> <span>{{headTitle}}</span><div class="head-name-bg"></div></div>
36662834   Andy   add 全屏功能
5
        <div class="header-fullscreen" @click="handleFullScreen"></div>
22fb20b3   songchongxian   城市停车运营监控
6
7
8
9
10
11
12
13
14
15
16
17
        <div class="head-time">{{ headTime }}</div>
      </span>
    </div>
  </template>
  
  <script>
    import common from '../../api/common';
    export default {
      name: "appHeader",
      data() {
        return {
          headTitle:"",//城市智慧停车大数据中心
36662834   Andy   add 全屏功能
18
19
          headTime:'',//当前时间
          fullscreen: false
22fb20b3   songchongxian   城市停车运营监控
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
        }
      },
      mounted() {
        this.headTitle=appConfig.appTitle;
        this.getCurTime()
      },
      methods: {
        getCurTime(){
          let _self=this;
          _self.headTime=common.getNowFormatDate();
  
          setInterval(function(){
            _self.headTime=common.getNowFormatDate();
          },1000);//1分钟更新一次
        },
36662834   Andy   add 全屏功能
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
        handleFullScreen(){
              let element = document.documentElement;
              if (this.fullscreen) {
                  if (document.exitFullscreen) {
                      document.exitFullscreen();
                  } else if (document.webkitCancelFullScreen) {
                      document.webkitCancelFullScreen();
                  } else if (document.mozCancelFullScreen) {
                      document.mozCancelFullScreen();
                  } else if (document.msExitFullscreen) {
                      document.msExitFullscreen();
                  }
              } else {
                  if (element.requestFullscreen) {
                      element.requestFullscreen();
                  } else if (element.webkitRequestFullScreen) {
                      element.webkitRequestFullScreen();
                  } else if (element.mozRequestFullScreen) {
                      element.mozRequestFullScreen();
                  } else if (element.msRequestFullscreen) {
                      // IE11
                      element.msRequestFullscreen();
                  }
              }
              this.fullscreen = !this.fullscreen;
         },
22fb20b3   songchongxian   城市停车运营监控
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
  
      }
    }
  </script>
  
  <style lang="scss" scoped>
    .app-headBox {
      /*display: flex;*/
      /*justify-content: center;*/
      /*align-items: center;*/
      display: table;
      border: 0px solid red;
      font-size:18px;
      position:relative;
    .head-inner{
      display: table-cell;    /* 让子元素以表格的单元格形式渲染 */
      text-align: center;
      vertical-align: middle;
    }
    .head-name >span:first-child{
      position: relative;
      z-index: 666;
    }
    .head-name,.head-time{
      display: inline-block;
    }
    .head-name{
      font-size:23px;
      /*font-weight:bold;*/
      width: 884px;
      height: 60px;
      line-height: 60px;
      background: url(../../images/head/bg.svg) no-repeat;
      background-size: 100% 100%;
      position:relative;
  
    }
    .head-name-bg{
      background: url(../../images/head/headNameBg.png) no-repeat;
      background-size: 100% 100%;
      height: 60px;
      width:320px;
      position: absolute;
      top:-4px;
      left:280px;
      z-index: 10;
    }
36662834   Andy   add 全屏功能
108
109
110
111
112
113
114
115
116
117
      .header-fullscreen{
        width: 18px;
        height: 18px;
        line-height: 18px;
        position: absolute;
        right: 158px;
        top:25px;
        cursor:pointer;
        background: url('../../images/head/righttopbarico_Bg.png');
      }
22fb20b3   songchongxian   城市停车运营监控
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
    .head-time{
      font-size:14px;
      color:#b2c2cf;
      width: 101px;
      float:right;;
      right: 0px;
      top:0;
      bottom:0;
      text-align: left;
      position:absolute;
  
      display: flex;
      justify-content: center;
      align-items: center;
    }
    .head-time::before{
      content: " ";width: 35px; height: 35px;
      background: url("../../images/head/time.png") no-repeat center; background-size: 100%;
      position: absolute;
      left:0;
      margin-left:-45px;
    }
    }
  
  </style>