This commit is contained in:
2026-01-18 17:42:46 +08:00
parent 836bdc9409
commit f038dbab41
42 changed files with 3068 additions and 575 deletions

View File

@@ -0,0 +1,356 @@
<template>
<view class="agreement-container">
<!-- 顶部导航栏 -->
<view class="nav-bar">
<view class="nav-back" @tap="goBack">
<uni-icons type="left" size="24" color="#333"></uni-icons>
</view>
<view class="nav-title">隐私政策</view>
<view class="nav-placeholder"></view>
</view>
<!-- 内容区域 -->
<scroll-view class="content-scroll" scroll-y>
<view class="agreement-content">
<view class="agreement-title">家庭记账隐私政策</view>
<view class="agreement-intro">
<text class="intro-text">
我们非常重视您的隐私保护本隐私政策旨在向您说明我们如何收集使用存储和保护您的个人信息使用我们的服务即表示您同意本隐私政策的条款
</text>
</view>
<view class="agreement-section">
<text class="section-title">1. 信息收集</text>
<text class="section-text">
1.1 我们收集的信息包括
</text>
<text class="section-text">
1账户信息您在注册时提供的用户名密码昵称等
</text>
<text class="section-text">
2使用信息您使用应用的功能频率偏好等使用数据
</text>
<text class="section-text">
3设备信息设备型号操作系统版本唯一设备标识符等
</text>
<text class="section-text">
4日志信息访问时间页面浏览记录错误日志等
</text>
<text class="section-text">
1.2 我们仅在为您提供服务和改进产品时收集必要的信息绝不会收集与提供服务无关的信息
</text>
</view>
<view class="agreement-section">
<text class="section-title">2. 信息使用</text>
<text class="section-text">
2.1 我们可能使用收集的信息用于
</text>
<text class="section-text">
1提供维护和改进我们的服务
</text>
<text class="section-text">
2处理您的请求和交易
</text>
<text class="section-text">
3向您发送与服务相关的通知和更新
</text>
<text class="section-text">
4分析使用情况优化用户体验
</text>
<text class="section-text">
5防止欺诈滥用和安全威胁
</text>
<text class="section-text">
6遵守法律法规要求
</text>
</view>
<view class="agreement-section">
<text class="section-title">3. 信息共享</text>
<text class="section-text">
3.1 除以下情况外我们不会与第三方共享您的个人信息
</text>
<text class="section-text">
1获得您的明确同意
</text>
<text class="section-text">
2履行法律义务或响应法律要求
</text>
<text class="section-text">
3保护我们的权利财产或安全
</text>
<text class="section-text">
4与提供服务的合作伙伴共享但仅限于必要范围
</text>
<text class="section-text">
5业务转让或合并时涉及用户信息转移
</text>
<text class="section-text">
3.2 所有共享的信息都会受到严格的保密协议和隐私保护
</text>
</view>
<view class="agreement-section">
<text class="section-title">4. 信息存储与安全</text>
<text class="section-text">
4.1 我们采取合理的技术措施保护您的信息安全包括但不限于
</text>
<text class="section-text">
1数据加密传输和存储
</text>
<text class="section-text">
2访问权限控制
</text>
<text class="section-text">
3定期安全审计和风险评估
</text>
<text class="section-text">
4员工保密培训和责任制度
</text>
<text class="section-text">
4.2 我们在中华人民共和国境内存储您的个人信息
</text>
<text class="section-text">
4.3 如发生信息泄露我们将及时采取补救措施并通知您
</text>
</view>
<view class="agreement-section">
<text class="section-title">5. Cookie和类似技术</text>
<text class="section-text">
5.1 我们可能使用Cookie和类似技术来收集和存储信息以改善用户体验
</text>
<text class="section-text">
5.2 您可以通过浏览器设置管理Cookie但这可能影响某些功能的使用
</text>
</view>
<view class="agreement-section">
<text class="section-title">6. 您的权利</text>
<text class="section-text">
6.1 您对个人信息享有以下权利
</text>
<text class="section-text">
1访问更正删除您的个人信息
</text>
<text class="section-text">
2撤回对信息处理的同意
</text>
<text class="section-text">
3获取个人信息副本
</text>
<text class="section-text">
4限制信息处理
</text>
<text class="section-text">
5数据可携带权
</text>
<text class="section-text">
6反对信息处理
</text>
<text class="section-text">
7向监管机构投诉
</text>
<text class="section-text">
6.2 您可以通过应用内设置或联系我们来行使这些权利
</text>
</view>
<view class="agreement-section">
<text class="section-title">7. 信息保留</text>
<text class="section-text">
7.1 我们仅在实现收集目的所必需的期间内保留您的个人信息
</text>
<text class="section-text">
7.2 当账户注销或收集目的实现后我们将删除或匿名化处理您的信息法律法规另有规定的除外
</text>
</view>
<view class="agreement-section">
<text class="section-title">8. 未成年人保护</text>
<text class="section-text">
8.1 我们的服务主要面向成年人如果您未满18周岁请在监护人的陪同下使用本服务
</text>
<text class="section-text">
8.2 如发现未经未成年人监护人同意收集未成年人信息的情况请立即联系我们我们将及时删除相关信息
</text>
</view>
<view class="agreement-section">
<text class="section-title">9. 隐私政策的变更</text>
<text class="section-text">
9.1 我们可能不时更新本隐私政策
</text>
<text class="section-text">
9.2 更新后的政策将在应用内公布重大变更时我们会通过适当方式通知您
</text>
<text class="section-text">
9.3 继续使用服务即表示您接受更新后的隐私政策
</text>
</view>
<view class="agreement-section">
<text class="section-title">10. 联系我们</text>
<text class="section-text">
如对本隐私政策有任何疑问意见或请求请通过以下方式联系我们
</text>
<text class="section-text">
邮箱privacy@familyaccount.com
</text>
<text class="section-text">
电话400-XXX-XXXX
</text>
<text class="section-text">
地址中国XX省XX市XX区XX路XX号
</text>
</view>
<view class="agreement-section">
<text class="section-title">11. 适用法律</text>
<text class="section-text">
11.1 本隐私政策的订立执行和解释均适用中华人民共和国法律
</text>
<text class="section-text">
11.2 我们严格遵守中华人民共和国个人信息保护法网络安全法等相关法律法规的规定
</text>
</view>
<view class="agreement-footer">
<text class="footer-text">更新日期2024年1月</text>
<text class="footer-text">生效日期2024年1月1日</text>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {
// 不需要登录验证
needLogin: false
}
},
methods: {
// 返回上一页
goBack() {
uni.navigateBack()
}
}
}
</script>
<style lang="scss" scoped>
.agreement-container {
min-height: 100vh;
background: #F8F8F8;
display: flex;
flex-direction: column;
}
.nav-bar {
display: flex;
align-items: center;
justify-content: space-between;
height: 88rpx;
padding: 0 30rpx;
background: #fff;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
position: sticky;
top: 0;
z-index: 100;
}
.nav-back {
width: 60rpx;
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
}
.nav-title {
font-size: 36rpx;
font-weight: bold;
color: #333;
}
.nav-placeholder {
width: 60rpx;
}
.content-scroll {
flex: 1;
height: calc(100vh - 88rpx);
}
.agreement-content {
padding: 40rpx 30rpx;
background: #fff;
}
.agreement-title {
font-size: 40rpx;
font-weight: bold;
color: #333;
text-align: center;
margin-bottom: 40rpx;
}
.agreement-intro {
background: #f5f5f5;
padding: 30rpx;
border-radius: 10rpx;
margin-bottom: 40rpx;
}
.intro-text {
display: block;
font-size: 28rpx;
color: #666;
line-height: 1.8;
text-align: justify;
}
.agreement-section {
margin-bottom: 50rpx;
}
.section-title {
display: block;
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 20rpx;
}
.section-text {
display: block;
font-size: 28rpx;
color: #666;
line-height: 1.8;
margin-bottom: 20rpx;
text-align: justify;
}
.agreement-footer {
margin-top: 60rpx;
padding-top: 30rpx;
border-top: 1rpx solid #eee;
text-align: center;
}
.footer-text {
display: block;
font-size: 24rpx;
color: #999;
margin-bottom: 10rpx;
&:last-child {
margin-bottom: 0;
}
}
</style>

View File

@@ -0,0 +1,252 @@
<template>
<view class="agreement-container">
<!-- 顶部导航栏 -->
<view class="nav-bar">
<view class="nav-back" @tap="goBack">
<uni-icons type="left" size="24" color="#333"></uni-icons>
</view>
<view class="nav-title">用户协议</view>
<view class="nav-placeholder"></view>
</view>
<!-- 内容区域 -->
<scroll-view class="content-scroll" scroll-y>
<view class="agreement-content">
<view class="agreement-title">家庭记账用户协议</view>
<view class="agreement-section">
<text class="section-title">1. 服务条款的接受</text>
<text class="section-text">
欢迎使用家庭记账应用通过下载安装或使用本应用即表示您同意遵守本用户协议的所有条款和条件如果您不同意这些条款请不要使用本应用
</text>
</view>
<view class="agreement-section">
<text class="section-title">2. 服务说明</text>
<text class="section-text">
2.1 家庭记账是一款为用户提供记账账单管理等服务的移动应用程序
</text>
<text class="section-text">
2.2 我们保留随时修改或中断服务而不需通知用户的权利
</text>
<text class="section-text">
2.3 用户需自行承担使用本服务所产生的风险包括但不限于因使用本服务而导致的计算机系统损坏或数据丢失
</text>
</view>
<view class="agreement-section">
<text class="section-title">3. 用户账号</text>
<text class="section-text">
3.1 用户注册成功后将获得一个账号和密码用户应妥善保管账号和密码并对使用该账号和密码进行的所有活动承担责任
</text>
<text class="section-text">
3.2 用户不得将账号转让出借或以其他方式提供给他人使用
</text>
<text class="section-text">
3.3 如发现任何非法使用账号的情况应立即通知我们
</text>
</view>
<view class="agreement-section">
<text class="section-title">4. 用户行为规范</text>
<text class="section-text">
4.1 用户在使用本服务时必须遵守相关法律法规不得利用本服务从事任何违法或不当行为
</text>
<text class="section-text">
4.2 禁止用户
</text>
<text class="section-text">
1发布或传输任何违法有害威胁辱骂骚扰诽谤侵犯隐私的信息
</text>
<text class="section-text">
2侵犯他人的知识产权商业秘密或其他合法权利
</text>
<text class="section-text">
3干扰或破坏本服务的正常运行
</text>
<text class="section-text">
4传播病毒木马或其他恶意代码
</text>
</view>
<view class="agreement-section">
<text class="section-title">5. 隐私保护</text>
<text class="section-text">
我们重视用户的隐私保护关于个人信息收集使用和保护的具体内容请参阅我们的隐私政策
</text>
</view>
<view class="agreement-section">
<text class="section-title">6. 知识产权</text>
<text class="section-text">
6.1 本应用的所有内容包括但不限于文字图片音频视频软件程序版面设计等均受知识产权法保护
</text>
<text class="section-text">
6.2 用户在使用本服务过程中产生的内容用户保留其知识产权但授权我们在服务范围内使用该内容
</text>
</view>
<view class="agreement-section">
<text class="section-title">7. 免责声明</text>
<text class="section-text">
7.1 本服务按"现状"提供不提供任何明示或暗示的保证
</text>
<text class="section-text">
7.2 我们不对以下情况承担责任
</text>
<text class="section-text">
1因用户使用本服务而产生的任何直接或间接损失
</text>
<text class="section-text">
2因不可抗力网络故障系统维护等原因导致的服务中断
</text>
<text class="section-text">
3第三方提供的内容或服务
</text>
</view>
<view class="agreement-section">
<text class="section-title">8. 协议的修改</text>
<text class="section-text">
我们有权随时修改本协议的条款修改后的协议一旦公布即代替原协议用户如不同意修改后的协议可以停止使用本服务继续使用本服务即视为用户接受修改后的协议
</text>
</view>
<view class="agreement-section">
<text class="section-title">9. 法律适用与争议解决</text>
<text class="section-text">
9.1 本协议的订立执行和解释均适用中华人民共和国法律
</text>
<text class="section-text">
9.2 如发生争议双方应友好协商解决协商不成的任何一方均可向被告所在地人民法院提起诉讼
</text>
</view>
<view class="agreement-section">
<text class="section-title">10. 联系我们</text>
<text class="section-text">
如对本协议有任何疑问或建议请通过以下方式联系我们
</text>
<text class="section-text">
邮箱support@familyaccount.com
</text>
<text class="section-text">
电话400-XXX-XXXX
</text>
</view>
<view class="agreement-footer">
<text class="footer-text">更新日期2024年1月</text>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {
// 不需要登录验证
needLogin: false
}
},
methods: {
// 返回上一页
goBack() {
uni.navigateBack()
}
}
}
</script>
<style lang="scss" scoped>
.agreement-container {
min-height: 100vh;
background: #F8F8F8;
display: flex;
flex-direction: column;
}
.nav-bar {
display: flex;
align-items: center;
justify-content: space-between;
height: 88rpx;
padding: 0 30rpx;
background: #fff;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
position: sticky;
top: 0;
z-index: 100;
}
.nav-back {
width: 60rpx;
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
}
.nav-title {
font-size: 36rpx;
font-weight: bold;
color: #333;
}
.nav-placeholder {
width: 60rpx;
}
.content-scroll {
flex: 1;
height: calc(100vh - 88rpx);
}
.agreement-content {
padding: 40rpx 30rpx;
background: #fff;
}
.agreement-title {
font-size: 40rpx;
font-weight: bold;
color: #333;
text-align: center;
margin-bottom: 50rpx;
}
.agreement-section {
margin-bottom: 50rpx;
}
.section-title {
display: block;
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 20rpx;
}
.section-text {
display: block;
font-size: 28rpx;
color: #666;
line-height: 1.8;
margin-bottom: 20rpx;
text-align: justify;
}
.agreement-footer {
margin-top: 60rpx;
padding-top: 30rpx;
border-top: 1rpx solid #eee;
text-align: center;
}
.footer-text {
font-size: 24rpx;
color: #999;
}
</style>

View File

@@ -0,0 +1,204 @@
<template>
<un-pages
:show-nav-bar="true"
nav-bar-title="我的"
:show-back="false"
:show-tab-bar="true"
@tab-change="handleTabChange"
>
<view class="page-content">
<!-- 用户信息头部 -->
<view class="user-header">
<view class="user-avatar">
<uni-icons type="person-filled" size="60" color="#fff"></uni-icons>
</view>
<view class="user-info">
<text class="user-name">{{ userInfo.nickname || '未登录' }}</text>
<text class="user-desc">{{ userInfo.username || '点击登录' }}</text>
</view>
</view>
<!-- 功能菜单 -->
<view class="menu-section">
<view class="menu-item" @tap="navigateTo('/pages/ucenter/profile')">
<view class="menu-left">
<uni-icons type="gear" size="20" color="#667eea"></uni-icons>
<text class="menu-text">个人设置</text>
</view>
<uni-icons type="right" size="16" color="#ccc"></uni-icons>
</view>
<view class="menu-item" @tap="navigateTo('/pages/ucenter/help')">
<view class="menu-left">
<uni-icons type="help" size="20" color="#667eea"></uni-icons>
<text class="menu-text">帮助中心</text>
</view>
<uni-icons type="right" size="16" color="#ccc"></uni-icons>
</view>
<view class="menu-item" @tap="navigateTo('/pages/ucenter/about')">
<view class="menu-left">
<uni-icons type="info" size="20" color="#667eea"></uni-icons>
<text class="menu-text">关于我们</text>
</view>
<uni-icons type="right" size="16" color="#ccc"></uni-icons>
</view>
</view>
<!-- 退出登录按钮 -->
<view class="logout-section" v-if="isLogin">
<button class="logout-btn" @tap="handleLogout">退出登录</button>
</view>
</view>
</un-pages>
</template>
<script>
import { isLogin, logout } from '@/utils/auth.js'
export default {
data() {
return {
userInfo: {},
isLogin: false
}
},
onLoad() {
this.checkLoginStatus()
},
onShow() {
this.checkLoginStatus()
},
methods: {
// 检查登录状态
checkLoginStatus() {
this.isLogin = isLogin()
this.userInfo = uni.getStorageSync('userInfo') || {}
},
// 页面跳转
navigateTo(url) {
if (!this.isLogin) {
uni.navigateTo({
url: '/pages/ucenter/login/index'
})
return
}
uni.showToast({
title: '功能开发中',
icon: 'none',
duration: 2000
})
},
// 退出登录
handleLogout() {
uni.showModal({
title: '提示',
content: '确定要退出登录吗?',
success: (res) => {
if (res.confirm) {
logout()
}
}
})
},
// Tab切换
handleTabChange(path) {
console.log('Tab changed to:', path)
}
}
}
</script>
<style lang="scss" scoped>
.page-content {
padding: 40rpx 30rpx;
}
.user-header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 20rpx;
padding: 60rpx 40rpx;
margin: 40rpx 0;
display: flex;
align-items: center;
.user-avatar {
width: 120rpx;
height: 120rpx;
background: rgba(255, 255, 255, 0.3);
border-radius: 60rpx;
display: flex;
align-items: center;
justify-content: center;
margin-right: 30rpx;
}
.user-info {
flex: 1;
display: flex;
flex-direction: column;
.user-name {
font-size: 36rpx;
font-weight: bold;
color: #fff;
margin-bottom: 16rpx;
}
.user-desc {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.9);
}
}
}
.menu-section {
background: #fff;
border-radius: 20rpx;
overflow: hidden;
.menu-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 30rpx 40rpx;
border-bottom: 1rpx solid #f5f5f5;
&:last-child {
border-bottom: none;
}
.menu-left {
display: flex;
align-items: center;
.menu-text {
font-size: 32rpx;
color: #333;
margin-left: 20rpx;
}
}
}
}
.logout-section {
margin-top: 60rpx;
.logout-btn {
width: 100%;
height: 90rpx;
line-height: 90rpx;
border-radius: 45rpx;
background: #fff;
color: #f56c6c;
font-size: 32rpx;
border: 2rpx solid #f56c6c;
&::after {
border: none;
}
}
}
</style>

View File

@@ -0,0 +1,407 @@
<template>
<view class="login-container">
<view class="login-content">
<!-- Logo 区域 -->
<view class="logo-section">
<image src="/static/logo.png" class="logo" mode="aspectFit"></image>
<text class="app-name">家庭记账</text>
<text class="welcome-text">欢迎使用家庭记账</text>
</view>
<!-- 表单区域 -->
<view class="form-section">
<view class="form-item">
<uni-icons type="person" size="20" color="#999"></uni-icons>
<input class="input" type="text" v-model="formData.username" placeholder="请输入用户名"
placeholder-class="input-placeholder" maxlength="30" />
</view>
<view class="form-item">
<uni-icons type="locked" size="20" color="#999"></uni-icons>
<input class="input" :type="showPassword ? 'text' : 'password'" v-model="formData.password"
placeholder="请输入密码" placeholder-class="input-placeholder" />
<uni-icons :type="showPassword ? 'eye-slash' : 'eye'" size="20" color="#999"
@tap="togglePassword"></uni-icons>
</view>
<view class="form-options">
<view class="checkbox-item" @tap="toggleRemember">
<uni-icons :type="formData.remember ? 'checkbox-filled' : 'circle'"
:color="formData.remember ? '#4CAF50' : '#999'" size="20"></uni-icons>
<text class="checkbox-text">记住密码</text>
</view>
<text class="forget-password" @tap="handleForgetPassword">忘记密码?</text>
</view>
<button class="login-btn" type="primary" @tap="handleLogin" :loading="loading">
{{ loading ? '登录中...' : '登录' }}
</button>
<view class="register-tip">
<text class="tip-text">还没有账号</text>
<text class="register-link" @tap="goToRegister">立即注册</text>
</view>
</view>
<!-- 其他登录方式 -->
<view class="other-login" v-if="false">
<view class="divider">
<text class="divider-text">其他登录方式</text>
</view>
<view class="social-login">
<view class="social-item" @tap="handleWechatLogin">
<uni-icons type="weixin" size="32" color="#07C160"></uni-icons>
<text class="social-text">微信登录</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import authApi from '@/api/modules/auth'
export default {
data() {
return {
// 不需要登录验证
needLogin: false,
formData: {
username: '',
password: '',
remember: false
},
showPassword: false,
loading: false
}
},
onLoad() {
// 检查是否有记住的密码
const savedUsername = uni.getStorageSync('savedUsername')
const savedPassword = uni.getStorageSync('savedPassword')
if (savedUsername && savedPassword) {
this.formData.username = savedUsername
this.formData.password = savedPassword
this.formData.remember = true
}
},
methods: {
// 切换密码显示/隐藏
togglePassword() {
this.showPassword = !this.showPassword
},
// 切换记住密码
toggleRemember() {
this.formData.remember = !this.formData.remember
},
// 登录
async handleLogin() {
// 表单验证
if (!this.validateForm()) {
return
}
try {
this.loading = true
// 调用登录接口
const result = await authApi.login.post({
username: this.formData.username,
password: this.formData.password
})
// 保存 token 和用户信息
if (result.code == 1) {
this.$store.commit('setUserLogin', result.data)
const user = await authApi.info.get()
this.$store.commit('setUserInfo', user.data)
// 记住密码
if (this.formData.remember) {
uni.setStorageSync('savedUsername', this.formData.username)
uni.setStorageSync('savedPassword', this.formData.password)
} else {
uni.removeStorageSync('savedUsername')
uni.removeStorageSync('savedPassword')
}
uni.showToast({
title: '登录成功',
icon: 'success',
duration: 1500
})
// 跳转到首页
setTimeout(() => {
uni.switchTab({
url: '/pages/index/index'
})
}, 1500)
} else {
uni.showToast({
title: result.message,
icon: 'success',
duration: 1500
})
}
} catch (error) {
console.error('登录失败:', error)
} finally {
this.loading = false
}
},
// 表单验证
validateForm() {
const { username, password } = this.formData
if (!username) {
uni.showToast({
title: '请输入用户名',
icon: 'none',
duration: 2000
})
return false
}
if (username.length < 3) {
uni.showToast({
title: '用户名至少3个字符',
icon: 'none',
duration: 2000
})
return false
}
if (!password) {
uni.showToast({
title: '请输入密码',
icon: 'none',
duration: 2000
})
return false
}
if (password.length < 6) {
uni.showToast({
title: '密码长度不能少于6位',
icon: 'none',
duration: 2000
})
return false
}
return true
},
// 忘记密码
handleForgetPassword() {
uni.showToast({
title: '功能开发中',
icon: 'none',
duration: 2000
})
},
// 跳转到注册页
goToRegister() {
uni.navigateTo({
url: '/pages/ucenter/register/index'
})
},
// 微信登录
handleWechatLogin() {
uni.showToast({
title: '微信登录功能开发中',
icon: 'none',
duration: 2000
})
}
}
}
</script>
<style lang="scss" scoped>
.login-container {
min-height: 100vh;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 0 60rpx;
box-sizing: border-box;
}
.login-content {
padding-top: 120rpx;
}
.logo-section {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 80rpx;
.logo {
width: 160rpx;
height: 160rpx;
margin-bottom: 30rpx;
border-radius: 20rpx;
background: rgba(255, 255, 255, 0.9);
padding: 20rpx;
}
.app-name {
font-size: 48rpx;
font-weight: bold;
color: #fff;
margin-bottom: 20rpx;
}
.welcome-text {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.9);
}
}
.form-section {
.form-item {
display: flex;
align-items: center;
background: rgba(255, 255, 255, 0.95);
border-radius: 16rpx;
padding: 30rpx 40rpx;
margin-bottom: 30rpx;
.input {
flex: 1;
margin-left: 20rpx;
margin-right: 20rpx;
font-size: 32rpx;
color: #333;
}
.input-placeholder {
color: #999;
}
}
.form-options {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 40rpx;
padding: 0 10rpx;
.checkbox-item {
display: flex;
align-items: center;
.checkbox-text {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.9);
margin-left: 10rpx;
}
}
.forget-password {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.9);
}
}
.login-btn {
width: 100%;
height: 100rpx;
line-height: 100rpx;
border-radius: 50rpx;
background: linear-gradient(90deg, #f093fb 0%, #f5576c 100%);
color: #fff;
font-size: 36rpx;
font-weight: bold;
border: none;
box-shadow: 0 8rpx 20rpx rgba(245, 87, 108, 0.4);
margin-bottom: 40rpx;
&::after {
border: none;
}
}
.register-tip {
display: flex;
justify-content: center;
align-items: center;
.tip-text {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.9);
}
.register-link {
font-size: 28rpx;
color: #fff;
font-weight: bold;
margin-left: 10rpx;
text-decoration: underline;
}
}
}
.other-login {
margin-top: 100rpx;
.divider {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 60rpx;
position: relative;
&::before,
&::after {
content: '';
position: absolute;
width: 200rpx;
height: 1rpx;
background: rgba(255, 255, 255, 0.3);
}
&::before {
left: 0;
}
&::after {
right: 0;
}
.divider-text {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.6);
padding: 0 20rpx;
}
}
.social-login {
display: flex;
justify-content: center;
.social-item {
display: flex;
flex-direction: column;
align-items: center;
.social-text {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.9);
margin-top: 20rpx;
}
}
}
}
</style>

View File

@@ -0,0 +1,401 @@
<template>
<view class="register-container">
<view class="register-content">
<!-- Logo 区域 -->
<view class="logo-section">
<image src="/static/logo.png" class="logo" mode="aspectFit"></image>
<text class="app-name">用户注册</text>
<text class="welcome-text">创建您的家庭记账账号</text>
</view>
<!-- 表单区域 -->
<view class="form-section">
<view class="form-item">
<uni-icons type="person" size="20" color="#999"></uni-icons>
<input
class="input"
type="text"
v-model="formData.username"
placeholder="请输入用户名"
placeholder-class="input-placeholder"
maxlength="30"
/>
</view>
<view class="form-item">
<uni-icons type="locked" size="20" color="#999"></uni-icons>
<input
class="input"
:type="showPassword ? 'text' : 'password'"
v-model="formData.password"
placeholder="请设置密码6-20位"
placeholder-class="input-placeholder"
/>
<uni-icons
:type="showPassword ? 'eye-slash' : 'eye'"
size="20"
color="#999"
@tap="togglePassword"
></uni-icons>
</view>
<view class="form-item">
<uni-icons type="locked" size="20" color="#999"></uni-icons>
<input
class="input"
:type="showConfirmPassword ? 'text' : 'password'"
v-model="formData.confirmPassword"
placeholder="请再次输入密码"
placeholder-class="input-placeholder"
/>
<uni-icons
:type="showConfirmPassword ? 'eye-slash' : 'eye'"
size="20"
color="#999"
@tap="toggleConfirmPassword"
></uni-icons>
</view>
<view class="form-item">
<uni-icons type="info" size="20" color="#999"></uni-icons>
<input
class="input"
type="text"
v-model="formData.nickname"
placeholder="请设置昵称"
placeholder-class="input-placeholder"
maxlength="20"
/>
</view>
<view class="agreement-item">
<uni-icons
:type="formData.agreed ? 'checkbox-filled' : 'circle'"
:color="formData.agreed ? '#4CAF50' : '#999'"
size="20"
@tap="toggleAgreement"
></uni-icons>
<text class="agreement-text">
我已阅读并同意
<text class="agreement-link" @tap="handleAgreement('user')">用户协议</text>
<text class="agreement-link" @tap="handleAgreement('privacy')">隐私政策</text>
</text>
</view>
<button class="register-btn" type="primary" @tap="handleRegister" :loading="loading">
{{ loading ? '注册中...' : '立即注册' }}
</button>
<view class="login-tip">
<text class="tip-text">已有账号</text>
<text class="login-link" @tap="goToLogin">立即登录</text>
</view>
</view>
</view>
</view>
</template>
<script>
import authApi from '@/api/modules/auth'
export default {
data() {
return {
// 不需要登录验证
needLogin: false,
formData: {
username: '',
password: '',
confirmPassword: '',
nickname: '',
agreed: false
},
showPassword: false,
showConfirmPassword: false,
loading: false
}
},
methods: {
// 切换密码显示/隐藏
togglePassword() {
this.showPassword = !this.showPassword
},
toggleConfirmPassword() {
this.showConfirmPassword = !this.showConfirmPassword
},
// 切换协议同意
toggleAgreement() {
this.formData.agreed = !this.formData.agreed
},
// 注册
async handleRegister() {
// 表单验证
if (!this.validateForm()) {
return
}
try {
this.loading = true
// 调用注册接口
const result = await authApi.register.post({
username: this.formData.username,
password: this.formData.password,
nickname: this.formData.nickname
})
uni.showToast({
title: '注册成功',
icon: 'success',
duration: 1500
})
// 跳转到登录页
setTimeout(() => {
uni.redirectTo({
url: '/pages/ucenter/login/index'
})
}, 1500)
} catch (error) {
console.error('注册失败:', error)
} finally {
this.loading = false
}
},
// 表单验证
validateForm() {
const { username, password, confirmPassword, nickname, agreed } = this.formData
// 验证用户名
if (!username) {
uni.showToast({
title: '请输入用户名',
icon: 'none',
duration: 2000
})
return false
}
if (username.length < 3) {
uni.showToast({
title: '用户名至少3个字符',
icon: 'none',
duration: 2000
})
return false
}
// 验证密码
if (!password) {
uni.showToast({
title: '请设置密码',
icon: 'none',
duration: 2000
})
return false
}
if (password.length < 6 || password.length > 20) {
uni.showToast({
title: '密码长度为6-20位',
icon: 'none',
duration: 2000
})
return false
}
// 验证确认密码
if (!confirmPassword) {
uni.showToast({
title: '请再次输入密码',
icon: 'none',
duration: 2000
})
return false
}
if (password !== confirmPassword) {
uni.showToast({
title: '两次输入的密码不一致',
icon: 'none',
duration: 2000
})
return false
}
// 验证昵称
if (!nickname) {
uni.showToast({
title: '请设置昵称',
icon: 'none',
duration: 2000
})
return false
}
// 验证协议
if (!agreed) {
uni.showToast({
title: '请阅读并同意用户协议和隐私政策',
icon: 'none',
duration: 2000
})
return false
}
return true
},
// 查看协议
handleAgreement(type) {
let url = ''
if (type === 'user') {
url = '/pages/ucenter/agreement/user'
} else if (type === 'privacy') {
url = '/pages/ucenter/agreement/privacy'
}
if (url) {
uni.navigateTo({
url: url
})
}
},
// 跳转到登录页
goToLogin() {
uni.navigateBack()
}
}
}
</script>
<style lang="scss" scoped>
.register-container {
min-height: 100vh;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 0 60rpx;
box-sizing: border-box;
}
.register-content {
padding-top: 80rpx;
}
.logo-section {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 60rpx;
.logo {
width: 140rpx;
height: 140rpx;
margin-bottom: 30rpx;
border-radius: 20rpx;
background: rgba(255, 255, 255, 0.9);
padding: 20rpx;
}
.app-name {
font-size: 44rpx;
font-weight: bold;
color: #fff;
margin-bottom: 16rpx;
}
.welcome-text {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.9);
}
}
.form-section {
.form-item {
display: flex;
align-items: center;
background: rgba(255, 255, 255, 0.95);
border-radius: 16rpx;
padding: 30rpx 40rpx;
margin-bottom: 24rpx;
.input {
flex: 1;
margin-left: 20rpx;
margin-right: 20rpx;
font-size: 32rpx;
color: #333;
}
.input-placeholder {
color: #999;
}
}
.agreement-item {
display: flex;
align-items: flex-start;
margin-bottom: 30rpx;
padding: 0 10rpx;
.agreement-text {
flex: 1;
font-size: 26rpx;
color: rgba(255, 255, 255, 0.9);
line-height: 1.6;
margin-left: 10rpx;
.agreement-link {
color: #fff;
font-weight: bold;
text-decoration: underline;
}
}
}
.register-btn {
width: 100%;
height: 100rpx;
line-height: 100rpx;
border-radius: 50rpx;
background: linear-gradient(90deg, #f093fb 0%, #f5576c 100%);
color: #fff;
font-size: 36rpx;
font-weight: bold;
border: none;
box-shadow: 0 8rpx 20rpx rgba(245, 87, 108, 0.4);
margin-bottom: 40rpx;
&::after {
border: none;
}
}
.login-tip {
display: flex;
justify-content: center;
align-items: center;
.tip-text {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.9);
}
.login-link {
font-size: 28rpx;
color: #fff;
font-weight: bold;
margin-left: 10rpx;
text-decoration: underline;
}
}
}
</style>