解决了已知问题

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,4 +1,4 @@
// pages/zucepage/zucepage.js
import {url} from '../../request'
Page({
/**
@ -8,59 +8,171 @@ Page({
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
name(e){
this.setData({
name:e.detail.value
})
console.log(e.detail.value);
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
phone(e){
this.setData({
phone:e.detail.value
})
console.log(e.detail.value);
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
code(e){
this.setData({
code:e.detail.value
})
console.log(e.detail.value);
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
yanzhengma(e){
this.setData({
yanzhengma:e.detail.value
})
console.log(e.detail.value);
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
password(e){
this.setData({
password:e.detail.value
})
console.log(e.detail.value);
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
getcode(){
const phone = this.data.phone;
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);
}
});
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
// 注册
submit(){
const yanzhengma = this.data.yanzhengma
const phone = this.data.phone
const password = this.data.password
const code = this.data.code
const name = this.data.name
if (!name) {
wx.showToast({
title: '请输入昵称',
icon: 'none'
});
return;
}
if (!/^\d{6}$/.test(yanzhengma)) {
wx.showToast({
title: '请输入6位验证码',
icon: 'none'
});
return;
}
if (!/^\d{6,11}$/.test(phone)) {
wx.showToast({
title: '请输入6到11位的账号',
icon: 'none'
});
return;
}
// 密码验证6~10位字符
if (!/^.{6,10}$/.test(password)) {
wx.showToast({
title: '请输入6到10位的密码',
icon: 'none'
});
return;
}
if (!/^\d{6}$/.test(code)) {
wx.showToast({
title: '请输入6位的邀请码',
icon: 'none'
});
return;
}
if (this.data.isAgree!=true) {
wx.showToast({
title: '请先勾选协议',
icon: 'none'
});
return;
}
console.log("sakldhasjdhja");
wx.request({
url: url + '/userInfo/register',
method: 'POST',
data: {
nickName: this.data.name,
phoneNumber: this.data.phone,
verificationCode: this.data.yanzhengma,
invitationCode: this.data.code,
userPassword: this.data.password
},
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);
}
});
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
// 勾选
onAgreeChange(e) {
this.setData({
isAgree: true
});
console.log("gaibianler",this.data.isAgree);
},
})

View File

@ -1,26 +1,27 @@
<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-15">
<view class="flex-col justify-start items-start text-wrapper_2"><input class="text_3 font_3 text_4" placeholder="请输入昵称" /></view>
<view class="flex-col justify-start items-start view"><input class="text_3 font_3 text_5" placeholder="请输入手机号" /></view>
<view class="flex-col justify-start items-start text-wrapper_2"><input class="text_3 font_3 text_4" bindinput="name" bindinput="name" placeholder="请输入昵称" /></view>
<view class="flex-col justify-start items-start view"><input class="text_3 font_3 text_5" bindinput="phone" placeholder="请输入手机号" /></view>
<view class="flex-row justify-between section">
<input class="font_3 text_6" placeholder="请输入验证码" />
<text class="font_2 text_7">获取验证码</text>
<input class="font_3 text_6" bindinput="yanzhengma" placeholder="请输入验证码" />
<text class="font_2 text_7" bind:tap="getcode">获取验证码</text>
</view>
<view class="flex-col justify-start items-start view_2"><input class="text_3 font_3 text_8" placeholder="请输入邀请码" /></view>
<view class="flex-col justify-start items-start view_3"><input class="text_3 font_3 text_9" placeholder="请设置密码" /></view>
<view class="flex-col justify-start items-start view_2"><input class="text_3 font_3 text_8" bindinput="code" placeholder="请输入邀请码" /></view>
<view class="flex-col justify-start items-start view_3"><input class="text_3 font_3 text_9" bindinput="password" placeholder="请设置密码" /></view>
</view>
</view>
<view class="flex-row items-center self-start group_2">
<radio class="radio" color="#ff8d1a"></radio>
<radio class="radio" color="#ff8d1a" bind:tap="onAgreeChange"></radio>
<text class="shrink-0 font_4 text_10">我已阅读并同意</text>
<text class="flex-1 font_4 text_11">青橙用户服务协议、隐私政策</text>
</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="submit">
<text class="font text_12">注册</text>
</view>
<view class="self-center group_3">

View File

@ -10,8 +10,6 @@
height: 100%;
}
.text-wrapper {
padding: 426.96rpx 0 6.02rpx;
background-image: url('https://ide.code.fun/api/image?token=680efc2c4ae84d00122e3b6c&name=ac6edf59808d551877b71d448fce5024.png');
background-size: 100% 100%;
background-repeat: no-repeat;
width: 461.54rpx;