mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-11 20:06:47 +08:00
--fix bug
This commit is contained in:
@@ -2,19 +2,19 @@
|
|||||||
<div class="navTop">
|
<div class="navTop">
|
||||||
<div class="navTopMain">
|
<div class="navTopMain">
|
||||||
<img
|
<img
|
||||||
style="width: 205px; height: 29px; margin-left: 37px; margin-top: 22px"
|
style="width: 205px; height: 29px; margin-left: 37px; margin-top: 22px"
|
||||||
src="../assets/images/navtop/logo.png"
|
src="../assets/images/navtop/logo.png"
|
||||||
/>
|
/>
|
||||||
<div class="navTopRight">
|
<div class="navTopRight">
|
||||||
<div class="role">
|
<div class="role">
|
||||||
<div>{{ selectRole }}</div>
|
<div>{{ state.selectRole }}</div>
|
||||||
<div class="roleArrow"></div>
|
<div class="roleArrow"></div>
|
||||||
<div class="roleItems">
|
<div class="roleItems">
|
||||||
<div
|
<div
|
||||||
v-for="(value, index) in roleList"
|
v-for="(value, index) in state.roleList"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="roleItem"
|
class="roleItem"
|
||||||
@click="changeRole(value)"
|
@click="changeRole(value)"
|
||||||
>
|
>
|
||||||
{{ value.name }}
|
{{ value.name }}
|
||||||
</div>
|
</div>
|
||||||
@@ -22,143 +22,66 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="user">
|
<div class="user">
|
||||||
<img
|
<img
|
||||||
style="
|
style="
|
||||||
width: 40px;
|
width: 40px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
"
|
"
|
||||||
:src="avatar"
|
:src="userInfo?.avatar"
|
||||||
/>
|
/>
|
||||||
<div style="margin-right: 20px">{{ username }}</div>
|
<div style="margin-right: 20px">{{ userInfo?.realName }}</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 2022-12-2注释 后面放开 增加username的margin-right:20 -->
|
|
||||||
<!-- <div
|
|
||||||
class="signOutMain"
|
|
||||||
style="margin: 0px 33px 0px 35px"
|
|
||||||
@click="showDrawer"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
style="width: 22px; height: 22px"
|
|
||||||
src="../assets/images/navtop/download.png"
|
|
||||||
/>
|
|
||||||
<span class="signOut">下载</span>
|
|
||||||
</div> -->
|
|
||||||
<div class="signOutMain" @click="logOut">
|
<div class="signOutMain" @click="logOut">
|
||||||
<img
|
<img
|
||||||
style="width: 27px; height: 27px"
|
style="width: 27px; height: 27px"
|
||||||
src="../assets/images/navtop/signout.png"
|
src="../assets/images/navtop/signout.png"
|
||||||
/>
|
/>
|
||||||
<span class="signOut">登出</span>
|
<span class="signOut">登出</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<down-load v-model:downloadVisible="visible" />
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup>
|
||||||
import { reactive, toRefs } from "vue";
|
import {computed, reactive} from "vue";
|
||||||
import DownLoad from "../components/drawers/DownLoad";
|
import {studentUrl} from "@/api/method";
|
||||||
import * as api from "../api/index1";
|
|
||||||
import { studentUrl } from "../api/method";
|
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
import { useStore, createStore } from "vuex";
|
import {useStore, createStore} from "vuex";
|
||||||
|
|
||||||
export default {
|
const store = useStore();
|
||||||
name: "NavTop",
|
|
||||||
components: {
|
|
||||||
DownLoad,
|
|
||||||
},
|
|
||||||
setup() {
|
|
||||||
const store = useStore();
|
|
||||||
|
|
||||||
const state = reactive({
|
const userInfo = computed(()=>store.state.userInfo)
|
||||||
selectRole: "管理员",
|
|
||||||
username: "",
|
|
||||||
avatar: require("../assets/images/avatar.png"),
|
|
||||||
roleList: [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: "管理员",
|
|
||||||
go: "/manage/learningpath",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: "学员",
|
|
||||||
go: studentUrl,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
visible: false,
|
const state = reactive({
|
||||||
});
|
selectRole: "管理员",
|
||||||
const changeRole = (value) => {
|
roleList: [
|
||||||
state.roleList.map((item) => {
|
{
|
||||||
if (value.name === item.name) {
|
id: 1,
|
||||||
state.selectRole = item.name;
|
name: "管理员",
|
||||||
window.open(item.go, "_self");
|
go: "/manage/learningpath",
|
||||||
}
|
},
|
||||||
});
|
{
|
||||||
};
|
id: 2,
|
||||||
const showDrawer = () => {
|
name: "学员",
|
||||||
state.visible = true;
|
go: studentUrl,
|
||||||
console.log("点击下载", state.visible);
|
},
|
||||||
};
|
],
|
||||||
const getUser = () => {
|
visible: false,
|
||||||
api
|
});
|
||||||
.getUser()
|
const changeRole = (value) => {
|
||||||
.then((res) => {
|
state.roleList.map((item) => {
|
||||||
console.log("获取登录信息成功", res);
|
if (value.name === item.name) {
|
||||||
if (res.data.code === 200) {
|
state.selectRole = item.name;
|
||||||
state.username = res.data.data.realName;
|
window.open(item.go, "_self");
|
||||||
// state.avatar = res.data.data.avatar
|
}
|
||||||
// ? res.data.data.avatar
|
});
|
||||||
// : require("../assets/images/avatar.png");
|
};
|
||||||
state.avatar = require("../assets/images/avatar.png");
|
const logOut = () => {
|
||||||
}
|
store.replaceState(createStore({state: {openpages: []}}).state);
|
||||||
})
|
localStorage.clear();
|
||||||
.catch((err) => {
|
(process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'alpine') ? router.push({path: '/login'}) : (window.location.href = process.env.VUE_APP_LOGIN_URL)
|
||||||
console.log("获取登录信息失败", err);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
getUser();
|
|
||||||
|
|
||||||
const logOut = () => {
|
|
||||||
|
|
||||||
store.replaceState(createStore({state: {openpages:null}}).state);
|
|
||||||
|
|
||||||
localStorage.removeItem("faceclassPic");
|
|
||||||
localStorage.removeItem("faceclassClass");
|
|
||||||
localStorage.removeItem("faceclassScene");
|
|
||||||
localStorage.removeItem("projectLevel");
|
|
||||||
localStorage.removeItem("projectSys");
|
|
||||||
localStorage.removeItem("pathmapPic");
|
|
||||||
localStorage.removeItem("projectClass");
|
|
||||||
localStorage.removeItem("projectPic");
|
|
||||||
|
|
||||||
localStorage.removeItem("routerId");
|
|
||||||
localStorage.removeItem("selectedKeys");
|
|
||||||
localStorage.removeItem("openKeys");
|
|
||||||
localStorage.removeItem("stageId");
|
|
||||||
localStorage.removeItem("openpages");
|
|
||||||
localStorage.removeItem("memberInitInfo");
|
|
||||||
localStorage.removeItem("projectId");
|
|
||||||
localStorage.removeItem("projectTemplateId");
|
|
||||||
localStorage.removeItem("orgtreeList");
|
|
||||||
process.env.NODE_ENV === 'development' ? router.push({path: '/learningpath'}) : (window.location.href = process.env.VUE_APP_LOGIN_URL)
|
|
||||||
if(process.env.NODE_ENV === 'development'){
|
|
||||||
setTimeout(() => {
|
|
||||||
window.location.reload();
|
|
||||||
}, 3000);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return {
|
|
||||||
...toRefs(state),
|
|
||||||
changeRole,
|
|
||||||
showDrawer,
|
|
||||||
logOut,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
Reference in New Issue
Block a user