mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-11 11:56:46 +08:00
189 lines
4.4 KiB
Vue
189 lines
4.4 KiB
Vue
<template>
|
|
<div class="navTop">
|
|
<div class="navTopMain">
|
|
<img
|
|
style="width: 205px; height: 29px; margin-left: 37px; margin-top: 22px"
|
|
src="../assets/images/navtop/logo.png"
|
|
/>
|
|
<div class="navTopRight">
|
|
<div class="role">
|
|
<div>{{ state.selectRole }}</div>
|
|
<div class="roleArrow"></div>
|
|
<div class="roleItems">
|
|
<div
|
|
v-for="(value, index) in state.roleList"
|
|
:key="index"
|
|
class="roleItem"
|
|
@click="changeRole(value)"
|
|
>
|
|
{{ value.name }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="user">
|
|
<img
|
|
style="
|
|
width: 40px;
|
|
height: 40px;
|
|
margin-left: 8px;
|
|
border-radius: 15px;
|
|
margin-right: 10px;
|
|
"
|
|
:src="userInfo?.avatar"
|
|
/>
|
|
<div style="margin-right: 20px">{{ userInfo?.realName }}</div>
|
|
</div>
|
|
<div class="signOutMain" @click="logOut">
|
|
<img
|
|
style="width: 27px; height: 27px"
|
|
src="../assets/images/navtop/signout.png"
|
|
/>
|
|
<span class="signOut">登出</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script setup>
|
|
import {computed, reactive} from "vue";
|
|
import {studentUrl} from "@/api/method";
|
|
import router from "@/router";
|
|
import {useStore, createStore} from "vuex";
|
|
|
|
const store = useStore();
|
|
|
|
const userInfo = computed(()=>store.state.userInfo)
|
|
|
|
const state = reactive({
|
|
selectRole: "管理员",
|
|
roleList: [
|
|
{
|
|
id: 1,
|
|
name: "管理员",
|
|
go: "/manage/learningpath",
|
|
},
|
|
{
|
|
id: 2,
|
|
name: "学员",
|
|
go: studentUrl,
|
|
},
|
|
],
|
|
visible: false,
|
|
});
|
|
const changeRole = (value) => {
|
|
state.roleList.map((item) => {
|
|
if (value.name === item.name) {
|
|
state.selectRole = item.name;
|
|
window.open(item.go, "_self");
|
|
}
|
|
});
|
|
};
|
|
const logOut = () => {
|
|
store.replaceState(createStore({state: {openpages: []}}).state);
|
|
localStorage.clear();
|
|
(process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'alpine') ? router.push({path: '/login'}) : (window.location.href = process.env.VUE_APP_LOGIN_URL)
|
|
};
|
|
</script>
|
|
<style scoped lang="scss">
|
|
.navTop {
|
|
width: 100%;
|
|
height: 80px;
|
|
// display: flex;
|
|
background-color: rgba(255, 255, 255, 1);
|
|
|
|
// box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.21);
|
|
.navTopMain {
|
|
width: 100%;
|
|
height: 80px;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
background-color: rgba(255, 255, 255, 1);
|
|
// background-color: #0078fc;
|
|
.navTopRight {
|
|
display: flex;
|
|
}
|
|
|
|
.role {
|
|
display: flex;
|
|
align-items: center;
|
|
font-size: 16px;
|
|
font-weight: 400;
|
|
font-family: "Menlo", "苹方-简" !important;
|
|
color: #000;
|
|
line-height: 36px;
|
|
cursor: pointer;
|
|
position: relative;
|
|
|
|
.roleArrow {
|
|
width: 13px;
|
|
height: 7px;
|
|
margin-left: 8px;
|
|
background-image: url(../assets/images/navtop/down.png);
|
|
background-size: 100%;
|
|
}
|
|
|
|
.roleItems {
|
|
width: 109px;
|
|
height: 90px;
|
|
padding-top: 10px;
|
|
background: #ffffff;
|
|
box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.21);
|
|
position: absolute;
|
|
top: 60px;
|
|
right: 0px;
|
|
text-align: center;
|
|
display: none;
|
|
z-index: 100;
|
|
}
|
|
|
|
.roleItem {
|
|
font-size: 14px;
|
|
font-weight: 400;
|
|
color: rgba(79, 81, 86, 1);
|
|
line-height: 36px;
|
|
}
|
|
|
|
.roleItem:hover {
|
|
color: #4ea6ff;
|
|
}
|
|
}
|
|
|
|
.role:hover .roleItems {
|
|
display: block;
|
|
}
|
|
|
|
// .role:hover .roleArrow {
|
|
// background-image: url(../assets/images/navtop/up.png);
|
|
// }
|
|
|
|
.user {
|
|
margin-left: 37px;
|
|
display: flex;
|
|
align-items: center;
|
|
font-size: 14px;
|
|
font-weight: 400;
|
|
// color: #b3bdc4;
|
|
color: #000;
|
|
line-height: 36px;
|
|
font-family: "Menlo", "苹方-简" !important;
|
|
}
|
|
|
|
.signOutMain {
|
|
cursor: pointer;
|
|
margin-right: 29px;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.signOut {
|
|
font-size: 16px;
|
|
font-weight: 400;
|
|
color: #000;
|
|
line-height: 22px;
|
|
margin-left: 5px;
|
|
font-family: "Menlo", "苹方-简" !important;
|
|
}
|
|
}
|
|
}
|
|
</style>
|