解决了已知问题

This commit is contained in:
Ling53666
2025-05-11 15:12:01 +08:00
parent 36cc2fe7ba
commit bb84973913
41 changed files with 2980 additions and 801 deletions

View File

@ -1,66 +1,151 @@
// pages/wangjimima/wangjimima.js
import {url} from '../../request'
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
phone(e){
this.setData({
phone:e.detail.value
})
console.log(e.detail.value);
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
yanzhengma(e){
this.setData({
yanzhengma:e.detail.value
})
console.log(e.detail.value);
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
password(e){
this.setData({
password:e.detail.value
})
console.log(e.detail.value);
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
passwordagain(e){
this.setData({
passwordagain:e.detail.value
})
console.log(e.detail.value);
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
subimt(){
const phone = this.data.phone
const yanzhengma = this.data.yanzhengma
const password = this.data.password
const passwordagain = this.data.passwordagain
console.log(phone,'aslkjyhdkjashdjkashkj');
if (!/^\d{11}$/.test(phone)) {
wx.showToast({
title: '请输入11位的手机号',
icon: 'none'
});
return;
}
if (!/^\d{6}$/.test(yanzhengma)) {
wx.showToast({
title: '请输入6位的验证码',
icon: 'none'
});
return;
}
if (!/^[a-zA-Z0-9]{6,10}$/.test(password)) {
wx.showToast({
title: '请输入6~10位的密码',
icon: 'none'
});
return;
}
if (!/^[a-zA-Z0-9]{6,10}$/.test(passwordagain)) {
wx.showToast({
title: '请再次输入密码',
icon: 'none'
});
return;
}
if(password !== passwordagain){
wx.showToast({
title: '两次输入的密码不一致,请重新输入',
icon: 'none'
});
return;
}
wx.request({
url: url + '/userInfo/mini/out/reset/pwd',
method: 'POST',
data: {
phoneNumber: this.data.phone,
verificationCode: this.data.yanzhengma,
userPassword: this.data.password,
userConfirmPassword: this.data.passwordagain
},
header: {
'content-type': 'application/json'
},
success(res) {
console.log('重置成功', res);
if(res.data.code==1){
wx.showToast({
title: '重置成功',
icon: 'success',
duration: 2000
});
setTimeout(() => {
wx.navigateBack({
delta: 1
})
}, 2000);
}else{
wx.showToast({
title: res.data.message,
icon: 'error',
duration: 2000
});
}
},
fail(err) {
console.error('请求失败', err);
}
});
},
// 获取验证码
getcode(){
const phone = this.data.phone;
console.log(phone,'askjhdsakjhdjkashjk');
if (!/^\d{11}$/.test(phone)) {
wx.showToast({
title: '请输入11位的手机号',
icon: 'none'
});
return;
}
wx.request({
url: url + '/userInfo/code',
method: 'POST',
data: {
templateString: this.data.phone
},
header: {
'content-type': 'application/json'
},
success(res) {
console.log('发送成功', res);
if(res.data.code==1){
wx.showToast({
title: '发送成功',
icon: 'success',
duration: 2000
});
}else{
wx.showToast({
title: res.data.message,
icon: 'success',
duration: 2000
});
}
},
fail(err) {
console.error('请求失败', err);
}
});
},
})