修改我的车辆审核状态、问卷调查、登录添加用户隐私协议弹窗

This commit is contained in:
zhouyanli
2026-06-18 16:38:56 +08:00
parent 1efa212d26
commit 36ee7c3562
7 changed files with 734 additions and 453 deletions

View File

@@ -30,7 +30,7 @@
<!-- 协议勾选 + 忘记密码 -->
<view class="agreement-wrap">
<view class="agreement-item">
<view @click="toggleAgreement">
<view @click="toggleAgreement" class="checkbox-icon">
<uni-icons
type="checkbox-filled"
size="24"
@@ -42,11 +42,12 @@
size="24"
color="#999"
v-else
></uni-icons>
></uni-icons>
</view>
<text class="agreement-text" @click.stop="goToPrivacy">我已阅读并同意
<text class="agreePrivacy" >用户隐私政策</text>
<text class="agreement-text" >我已阅读并同意
<text class="agreePrivacy" @click.stop="">用户协议</text>
<text class="agreePrivacy" @click.stop="goToPrivacy">隐私政策</text>
</text>
</view>
<navigator class="forget-pwd" url="/pageSubPack/loginSub/forget-pwd">忘记密码</navigator>
@@ -66,12 +67,16 @@
<navigator class="link-item" url="/pageSubPack/loginSub/register-new-user">注册新用户</navigator>
</view>
</view>
<!-- 隐私协议弹窗 -->
<privacy-popup v-model:show="showPrivacyPopup" @agree="agreePrivacy" @disagree="disagreePrivacy" @close="showPrivacyPopup = false" />
</template>
<script setup>
import { ref, computed } from 'vue';
import {onLoad} from "@dcloudio/uni-app"
import {getLoginPassword} from '../api/api.js'
import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue'
// 响应式数据
const phoneNumber = ref('');
@@ -92,11 +97,37 @@ const toggleAgreement = () => {
agreeAgreement.value = !agreeAgreement.value;
};
// 跳转隐私协议
const showPrivacyPopup = ref(false)
const pendingAction = ref('') // 记录待执行操作,如 'smsLogin'
// 跳转隐私协议页面
const goToPrivacy = () => {
uni.navigateTo({
url:'/pageSubPack/loginSub/privacy',
})
uni.navigateTo({ url: "/pageSubPack/loginSub/privacy" })
}
// 打开隐私弹窗(可传入待执行操作标识)
const openPrivacyPopup = (action) => {
pendingAction.value = action || ''
showPrivacyPopup.value = true
}
// 同意隐私协议
const agreePrivacy = () => {
showPrivacyPopup.value = false
agreeAgreement.value = true
// 执行之前拦截的操作
if (pendingAction.value === 'smsLogin') {
uni.navigateTo({ url: '/pageSubPack/loginSub/login' })
} else if (pendingAction.value === 'login') {
doLogin()
}
pendingAction.value = ''
}
// 不同意隐私协议
const disagreePrivacy = () => {
showPrivacyPopup.value = false
pendingAction.value = ''
}
// 检查表单
@@ -130,9 +161,13 @@ const handleLogin = () => {
return;
}
if(!agreeAgreement.value){
uni.showToast({ title: '请勾选协议', icon: 'none' });
openPrivacyPopup('login')
return;
}
doLogin()
};
const doLogin = () => {
uni.showLoading({ title: '登录中...', mask: true });
const push_cid = uni.getStorageSync('push_cid')
let params = {
@@ -143,33 +178,32 @@ const handleLogin = () => {
getLoginPassword(params).then(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.setStorageSync('userId',res.data.userId)
}
uni.hideLoading();
uni.showToast({ title: '登录成功', icon: 'success' });
setTimeout(() =>{
uni.switchTab({
url: '/pages/index/index'
},1000);
})
// 存用户ID
if(res.data) {
// 存当前绑定的小区ID0 表示未绑定
const currentVillageId = res.data.currentVillageId || 0;
uni.setStorageSync('currentVillageId', currentVillageId);
uni.setStorageSync('userId',res.data.userId)
}
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 => {
// console.log('密码登录异常',err)
uni.hideLoading();
uni.showToast({
title: err.msg || '网络异常',
icon: 'error'
});
})
// console.log('密码登录异常',err)
uni.hideLoading();
uni.showToast({
title: err.msg || '网络异常',
icon: 'error'
});
})
};
</script>
@@ -233,33 +267,41 @@ const handleLogin = () => {
.agreement-wrap {
display: flex;
align-items: flex-start;
justify-content: space-between;
align-items: center;
margin: 70rpx 0 28rpx 0;
padding: 0 10rpx;
}
.agreement-item {
display: flex;
align-items: center;
align-items: flex-start;
flex: 1;
min-width: 0;
}
.checkbox-icon {
flex-shrink: 0;
margin-top: 2rpx;
}
.agreement-text {
font-size: 24rpx;
color: #666;
margin-left: 10rpx;
line-height: 1.5;
}
.agreePrivacy{
color: #2F77FD;
}
/* .agreePrivacy.active{
color: #2F77FD;
} */
.forget-pwd {
font-size: 24rpx;
color: #666;
text-decoration: none;
flex-shrink: 0;
margin-left: 16rpx;
line-height: 1.5;
}
.login-btn {
@@ -295,4 +337,5 @@ button:after{
color: #007aff;
text-decoration: none;
}
</style>
</style>