[fix][V]:完成对接navbar用户名显示

master
Romesum 5 years ago
parent 1c799d5ced
commit 147bb0f028

@ -12,11 +12,12 @@
<el-submenu index="2"> <el-submenu index="2">
<template slot="title">实验室申请</template> <template slot="title">实验室申请</template>
<el-menu-item index="2-1" route="book" @click="$router.push('/teacher/applyLab')"></el-menu-item> <el-menu-item index="2-1" route="book" @click="$router.push('/teacher/applyLab')"></el-menu-item>
<el-menu-item index="2-2" route="myBooking" @click="$router.push('/teacher/myApplyRecord')"></el-menu-item> <el-menu-item index="2-2" route="myBooking" @click="$router.push('/teacher/myApplyRecord')">
</el-menu-item>
</el-submenu> </el-submenu>
<el-menu-item index="3" route="course">课程管理</el-menu-item> <el-menu-item index="3" route="course">课程管理</el-menu-item>
<el-menu-item index="4" route="schedule" @click="$router.push('/teacher/myCourse')"></el-menu-item> <el-menu-item index="4" route="schedule" @click="$router.push('/teacher/myCourse')"></el-menu-item>
<drop-down-user user="个人中心" @back="backLogin" @goPersonal="goPersonal"></drop-down-user> <drop-down-user :user="nickname" @back="backLogin" @goPersonal="goPersonal"></drop-down-user>
</el-menu> </el-menu>
</div> </div>
</template> </template>
@ -25,10 +26,12 @@
import dropDownUser from "~/components/dropDownUser"; import dropDownUser from "~/components/dropDownUser";
import {get} from "~/utils"; import {get} from "~/utils";
import {showSuccess} from "~/utils/dialog"; import {showSuccess} from "~/utils/dialog";
export default { export default {
data() { data() {
return { return {
activeIndex: '1' activeIndex: '1',
nickname: ''
}; };
}, },
methods: { methods: {
@ -37,26 +40,26 @@
}, },
async backLogin() { async backLogin() {
await get('lb/user/logout') await get('lb/user/logout')
await showSuccess("退出成功",this) await showSuccess("退出成功", this)
setTimeout(()=>{ setTimeout(() => {
this.$router.push('/login') this.$router.push('/login')
},1000) }, 1000)
}, },
goPersonal:function () { goPersonal: function () {
this.$router.push('/teacher/personal') this.$router.push('/teacher/personal')
} }
}, },
components:{ components: {
dropDownUser dropDownUser
}, },
mounted() { async mounted() {
this.nickname = await get('lb/user/getUserName')
} }
} }
</script> </script>
<style scoped> <style scoped>
.nav{ .nav {
width: 100%; width: 100%;
} }
</style> </style>

Loading…
Cancel
Save