| | |
| | | </route> |
| | | |
| | | <template> |
| | | <view class="pt-40 text-xl text-center text-green-500">我的页面</view> |
| | | <view class="bg-base"> |
| | | <wd-cell-group border> |
| | | <wd-cell title="登录用户" :value="realName" icon="user" is-link /> |
| | | <wd-cell title="角色" :value="loginRoleName()" icon="bags" is-link /> |
| | | <wd-cell title="人员管理" icon="usergroup" is-link @click="handleInfo" /> |
| | | </wd-cell-group> |
| | | <wd-cell-group border class="mt-2"> |
| | | <wd-cell title="退出登录" icon="login" is-link @click="handleLogout" /> |
| | | </wd-cell-group> |
| | | </view> |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | // |
| | | import { useUserStore, useAccessStore, useSystemConfigStore } from '@/store' |
| | | import { loginRoleName } from '@/utils/RoleUtils' |
| | | import { useMessage } from 'wot-design-uni' |
| | | const message = useMessage() |
| | | const userStore = useUserStore() |
| | | const accessStore = useAccessStore() |
| | | const configStore = useSystemConfigStore() |
| | | const realName = computed(() => userStore?.userInfo?.realName) |
| | | |
| | | function handleLogout() { |
| | | if (!isLogined()) { |
| | | uni.navigateTo({ url: '/pages/login/index' }) |
| | | return false |
| | | } |
| | | message |
| | | .confirm({ |
| | | msg: '提示', |
| | | title: '确定退出登录吗?', |
| | | }) |
| | | .then(() => { |
| | | userStore.clearUserInfo() |
| | | accessStore.clearAccessInfo() |
| | | configStore.clearConfigInfo() |
| | | uni.navigateTo({ url: '/pages/login/index' }) |
| | | }) |
| | | .catch(() => {}) |
| | | } |
| | | |
| | | const isLogined = () => { |
| | | return accessStore.isLogined |
| | | } |
| | | |
| | | function handleInfo() { |
| | | uni.showToast({ |
| | | title: '功能开发中', |
| | | icon: 'none', |
| | | }) |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |