112 lines
3.7 KiB
Vue
112 lines
3.7 KiB
Vue
<template>
|
|
<div class="xl:w-screen-xl m-auto py-4 my-20">
|
|
<el-page-header :icon="ArrowLeft" @back="goBack">
|
|
<template #content>
|
|
<span class="text-large font-600 mr-3"> 用户中心 </span>
|
|
</template>
|
|
<div class="login-layout mt-10 sm:w-screen-xl w-full">
|
|
<div class="m-auto flex sm:flex-row flex-col sm:px-0 px-3">
|
|
<!-- 用户菜单 -->
|
|
<!-- <UserMenu :activeIndex="activeIndex" @done="onDone" class="sm:flex hidden"/>-->
|
|
<div class="flash bg-white rounded-lg w-full">
|
|
<div class="title text-xl text-gray-700 md:px-8 p-4 md:mt-3 font-500">账号信息</div>
|
|
<div class="lg:w-screen-lg w-full sm:px-4 sm:py-4 mb-10">
|
|
<el-descriptions class="px-4" :column="2" border>
|
|
<el-descriptions-item label="用户ID">{{user?.userId}}</el-descriptions-item>
|
|
<el-descriptions-item label="手机号码">{{user?.mobile}}</el-descriptions-item>
|
|
<el-descriptions-item label="昵称">{{user?.nickname}}</el-descriptions-item>
|
|
<el-descriptions-item label="性别">{{user?.sexName}}</el-descriptions-item>
|
|
<el-descriptions-item label="邮箱">{{user?.email}}</el-descriptions-item>
|
|
<el-descriptions-item label="生日">{{user?.birthday}}</el-descriptions-item>
|
|
<el-descriptions-item label="所在省份">{{user?.province}}</el-descriptions-item>
|
|
<el-descriptions-item label="所在城市">{{user?.city}}</el-descriptions-item>
|
|
<el-descriptions-item label="可用余额">{{user?.balance}}</el-descriptions-item>
|
|
<el-descriptions-item label="可用积分">{{user?.points}}</el-descriptions-item>
|
|
<el-descriptions-item label="个人简介">{{user?.introduction}}</el-descriptions-item>
|
|
</el-descriptions>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</el-page-header>
|
|
</div>
|
|
</template>
|
|
<script setup lang="ts">
|
|
import { ArrowLeft,View,Search } from '@element-plus/icons-vue'
|
|
import {useWebsite} from "~/composables/configState";
|
|
import useFormData from '@/utils/use-form-data';
|
|
import type {User} from '@/api/system/user/model';
|
|
import {ref} from 'vue'
|
|
import UserMenu from "./components/UserMenu.vue";
|
|
import {updateUser} from "~/api/layout";
|
|
import {openUrl} from "~/utils/common";
|
|
|
|
|
|
// 配置信息
|
|
const runtimeConfig = useRuntimeConfig();
|
|
const route = useRoute();
|
|
const router = useRouter();
|
|
const website = useWebsite()
|
|
const user = useUser();
|
|
const activeIndex = ref('');
|
|
|
|
// 配置信息
|
|
const {form, assignFields} = useFormData<User>({
|
|
userId: undefined,
|
|
nickname: '',
|
|
username: '',
|
|
phone: '',
|
|
mobile: '',
|
|
sex: '',
|
|
sexName: '',
|
|
email: '',
|
|
password: '',
|
|
code: '',
|
|
smsCode: '',
|
|
comments: '',
|
|
remember: true,
|
|
tenantId: undefined,
|
|
tenantName: undefined
|
|
});
|
|
|
|
useHead({
|
|
title: `用户中心`,
|
|
meta: [{name: website.value.keywords, content: website.value.comments}]
|
|
});
|
|
|
|
const onDone = (index: string) => {
|
|
activeIndex.value = index;
|
|
}
|
|
|
|
const reload = async () => {
|
|
// 未登录状态(是否强制登录)
|
|
const token = localStorage.getItem('token');
|
|
if (!token || token == '') {
|
|
navigateTo('/passport/login');
|
|
return false;
|
|
}
|
|
if(user.value){
|
|
form.userId = user.value.userId;
|
|
form.nickname = user.value.nickname;
|
|
form.realName = user.value.realName;
|
|
form.mobile = user.value.mobile;
|
|
form.email = user.value.email;
|
|
form.sex = user.value.sex;
|
|
form.comments = user.value.comments;
|
|
}
|
|
}
|
|
|
|
const goBack = () => {
|
|
router.back(); // 返回上一页
|
|
}
|
|
|
|
watch(
|
|
() => route.path,
|
|
(path) => {
|
|
activeIndex.value = path;
|
|
reload();
|
|
},
|
|
{immediate: true}
|
|
);
|
|
</script>
|