基本功能都已完成
This commit is contained in:
@@ -1,24 +1,178 @@
|
||||
<template>
|
||||
<view class="padding page">
|
||||
<view class="padding bg-white">
|
||||
<view class="flex justify-between padding-bottom solid-bottom">
|
||||
<view>修改登录密码</view>
|
||||
<view class="lg text-gray cuIcon-right"></view>
|
||||
<view class="page">
|
||||
<view class="padding bg-white margin-top">
|
||||
<!-- 旧密码 -->
|
||||
<view class="form-item solid-bottom">
|
||||
<view class="form-label">旧密码</view>
|
||||
<view class="form-input-wrap">
|
||||
<input
|
||||
class="form-input"
|
||||
v-model="formData.oldPassword"
|
||||
:type="showOldPwd ? 'text' : 'password'"
|
||||
placeholder="请输入旧密码"
|
||||
/>
|
||||
<view class="pwd-toggle" @click="showOldPwd = !showOldPwd">
|
||||
<text :class="showOldPwd ? 'cuIcon-attention' : 'cuIcon-attentionforbid'"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex justify-between padding-top padding-bottom solid-bottom">
|
||||
<view>注销账户</view>
|
||||
<view class="lg text-gray cuIcon-right"></view>
|
||||
|
||||
<!-- 新密码 -->
|
||||
<view class="form-item solid-bottom">
|
||||
<view class="form-label">新密码</view>
|
||||
<view class="form-input-wrap">
|
||||
<input
|
||||
class="form-input"
|
||||
v-model="formData.newPassword"
|
||||
:type="showNewPwd ? 'text' : 'password'"
|
||||
placeholder="请输入新密码"
|
||||
/>
|
||||
<view class="pwd-toggle" @click="showNewPwd = !showNewPwd">
|
||||
<text :class="showNewPwd ? 'cuIcon-attention' : 'cuIcon-attentionforbid'"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 确认密码 -->
|
||||
<view class="form-item">
|
||||
<view class="form-label">确认密码</view>
|
||||
<view class="form-input-wrap">
|
||||
<input
|
||||
class="form-input"
|
||||
v-model="formData.confirmPassword"
|
||||
:type="showConfirmPwd ? 'text' : 'password'"
|
||||
placeholder="请再次输入新密码"
|
||||
/>
|
||||
<view class="pwd-toggle" @click="showConfirmPwd = !showConfirmPwd">
|
||||
<text :class="showConfirmPwd ? 'cuIcon-attention' : 'cuIcon-attentionforbid'"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 提示信息 -->
|
||||
<view class="tips">
|
||||
<text class="text-gray text-sm">密码长度至少6位,建议包含字母和数字</text>
|
||||
</view>
|
||||
|
||||
<!-- 保存按钮 -->
|
||||
<view class="padding">
|
||||
<button class="bg-blue round" @click="handleSave" :loading="saving">保存</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { updatePassword } from '@/request/three_one_api/info.js';
|
||||
|
||||
const saving = ref(false);
|
||||
const showOldPwd = ref(false);
|
||||
const showNewPwd = ref(false);
|
||||
const showConfirmPwd = ref(false);
|
||||
|
||||
const formData = reactive({
|
||||
oldPassword: '',
|
||||
newPassword: '',
|
||||
confirmPassword: ''
|
||||
});
|
||||
|
||||
// 保存
|
||||
const handleSave = async () => {
|
||||
// 表单验证
|
||||
if (!formData.oldPassword) {
|
||||
uni.showToast({ title: '请输入旧密码', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!formData.newPassword) {
|
||||
uni.showToast({ title: '请输入新密码', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (formData.newPassword.length < 6) {
|
||||
uni.showToast({ title: '新密码长度至少6位', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!formData.confirmPassword) {
|
||||
uni.showToast({ title: '请确认新密码', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (formData.newPassword !== formData.confirmPassword) {
|
||||
uni.showToast({ title: '两次输入的密码不一致', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (formData.oldPassword === formData.newPassword) {
|
||||
uni.showToast({ title: '新密码不能与旧密码相同', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
saving.value = true;
|
||||
try {
|
||||
const params = {
|
||||
oldPassword: formData.oldPassword,
|
||||
newPassword: formData.newPassword,
|
||||
confirmPassword: formData.confirmPassword
|
||||
};
|
||||
|
||||
const res = await updatePassword(params);
|
||||
if (res.code === 0) {
|
||||
uni.showToast({ title: '密码修改成功', icon: 'success' });
|
||||
// 清空表单
|
||||
formData.oldPassword = '';
|
||||
formData.newPassword = '';
|
||||
formData.confirmPassword = '';
|
||||
// 延迟返回
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1500);
|
||||
} else {
|
||||
uni.showToast({ title: res.msg || '修改失败', icon: 'none' });
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('修改密码失败:', err);
|
||||
uni.showToast({ title: '修改失败', icon: 'none' });
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: #EBF2FC;
|
||||
}
|
||||
</style>
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: #EBF2FC;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
|
||||
.form-label {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.form-input-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: #f5f5f5;
|
||||
border-radius: 12rpx;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
.form-input {
|
||||
flex: 1;
|
||||
height: 80rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.pwd-toggle {
|
||||
padding: 10rpx;
|
||||
font-size: 36rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.tips {
|
||||
padding: 20rpx 30rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<view class="flex justify-between align-center padding-tb solid-bottom" @click="chooseAvatar">
|
||||
<view class="text-black">头像</view>
|
||||
<view class="flex align-center">
|
||||
<image class="avatar" :src="userInfo.avatar" mode="aspectFill"></image>
|
||||
<image class="avatar" :src="avatarPreview || getImageUrl(userInfo.avatar) || defaultAvatar" mode="aspectFill"></image>
|
||||
<view class="lg text-gray cuIcon-right margin-left-xs"></view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -14,25 +14,25 @@
|
||||
<view class="flex justify-between align-center padding-tb solid-bottom">
|
||||
<view class="text-black label-text">昵称</view>
|
||||
<view class="flex align-center flex-sub justify-end">
|
||||
<input class="input-right" v-model="userInfo.nickname" placeholder="请输入昵称" />
|
||||
<input class="input-right" v-model="userInfo.nickName" placeholder="请输入昵称" />
|
||||
<view class="lg text-gray cuIcon-right margin-left-xs"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 用户名 -->
|
||||
<!-- 电话号码 -->
|
||||
<view class="flex justify-between align-center padding-tb solid-bottom">
|
||||
<view class="text-black label-text">用户名</view>
|
||||
<view class="flex align-center">
|
||||
<text class="text-black">{{ userInfo.username }}</text>
|
||||
<view class="lg text-gray cuIcon-right margin-left-xs"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 个性签名 -->
|
||||
<view class="flex justify-between align-center padding-tb solid-bottom">
|
||||
<view class="text-black label-text">个性签名</view>
|
||||
<view class="text-black label-text">电话号码</view>
|
||||
<view class="flex align-center flex-sub justify-end">
|
||||
<input class="input-right" v-model="userInfo.signature" placeholder="请输入个性签名" />
|
||||
<input class="input-right" v-model="userInfo.phonenumber" placeholder="请输入电话号码" type="number" />
|
||||
<view class="lg text-gray cuIcon-right margin-left-xs"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 邮箱 -->
|
||||
<view class="flex justify-between align-center padding-tb solid-bottom">
|
||||
<view class="text-black label-text">邮箱</view>
|
||||
<view class="flex align-center flex-sub justify-end">
|
||||
<input class="input-right" v-model="userInfo.email" placeholder="请输入邮箱" />
|
||||
<view class="lg text-gray cuIcon-right margin-left-xs"></view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -44,15 +44,15 @@
|
||||
<view class="gender-switch">
|
||||
<view
|
||||
class="gender-item"
|
||||
:class="{ 'gender-active': userInfo.gender === 1, 'gender-male': userInfo.gender === 1 }"
|
||||
@click="userInfo.gender = 1"
|
||||
:class="{ 'gender-active': userInfo.sex === '0', 'gender-male': userInfo.sex === '0' }"
|
||||
@click="userInfo.sex = '0'"
|
||||
>
|
||||
<text class="cuIcon-male"></text>
|
||||
</view>
|
||||
<view
|
||||
class="gender-item"
|
||||
:class="{ 'gender-active': userInfo.gender === 2, 'gender-female': userInfo.gender === 2 }"
|
||||
@click="userInfo.gender = 2"
|
||||
:class="{ 'gender-active': userInfo.sex === '1', 'gender-female': userInfo.sex === '1' }"
|
||||
@click="userInfo.sex = '1'"
|
||||
>
|
||||
<text class="cuIcon-female"></text>
|
||||
</view>
|
||||
@@ -60,42 +60,59 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 日期选择 -->
|
||||
<view class="flex justify-between align-center padding-tb solid-bottom" @click="showDatePicker = true">
|
||||
<view class="text-black">日期选择</view>
|
||||
<view class="flex align-center">
|
||||
<text class="text-black">{{ userInfo.birthday || '请选择日期' }}</text>
|
||||
<view class="lg text-gray cuIcon-right margin-left-xs"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<up-calendar
|
||||
:show="showDatePicker"
|
||||
mode="single"
|
||||
@confirm="confirmDate"
|
||||
@close="showDatePicker = false"
|
||||
></up-calendar>
|
||||
|
||||
<button class="bg-blue round margin-top-xl" @click="handleSave">保存</button>
|
||||
<button class="round line-blue margin-top" @click="handleLogout">退出登录</button>
|
||||
<button class="bg-blue round margin-top-xl" @click="handleSave" :loading="saving">保存</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { baseUrl, getToken } from '@/request/request.js';
|
||||
import { getProfileDetail, updateProfile } from '@/request/three_one_api/info.js';
|
||||
|
||||
const showDatePicker = ref(false);
|
||||
const saving = ref(false);
|
||||
const defaultAvatar = 'https://ossweb-img.qq.com/images/lol/web201310/skin/big81005.jpg';
|
||||
const avatarPreview = ref(''); // 用于显示选择的图片临时预览
|
||||
|
||||
const userInfo = reactive({
|
||||
avatar: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big81005.jpg',
|
||||
nickname: '希缝弗斯',
|
||||
username: '17374339800',
|
||||
signature: '',
|
||||
gender: 1, // 1-男 2-女
|
||||
birthday: '2025-10-09'
|
||||
avatar: '', // 保存相对路径,用于提交
|
||||
nickName: '',
|
||||
phonenumber: '',
|
||||
email: '',
|
||||
sex: '0' // '0'-男 '1'-女
|
||||
});
|
||||
|
||||
// 获取图片完整URL(用于显示)
|
||||
const getImageUrl = (path) => {
|
||||
if (!path) return '';
|
||||
if (path.startsWith('http')) return path;
|
||||
return baseUrl + path;
|
||||
};
|
||||
|
||||
// 页面加载时获取个人信息
|
||||
onMounted(() => {
|
||||
loadProfileDetail();
|
||||
});
|
||||
|
||||
// 获取个人信息
|
||||
const loadProfileDetail = async () => {
|
||||
try {
|
||||
uni.showLoading({ title: '加载中...' });
|
||||
const res = await getProfileDetail();
|
||||
uni.hideLoading();
|
||||
if (res.code === 0 && res.data) {
|
||||
userInfo.avatar = res.data.avatar || '';
|
||||
userInfo.nickName = res.data.nickName || '';
|
||||
userInfo.phonenumber = res.data.phonenumber || '';
|
||||
userInfo.email = res.data.email || '';
|
||||
userInfo.sex = res.data.sex || '0';
|
||||
}
|
||||
} catch (err) {
|
||||
uni.hideLoading();
|
||||
console.error('获取个人信息失败:', err);
|
||||
}
|
||||
};
|
||||
|
||||
// 选择头像
|
||||
const chooseAvatar = () => {
|
||||
uni.chooseImage({
|
||||
@@ -103,33 +120,84 @@ const chooseAvatar = () => {
|
||||
sizeType: ['compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: (res) => {
|
||||
userInfo.avatar = res.tempFilePaths[0];
|
||||
const tempFilePath = res.tempFilePaths[0];
|
||||
// 显示临时预览
|
||||
avatarPreview.value = tempFilePath;
|
||||
// 上传获取链接
|
||||
uploadAvatar(tempFilePath);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 日期选择确认
|
||||
const confirmDate = (e) => {
|
||||
userInfo.birthday = e[0];
|
||||
showDatePicker.value = false;
|
||||
// 上传头像获取链接
|
||||
const uploadAvatar = (filePath) => {
|
||||
uni.showLoading({ title: '上传中...' });
|
||||
|
||||
uni.uploadFile({
|
||||
url: baseUrl + '/frontend/attachment/upload',
|
||||
filePath: filePath,
|
||||
name: 'file',
|
||||
header: {
|
||||
'Authorization': getToken()
|
||||
},
|
||||
success: (uploadRes) => {
|
||||
uni.hideLoading();
|
||||
try {
|
||||
const data = JSON.parse(uploadRes.data);
|
||||
if (data.code === 0 && data.data) {
|
||||
// 上传成功,保存相对路径(用于提交)
|
||||
userInfo.avatar = data.data.url || data.data;
|
||||
uni.showToast({ title: '上传成功', icon: 'success' });
|
||||
} else {
|
||||
avatarPreview.value = ''; // 上传失败,清除预览
|
||||
uni.showToast({ title: data.msg || '上传失败', icon: 'none' });
|
||||
}
|
||||
} catch (e) {
|
||||
avatarPreview.value = '';
|
||||
uni.showToast({ title: '上传失败', icon: 'none' });
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
avatarPreview.value = '';
|
||||
uni.showToast({ title: '上传失败', icon: 'none' });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 保存
|
||||
const handleSave = () => {
|
||||
uni.showToast({ title: '保存成功', icon: 'success' });
|
||||
};
|
||||
|
||||
// 退出登录
|
||||
const handleLogout = () => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要退出登录吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.reLaunch({ url: '/pages/login/login' });
|
||||
}
|
||||
const handleSave = async () => {
|
||||
// 表单验证
|
||||
if (!userInfo.nickName) {
|
||||
uni.showToast({ title: '请输入昵称', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
saving.value = true;
|
||||
try {
|
||||
const params = {
|
||||
nickName: userInfo.nickName,
|
||||
phonenumber: userInfo.phonenumber,
|
||||
email: userInfo.email,
|
||||
sex: userInfo.sex,
|
||||
avatar: userInfo.avatar // 提交相对路径
|
||||
};
|
||||
|
||||
const res = await updateProfile(params);
|
||||
if (res.code === 0) {
|
||||
uni.showToast({ title: '保存成功', icon: 'success' });
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1500);
|
||||
} else {
|
||||
uni.showToast({ title: res.msg || '保存失败', icon: 'none' });
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('保存失败:', err);
|
||||
uni.showToast({ title: '保存失败', icon: 'none' });
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -197,4 +265,4 @@ const handleLogout = () => {
|
||||
color: #2667E9;
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -1,101 +1,134 @@
|
||||
<template>
|
||||
<view class="title">
|
||||
<view class="padding">
|
||||
<view class="text-center margin-top-xl text-white text-bold">我的</view>
|
||||
<view class="flex justify-between align-center" style="padding-top:60rpx;" >
|
||||
<view class="flex align-center">
|
||||
<view class="cu-avatar xl round" style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big99008.jpg);"></view>
|
||||
<view class="margin-left">
|
||||
<view class="text-white text-lg text-bold">hhhrrrr</view>
|
||||
<view class="text-white" style="opacity: 0.8;">17374339800</view>
|
||||
<view class="page-wrapper">
|
||||
<!-- 顶部弥散渐变背景 -->
|
||||
<view class="header-bg">
|
||||
<!-- 弥散光斑效果 -->
|
||||
<view class="blur-circle circle-1"></view>
|
||||
<view class="blur-circle circle-2"></view>
|
||||
<view class="blur-circle circle-3"></view>
|
||||
|
||||
<!-- 标题 -->
|
||||
<!-- <view class="header-title">我的</view> -->
|
||||
|
||||
<!-- 用户信息区域 -->
|
||||
<view class="user-info-section">
|
||||
<view class="user-avatar">
|
||||
<image class="avatar-img" :src="getImageUrl(userInfo.avatar) || defaultAvatar" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="user-details">
|
||||
<view class="user-name">{{ userInfo.nickName || '未设置昵称' }}</view>
|
||||
<view class="user-phone">{{ userInfo.phonenumber || '未绑定手机' }}</view>
|
||||
</view>
|
||||
<button class="edit-btn" @click="editinfo()">编辑资料</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 内容区域 -->
|
||||
<view class="content-area">
|
||||
<!-- 菜单卡片 -->
|
||||
<view class="menu-card">
|
||||
<!-- <view class="menu-item" @click="Helpcenter()">
|
||||
<view class="menu-left">
|
||||
<image src="/static/my/Helpcenter.png" class="menu-icon"></image>
|
||||
<text class="menu-text">帮助中心</text>
|
||||
</view>
|
||||
<text class="cuIcon-right menu-arrow"></text>
|
||||
</view> -->
|
||||
<!-- <view class="menu-item">
|
||||
<view class="menu-left">
|
||||
<image src="/static/my/CustomerService.png" class="menu-icon"></image>
|
||||
<text class="menu-text">智能客服</text>
|
||||
</view>
|
||||
<text class="cuIcon-right menu-arrow"></text>
|
||||
</view> -->
|
||||
<view class="menu-item" @click="editinfo()">
|
||||
<view class="menu-left">
|
||||
<image src="/static/my/Notification.png" class="menu-icon"></image>
|
||||
<text class="menu-text">编辑个人信息</text>
|
||||
</view>
|
||||
<text class="cuIcon-right menu-arrow"></text>
|
||||
</view>
|
||||
<view class="menu-item" @click="Account()">
|
||||
<view class="menu-left">
|
||||
<image src="/static/my/Account.png" class="menu-icon"></image>
|
||||
<text class="menu-text">修改登录密码</text>
|
||||
</view>
|
||||
<text class="cuIcon-right menu-arrow"></text>
|
||||
</view>
|
||||
<!-- <view class="menu-item">
|
||||
<view class="menu-left">
|
||||
<image src="/static/my/Delete.png" class="menu-icon"></image>
|
||||
<text class="menu-text">清除缓存</text>
|
||||
</view>
|
||||
<view class="menu-right">
|
||||
<text class="menu-value">0B</text>
|
||||
<text class="cuIcon-right menu-arrow"></text>
|
||||
</view>
|
||||
</view>
|
||||
<button class="cu-btn round edit-btn bg-blue text-white ">编辑资料</button>
|
||||
<view class="menu-item" @click="Settings()">
|
||||
<view class="menu-left">
|
||||
<image src="/static/my/Settings.png" class="menu-icon"></image>
|
||||
<text class="menu-text">通用设置</text>
|
||||
</view>
|
||||
<text class="cuIcon-right menu-arrow"></text>
|
||||
</view>
|
||||
<view class="menu-item">
|
||||
<view class="menu-left">
|
||||
<image src="/static/my/Helpcenter.png" class="menu-icon"></image>
|
||||
<text class="menu-text">关于</text>
|
||||
</view>
|
||||
<view class="menu-right">
|
||||
<text class="menu-value">1.0.0</text>
|
||||
<text class="cuIcon-right menu-arrow"></text>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- 退出登录按钮 -->
|
||||
<button class="logout-btn" @click="handleLogout()">退出登录</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="page-content">
|
||||
<view class="padding bg-white radius">
|
||||
<view class="flex justify-between padding-bottom solid-bottom">
|
||||
<view class="flex " @click="Helpcenter()">
|
||||
<image src="/static/my/Helpcenter.png" style="width:40rpx;height: 40rpx;"></image>
|
||||
<view class="margin-left">帮助中心</view>
|
||||
</view>
|
||||
<view class="lg text-gray cuIcon-right"></view>
|
||||
</view>
|
||||
<view class="flex justify-between padding-bottom padding-top solid-bottom">
|
||||
<view class="flex">
|
||||
<image src="/static/my/CustomerService.png" style="width:40rpx;height: 40rpx;"></image>
|
||||
<view class="margin-left">智能客服</view>
|
||||
</view>
|
||||
<view class="lg text-gray cuIcon-right"></view>
|
||||
</view>
|
||||
<view class="flex justify-between padding-bottom padding-top solid-bottom">
|
||||
<view class="flex" @click="Account()">
|
||||
<image src="/static/my/Account.png" style="width:40rpx;height: 40rpx;"></image>
|
||||
<view class="margin-left">账号安全</view>
|
||||
</view>
|
||||
<view class="lg text-gray cuIcon-right"></view>
|
||||
</view>
|
||||
<view class="flex justify-between padding-bottom padding-top solid-bottom">
|
||||
<view class="flex" @click="notification()">
|
||||
<image src="/static/my/Notification.png" style="width:40rpx;height: 40rpx;"></image>
|
||||
<view class="margin-left">新消息通知</view>
|
||||
</view>
|
||||
<view class="lg text-gray cuIcon-right"></view>
|
||||
</view>
|
||||
<view class="flex justify-between padding-bottom padding-top solid-bottom">
|
||||
<view class="flex">
|
||||
<image src="/static/my/Delete.png" style="width:40rpx;height: 40rpx;"></image>
|
||||
<view class="margin-left">清除缓存</view>
|
||||
</view>
|
||||
<view class="lg text-gray cuIcon-right"></view>
|
||||
</view>
|
||||
<view class="flex justify-between padding-bottom padding-top solid-bottom">
|
||||
<view class="flex" @click="Settings()">
|
||||
<image src="/static/my/Settings.png" style="width:40rpx;height: 40rpx;"></image>
|
||||
<view class="margin-left">通用设置</view>
|
||||
</view>
|
||||
<view class="lg text-gray cuIcon-right"></view>
|
||||
</view>
|
||||
<view class="flex justify-between padding-bottom padding-top solid-bottom">
|
||||
<view class="flex">
|
||||
<image src="/static/my/Helpcenter.png" style="width:40rpx;height: 40rpx;"></image>
|
||||
<view class="margin-left">关于</view>
|
||||
</view>
|
||||
<view class="lg text-gray cuIcon-right"></view>
|
||||
</view>
|
||||
</view>
|
||||
<button class=" bg-blue round margin-top-xl " @click="handleLogout()">退出登录</button>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ref, reactive } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
import { baseUrl } from '@/request/request.js';
|
||||
import { getProfileDetail } from '@/request/three_one_api/info.js';
|
||||
|
||||
const defaultAvatar = 'https://ossweb-img.qq.com/images/lol/web201310/skin/big99008.jpg';
|
||||
|
||||
// 用户信息
|
||||
const userInfo = reactive({
|
||||
avatar: '',
|
||||
nickName: '',
|
||||
phonenumber: ''
|
||||
});
|
||||
|
||||
// // 获取用户信息
|
||||
// const getUserInfo = () => {
|
||||
// try {
|
||||
// const storedUserInfo = uni.getStorageSync('userInfo');
|
||||
// if (storedUserInfo) {
|
||||
// const info = JSON.parse(storedUserInfo);
|
||||
// userInfo.nickName = info.nickName || '';
|
||||
// userInfo.phonenumber = info.phonenumber || info.username || '';
|
||||
// }
|
||||
// } catch (e) {
|
||||
// console.error('获取用户信息失败:', e);
|
||||
// }
|
||||
// };
|
||||
// 获取图片完整URL(用于显示)
|
||||
const getImageUrl = (path) => {
|
||||
if (!path) return '';
|
||||
if (path.startsWith('http')) return path;
|
||||
return baseUrl + path;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getUserInfo();
|
||||
// 获取用户信息
|
||||
const loadUserInfo = async () => {
|
||||
try {
|
||||
const res = await getProfileDetail();
|
||||
if (res.code === 0 && res.data) {
|
||||
userInfo.avatar = res.data.avatar || '';
|
||||
userInfo.nickName = res.data.nickName || '';
|
||||
userInfo.phonenumber = res.data.phonenumber || '';
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('获取用户信息失败:', e);
|
||||
}
|
||||
};
|
||||
|
||||
// 每次页面显示时获取最新数据(包括从编辑页返回)
|
||||
onShow(() => {
|
||||
loadUserInfo();
|
||||
});
|
||||
|
||||
//帮助中心
|
||||
@@ -110,6 +143,12 @@
|
||||
url:'/pages/personalcenter/notification'
|
||||
})
|
||||
}
|
||||
//编辑个人信息
|
||||
const editinfo = () => {
|
||||
uni.navigateTo({
|
||||
url:'/pages/personalcenter/edit'
|
||||
})
|
||||
}
|
||||
//通用设置
|
||||
const Settings = () => {
|
||||
uni.navigateTo({
|
||||
@@ -144,22 +183,190 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
page {
|
||||
background: #EBF2FC;
|
||||
.page-wrapper {
|
||||
min-height: 100vh;
|
||||
background: #EBF2FC;
|
||||
}
|
||||
|
||||
// 顶部弥散渐变背景
|
||||
.header-bg {
|
||||
position: relative;
|
||||
height: 400rpx;
|
||||
background: linear-gradient(180deg, #3B7FED 0%, #007AFF 50%, #8BB8F8 100%);
|
||||
padding-top: 60rpx;
|
||||
overflow: hidden;
|
||||
|
||||
// 弥散光斑效果
|
||||
.blur-circle {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
filter: blur(60rpx);
|
||||
opacity: 0.5;
|
||||
}
|
||||
.page-content {
|
||||
background: #EBF2FC;
|
||||
border-radius: 40rpx 40rpx 0rpx 0rpx;
|
||||
margin-top: -40rpx;
|
||||
padding: 30rpx;
|
||||
padding-bottom: 50rpx;
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
min-height: calc(100vh - 400rpx);
|
||||
|
||||
.circle-1 {
|
||||
width: 300rpx;
|
||||
height: 300rpx;
|
||||
background: rgba(100, 180, 255, 0.6);
|
||||
top: -50rpx;
|
||||
left: -50rpx;
|
||||
}
|
||||
.title {
|
||||
height: 440rpx;
|
||||
background: linear-gradient(135deg, #2667E9 0%, #4A8AF4 50%, #719BF0 100%);
|
||||
padding-top: 60rpx;
|
||||
|
||||
.circle-2 {
|
||||
width: 250rpx;
|
||||
height: 250rpx;
|
||||
background: rgba(150, 200, 255, 0.5);
|
||||
top: 100rpx;
|
||||
right: -30rpx;
|
||||
}
|
||||
|
||||
.circle-3 {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
background: rgba(180, 220, 255, 0.4);
|
||||
bottom: 50rpx;
|
||||
left: 200rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// 标题
|
||||
.header-title {
|
||||
text-align: center;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
position: relative;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
// 用户信息区域
|
||||
.user-info-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 60rpx 40rpx 0;
|
||||
position: relative;
|
||||
z-index: 5;
|
||||
|
||||
.user-avatar {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
border: 4rpx solid rgba(255, 255, 255, 0.5);
|
||||
box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.15);
|
||||
|
||||
.avatar-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.user-details {
|
||||
flex: 1;
|
||||
margin-left: 24rpx;
|
||||
|
||||
.user-name {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #fff;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.user-phone {
|
||||
font-size: 26rpx;
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
}
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
// padding: 16rpx 32rpx;
|
||||
background: rgba(255, 255, 255, 0.25);
|
||||
border: 2rpx solid rgba(255, 255, 255, 0.5);
|
||||
border-radius: 32rpx;
|
||||
font-size: 26rpx;
|
||||
color: #fff;
|
||||
backdrop-filter: blur(10rpx);
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 内容区域
|
||||
.content-area {
|
||||
position: relative;
|
||||
margin-top: -60rpx;
|
||||
padding: 0 30rpx 50rpx;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
// 菜单卡片
|
||||
.menu-card {
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 10rpx 0;
|
||||
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 32rpx 36rpx;
|
||||
border-bottom: 1rpx solid #F5F5F5;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.menu-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.menu-icon {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
|
||||
.menu-text {
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
.menu-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.menu-value {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.menu-arrow {
|
||||
font-size: 28rpx;
|
||||
color: #ccc;
|
||||
}
|
||||
}
|
||||
|
||||
// 退出登录按钮
|
||||
.logout-btn {
|
||||
margin-top: 60rpx;
|
||||
height: 96rpx;
|
||||
line-height: 96rpx;
|
||||
background: linear-gradient(135deg, #3B7FED 0%, #5A9CF5 100%);
|
||||
border-radius: 48rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
box-shadow: 0 8rpx 24rpx rgba(59, 127, 237, 0.35);
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user