whychdw
2019-07-02 d2f48914142e8e40f432aebb987529f08a22c407
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
<style scoped>
.layout-logo{
    padding: 0 16px;
    height: 36px;
    line-height: 36px;
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 4px;
    color: #FFFFFF;
    border-radius: 3px;
    float: left;
    position: relative;
    top: 15px;
    left: 20px;
}
.layout-nav{
    width: 350px;
    margin: 0 auto;
    margin-right: 60px;
}
.user-info-menu {
    color: #FFFFFF;
}
.user-info-menu-icon {
    display: inline-block;
    text-align: center;
    font-size: 18px;
    color: #fff;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    vertical-align: middle;
    width: 32px;
    height: 32px;
    line-height: 32px;
    border-radius: 16px;
    background-color: #87d068;
}
.main-page-content {
    height: calc(100vh - 64px);
}
</style>
<template>
  <div id="app">
    <div class="layout">
        <Layout>
            <Header>
                <Menu mode="horizontal" theme="dark" :active-name="activeName">
                    <div class="layout-logo">
                        新能源充电桩在线巡检系统
                    </div>
                    <div class="layout-nav">
                        <MenuItem name="home" to="/">
                            <Icon type="ios-home" />
                            <span>首页</span>
                        </MenuItem>
                        <MenuItem name="control" to="/control">
                            <Icon type="ios-stats" />
                            <span>实时监控</span>
                        </MenuItem>
                        <MenuItem name="history" to="/history">
                            <Icon type="ios-paper" />
                            <span>历史数据</span>
                        </MenuItem>
                        <!-- <MenuItem name="4">
                            <Icon type="ios-notifications" />
                            <span>告警管理</span>
                        </MenuItem>
                        <MenuItem name="5">
                            <Icon type="ios-settings" />
                            <span>系统管理</span>
                        </MenuItem> -->
                    </div>
                    <div class="user-info-menu">
                        <!-- <Avatar style="background-color: #87d068" icon="ios-person" />
                        <Dropdown trigger="hover" style="margin-left: 8px; color: #FFFFFF">
                            <a href="javascript:void(0)" style="color: #FFFFFF">
                                霍东伟
                                <Icon type="ios-arrow-down"></Icon>
                            </a>
                            <DropdownMenu slot="list">
                                <DropdownItem>密码修改</DropdownItem>
                                <DropdownItem>退出系统</DropdownItem>
                            </DropdownMenu>
                        </Dropdown> -->
                        <!-- <Tooltip :content="warnStatus.tooltip" placement="bottom">
                            <span style="font-size: 22px; margin-left:8px"><Icon :type="warnStatus.type" @click="toggleWarnStatus"/></span>
                        </Tooltip> -->
                        <!-- <audio src="./music/smoke_alarm.mp3" controls="controls" autoplay="autoplay"></audio> -->
                    </div>
                </Menu>
            </Header>
            <Content class="main-page-content" :style="{padding: '1px', minHeight: '280px', background: '#fff', overflowY: 'auto' }">
                <router-view></router-view>
            </Content>
        </Layout>
    </div>
  </div>
</template>
<script>
 
export default {
  name: 'app',
  data: function() {
    return {
        activeName: '',        // 当前页面所在的路由
        warnStatus: {
            type: 'ios-notifications',
            tooltip: '点击关闭告警音'
        }
    }
  },
  methods:{
      openWarnStatus: function() {
            this.warnStatus = {
                type: 'ios-notifications',
                tooltip: '点击关闭告警音'
            };
      },
      offWarnStatus: function() {
            this.warnStatus = {
                type: 'ios-notifications-off',
                tooltip: '点击开启告警音'
            };
      },
      toggleWarnStatus: function() {
          if(this.warnStatus.type == 'ios-notifications') {
              this.offWarnStatus();
          }else {
              this.openWarnStatus();
          }
      }
  },
  mounted: function() {
      var _self = this;
      this.$bus.$off('setMainNav').$on('setMainNav', function(activeName) {
          _self.activeName = activeName;
      });
  }
}
</script>