mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-08 01:17:23 +08:00
refactor: user settings & make style follow the theme
This commit is contained in:
parent
ac96c7b088
commit
fdf47e8f6f
@ -10,9 +10,9 @@ export default defineFakeRoute([
|
|||||||
data: {
|
data: {
|
||||||
avatarUrl: "https://avatars.githubusercontent.com/u/44761321",
|
avatarUrl: "https://avatars.githubusercontent.com/u/44761321",
|
||||||
nickName: "企丸丸",
|
nickName: "企丸丸",
|
||||||
introduce: "我是幻兽帕鲁里的NO.1",
|
introduce: "我是幻兽帕鲁里的明星",
|
||||||
regionCode: "001002001",
|
regionCode: "001002001",
|
||||||
address: "体育路冰鸟密域祭坛地下城",
|
address: "冰鸟密域祭坛地下城",
|
||||||
userName: "admin"
|
userName: "admin"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, onBeforeUnmount } from "vue";
|
import { ref } from "vue";
|
||||||
import { useNav } from "@/layout/hooks/useNav";
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
import leftLine from "@iconify-icons/ri/arrow-left-s-line";
|
import leftLine from "@iconify-icons/ri/arrow-left-s-line";
|
||||||
import userLine from "@iconify-icons/ri/user-3-line";
|
import userLine from "@iconify-icons/ri/user-3-line";
|
||||||
import profileLine from "@iconify-icons/ri/profile-line";
|
import profileLine from "@iconify-icons/ri/profile-line";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { getUserInfo } from "@/api/user";
|
import { getUserInfo } from "@/api/user";
|
||||||
const route = useRoute();
|
|
||||||
|
import UserInfoManage from "@/layout/components/userSettings/userInfoManage.vue";
|
||||||
|
import SafeManage from "@/layout/components/userSettings/safeManage.vue";
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { userAvatar, getLogo, username } = useNav();
|
const { getLogo, isCollapse } = useNav();
|
||||||
const defaultActive = ref<string>(route.path as string);
|
|
||||||
const userInfo = ref({
|
const userInfo = ref({
|
||||||
nickName: "",
|
nickName: "",
|
||||||
avatarUrl: "",
|
avatarUrl: "",
|
||||||
@ -21,44 +23,104 @@ getUserInfo().then(res => {
|
|||||||
const handleBack = () => {
|
const handleBack = () => {
|
||||||
router.go(-1);
|
router.go(-1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const witchPane = ref("userInfoManage");
|
||||||
|
const panes = [
|
||||||
|
{
|
||||||
|
key: "userInfoManage",
|
||||||
|
label: "基本设置",
|
||||||
|
icon: userLine,
|
||||||
|
component: UserInfoManage
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "safeManage",
|
||||||
|
label: "安全设置",
|
||||||
|
icon: profileLine,
|
||||||
|
component: SafeManage
|
||||||
|
}
|
||||||
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-container class="h-full py-8">
|
<el-container class="h-full">
|
||||||
<el-aside class="w-70 pure-border-color px-4">
|
<el-aside class="settings-sidebar px-2" width="210px">
|
||||||
<el-menu :default-active="defaultActive" router>
|
<el-menu :default-active="witchPane" class="settings-menu">
|
||||||
<el-menu-item class="flex items-center" @click="handleBack">
|
<el-menu-item @click="handleBack">
|
||||||
<IconifyIconOffline :icon="leftLine" />
|
<div class="flex items-center">
|
||||||
<img :src="getLogo()" class="w-6 h-6" alt="logo" />
|
<IconifyIconOffline :icon="leftLine" />
|
||||||
<span class="ml-2">返回</span>
|
<img :src="getLogo()" class="w-6 h-6" alt="logo" />
|
||||||
|
<span class="ml-2">返回</span>
|
||||||
|
</div>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<li class="flex items-center ml-8 mt-4">
|
<li class="flex items-center ml-8 mt-4">
|
||||||
<div>
|
<div>
|
||||||
<el-avatar :size="80" :src="userInfo.avatarUrl" />
|
<el-avatar :size="80" :src="userInfo.avatarUrl" />
|
||||||
</div>
|
</div>
|
||||||
<div class="pl-4">
|
<div class="pl-4 flex-col">
|
||||||
<p>{{ userInfo.nickName }}</p>
|
<p>{{ userInfo.nickName }}</p>
|
||||||
<el-text class="mt-2" type="info">{{ userInfo.userName }}</el-text>
|
<p>
|
||||||
|
<el-text class="mt-2" type="info">{{
|
||||||
|
userInfo.userName
|
||||||
|
}}</el-text>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<el-menu-item index="/user-settings/user-info-manage">
|
<el-menu-item
|
||||||
<el-icon><IconifyIconOffline :icon="userLine" /></el-icon>
|
v-for="item in panes"
|
||||||
<span>基本设置</span>
|
:key="item.key"
|
||||||
</el-menu-item>
|
:index="item.key"
|
||||||
<el-menu-item index="/user-settings/safe-manage">
|
@click="witchPane = item.key"
|
||||||
<el-icon><IconifyIconOffline :icon="profileLine" /></el-icon>
|
>
|
||||||
<span>安全设置</span>
|
<div class="flex items-center">
|
||||||
|
<el-icon><IconifyIconOffline :icon="item.icon" /></el-icon>
|
||||||
|
<span>{{ item.label }}</span>
|
||||||
|
</div>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</el-aside>
|
</el-aside>
|
||||||
<el-main>
|
<el-main>
|
||||||
<router-view />
|
<component :is="panes.find(item => item.key === witchPane).component" />
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.pure-border-color {
|
.settings-sidebar {
|
||||||
border-color: var(--pure-border-color); /* 使用边框颜色变量 */
|
background: $menuBg;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-menu {
|
||||||
|
color: $subMenuActiveText;
|
||||||
|
background-color: transparent !important;
|
||||||
|
border: none !important;
|
||||||
|
|
||||||
|
::v-deep(.el-menu-item) {
|
||||||
|
position: relative;
|
||||||
|
background-color: transparent !important;
|
||||||
|
|
||||||
|
div {
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.is-active {
|
||||||
|
span {
|
||||||
|
color: #fff !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
i {
|
||||||
|
color: #fff !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0 8px;
|
||||||
|
margin: 4px 0;
|
||||||
|
clear: both;
|
||||||
|
content: "";
|
||||||
|
background: var(--el-color-primary) !important;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -100,7 +100,7 @@ export function useNav() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleOpenUserSettings() {
|
function handleOpenUserSettings() {
|
||||||
router.push({ name: "UserInfoManage" });
|
router.push({ name: "UserSettings" });
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleSideBar() {
|
function toggleSideBar() {
|
||||||
|
@ -47,20 +47,6 @@ export default [
|
|||||||
title: $t("buttons.hsUserSettings"),
|
title: $t("buttons.hsUserSettings"),
|
||||||
showLink: false,
|
showLink: false,
|
||||||
rank: 103
|
rank: 103
|
||||||
},
|
}
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: "user-info-manage",
|
|
||||||
name: "UserInfoManage",
|
|
||||||
component: () =>
|
|
||||||
import("@/layout/components/userSettings/userInfoManage.vue")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "safe-manage",
|
|
||||||
name: "SafeManage",
|
|
||||||
component: () =>
|
|
||||||
import("@/layout/components/userSettings/safeManage.vue")
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
] satisfies Array<RouteConfigsTable>;
|
] satisfies Array<RouteConfigsTable>;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user