解决了已知问题

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);
}
});
},
})

View File

@ -1,25 +1,26 @@
<view class="flex-col page">
<view class="flex-col justify-start items-center self-center text-wrapper">
<image src="/image/logo.png" mode="aspectFill"></image>
<text class="font text">欢迎登陆—青橙校园</text>
</view>
<view class="flex-col self-stretch group">
<text class="self-start font_2 text_2">忘记密码</text>
<view class="flex-col self-stretch mt-22">
<view class="flex-col self-stretch">
<view class="flex-col justify-start items-start text-wrapper_1"><input class="text_1 font_2 text_4" placeholder="请输入手机号" /></view>
<view class="flex-col justify-start items-start text-wrapper_1"><input class="text_1 font_2 text_4" bindinput="phone" placeholder="请输入手机号" /></view>
<view class="flex-row justify-between section mt-20">
<input class="font_2 text_5" placeholder="请输入验证码" />
<text class="font_2 text_6">获取验证码</text>
<input class="font_2 text_5" bindinput="yanzhengma" placeholder="请输入验证码" />
<text class="font_2 text_6" bind:tap="getcode">获取验证码</text>
</view>
<view class="flex-col justify-start items-start text-wrapper_2 mt-20"><input class="text_1 font_2" placeholder="请输入密码" /></view>
<view class="flex-col justify-start items-start text-wrapper_2 mt-20"><input class="text_1 font_2" bindinput="password" password type="text" placeholder="请输入密码" /></view>
<view class="flex-col justify-start items-start text-wrapper_4 mt-20">
<input class="text_1 font_2 text_7" placeholder="请再次输入密码" />
<input class="text_1 font_2 text_7" bindinput="passwordagain" password type="text" placeholder="请再次输入密码" />
</view>
</view>
<text class="self-end text_8 mt-16">登陆账号</text>
</view>
</view>
<view class="flex-col justify-start items-center self-stretch text-wrapper_3">
<view class="flex-col justify-start items-center self-stretch text-wrapper_3" bind:tap="subimt">
<text class="font text_9">重置密码</text>
</view>
</view>

View File

@ -2,13 +2,11 @@
padding: 73.08rpx 38.46rpx 275rpx 48.08rpx;
background-color: #ffffff;
width: 100%;
overflow-y: auto;
overflow-y: hidden;
overflow-x: hidden;
height: 100%;
}
.text-wrapper {
padding: 384.65rpx 0 19.48rpx;
background-image: url('https://ide.code.fun/api/image?token=680efc2c4ae84d00122e3b6c&name=9927844a76c9298d1ba7d7f5f997ca65.png');
background-size: 100% 100%;
background-repeat: no-repeat;
width: 432.69rpx;