增加头部名称
This commit is contained in:
parent
6f6e2d5200
commit
22409d3bd5
|
@ -22,7 +22,7 @@
|
||||||
<el-dropdown-item>
|
<el-dropdown-item>
|
||||||
<el-icon><Setting /></el-icon>设置
|
<el-icon><Setting /></el-icon>设置
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item divided>
|
<el-dropdown-item divided @click="logout">
|
||||||
<el-icon><SwitchButton /></el-icon>退出登录
|
<el-icon><SwitchButton /></el-icon>退出登录
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
|
@ -37,10 +37,18 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { User, CaretBottom, UserFilled, Setting, SwitchButton } from '@element-plus/icons-vue'
|
import { User, CaretBottom, UserFilled, Setting, SwitchButton } from '@element-plus/icons-vue'
|
||||||
|
import router from "@/router/index.js";
|
||||||
|
|
||||||
const userInfo = ref({
|
const userInfo = ref({
|
||||||
username: sessionStorage.getItem('username') || '未登录',
|
username: sessionStorage.getItem('username') || '未登录',
|
||||||
})
|
})
|
||||||
|
const logout = () => {
|
||||||
|
// 清空 sessionStorage
|
||||||
|
sessionStorage.clear()
|
||||||
|
|
||||||
|
// 重定向到登录页面
|
||||||
|
router.push('/login')
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
<span>文字识别</span>
|
<span>文字识别</span>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
|
|
||||||
<el-menu-item index="/user">
|
<el-menu-item index="/user" v-if="isPermission">
|
||||||
<el-icon><User /></el-icon>
|
<el-icon><User /></el-icon>
|
||||||
<span>用户管理</span>
|
<span>用户管理</span>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
|
@ -74,7 +74,7 @@ import { House, Document, ChatLineRound, Files, DataLine, User } from '@element-
|
||||||
|
|
||||||
const isCollapse = ref(false)
|
const isCollapse = ref(false)
|
||||||
const activeIndex = ref('/home')
|
const activeIndex = ref('/home')
|
||||||
|
const isPermission = ref(sessionStorage.getItem('permission')==='0')
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -31,7 +31,8 @@ export default {
|
||||||
const user = ref({
|
const user = ref({
|
||||||
data: '',
|
data: '',
|
||||||
code: 0,
|
code: 0,
|
||||||
message: ''
|
message: '',
|
||||||
|
permission: ''
|
||||||
});
|
});
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
@ -52,9 +53,11 @@ export default {
|
||||||
console.log(data.data);
|
console.log(data.data);
|
||||||
const token = data.data;
|
const token = data.data;
|
||||||
const username = data.username;
|
const username = data.username;
|
||||||
|
const permission = data.permission;
|
||||||
console.log(token, username);
|
console.log(token, username);
|
||||||
sessionStorage.setItem('token', token);
|
sessionStorage.setItem('token', token);
|
||||||
sessionStorage.setItem('username', username);
|
sessionStorage.setItem('username', username);
|
||||||
|
sessionStorage.setItem('permission', permission);
|
||||||
await router.push('/home');
|
await router.push('/home');
|
||||||
} else {
|
} else {
|
||||||
alert(data.message);
|
alert(data.message);
|
||||||
|
|
Loading…
Reference in New Issue