|
|
|
@ -1,17 +1,16 @@ |
|
|
|
|
<template> |
|
|
|
|
<div class="header"> |
|
|
|
|
<a class="logo" @click="toIndex"> |
|
|
|
|
<!-- <span v-if="token && isManager && !showSetting">{{schoolName}}</span> --> |
|
|
|
|
<img src="@/assets/img/logo.png" alt=""> |
|
|
|
|
</a> |
|
|
|
|
<div class="inner"> |
|
|
|
|
<div style="height: 64px;"></div> |
|
|
|
|
<navbar ref="nav"></navbar> |
|
|
|
|
<div class="action" v-if="token"> |
|
|
|
|
<img v-if="isManager && showSetting" class="icon" :class="{'m-r-20': !isCustomer}" src="../../assets/img/setting.png" alt="" @click="toManager"> |
|
|
|
|
<img v-if="showSetting && isCustomer" class="icon m-r-20" src="../../assets/img/setting.png" alt="" @click="toManager"> |
|
|
|
|
<el-dropdown class="user-wrap" @command="userCommand"> |
|
|
|
|
<div class="user"> |
|
|
|
|
<el-avatar :size="40" :src="avatar" v-if="!isCustomer"></el-avatar> |
|
|
|
|
<el-avatar :size="40" :src="avatar"></el-avatar> |
|
|
|
|
<span class="username">{{userName}}</span> |
|
|
|
|
</div> |
|
|
|
|
<el-dropdown-menu slot="dropdown"> |
|
|
|
@ -68,7 +67,6 @@ export default { |
|
|
|
|
keyword: '', |
|
|
|
|
searchTimer: null, |
|
|
|
|
userName: '', |
|
|
|
|
isUser: false, |
|
|
|
|
showSetting: true, |
|
|
|
|
id: '', |
|
|
|
|
schoolName: '', |
|
|
|
@ -83,7 +81,7 @@ export default { |
|
|
|
|
components: { navbar }, |
|
|
|
|
computed: { |
|
|
|
|
...mapState('user', [ |
|
|
|
|
'avatar', 'isManager', 'schoolId', 'isCustomer' |
|
|
|
|
'avatar', 'schoolId', 'isCustomer' |
|
|
|
|
]), |
|
|
|
|
...mapState('auth', [ |
|
|
|
|
'routes' |
|
|
|
@ -114,8 +112,15 @@ export default { |
|
|
|
|
let customer = atob(decodeURI(this.customer)) == 'false' ? false : true |
|
|
|
|
this.setCustomer(customer) |
|
|
|
|
} |
|
|
|
|
// 如果是管理员,并且已经进入到了后台,那么就要把进入后台的图标给隐藏 |
|
|
|
|
let mg = this.$route.query.mg |
|
|
|
|
if (mg && atob(decodeURI(mg)) === 'true') { |
|
|
|
|
this.showSetting = false |
|
|
|
|
} |
|
|
|
|
// 如果登录了,并且非客户,才调用用户信息的接口(客户是没有用户信息的,也不能进入后台) |
|
|
|
|
this.token && this.isCustomer && this.getUserInfo() |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.token && !this.isCustomer && this.getUserInfo() |
|
|
|
|
}, 1000) |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
...mapActions('user', [ |
|
|
|
@ -125,13 +130,6 @@ export default { |
|
|
|
|
this.$get(this.api.userInfo).then(res => { |
|
|
|
|
let userInfo = res.userInfo ? res.userInfo : {} |
|
|
|
|
let userAccount = res.userAccount |
|
|
|
|
let isManager = userAccount.roleId != '0' // 判断该用户是普通用户还是其他角色,普通用户无法进入后台,要把后台那个图标隐藏 |
|
|
|
|
this.isUser = isManager |
|
|
|
|
let mg = this.$route.query.mg |
|
|
|
|
// 如果是管理员 |
|
|
|
|
if (mg && atob(decodeURI(mg)) === 'true') { |
|
|
|
|
this.showSetting = false |
|
|
|
|
} |
|
|
|
|
this.userName = userAccount.account |
|
|
|
|
this.id = userAccount.id |
|
|
|
|
this.schoolName = res.schoolName |
|
|
|
@ -139,11 +137,12 @@ export default { |
|
|
|
|
avatar: userInfo.userAvatars, |
|
|
|
|
schoolId: userAccount.schoolId, |
|
|
|
|
}) |
|
|
|
|
this.setManager(isManager) |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
}, |
|
|
|
|
toIndex() { |
|
|
|
|
this.$refs.nav.jump({ |
|
|
|
|
this.$route.path === '/index/list' |
|
|
|
|
? location.reload() |
|
|
|
|
: this.$refs.nav.jump({ |
|
|
|
|
index: '/index/list', |
|
|
|
|
title: '首页' |
|
|
|
|
}) |
|
|
|
|