<template>
|
<div class="navbar">
|
<Institute/>
|
|
|
<div class="right-menu">
|
|
<!-- <a v-if="appShow" style="color: white" @click="downApp">APP下载</a> -->
|
<!-- <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 v-if="appShow">
|
<span @click="downApp">APP下载</span>
|
</el-dropdown-item>
|
<el-dropdown-item divided>
|
<span style="display:block;" @click="logout">退出登录</span>
|
</el-dropdown-item>
|
</el-dropdown-menu>
|
</el-dropdown>
|
|
<template v-if="device!=='mobile'">
|
<screenfull class="right-menu-item hover-effect" />
|
</template>
|
</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 = process.env.IMG_API + 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: 80px;
|
padding:10px 0;
|
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: 14px;
|
vertical-align: middle;
|
}
|
.el-icon-caret-bottom {
|
cursor: pointer;
|
position: absolute;
|
right: -20px;
|
top: 25px;
|
font-size: 12px;
|
}
|
}
|
}
|
}
|
}
|
|
</style>
|