| | |
| | | <div class="custom-header"> |
| | | <el-row class="content" justify="space-between"> |
| | | <el-text class="text-white text-2xl font-bold">广东省技能人才评价考务管理平台</el-text> |
| | | <el-dropdown v-if="!userInfo.id" placement="bottom"> |
| | | <el-dropdown v-if="userInfo.id" placement="bottom"> |
| | | <el-row align="middle"> |
| | | <Icon icon="fa:user-circle" width="22" height="22" class="mr-2" style="color: #fff" /> |
| | | <el-text class="text-white cursor-p text-lg font-bold">黄婷婷</el-text> |
| | |
| | | <template #dropdown> |
| | | <el-dropdown-menu> |
| | | <el-dropdown-item>个人中心</el-dropdown-item> |
| | | <el-dropdown-item>退出登录</el-dropdown-item> |
| | | <el-dropdown-item @click="logout()">退出登录</el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </template> |
| | | </el-dropdown> |
| | |
| | | export default { |
| | | setup() { |
| | | const { loginDialogVisible } = storeToRefs(useLoginStore()) |
| | | const { setUserInfo } = useSessionStore() |
| | | const { userInfo } = storeToRefs(useSessionStore()) |
| | | return { loginDialogVisible, userInfo } |
| | | return { loginDialogVisible, userInfo, setUserInfo } |
| | | }, |
| | | data() { |
| | | return { |
| | | |
| | | } |
| | | }, |
| | | created() { |
| | | const token = localStorage.getItem('accessToken') |
| | | if (token) { |
| | | this.getUserInfo() |
| | | } |
| | | }, |
| | | methods: { |
| | | login() { |
| | | this.loginDialogVisible = true |
| | | }, |
| | | getUserInfo() { |
| | | setTimeout(() => { |
| | | this.setUserInfo({ |
| | | id: '12345', |
| | | username: '黄婷婷' |
| | | }) |
| | | }, 1000) |
| | | }, |
| | | logout() { |
| | | this.$messageBox.confirm('确定要退出登录吗', '提示', |
| | | { confirmButtonText: '确定', cancelButtonText: '取消', type: 'error' }).then(res => { |
| | | if (res == 'confirm') { |
| | | localStorage.removeItem('accessToken') |
| | | this.setUserInfo({}) |
| | | this.$message.success('退出登录') |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |