feat: 添加账户设置功能页面且兼容移动端 (#1022)

This commit is contained in:
EchoByte
2024-04-12 16:20:33 +08:00
committed by GitHub
parent 296db3789b
commit 332678ba88
25 changed files with 860 additions and 22 deletions

View File

@@ -2,16 +2,16 @@ import { storeToRefs } from "pinia";
import { getConfig } from "@/config";
import { useRouter } from "vue-router";
import { emitter } from "@/utils/mitt";
import userAvatar from "@/assets/user.jpg";
import Avatar from "@/assets/user.jpg";
import { getTopMenu } from "@/router/utils";
import { useFullscreen } from "@vueuse/core";
import { useGlobal } from "@pureadmin/utils";
import type { routeMetaType } from "../types";
import { transformI18n } from "@/plugins/i18n";
import { router, remainingPaths } from "@/router";
import { computed, type CSSProperties } from "vue";
import { useAppStoreHook } from "@/store/modules/app";
import { useUserStoreHook } from "@/store/modules/user";
import { useGlobal, isAllEmpty } from "@pureadmin/utils";
import { useEpThemeStoreHook } from "@/store/modules/epTheme";
import { usePermissionStoreHook } from "@/store/modules/permission";
import ExitFullscreen from "@iconify-icons/ri/fullscreen-exit-fill";
@@ -37,9 +37,18 @@ export function useNav() {
};
});
/** 用户名 */
/** 头像(如果头像为空则使用 src/assets/user.jpg */
const userAvatar = computed(() => {
return isAllEmpty(useUserStoreHook()?.avatar)
? Avatar
: useUserStoreHook()?.avatar;
});
/** 昵称(如果昵称为空则显示用户名) */
const username = computed(() => {
return useUserStoreHook()?.username;
return isAllEmpty(useUserStoreHook()?.nickname)
? useUserStoreHook()?.username
: useUserStoreHook()?.nickname;
});
/** 设置国际化选中后的样式 */
@@ -99,6 +108,10 @@ export function useNav() {
emitter.emit("openPanel");
}
function toAccountSettings() {
router.push({ name: "AccountSettings" });
}
function toggleSideBar() {
pureApp.toggleSideBar();
}
@@ -159,6 +172,7 @@ export function useNav() {
userAvatar,
avatarsStyle,
tooltipEffect,
toAccountSettings,
getDropdownItemStyle,
getDropdownItemClass
};