修复审核不通过的代码

This commit is contained in:
zhouyanli
2026-07-24 08:36:00 +08:00
parent 0cd2323bc2
commit ace7d969ac
7 changed files with 339 additions and 293 deletions

View File

@@ -1,6 +1,13 @@
<template>
<view class="login-page">
<view class="status_bar"></view>
<!-- 自定义导航栏:返回按钮 — 用户可拒绝登录 -->
<view class="custom-nav">
<view class="back-btn" @click="handleCancel">
<uni-icons type="arrow-left" size="24" color="#333"></uni-icons>
<text class="back-text">返回</text>
</view>
</view>
<!-- 登录标题 -->
<view class="login-title">手机验证码登录</view>
@@ -13,14 +20,6 @@
<uni-easyinput class="input-content" type="number" v-model="phoneNumber"
placeholder="请输入手机号" :inputBorder="false" maxlength="11" :placeholderStyle="placeholderStyle">
</uni-easyinput>
<!-- <input
class="input-content"
type="number"
placeholder="请输入手机号"
v-model="phoneNumber"
maxlength="11"
@input="checkForm"
/> -->
</view>
<!-- 验证码输入框 + 获取验证码按钮 -->
@@ -56,7 +55,7 @@
v-else
></uni-icons>
</view>
<text class="agreement-text" @click.stop="goToPrivacy">我已阅读并同意<text class="agreePrivacy">《用户隐私政策》</text></text>
<text class="agreement-text" @click.stop="goToPrivacy">我已阅读并同意<text class="agreePrivacy" @click.stop="goToPrivacy">《用户隐私政策》</text></text>
</view>
<!-- 登录按钮 -->
@@ -79,6 +78,7 @@
import { ref, computed, onUnmounted } from 'vue';
import {getLoginBySms,getSendCode} from '../api/api.js'
import { showApiError } from '../api/request.js'
import { saveLoginData } from '../api/auth.js'
// ========== 响应式数据 ==========
// 手机号
@@ -109,6 +109,16 @@ const canLogin = computed(() => {
});
// ========== 方法 ==========
// 用户取消登录 — 返回上一页
const handleCancel = () => {
const pages = getCurrentPages();
if (pages.length > 1) {
uni.navigateBack();
} else {
uni.switchTab({ url: '/pages/paymentIndex/paymentIndex' });
}
};
// 检查表单状态
const checkForm = () => {
// 无需额外逻辑,计算属性已实时监听
@@ -187,43 +197,24 @@ const handleLogin = () => {
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);
}
// 存当前绑定的小区ID,0 表示未绑定
const currentVillageId = res.data.currentVillageId || 0;
uni.setStorageSync('currentVillageId', currentVillageId);
saveLoginData(res.data);
uni.hideLoading();
uni.showToast({ title: '登录成功', icon: 'success' });
setTimeout(() =>{
uni.switchTab({ url: '/pages/paymentIndex/paymentIndex' });
// 登录成功后返回来源页
uni.navigateBack({
fail: () => {
uni.switchTab({ url: '/pages/paymentIndex/paymentIndex' });
}
});
},1500)
// }else{
// uni.showToast({ title: '登录失败', icon: 'error' });
}
// }else{
// uni.showToast({ title:'登录失败', icon: 'error' });
}
}).catch(err => {
showApiError(err)
})
// 模拟登录请求
// uni.showLoading({
// title: '登录中...'
// });
// uni.showToast({
// title:"登录成功",
// icon:'success'
// })
// setTimeout(() =>{
// uni.switchTab({ url: '/pages/paymentIndex/paymentIndex' });
// },1500)
uni.hideLoading()
};
@@ -245,17 +236,35 @@ onUnmounted(() => {
background: repeating-linear-gradient(to bottom, #E2F0FF, #F6FAFF );
}
.status_bar {
height: 160px;
height: var(--status-bar-height, 88rpx);
width: 100%;
}
/* ===== 自定义导航:返回/取消按钮 ===== */
.custom-nav {
margin-bottom: 20rpx;
}
.back-btn {
display: inline-flex;
align-items: center;
padding: 10rpx 20rpx;
background: rgba(255,255,255,0.9);
border-radius: 30rpx;
box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.08);
}
.back-text {
font-size: 28rpx;
color: #333;
margin-left: 6rpx;
}
/* 登录标题 */
.login-title {
font-size: 52rpx;
font-weight: 600;
color: #333;
text-align: center;
margin-bottom: 142rpx;
margin-bottom: 80rpx;
}
/* 输入框项 */
@@ -356,9 +365,6 @@ onUnmounted(() => {
.agreePrivacy{
color: #2F77FD;
}
/* .agreePrivacy.active{
color: #2F77FD;
} */
/* 登录按钮 */
.login-btn {
width: 100%;
@@ -375,7 +381,6 @@ onUnmounted(() => {
.login-btn:disabled {
background-color: #99c8ff;
color: #fff;
/* border-radius: 50px; */
}
/* 禁用按钮边框 */
button:after{