Files
medical-mall/pages/mall/admin/userCenter/index.uvue

196 lines
4.2 KiB
Plaintext

<template>
<view class="user-center-container">
<view class="page-header">
<text class="page-title">个人中心</text>
</view>
<view class="form-container">
<view class="form-item">
<text class="form-label">头像</text>
<view class="form-content avatar-uploader">
<!-- 默认使用一个占位头像或 Logo -->
<image class="avatar-img" src="/static/logo.png" mode="aspectFill"></image>
</view>
</view>
<view class="form-item">
<text class="form-label">账号</text>
<view class="form-content">
<input class="uni-input disabled" value="demo" disabled placeholder="请输入账号" />
</view>
</view>
<view class="form-item">
<text class="form-label"><text class="required">*</text>姓名</text>
<view class="form-content">
<input class="uni-input" v-model="formData.name" placeholder="请输入姓名" />
</view>
</view>
<view class="form-item">
<text class="form-label">原始密码</text>
<view class="form-content">
<input class="uni-input" type="password" v-model="formData.oldPassword" placeholder="请输入原始密码" />
</view>
</view>
<view class="form-item">
<text class="form-label">新密码</text>
<view class="form-content">
<input class="uni-input" type="password" v-model="formData.newPassword" placeholder="请输入新密码" />
</view>
</view>
<view class="form-item">
<text class="form-label">确认密码</text>
<view class="form-content">
<input class="uni-input" type="password" v-model="formData.confirmPassword" placeholder="请再次输入新密码" />
</view>
</view>
<view class="form-actions">
<button class="submit-btn" type="primary" @click="onSubmit">保存修改</button>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { reactive } from 'vue'
const formData = reactive({
name: 'demo',
oldPassword: '',
newPassword: '',
confirmPassword: ''
})
const onSubmit = () => {
if (formData.newPassword && formData.newPassword !== formData.confirmPassword) {
uni.showToast({ title: '两次输入的新密码不一致', icon: 'none' })
return
}
if (!formData.name) {
uni.showToast({ title: '姓名不能为空', icon: 'none' })
return
}
uni.showLoading({ title: '保存中...' })
setTimeout(() => {
uni.hideLoading()
uni.showToast({ title: '保存成功(演示)', icon: 'success' })
// 清空密码框
formData.oldPassword = ''
formData.newPassword = ''
formData.confirmPassword = ''
}, 500)
}
</script>
<style scoped>
.user-center-container {
padding: 20px;
background-color: #f5f7f9;
min-height: 100%;
}
.page-header {
margin-bottom: 20px;
}
.page-title {
font-size: 16px;
font-weight: bold;
color: #333;
}
.form-container {
background-color: #fff;
border-radius: 4px;
padding: 30px 20px;
max-width: 800px;
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.form-item {
display: flex;
flex-direction: row;
align-items: center;
margin-bottom: 24px;
}
.form-label {
width: 100px;
text-align: right;
margin-right: 16px;
font-size: 14px;
color: #606266;
flex-shrink: 0;
}
.required {
color: #f5222d;
margin-right: 4px;
}
.form-content {
flex: 1;
max-width: 400px;
}
.uni-input {
width: 100%;
height: 36px;
line-height: 36px;
padding: 0 12px;
border: 1px solid #dcdfe6;
border-radius: 4px;
font-size: 14px;
color: #333;
box-sizing: border-box;
}
.uni-input:focus {
border-color: #1890ff;
outline: none;
}
.disabled {
background-color: #f5f7fa;
color: #c0c4cc;
cursor: not-allowed;
}
.avatar-uploader {
display: flex;
justify-content: flex-start;
}
.avatar-img {
width: 80px;
height: 80px;
border-radius: 4px;
background-color: #f0f2f5;
border: 1px dashed #d9d9d9;
}
.form-actions {
margin-top: 40px;
padding-left: 116px;
}
.submit-btn {
background-color: #1890ff;
color: #fff;
font-size: 14px;
height: 36px;
line-height: 36px;
width: 120px;
border-radius: 4px;
border: none;
}
.submit-btn:active {
background-color: #096dd9;
}
</style>