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,