This commit is contained in:
Ling53666
2025-05-15 21:01:14 +08:00
parent 9b8553930b
commit 7c371623eb
35 changed files with 620 additions and 401 deletions

View File

@ -4,6 +4,35 @@ Page({
show: true,
morenshow: false,
currentTab: 'code',
countdown: 60, // 设置倒计时时长(秒)
timer: null, // 存储计时器
},
startCountdown() {
this.setData({
isCountingDown: true,
countdown: 60
});
this.data.timer = setInterval(() => {
let count = this.data.countdown;
if (count <= 1) {
clearInterval(this.data.timer);
this.setData({
isCountingDown: false,
countdown: 60
});
} else {
this.setData({
countdown: count - 1
});
}
}, 1000);
},
onUnload() {
// 页面卸载时清除定时器
if (this.data.timer) {
clearInterval(this.data.timer);
}
},
// 初始加载
onShow(){
@ -118,15 +147,14 @@ submit(){
icon: 'success',
duration: 2000
});
wx.setStorage({
key: "logmessage",
data: {
Authorization:res.data.data
},
success() {
console.log("信息存储成功");
}
})
try {
wx.setStorageSync('logmessage', {
Authorization: res.data.data
});
console.log("信息存储成功");
} catch (e) {
console.error("存储失败", e);
}
setTimeout(() => {
that.setmessage();
wx.switchTab({
@ -135,7 +163,7 @@ submit(){
}, 2000);
}else{
wx.showToast({
title: res.data.message,
title: res.data.message||res.data.error,
icon: 'error',
duration: 2000
});
@ -183,7 +211,7 @@ getcode(){
}else{
wx.showToast({
title: res.data.message,
icon: 'success',
icon: 'error',
duration: 2000
});
}
@ -192,6 +220,7 @@ getcode(){
console.error('请求失败', err);
}
});
this.startCountdown();
},
// 验证码登录提交
submityanzhengma(){
@ -230,15 +259,14 @@ submityanzhengma(){
icon: 'success',
duration: 2000
});
wx.setStorage({
key: "logmessage",
data: {
Authorization:res.data.data
},
success() {
console.log("信息存储成功");
}
})
try {
wx.setStorageSync('logmessage', {
Authorization: res.data.data
});
console.log("信息存储成功");
} catch (e) {
console.error("存储失败", e);
}
setTimeout(() => {
_this.setmessage();
wx.switchTab({
@ -247,7 +275,7 @@ submityanzhengma(){
}, 2000);
}else{
wx.showToast({
title: res.data.message,
title: res.data.message||res.data.error,
icon: 'error',
duration: 2000
});
@ -278,19 +306,18 @@ setmessage() {
success(res) {
console.log('查询成功', res);
if (res.data.code==1) {
wx.setStorage({
key: "usermessage",
data: {
nickName:res.data.data.nickName,
phoneNumber:res.data.data.phoneNumber,
userRole:res.data.data.userRole,
invitationCode:res.data.data.invitationCode,
userAvatar:res.data.data.userAvatar
},
success() {
console.log("信息存储成功");
}
})
try {
wx.setStorageSync("usermessage", {
nickName: res.data.data.nickName,
phoneNumber: res.data.data.phoneNumber,
userRole: res.data.data.userRole,
invitationCode: res.data.data.invitationCode,
userAvatar: res.data.data.userAvatar
});
console.log("信息存储成功");
} catch (e) {
console.error("信息存储失败", e);
}
} else {
wx.showToast({
title: res.data.message,

View File

@ -16,7 +16,7 @@
</view>
<view class="flex-row justify-between section mt-21">
<input class="font_4 text_5" bindinput="yanzhengcode" placeholder="请输入验证码" />
<text bind:tap="getcode" class="font_2 text_6">获取验证码</text>
<text bind:tap="{{isCountingDown ? '' : 'getcode'}}"style="color: {{isCountingDown ? '#ccc' : '#ff8d1a'}};" class="font_2 text_6"> {{ isCountingDown ? countdown + '秒后重试' : '获取验证码' }}</text>
</view>
</view>
<view wx:if="{{morenshow==true}}" class="flex-col self-stretch">
@ -38,7 +38,7 @@
</view>
<view class="flex-col self-stretch group_3">
<view class="flex-row items-center self-start">
<radio class="radio" color="#ff8d1a" bind:tap="onAgreeChange"></radio>
<checkbox class="radio" color="#ff8d1a" bind:tap="onAgreeChange" value="cb" />
<text class="shrink-0 font_5 text_9">我已阅读并同意</text>
<text class="font_5 text_10">用户服务协议、隐私政策</text>
</view>

View File

@ -106,9 +106,12 @@
line-height: 26.92rpx;
}
.text_9 {
margin-left: 50.94rpx;
margin-left: 20.94rpx;
color: #000000;
}
.radio{
margin-left: 30rpx;
}
.text_10 {
color: #d43030;
margin-left: 10rpx;