Your Name
2022-03-14 aaebe147d319e59a8b510ff4ce9271088a330732
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
<template>
  <div class="navbar">
    <Institute/>
 
 
    <div class="right-menu">
      <template v-if="device!=='mobile'">
        <screenfull class="right-menu-item hover-effect" />
      </template>
      <span v-if="appShow" style="color: white" @click="downApp">APP下载</span>
<!--      <el-popover-->
<!--        placement="right"-->
<!--        trigger="hover">-->
<!--        <img :src="apkPath">-->
<!--        <img slot="reference" :src="apkPath" style="max-height: 50px;max-width: 50px">-->
<!--      </el-popover>-->
 
      <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
        <div class="avatar-wrapper">
          <img :src="avatorPath" class="user-avatar">
          <span class="user-text">{{ name }}</span>
          <i class="el-icon-caret-bottom" />
        </div>
        <el-dropdown-menu slot="dropdown">
          <router-link to="/">
            <el-dropdown-item>
              首页
            </el-dropdown-item>
          </router-link>
          <el-dropdown-item divided>
            <span style="display:block;" @click="logout">退出登录</span>
          </el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
 
    <el-dialog :visible.sync="appDialogVisible"
               :modal-append-to-body="false" :close-on-click-modal="false"
               width="320px"
    title="监管APP安卓版浏览器扫码下载">
        <div id="appcode" style="height: 200px;width: 200px"/>
    </el-dialog>
  </div>
</template>
 
<script>
import { newAppFile,} from "@/api/appfile";
import { mapGetters } from 'vuex'
import Breadcrumb from '@/components/Breadcrumb'
import Institute from './Institute'
import Hamburger from '@/components/Hamburger'
import ErrorLog from '@/components/ErrorLog'
import Screenfull from '@/components/Screenfull'
import SizeSelect from '@/components/SizeSelect'
import ThemePicker from '@/components/ThemePicker'
import Search from '@/components/HeaderSearch'
import QRCode from "qrcodejs2"
const imgUrl = require('@/assets/person.jpg')
const appUrl = require('@/assets/sinano.png')
export default {
  filters: {
    parseIntValue(value) {
      if (value == '1') {
        return '√'
      } else {
        return '×'
      }
    }
  },
  components: {
    Breadcrumb,
    Hamburger,
    ErrorLog,
    Screenfull,
    SizeSelect,
    ThemePicker,
    Search,
    Institute
  },
  data() {
    return {
      warnBJList: [],
      warnBJVisible: false,
      pageSize: 10,
      recordTotal: 10,
      currentPage: 1,
      pageTotal: 0,
      warnYJList: [],
      warnYJVisible: false,
      warnGZList: [],
      warnGZVisible: false,
      warnWidth: '1000px',
      warnHeight: 500,
      appDialogVisible:false,
      appCode:"",
      appShow:true,
    }
  },
  created() {
    if (window.innerWidth <= 1200) {
      this.warnWidth = '660px'
      this.warnHeight = 360
    } else {
      this.warnWidth = '1000px'
      this.warnHeight = 500
    }
    this.getAppCode();
  },
  computed: {
    ...mapGetters([
      'sidebar',
      'name',
      'avatar',
      'device',
      'roles',
    ]),
    avatorPath() {
      return imgUrl
    },
    apkPath() {
      return appUrl
    }
  },
  methods: {
     getAppCode(){
         const roles = this.roles
         for (let role in roles){
             if(roles[role].name == '生产企业' ||
                 roles[role].name == '销售企业'){
                 this.appShow = false;
             }
         }
         const _this = this
         const params = {}
         params['filetype'] = "监管"
         newAppFile(params).then(response => {
             const res = response.data;
             if (res.code == 200) {
                 const result = res.result;
                 _this.appCode = result.fileurl
             }
         }).catch(error => {
         })
     },
     downApp(){
         this.appDialogVisible = true;
         this.$nextTick(() => {
             this.qrcode()
         })
    },
    qrcode () {
        let app = document.getElementById("appcode");
        if(app != null){
            app.innerHTML = "";
        }
        let appcode = new QRCode('appcode', {
            width: 200,
            height: 200,        // 高度
            text: this.appCode,   // 二维码内容
            render: 'canvas' ,   // 设置渲染方式(有两种方式 table和canvas,默认是canvas)
            background: '#f0f',   // 背景色
            // foreground: '#ff0'    // 前景色
        })
    },
    toggleSideBar() {
      this.$store.dispatch('toggleSideBar')
    },
    logout() {
      this.$store.dispatch('LogOut').then(() => {
        location.reload()// In order to re-instantiate the vue-router object to avoid bugs
      })
    }
  }
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.navbar {
  height: 60px;
  position: fixed;
  z-index: 1000;
  width: 100%;
  background-color: rgba(3,78,162,1);;
  overflow: hidden;
  .hamburger-container {
    line-height: 46px;
    height: 100%;
    float: left;
    cursor: pointer;
    transition: background .3s;
 
    &:hover {
      background: rgba(0, 0, 0, .025)
    }
  }
 
  .breadcrumb-container {
    float: left;
  }
 
  .errLog-container {
    display: inline-block;
    vertical-align: top;
  }
 
  .right-menu {
    float: right;
    height: 100%;
    line-height: 50px;
 
    &:focus {
      outline: none;
    }
 
    .right-menu-item {
      display: inline-block;
      padding: 0 8px;
      height: 100%;
      font-size: 18px;
      color: #FFFFFF;
      //vertical-align: text-bottom;
     // vertical-align: middle;
      &.hover-effect {
        cursor: pointer;
        transition: background .3s;
 
        &:hover {
          background: rgba(0, 0, 0, .025)
        }
      }
    }
 
    .avatar-container {
      margin-right: 30px;
 
      .avatar-wrapper {
        margin-top: 5px;
        position: relative;
 
        .user-avatar {
          cursor: pointer;
          width: 30px;
          height: 30px;
          border-radius: 10px;
          vertical-align: middle;
        }
        .user-text{
          margin-left:5px;
          font-size: 12px;
          vertical-align: middle;
          font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
        }
        .el-icon-caret-bottom {
          cursor: pointer;
          position: absolute;
          right: -20px;
          top: 25px;
          font-size: 12px;
        }
      }
    }
  }
}
 
</style>