修改跳转问题

This commit is contained in:
zhouyanli
2026-04-20 17:10:47 +08:00
parent 8af229f25b
commit c8940e5b02
9 changed files with 85 additions and 88 deletions

View File

@@ -94,50 +94,6 @@ const checkForm = () => {};
onLoad(() =>{
});
// const handleLogin = async () => {
// if (!canLogin.value) return;
// // 防止多次点击触发登录
// // canLogin.value = false;
// // // 2. 空值校验
// if (!phoneNumber.value) {
// uni.showToast({ title: '请输入手机号', icon: 'none' });
// // canLogin.value = true;
// return;
// }
// if (!password.value) {
// uni.showToast({ title: '请输入密码', icon: 'none' });
// // canLogin.value = true;
// return;
// }
// const params = {
// username: phoneNumber.value,
// password: password.value
// };
// try {
// // 3. 调用登录接口
// const res = await getLoginPassword(params);
// // 登录成功逻辑
// // 如果后端返回token这里保存
// // uni.setStorageSync('token', res.token || '');
// uni.showToast({ title: '登录成功', icon: 'success' });
// // 登录成功后再跳转
// setTimeout(() => {
// uni.switchTab({ url: '/pages/index/index' });
// }, 1500);
// } catch (err) {
// // 登录失败逻辑(所有错误:账号不存在/密码错/网络异常都走这里)
// uni.showToast({ title: `${err || '登录失败'}`, icon: 'none' });
// } finally {
// // 无论成功/失败,解锁按钮
// canLogin.value = true;
// }
// };
// 登录逻辑
const handleLogin = () => {
if (!canLogin.value) return
@@ -145,16 +101,16 @@ const handleLogin = () => {
username:phoneNumber.value,
password:password.value
}
if (!phoneNumber.value) {
uni.showToast({ title: '请输入手机号', icon: 'none' });
// canLogin.value = true;
return;
}
if (!password.value) {
uni.showToast({ title: '请输入密码', icon: 'none' });
// canLogin.value = true;
return;
}
// if (!phoneNumber.value) {
// uni.showToast({ title: '请输入手机号', icon: 'none' });
// // canLogin.value = true;
// return;
// }
// if (!password.value) {
// uni.showToast({ title: '请输入密码', icon: 'none' });
// // canLogin.value = true;
// return;
// }
// getLoginPassword(params).then(res =>{
// // console.log('33333',res)
// if(res.code === 200){
@@ -168,6 +124,9 @@ const handleLogin = () => {
// }
// })
uni.showLoading({
title: '登录中...'
});
setTimeout(() => {
uni.switchTab({ url: '/pages/index/index' });
}, 1500);