恢复接口

This commit is contained in:
zhouyanli
2026-04-28 16:52:51 +08:00
parent fdc53b09bb
commit e3e74a1be0
15 changed files with 187 additions and 242 deletions

View File

@@ -46,7 +46,7 @@
</view>
<text class="agreement-text" @click.stop="goToPrivacy">我已阅读并同意
<text class="agreePrivacy" :class="{ active:isClicked }">用户隐私政策</text>
<text class="agreePrivacy" >用户隐私政策</text>
</text>
</view>
<navigator class="forget-pwd" url="/pageSubPack/loginSub/forget-pwd">忘记密码</navigator>
@@ -72,7 +72,7 @@
<script setup>
import { ref, computed } from 'vue';
import {onLoad} from "@dcloudio/uni-app"
// import {getLoginPassword} from '../api/api.js'
import {getLoginPassword} from '../api/api.js'
// 响应式数据
const phoneNumber = ref('');
@@ -80,7 +80,7 @@ const password = ref('');
const agreeAgreement = ref(false); // 默认勾选
const placeholderStyle = ref('font-size:24rpx')
// 控制点击变色
const isClicked = ref(false)
// const isClicked = ref(false)
// 计算属性:是否可登录(帐号+密码+协议都满足)
const canLogin = computed(() => {
@@ -97,7 +97,7 @@ const toggleAgreement = () => {
// 跳转隐私协议
const goToPrivacy = () => {
// 点击变色
isClicked.value = true
// isClicked.value = true
uni.navigateTo({
url:'/pageSubPack/loginSub/privacy',
})
@@ -134,43 +134,43 @@ const handleLogin = () => {
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) {
// // 存当前绑定的小区ID0 表示未绑定
// 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' });
// }
getLoginPassword(params).then(res =>{
// console.log('33333',res)
if(res.code === 200){
uni.setStorageSync('token', res.data.token);
// 存用户ID
if(res.data) {
// 存当前绑定的小区ID0 表示未绑定
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: '网络异常',
icon: 'error'
});
})
// 测试
uni.showLoading({
title: '登录中...',
mask:true
});
setTimeout(() => {
uni.switchTab({ url: '/pages/index/index' });
}, 1500);
uni.hideLoading()
// uni.showLoading({
// title: '登录中...',
// mask:true
// });
// setTimeout(() => {
// uni.switchTab({ url: '/pages/index/index' });
// }, 1500);
// uni.hideLoading()
};
</script>
@@ -237,11 +237,11 @@ const handleLogin = () => {
margin-left: 10rpx;
}
.agreePrivacy{
color: #666;
}
.agreePrivacy.active{
color: #2F77FD;
}
/* .agreePrivacy.active{
color: #2F77FD;
} */
.forget-pwd {
font-size: 28rpx;