恢复接口

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

@@ -64,7 +64,7 @@
v-else
></uni-icons>
</view>
<text class="agreement-text" @click.stop="goToPrivacy">我已阅读并同意<text class="agreePrivacy" :class="{active:isClicked}">用户隐私政策</text></text>
<text class="agreement-text" @click.stop="goToPrivacy">我已阅读并同意<text class="agreePrivacy">用户隐私政策</text></text>
</view>
<!-- 登录按钮 -->
@@ -86,7 +86,7 @@
<script setup>
import { ref, computed, onUnmounted } from 'vue';
// import {getLoginBySms,getSendCode} from '../api/api.js'
import {getLoginBySms,getSendCode} from '../api/api.js'
// ========== 响应式数据 ==========
// 手机号
@@ -101,7 +101,7 @@ const countDown = ref(0);
// 定时器
let timer = null;
// 控制点击变色
const isClicked = ref(false)
// const isClicked = ref(false)
// ========== 计算属性 ==========
// 是否可以获取验证码(手机号格式正确)
@@ -131,7 +131,7 @@ const toggleAgreement = () => {
// 跳转隐私协议
const goToPrivacy = () => {
// 点击变色
isClicked.value = true
// isClicked.value = true
uni.navigateTo({
url:'/pageSubPack/loginSub/privacy',
})
@@ -179,55 +179,55 @@ const getVerifyCode = () => {
// 登录处理
const handleLogin = () => {
if (!canLogin.value) return;
// uni.showLoading({ title: '登录中...', mask: true });
uni.showLoading({ title: '登录中...', mask: true });
let params = {
phone:phoneNumber.value,
smsCode:'123456',
scene:'login',
}
// getLoginBySms(params).then(res =>{
// if(res.code === 200){
// if(res.data){
// uni.setStorageSync('token', res.data.token);
// // 存用户ID
// if(res.data.userId) {
// uni.setStorageSync('userId', res.data.userId);
// }
// // 存当前绑定的小区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' });
// },1500)
// }else{
// uni.showToast({ title: '登录失败', icon: 'error' });
// }
getLoginBySms(params).then(res =>{
if(res.code === 200){
if(res.data){
uni.setStorageSync('token', res.data.token);
// 存用户ID
if(res.data.userId) {
uni.setStorageSync('userId', res.data.userId);
}
// 存当前绑定的小区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' });
},1500)
}else{
uni.showToast({ title: '登录失败', icon: 'error' });
}
// }else{
// uni.showToast({ title:'登录失败', icon: 'error' });
// }
}else{
uni.showToast({ title:'登录失败', icon: 'error' });
}
// }).catch(err => {
// uni.showToast({
// title: '网络异常,请重试',
// icon: 'error'
// });
// })
}).catch(err => {
uni.showToast({
title: '网络异常,请重试',
icon: 'error'
});
})
// 模拟登录请求
uni.showLoading({
title: '登录中...'
});
uni.showToast({
title:"登录成功",
icon:'success'
})
setTimeout(() =>{
uni.switchTab({ url: '/pages/index/index' });
},1500)
// uni.showLoading({
// title: '登录中...'
// });
// uni.showToast({
// title:"登录成功",
// icon:'success'
// })
// setTimeout(() =>{
// uni.switchTab({ url: '/pages/index/index' });
// },1500)
uni.hideLoading()
};
@@ -340,11 +340,11 @@ onUnmounted(() => {
margin-left: 10rpx;
}
.agreePrivacy{
color: #666;
}
.agreePrivacy.active{
color: #2F77FD;
}
/* .agreePrivacy.active{
color: #2F77FD;
} */
/* 登录按钮 */
.login-btn {
width: 100%;