|
@@ -0,0 +1,125 @@
|
|
|
+<template>
|
|
|
+ <!-- 个人信息 -->
|
|
|
+ <el-dialog v-model="visible" align-center :append-to-body="true" width="500" class="dialog_class" draggable>
|
|
|
+ <template #header="{ titleId, titleClass }">
|
|
|
+ <div class="my-header">
|
|
|
+ <h4 :id="titleId" :class="titleClass">个人信息</h4>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <el-descriptions :column="2" border>
|
|
|
+ <el-descriptions-item label="昵称">{{ userInfo.nickName }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="用户名">{{ userInfo.userName }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="邮箱">{{ userInfo.email }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="手机号">{{ userInfo.mobileNo }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="用户类型">{{ userInfo.userType }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="注册时间">{{ userInfo.regTime }}</el-descriptions-item>
|
|
|
+ </el-descriptions>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="visible = false">关闭</el-button>
|
|
|
+ <el-button @click="handleEdit">编辑</el-button>
|
|
|
+ <el-button @click="handleChangePassword">修改密码</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 编辑个人信息 -->
|
|
|
+ <el-dialog v-model="editVisible" align-center :append-to-body="true" width="500" class="dialog_class" draggable>
|
|
|
+ <template #header>
|
|
|
+ <h4>编辑个人信息</h4>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <el-form label-position="left">
|
|
|
+ <el-form-item label="昵称" :label-width="LabelWidth">
|
|
|
+ <el-input v-model="userInfo.nickName"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="邮箱" :label-width="LabelWidth">
|
|
|
+ <el-input v-model="userInfo.email"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="手机号" :label-width="LabelWidth">
|
|
|
+ <el-input v-model="userInfo.mobileNo"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="editVisible = false">取消</el-button>
|
|
|
+ <el-button @click="handleSave">保存</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 修改密码 -->
|
|
|
+ <el-dialog v-model="changePwdVisible" align-center :append-to-body="true" width="500" class="dialog_class" draggable>
|
|
|
+ <template #header>
|
|
|
+ <h4>修改密码</h4>
|
|
|
+ </template>
|
|
|
+ <el-form>
|
|
|
+ <el-form-item label="旧密码">
|
|
|
+ <el-input type="password" v-model="oldPassword"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="新密码">
|
|
|
+ <el-input type="password" v-model="newPassword"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="changePwdVisible = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="ChangePassword">确定</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import { useUserStore } from '@/store/user'
|
|
|
+
|
|
|
+
|
|
|
+const visible = ref(false)
|
|
|
+const changePwdVisible = ref(false)
|
|
|
+const editVisible = ref(false)
|
|
|
+
|
|
|
+const LabelWidth = '80px'
|
|
|
+
|
|
|
+const userStore = useUserStore()
|
|
|
+
|
|
|
+const userInfo = reactive({
|
|
|
+ nickName: userStore.userInfo?.nickName || '用户登录',
|
|
|
+ email: userStore.userInfo?.email || '未设置',
|
|
|
+ mobileNo: userStore.userInfo?.mobileNo || '未设置',
|
|
|
+ regTime: userStore.userInfo?.regTime || '未设置',
|
|
|
+ userType: userStore.userInfo?.userType || '未设置',
|
|
|
+ userName: userStore.userInfo?.userName || '未设置',
|
|
|
+})
|
|
|
+
|
|
|
+const oldPassword = ref('')
|
|
|
+const newPassword = ref('')
|
|
|
+
|
|
|
+const handleEdit = () => {
|
|
|
+ // 触发编辑逻辑
|
|
|
+ console.log('编辑用户信息')
|
|
|
+ visible.value = false;
|
|
|
+ editVisible.value = true;
|
|
|
+}
|
|
|
+
|
|
|
+const handleSave = () => {
|
|
|
+ // 触发保存逻辑
|
|
|
+ console.log('保存用户信息')
|
|
|
+ editVisible.value = false;
|
|
|
+}
|
|
|
+
|
|
|
+const handleChangePassword = () => {
|
|
|
+ // 触发修改密码逻辑
|
|
|
+ console.log('修改密码')
|
|
|
+ visible.value = false;
|
|
|
+ changePwdVisible.value = true;
|
|
|
+}
|
|
|
+
|
|
|
+const ChangePassword = () => {
|
|
|
+ // 这里添加修改密码的逻辑
|
|
|
+ console.log('旧密码:', oldPassword.value)
|
|
|
+ console.log('新密码: ', newPassword.value)
|
|
|
+ // 清空输入框
|
|
|
+ oldPassword.value = ''
|
|
|
+ newPassword.value = ''
|
|
|
+ changePwdVisible.value = false
|
|
|
+}
|
|
|
+defineExpose({ visible, changePwdVisible })
|
|
|
+</script>
|