mirror of
https://gitee.com/qingqing-coconut-tea/RcKtFezyRAZX
synced 2026-07-21 10:32:32 +08:00
init
This commit is contained in:
121
wechat/pages/forget-password/forget-password.js
Normal file
121
wechat/pages/forget-password/forget-password.js
Normal file
@@ -0,0 +1,121 @@
|
||||
// pages/forget-password/forget-password.js
|
||||
// 忘记密码逻辑处理
|
||||
|
||||
const api = require('../../services/api')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
phone: '',
|
||||
verifyCode: '',
|
||||
password: '',
|
||||
confirmPassword: '',
|
||||
countdown: 0,
|
||||
sendBtnText: '获取验证码',
|
||||
loading: false
|
||||
},
|
||||
|
||||
onPhoneInput(e) {
|
||||
this.setData({ phone: e.detail.value })
|
||||
},
|
||||
|
||||
onVerifyCodeInput(e) {
|
||||
this.setData({ verifyCode: e.detail.value })
|
||||
},
|
||||
|
||||
onPasswordInput(e) {
|
||||
this.setData({ password: e.detail.value })
|
||||
},
|
||||
|
||||
onConfirmPasswordInput(e) {
|
||||
this.setData({ confirmPassword: e.detail.value })
|
||||
},
|
||||
|
||||
onSendVerifyCode() {
|
||||
const phone = this.data.phone.trim()
|
||||
|
||||
if (!phone) {
|
||||
wx.showToast({ title: '请输入手机号', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
api.sendSmsCode({ phone, type: 'forget' }).then(res => {
|
||||
if (res.code === 200) {
|
||||
wx.showToast({ title: '验证码已发送', icon: 'success' })
|
||||
this.startCountdown()
|
||||
} else {
|
||||
wx.showToast({ title: res.message || '发送失败', icon: 'none' })
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
startCountdown() {
|
||||
let seconds = 60
|
||||
this.setData({ countdown: seconds, sendBtnText: `${seconds}s` })
|
||||
|
||||
const timer = setInterval(() => {
|
||||
seconds--
|
||||
if (seconds <= 0) {
|
||||
clearInterval(timer)
|
||||
this.setData({ countdown: 0, sendBtnText: '获取验证码' })
|
||||
} else {
|
||||
this.setData({ sendBtnText: `${seconds}s` })
|
||||
}
|
||||
}, 1000)
|
||||
},
|
||||
|
||||
doReset() {
|
||||
const { phone, verifyCode, password, confirmPassword } = this.data
|
||||
|
||||
if (!phone.trim()) {
|
||||
wx.showToast({ title: '请输入手机号', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
if (!verifyCode.trim()) {
|
||||
wx.showToast({ title: '请输入验证码', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
if (!password.trim()) {
|
||||
wx.showToast({ title: '请输入新密码', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
if (password.length < 6) {
|
||||
wx.showToast({ title: '密码至少6位', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
if (password !== confirmPassword) {
|
||||
wx.showToast({ title: '两次密码不一致', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
this.setData({ loading: true })
|
||||
|
||||
api.resetPassword({
|
||||
phone: phone.trim(),
|
||||
verifyCode: verifyCode.trim(),
|
||||
password: password.trim()
|
||||
}).then(res => {
|
||||
this.setData({ loading: false })
|
||||
if (res.code === 200) {
|
||||
wx.showToast({ title: '密码重置成功', icon: 'success' })
|
||||
setTimeout(() => {
|
||||
wx.redirectTo({ url: '/pages/login/login' })
|
||||
}, 1500)
|
||||
} else {
|
||||
wx.showToast({ title: res.message || '重置失败', icon: 'none' })
|
||||
}
|
||||
}).catch(() => {
|
||||
this.setData({ loading: false })
|
||||
wx.showToast({ title: '重置失败', icon: 'none' })
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* @联系作者:16768118056
|
||||
* @描述:(此项目非免费分享)源码百分百可用,搞定毕设不发愁,支持远程调试安装、二次开发、定制、讲解、文档类。
|
||||
* @访问:https://www.notmaker.com/detail/8326a897119d4542896c863a69d7bbe7/gtt20260415,查看完整运行演示。
|
||||
*/
|
||||
11
wechat/pages/forget-password/forget-password.json
Normal file
11
wechat/pages/forget-password/forget-password.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "忘记密码",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
|
||||
/**
|
||||
* @联系作者:16768118056
|
||||
* @描述:(此项目非免费分享)源码百分百可用,搞定毕设不发愁,支持远程调试安装、二次开发、定制、讲解、文档类。
|
||||
* @访问:https://www.notmaker.com/detail/8326a897119d4542896c863a69d7bbe7/gtt20260415,查看完整运行演示。
|
||||
*/
|
||||
42
wechat/pages/forget-password/forget-password.wxml
Normal file
42
wechat/pages/forget-password/forget-password.wxml
Normal file
@@ -0,0 +1,42 @@
|
||||
<!-- pages/forget-password/forget-password.wxml -->
|
||||
<!-- 忘记密码视图 -->
|
||||
|
||||
<view class="forget-container">
|
||||
<view class="header">
|
||||
<text class="title">忘记密码</text>
|
||||
<text class="subtitle">请输入您的手机号</text>
|
||||
</view>
|
||||
|
||||
<view class="form">
|
||||
<view class="form-item">
|
||||
<text class="iconfont icon-phone form-icon"></text>
|
||||
<input class="form-input" type="number" maxlength="11" placeholder="请输入手机号" bindinput="onPhoneInput" value="{{phone}}" />
|
||||
</view>
|
||||
|
||||
<view class="form-item verify-code-item">
|
||||
<text class="iconfont icon-verify form-icon"></text>
|
||||
<input class="form-input" type="number" maxlength="6" placeholder="请输入验证码" bindinput="onVerifyCodeInput" value="{{verifyCode}}" />
|
||||
<button class="send-code-btn {{countdown > 0 ? 'disabled' : ''}}" bindtap="onSendVerifyCode" disabled="{{countdown > 0}}">
|
||||
{{sendBtnText}}
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="iconfont icon-password form-icon"></text>
|
||||
<input class="form-input" type="password" placeholder="请输入新密码" bindinput="onPasswordInput" value="{{password}}" />
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="iconfont icon-password form-icon"></text>
|
||||
<input class="form-input" type="password" placeholder="请确认新密码" bindinput="onConfirmPasswordInput" value="{{confirmPassword}}" />
|
||||
</view>
|
||||
|
||||
<button class="reset-btn" bindtap="doReset" loading="{{loading}}">重置密码</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
/**
|
||||
* @联系作者:16768118056
|
||||
* @描述:(此项目非免费分享)源码百分百可用,搞定毕设不发愁,支持远程调试安装、二次开发、定制、讲解、文档类。
|
||||
* @访问:https://www.notmaker.com/detail/8326a897119d4542896c863a69d7bbe7/gtt20260415,查看完整运行演示。
|
||||
*/
|
||||
93
wechat/pages/forget-password/forget-password.wxss
Normal file
93
wechat/pages/forget-password/forget-password.wxss
Normal file
@@ -0,0 +1,93 @@
|
||||
/* pages/forget-password/forget-password.wxss */
|
||||
/* 忘记密码页面样式 */
|
||||
|
||||
.forget-container {
|
||||
min-height: 100vh;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
padding: 80rpx 60rpx 60rpx;
|
||||
}
|
||||
|
||||
.header {
|
||||
text-align: center;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: block;
|
||||
font-size: 48rpx;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 28rpx;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
|
||||
.form {
|
||||
background-color: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 60rpx 40rpx;
|
||||
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.form-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
padding: 24rpx 0;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.form-icon {
|
||||
font-size: 40rpx;
|
||||
color: #667eea;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.form-input {
|
||||
flex: 1;
|
||||
height: 60rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.verify-code-item {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.send-code-btn {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
padding: 12rpx 20rpx;
|
||||
font-size: 24rpx;
|
||||
color: #667eea;
|
||||
background-color: #fff;
|
||||
border: 1rpx solid #667eea;
|
||||
border-radius: 24rpx;
|
||||
}
|
||||
|
||||
.send-code-btn.disabled {
|
||||
color: #999;
|
||||
border-color: #ddd;
|
||||
}
|
||||
|
||||
.reset-btn {
|
||||
margin-top: 40rpx;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
border-radius: 44rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* @联系作者:16768118056
|
||||
* @描述:(此项目非免费分享)源码百分百可用,搞定毕设不发愁,支持远程调试安装、二次开发、定制、讲解、文档类。
|
||||
* @访问:https://www.notmaker.com/detail/8326a897119d4542896c863a69d7bbe7/gtt20260415,查看完整运行演示。
|
||||
*/
|
||||
Reference in New Issue
Block a user