|
|
|
@ -4,9 +4,14 @@ |
|
|
|
<img src="../assets/header-logo.png" alt=""> |
|
|
|
</div> |
|
|
|
<div class="header-right flex" v-if="headerShow"> |
|
|
|
<!-- <div :class="right-item" @click="goToPage('/doctorInformation?doctor_id=' + doctor_id)">个人信息</div> |
|
|
|
<div :class="right-item" @click="goToPage('/hosInformation')">医院管理</div> --> |
|
|
|
<div :class="['right-item', currentPath == item.path ? 'right-item-active' :'']" v-for="(item,index) in routerNavList" :key="index" @click="goToPage(item.path)">{{ item.name }}</div> |
|
|
|
<div |
|
|
|
:class="['right-item', currentPath == item.path ? 'right-item-active' :'']" |
|
|
|
v-for="(item,index) in routerNavList" |
|
|
|
:key="index" |
|
|
|
@click="goToPage(item.path)" |
|
|
|
> |
|
|
|
{{ item.name }} |
|
|
|
</div> |
|
|
|
<el-dropdown trigger="click"> |
|
|
|
<div class="right-item flex el-dropdown-link"> |
|
|
|
<img class="right-item-icon" src="../assets/header-icon.png" alt=""> |
|
|
|
@ -14,16 +19,14 @@ |
|
|
|
<div class="img"></div> |
|
|
|
</div> |
|
|
|
<el-dropdown-menu slot="dropdown"> |
|
|
|
<!-- <el-dropdown-item><a href="/agent/domainList" target="_blank">我的域名</a></el-dropdown-item> --> |
|
|
|
<el-dropdown-item><div @click="loginOut">退出</div></el-dropdown-item> |
|
|
|
</el-dropdown-menu> |
|
|
|
</el-dropdown> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
|
|
|
|
<script> |
|
|
|
export default { |
|
|
|
data(){ |
|
|
|
return{ |
|
|
|
@ -38,7 +41,7 @@ export default { |
|
|
|
}, |
|
|
|
{ |
|
|
|
name:'医院管理', |
|
|
|
path:'/' |
|
|
|
path:'/hospitalManage' |
|
|
|
}, |
|
|
|
{ |
|
|
|
name:'收款管理', |
|
|
|
@ -52,6 +55,10 @@ export default { |
|
|
|
this.doctor_id = localStorage.getItem('doctor_id') |
|
|
|
if(this.user){ |
|
|
|
this.headerShow = true |
|
|
|
// 初始化时设置当前路由高亮 |
|
|
|
this.updateCurrentPath() |
|
|
|
// 监听路由变化 |
|
|
|
this.watchRouteChange() |
|
|
|
}else{ |
|
|
|
this.headerShow = false |
|
|
|
} |
|
|
|
@ -72,19 +79,45 @@ export default { |
|
|
|
// 退出登录 |
|
|
|
this.$http('POST', '/login_out', {}).then(response => { |
|
|
|
if(response.status){ |
|
|
|
// 移除信息待定 ---需要修改喔 |
|
|
|
localStorage.removeItem('token'); |
|
|
|
localStorage.removeItem('nick'); |
|
|
|
localStorage.removeItem('doctor_id'); |
|
|
|
// 退出后跳转到登录页或首页 |
|
|
|
this.$router.push('/login'); |
|
|
|
}else{ |
|
|
|
this.$message.error(response.data.info) |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
console.error(error, 'error') |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 更新当前路径高亮状态 |
|
|
|
updateCurrentPath() { |
|
|
|
const currentRoute = this.$route.path; |
|
|
|
const matchedItem = this.routerNavList.find(item => |
|
|
|
currentRoute.startsWith(item.path) |
|
|
|
); |
|
|
|
if (matchedItem) { |
|
|
|
this.currentPath = matchedItem.path; |
|
|
|
} else { |
|
|
|
this.currentPath = ''; |
|
|
|
} |
|
|
|
}, |
|
|
|
// 监听路由变化 |
|
|
|
watchRouteChange() { |
|
|
|
this.$watch('$route', (to, from) => { |
|
|
|
console.log(to,from,'===='); |
|
|
|
this.updateCurrentPath(); |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
beforeDestroy() { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
.flex { |
|
|
|
display: flex; |
|
|
|
@ -134,7 +167,6 @@ export default { |
|
|
|
cursor: pointer; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.right-item-icon { |
|
|
|
width: 36px; |
|
|
|
height: 36px; |
|
|
|
|