修改首页、引导页等样式问题;对接登录接口
This commit is contained in:
@@ -51,7 +51,7 @@
|
||||
<!-- 底部链接 -->
|
||||
<view class="bottom-link">
|
||||
<navigator class="link-item" url="/pageSubPack/loginSub/login">验证码登录</navigator>
|
||||
<navigator class="link-item" url="/pageSubPack/loginSub/register-new-user">注册新用户</navigator>
|
||||
<!-- <navigator class="link-item" url="/pageSubPack/loginSub/register-new-user">注册新用户</navigator> -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -104,67 +104,56 @@
|
||||
|
||||
// 登录逻辑
|
||||
const handleLogin = () => {
|
||||
// if (!canLogin.value) {
|
||||
// uni.showToast({ title: '请输入账号和密码', icon: 'none' });
|
||||
// return
|
||||
// }
|
||||
if (!canLogin.value) {
|
||||
uni.showToast({ title: '请输入账号和密码', icon: 'none' });
|
||||
return
|
||||
}
|
||||
|
||||
// if (!phoneNumber.value) {
|
||||
// uni.showToast({ title: '请输入账号', icon: 'none' });
|
||||
// return;
|
||||
// }
|
||||
// if (!password.value) {
|
||||
// uni.showToast({ title: '请输入密码', icon: 'none' });
|
||||
// return;
|
||||
// }
|
||||
// if(!agreeAgreement.value){
|
||||
// uni.showToast({ title: '请勾选协议', icon: 'none' });
|
||||
// return;
|
||||
// }
|
||||
// uni.showLoading({ title: '登录中...', mask: true });
|
||||
// let params = {
|
||||
// username:phoneNumber.value,
|
||||
// password:password.value
|
||||
// }
|
||||
// getLoginPassword(params).then(res =>{
|
||||
// console.log('33333',res)
|
||||
// if(res.code === 200){
|
||||
// uni.setStorageSync('token', res.data.token);
|
||||
// // 存用户ID
|
||||
// if(res.data) {
|
||||
// // 存当前绑定的小区ID,0 表示未绑定
|
||||
// const currentVillageId = res.data.currentVillageId || 0;
|
||||
// uni.setStorageSync('currentVillageId', currentVillageId);
|
||||
// }
|
||||
// uni.hideLoading();
|
||||
// uni.showToast({ title: '登录成功', icon: 'success' });
|
||||
// setTimeout(() =>{
|
||||
// uni.switchTab({
|
||||
// url: '/pages/index/index'
|
||||
// },1000);
|
||||
// })
|
||||
// }else{
|
||||
// uni.showToast({ title: res.msg, icon: 'error' });
|
||||
// }
|
||||
if (!phoneNumber.value) {
|
||||
uni.showToast({ title: '请输入账号', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!password.value) {
|
||||
uni.showToast({ title: '请输入密码', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if(!agreeAgreement.value){
|
||||
uni.showToast({ title: '请勾选协议', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
uni.showLoading({ title: '登录中...', mask: true });
|
||||
let params = {
|
||||
username:phoneNumber.value,
|
||||
password:password.value
|
||||
}
|
||||
getLoginPassword(params).then(res =>{
|
||||
// console.log('33333',res)
|
||||
if(res.code === 200){
|
||||
uni.setStorageSync('token', res.data.token);
|
||||
// 存用户ID
|
||||
if(res.data) {
|
||||
// 存当前绑定的小区ID,0 表示未绑定
|
||||
// const currentVillageId = res.data.currentVillageId || 0;
|
||||
// uni.setStorageSync('currentVillageId', currentVillageId);
|
||||
}
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: '登录成功', icon: 'success' });
|
||||
setTimeout(() =>{
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
},1000);
|
||||
})
|
||||
}else{
|
||||
uni.showToast({ title: res.msg, icon: 'error' });
|
||||
}
|
||||
|
||||
// }).catch(err => {
|
||||
// uni.showToast({
|
||||
// title: '网络异常',
|
||||
// icon: 'error'
|
||||
// });
|
||||
// })
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.msg,
|
||||
icon: 'error'
|
||||
});
|
||||
})
|
||||
|
||||
// 测试
|
||||
uni.showLoading({
|
||||
title: '登录中...',
|
||||
mask: true
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
}, 1500);
|
||||
uni.hideLoading()
|
||||
|
||||
};
|
||||
</script>
|
||||
@@ -253,7 +242,7 @@
|
||||
color: #fff;
|
||||
border-radius: 8rpx;
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 60rpx;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.login-btn:disabled {
|
||||
@@ -270,7 +259,7 @@
|
||||
|
||||
.bottom-link {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
justify-content: center;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user