|
@@ -17,8 +17,8 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div class="header_right">
|
|
<div class="header_right">
|
|
|
<el-dropdown trigger="click" @command="UserCommand" placement="bottom-end">
|
|
<el-dropdown trigger="click" @command="UserCommand" placement="bottom-end">
|
|
|
- <span class="userName">
|
|
|
|
|
- {{ userInfo.nickname }}
|
|
|
|
|
|
|
+ <span class="user_name">
|
|
|
|
|
+ {{ userInfo.userName }}
|
|
|
<el-icon class="el-icon--right">
|
|
<el-icon class="el-icon--right">
|
|
|
<arrow-down />
|
|
<arrow-down />
|
|
|
</el-icon>
|
|
</el-icon>
|
|
@@ -68,6 +68,7 @@ import { ElMessage } from 'element-plus'
|
|
|
import type { FormInstance, FormRules } from 'element-plus'
|
|
import type { FormInstance, FormRules } from 'element-plus'
|
|
|
// 1. 引入 Pinia store
|
|
// 1. 引入 Pinia store
|
|
|
import { useUserStore } from '@/store/user'
|
|
import { useUserStore } from '@/store/user'
|
|
|
|
|
+import { replace } from 'lodash-es'
|
|
|
|
|
|
|
|
// 2. 初始化 store
|
|
// 2. 初始化 store
|
|
|
const userStore = useUserStore()
|
|
const userStore = useUserStore()
|
|
@@ -107,11 +108,8 @@ const activeMenuName = computed(() => {
|
|
|
// activeMenuName.value = menuName
|
|
// activeMenuName.value = menuName
|
|
|
// }
|
|
// }
|
|
|
const userInfo = computed(() => {
|
|
const userInfo = computed(() => {
|
|
|
- const user = localStorage.getItem('userInfo')
|
|
|
|
|
- if (user) {
|
|
|
|
|
- return JSON.parse(user)
|
|
|
|
|
- }
|
|
|
|
|
- return null
|
|
|
|
|
|
|
+ console.log("打印用户名",userStore.userInfo.userName)
|
|
|
|
|
+ return userStore.userInfo
|
|
|
})
|
|
})
|
|
|
const dialogShow = ref(false)
|
|
const dialogShow = ref(false)
|
|
|
interface EditPassWordData {
|
|
interface EditPassWordData {
|
|
@@ -152,12 +150,27 @@ const setPassWord = () => {
|
|
|
}
|
|
}
|
|
|
// 退出登录
|
|
// 退出登录
|
|
|
const loginOutFn = async () => {
|
|
const loginOutFn = async () => {
|
|
|
- console.log(userInfo.value.username)
|
|
|
|
|
- const res = await loginOut(userInfo.value.userid)
|
|
|
|
|
|
|
+ console.log("打印用户信息",userInfo.value)
|
|
|
|
|
+ const res = await loginOut(userInfo.value.userId)
|
|
|
if(res.code == 200) {
|
|
if(res.code == 200) {
|
|
|
localStorage.removeItem('token')
|
|
localStorage.removeItem('token')
|
|
|
localStorage.removeItem('userInfo')
|
|
localStorage.removeItem('userInfo')
|
|
|
- router.push('/login')
|
|
|
|
|
|
|
+ console.log("打印当前环境import.meta.env.MODE",import.meta.env.MODE);
|
|
|
|
|
+ //增加环境判断
|
|
|
|
|
+ if(import.meta.env.MODE == 'development') {
|
|
|
|
|
+ // window.location.href = 'http://localhost:8080'
|
|
|
|
|
+ router.push('/login')
|
|
|
|
|
+ }
|
|
|
|
|
+ else if(import.meta.env.MODE == 'test')
|
|
|
|
|
+ {
|
|
|
|
|
+ window.location.href = 'https://dev3.k12100.net'
|
|
|
|
|
+ }
|
|
|
|
|
+ else if(import.meta.env.MODE == 'production')
|
|
|
|
|
+ {
|
|
|
|
|
+ window.location.href = 'https://www.k12100.com'
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // router.push('/login')
|
|
|
}else {
|
|
}else {
|
|
|
ElMessage.error(res.msg)
|
|
ElMessage.error(res.msg)
|
|
|
}
|
|
}
|
|
@@ -379,9 +392,11 @@ const confirmPassWord = async (formEl: FormInstance | undefined) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.header_right {
|
|
.header_right {
|
|
|
- width: auto;
|
|
|
|
|
|
|
+ min-width: 100px;
|
|
|
line-height: 30px;
|
|
line-height: 30px;
|
|
|
-
|
|
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ justify-content: flex-end;
|
|
|
|
|
+ align-items: center;
|
|
|
.user_name {
|
|
.user_name {
|
|
|
font-size: 15px;
|
|
font-size: 15px;
|
|
|
color: #fff;
|
|
color: #fff;
|