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

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

@@ -0,0 +1,156 @@
<template>
<view class="privacy-mask" v-if="show" @click="handleMaskClick">
<view class="privacy-popup" @click.stop>
<view class="popup-header">
<text class="popup-title">请先阅读并同意协议</text>
<view class="popup-close" @click="handleClose"></view>
</view>
<scroll-view class="popup-body" scroll-y>
<view class="popup-content">
<view class="section-text">
我已仔细阅读并同意
<text class="privacy-link" @click="goToPrivacy">用户协议隐私政策</text>
全部内容
</view>
</view>
</scroll-view>
<view class="popup-footer">
<button class="popup-btn disagree-btn" @click="handleDisagree">不同意</button>
<button class="popup-btn agree-btn" @click="handleAgree">同意</button>
</view>
</view>
</view>
</template>
<script setup>
defineProps({
show: {
type: Boolean,
default: false
}
})
const emit = defineEmits(['agree', 'disagree', 'close', 'update:show'])
const handleAgree = () => {
emit('agree')
}
const handleDisagree = () => {
emit('disagree')
}
const handleClose = () => {
emit('close')
emit('update:show', false)
}
const handleMaskClick = () => {
emit('close')
emit('update:show', false)
}
const goToPrivacy = () => {
uni.navigateTo({ url: '/pageSubPack/loginSub/privacy' })
}
</script>
<style scoped>
.privacy-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 9999;
display: flex;
align-items: center;
justify-content: center;
}
.privacy-popup {
width: 640rpx;
max-height: 80vh;
background: #fff;
border-radius: 16rpx;
display: flex;
flex-direction: column;
overflow: hidden;
}
.popup-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 28rpx 30rpx 16rpx;
border-bottom: 1rpx solid #eee;
}
.popup-title {
font-size: 32rpx;
font-weight: 600;
color: #333;
}
.popup-close {
width: 48rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
color: #999;
border-radius: 50%;
background: #f5f5f5;
}
.popup-body {
flex: 1;
padding: 24rpx 30rpx;
max-height: 50vh;
}
.popup-content .section-text {
font-size: 26rpx;
line-height: 1.8;
color: #666;
text-align: justify;
}
.privacy-link {
color: #007aff;
}
.popup-footer {
display: flex;
padding: 20rpx 30rpx 30rpx;
gap: 20rpx;
border-top: 1rpx solid #eee;
}
.popup-btn {
flex: 1;
height: 80rpx;
line-height: 80rpx;
border-radius: 8rpx;
font-size: 28rpx;
border: none;
padding: 0;
margin: 0;
}
.popup-btn::after {
border: none;
}
.disagree-btn {
background: #f5f5f5;
color: #666;
}
.agree-btn {
background: #007aff;
color: #fff;
}
</style>

View File

@@ -95,12 +95,12 @@ export const getQuestionnaireList = (data) => {
return get('/api/resident/questionnaire/list',data) return get('/api/resident/questionnaire/list',data)
} }
// 问卷详情 // 问卷详情
export const getQuestionnaireDetail = (data) => { export const getQuestionnaireDetail = (id,data) => {
return get('/api/resident/questionnaire/myAnswers',data) return get(`/api/resident/questionnaire/${id}`,data)
} }
// 提交问卷 // 提交问卷
export const submitQuestionnair = (id,data) => { export const submitQuestionnair = (id,data) => {
return post(`/api/resident/questionnaire/${id}/submit`, data) return post(`/api/resident/questionnaire/submit/${id}`, data)
} }
// =====投诉意见======= // =====投诉意见=======
// 获取投诉类型 // 获取投诉类型

View File

@@ -56,7 +56,11 @@
v-else v-else
></uni-icons> ></uni-icons>
</view> </view>
<text class="agreement-text" @click.stop="goToPrivacy">我已阅读并同意<text class="agreePrivacy">用户隐私政策</text></text> <text class="agreement-text" >
我已阅读并同意
<text class="agreePrivacy">用户协议</text>
<text @click.stop="goToPrivacy" class="agreePrivacy">隐私政策</text>
</text>
</view> </view>
<!-- 登录按钮 --> <!-- 登录按钮 -->
@@ -72,12 +76,16 @@
<navigator class="link-item" url="/pageSubPack/loginSub/pwd-login">账号密码登录</navigator> <navigator class="link-item" url="/pageSubPack/loginSub/pwd-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>
<!-- 隐私协议弹窗 -->
<privacy-popup v-model:show="showPrivacyPopup" @agree="agreePrivacy" @disagree="disagreePrivacy" @close="showPrivacyPopup = false" />
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref, computed, onUnmounted } from 'vue'; import { ref, computed, onUnmounted } from 'vue';
import {getLoginBySms,getSendCode} from '../api/api.js' import {getLoginBySms,getSendCode} from '../api/api.js'
import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue'
// ========== 响应式数据 ========== // ========== 响应式数据 ==========
// 手机号 // 手机号
@@ -91,6 +99,9 @@ const agreeAgreement = ref(false); // 默认不勾选
const countDown = ref(0); const countDown = ref(0);
// 定时器 // 定时器
let timer = null; let timer = null;
// 隐私弹窗
const showPrivacyPopup = ref(false)
const pendingAction = ref('')
// ========== 计算属性 ========== // ========== 计算属性 ==========
// 是否可以获取验证码(手机号格式正确) // 是否可以获取验证码(手机号格式正确)
@@ -124,6 +135,28 @@ const goToPrivacy = () => {
}) })
} }
// 打开隐私弹窗
const openPrivacyPopup = (action) => {
pendingAction.value = action || ''
showPrivacyPopup.value = true
}
// 同意隐私协议
const agreePrivacy = () => {
showPrivacyPopup.value = false
agreeAgreement.value = true
if (pendingAction.value === 'login') {
doLogin()
}
pendingAction.value = ''
}
// 不同意隐私协议
const disagreePrivacy = () => {
showPrivacyPopup.value = false
pendingAction.value = ''
}
// 获取验证码 // 获取验证码
const getVerifyCode = () => { const getVerifyCode = () => {
if (!canGetVerify.value) return; if (!canGetVerify.value) return;
@@ -183,9 +216,13 @@ const handleLogin = () => {
return; return;
} }
if (!agreeAgreement.value) { if (!agreeAgreement.value) {
uni.showToast({ title: '请勾选协议', icon: 'none' }); openPrivacyPopup('login')
return; return;
} }
doLogin()
};
const doLogin = () => {
uni.showLoading({ title: '登录中...', mask: true }); uni.showLoading({ title: '登录中...', mask: true });
const push_cid = uni.getStorageSync('push_cid') const push_cid = uni.getStorageSync('push_cid')
let params = { let params = {
@@ -246,7 +283,7 @@ const handleLogin = () => {
// #endif // #endif
// setTimeout(() =>{ // setTimeout(() =>{
// uni.switchTab({ url: '/pages/index/index' }); // uni.switchTab({ url: '/pages/index/index' });
// },1500) // },1500)
uni.hideLoading() uni.hideLoading()
}; };

View File

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

View File

@@ -1,456 +1,486 @@
<template> <template>
<view class="register-page"> <view class="register-page">
<view class="status_bar"></view> <view class="status_bar"></view>
<!-- 顶部导航 --> <!-- 顶部导航 -->
<view class="nav-bar"> <view class="nav-bar">
<uni-icons type="left" size="28" color="#333" @click="goBack"></uni-icons> <uni-icons type="left" size="28" color="#333" @click="goBack"></uni-icons>
<view class="nav-title">注册</view> <view class="nav-title">注册</view>
</view>
<!-- 注册标题 -->
<view class="register-title">注册用户</view>
<!-- 手机号输入框 -->
<view class="input-item">
<view class="input-icon">
<image src="https://wuyeadmin.bugtc.com/images/login/phone.png" mode=""
style="height: 100%;width: 100%;"></image>
</view> </view>
<uni-easyinput class="input-content" type="number" v-model="phoneNumber" placeholder="请输入手机号"
:inputBorder="false" maxlength="11" :placeholderStyle="placeholderStyle">
</uni-easyinput>
</view>
<!-- 验证码输入 + 获取验证码按钮 --> <!-- 注册标题 -->
<view class="input-item verify-item"> <view class="register-title">注册用户</view>
<view class="input-icon">
<image src="https://wuyeadmin.bugtc.com/images/login/code.png" mode="" style="height: 100%;width: 100%;"> <!-- 手机号输入框 -->
</image> <view class="input-item">
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> --> <view class="input-icon">
<image src="https://wuyeadmin.bugtc.com/images/login/phone.png" mode=""
style="height: 100%;width: 100%;"></image>
</view>
<uni-easyinput class="input-content" type="number" v-model="phoneNumber" placeholder="请输入手机号"
:inputBorder="false" maxlength="11" :placeholderStyle="placeholderStyle">
</uni-easyinput>
</view> </view>
<uni-easyinput class="input-content verify-input" type="number" v-model="verifyCode" placeholder="请输入验证码"
:inputBorder="false" maxlength="6" :placeholderStyle="placeholderStyle">
</uni-easyinput>
<button class="get-verify-btn" :disabled="!canGetVerify || countDown > 0" @click="getVerifyCode"> <!-- 验证码输入 + 获取验证码按钮 -->
{{ countDown > 0 ? `${countDown}s后重新获取` : '获取验证码' }} <view class="input-item verify-item">
<view class="input-icon">
<image src="https://wuyeadmin.bugtc.com/images/login/code.png" mode="" style="height: 100%;width: 100%;">
</image>
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
</view>
<uni-easyinput class="input-content verify-input" type="number" v-model="verifyCode" placeholder="请输入验证码"
:inputBorder="false" maxlength="6" :placeholderStyle="placeholderStyle">
</uni-easyinput>
<button class="get-verify-btn" :disabled="!canGetVerify || countDown > 0" @click="getVerifyCode">
{{ countDown > 0 ? `${countDown}s后重新获取` : '获取验证码' }}
</button>
</view>
<!-- 账号输入框 -->
<view class="input-item">
<view class="input-icon">
<image src="https://wuyeadmin.bugtc.com/images/login/account.png" mode=""
style="height: 100%;width: 100%;"></image>
<!-- <uni-icons type="person" size="24" color="#999"></uni-icons> -->
</view>
<uni-easyinput class="input-content" type="text" v-model="account" placeholder="请输入账号" :inputBorder="false"
:placeholderStyle="placeholderStyle">
</uni-easyinput>
</view>
<!-- 密码输入框 -->
<view class="input-item">
<view class="input-icon">
<image src="https://wuyeadmin.bugtc.com/images/login/password.png" mode=""
style="height: 100%;width: 100%;"></image>
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
</view>
<uni-easyinput class="input-content" type="password" v-model="password" placeholder="请输入密码"
:inputBorder="false" :placeholderStyle="placeholderStyle">
</uni-easyinput>
</view>
<!-- 协议勾选 -->
<view class="agreement-item">
<view @click="toggleAgreement">
<uni-icons type="checkbox-filled" size="24" color="#007aff" v-if="agreeAgreement"></uni-icons>
<uni-icons type="checkbox" size="24" color="#999" v-else></uni-icons>
</view>
<!-- <text class="agreement-text" @click.stop="goToPrivacy">我已阅读并同意<text
class="agreePrivacy">用户隐私政策</text></text> -->
<text class="agreement-text" >我已阅读并同意
<text class="agreePrivacy" @click.stop="">用户协议</text>
<text class="agreePrivacy" @click.stop="goToPrivacy">隐私政策</text>
</text>
</view>
<!-- 立即注册按钮 -->
<button class="register-btn" @click="handleRegister">
立即注册
</button> </button>
</view>
<!-- 账号输入框 --> <!-- 跳转登录链接 -->
<view class="input-item"> <view class="login-link">
<view class="input-icon"> <navigator class="link-item" url="/pageSubPack/loginSub/login">已有账号去登录</navigator>
<image src="https://wuyeadmin.bugtc.com/images/login/account.png" mode=""
style="height: 100%;width: 100%;"></image>
<!-- <uni-icons type="person" size="24" color="#999"></uni-icons> -->
</view> </view>
<uni-easyinput class="input-content" type="text" v-model="account" placeholder="请输入账号" :inputBorder="false"
:placeholderStyle="placeholderStyle">
</uni-easyinput>
<!-- 隐私协议弹窗 -->
<privacy-popup v-model:show="showPrivacyPopup" @agree="agreePrivacy" @disagree="disagreePrivacy" @close="showPrivacyPopup = false" />
</view> </view>
</template>
<!-- 密码输入框 --> <script setup>
<view class="input-item"> import {
<view class="input-icon"> ref,
<image src="https://wuyeadmin.bugtc.com/images/login/password.png" mode="" computed,
style="height: 100%;width: 100%;"></image> onUnmounted
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> --> } from 'vue';
</view> import {
<uni-easyinput class="input-content" type="password" v-model="password" placeholder="请输入密码" getRegisterUser,
:inputBorder="false" :placeholderStyle="placeholderStyle"> getSendCode
</uni-easyinput> } from '../api/api.js'
import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue'
</view> // ========== 响应式数据 ==========
<!-- 协议勾选 --> // 表单数据
<view class="agreement-item"> const phoneNumber = ref('');
<view @click="toggleAgreement"> const verifyCode = ref('');
<uni-icons type="checkbox-filled" size="24" color="#007aff" v-if="agreeAgreement"></uni-icons> const account = ref('');
<uni-icons type="checkbox" size="24" color="#999" v-else></uni-icons> const password = ref('');
</view> const placeholderStyle = ref('font-size:24rpx')
<text class="agreement-text" @click.stop="goToPrivacy">我已阅读并同意<text // 协议勾选
class="agreePrivacy">用户隐私政策</text></text> const agreeAgreement = ref(false);
</view> // 隐私弹窗
const showPrivacyPopup = ref(false)
const pendingAction = ref('')
// 验证码倒计时
const countDown = ref(0);
let timer = null;
// ========== 计算属性 ==========
// 是否可获取验证码(手机号格式正确)
const canGetVerify = computed(() => {
const phoneReg = /^1[3-9]\d{9}$/;
return phoneReg.test(phoneNumber.value);
});
<!-- 立即注册按钮 --> // 是否可注册(所有表单项+协议都满足)
<button class="register-btn" @click="handleRegister"> const canRegister = computed(() => {
立即注册 const phoneReg = /^1[3-9]\d{9}$/; // 手机号11位
</button> const verifyReg = /^\d{6}$/; // 验证码6位
const accountReg = /^.{4,20}$/; // 账号4-20位
const pwdReg = /^.{6,16}$/; // 密码6-16位
<!-- 跳转登录链接 --> return phoneReg.test(phoneNumber.value) &&
<view class="login-link"> verifyReg.test(verifyCode.value) &&
<navigator class="link-item" url="/pageSubPack/loginSub/login">已有账号去登录</navigator> accountReg.test(account.value) &&
</view> pwdReg.test(password.value) &&
</view> agreeAgreement.value;
</template> });
<script setup> // ========== 方法 ==========
import { // 返回上一页
ref, const goBack = () => {
computed, uni.navigateBack();
onUnmounted };
} from 'vue';
import {
getRegisterUser,
getSendCode
} from '../api/api.js'
// ========== 响应式数据 ========== // 切换协议勾选状态
// 表单数据 const toggleAgreement = () => {
const phoneNumber = ref(''); agreeAgreement.value = !agreeAgreement.value;
const verifyCode = ref(''); };
const account = ref(''); // 跳转隐私协议
const password = ref(''); const goToPrivacy = () => {
const placeholderStyle = ref('font-size:24rpx') uni.navigateTo({
// 协议勾选 url: '/pageSubPack/loginSub/privacy',
const agreeAgreement = ref(false); })
// 验证码倒计时
const countDown = ref(0);
let timer = null;
// ========== 计算属性 ==========
// 是否可获取验证码(手机号格式正确)
const canGetVerify = computed(() => {
const phoneReg = /^1[3-9]\d{9}$/;
return phoneReg.test(phoneNumber.value);
});
// 是否可注册(所有表单项+协议都满足)
const canRegister = computed(() => {
const phoneReg = /^1[3-9]\d{9}$/; // 手机号11位
const verifyReg = /^\d{6}$/; // 验证码6位
const accountReg = /^.{4,20}$/; // 账号4-20位
const pwdReg = /^.{6,16}$/; // 密码6-16位
return phoneReg.test(phoneNumber.value) &&
verifyReg.test(verifyCode.value) &&
accountReg.test(account.value) &&
pwdReg.test(password.value) &&
agreeAgreement.value;
});
// ========== 方法 ==========
// 返回上一页
const goBack = () => {
uni.navigateBack();
};
// 切换协议勾选状态
const toggleAgreement = () => {
agreeAgreement.value = !agreeAgreement.value;
};
// 跳转隐私协议
const goToPrivacy = () => {
uni.navigateTo({
url: '/pageSubPack/loginSub/privacy',
})
}
// 检查表单状态(实时更新按钮状态)
const checkForm = () => {};
// 获取验证码
const getVerifyCode = () => {
if (!canGetVerify.value) return;
let params = {
phone: phoneNumber.value,
scene: 'register'
} }
getSendCode(params).then(res => { // 检查表单状态(实时更新按钮状态)
if (res.code === 200) { const checkForm = () => {};
uni.showToast({
title: '验证码已发送',
icon: 'success'
});
// 开始60秒倒计时
countDown.value = 60;
timer = setInterval(() => {
countDown.value--;
if (countDown.value <= 0) {
clearInterval(timer);
timer = null;
}
}, 1000);
} else { // 打开隐私弹窗
const openPrivacyPopup = (action) => {
pendingAction.value = action || ''
showPrivacyPopup.value = true
}
// 同意隐私协议
const agreePrivacy = () => {
showPrivacyPopup.value = false
agreeAgreement.value = true
if (pendingAction.value === 'register') {
doRegister()
}
pendingAction.value = ''
}
// 不同意隐私协议
const disagreePrivacy = () => {
showPrivacyPopup.value = false
pendingAction.value = ''
}
// 获取验证码
const getVerifyCode = () => {
if (!canGetVerify.value) return;
let params = {
phone: phoneNumber.value,
scene: 'register'
}
getSendCode(params).then(res => {
if (res.code === 200) {
uni.showToast({
title: '验证码已发送',
icon: 'success'
});
// 开始60秒倒计时
countDown.value = 60;
timer = setInterval(() => {
countDown.value--;
if (countDown.value <= 0) {
clearInterval(timer);
timer = null;
}
}, 1000);
} else {
uni.showToast({
title: '验证码发送失败',
icon: 'error'
});
}
}).catch(err => {
uni.showToast({ uni.showToast({
title: '验证码发送失败', title: err.msg || '网络异常',
icon: 'error' icon: 'error'
}); });
})
};
// 处理注册逻辑
const handleRegister = () => {
if (!phoneNumber.value) {
uni.showToast({ title: '请输入手机号', icon: 'none' });
return;
} }
}).catch(err => { if (!/^1[3-9]\d{9}$/.test(phoneNumber.value)) {
uni.showToast({ uni.showToast({ title: '请输入正确的手机号', icon: 'none' });
title: err.msg || '网络异常', return;
icon: 'error' }
if (!verifyCode.value) {
uni.showToast({ title: '请输入验证码', icon: 'none' });
return;
}
if (!/^\d{6}$/.test(verifyCode.value)) {
uni.showToast({ title: '验证码为 6 位数字', icon: 'none' });
return;
}
if (!account.value) {
uni.showToast({ title: '请输入账号', icon: 'none' });
return;
}
if (account.value.length < 4 || account.value.length > 20) {
uni.showToast({ title: '账号长度需为 4-20 位', icon: 'none' });
return;
}
if (!password.value) {
uni.showToast({ title: '请输入密码', icon: 'none' });
return;
}
if (password.value.length < 6) {
uni.showToast({ title: '密码至少输入 6 位', icon: 'none' });
return;
}
if (password.value.length > 16) {
uni.showToast({ title: '密码不能超过 16 位', icon: 'none' });
return;
}
if (!agreeAgreement.value) {
openPrivacyPopup('register')
return;
}
doRegister()
};
const doRegister = () => {
uni.showLoading({
title: '注册中...',
mask: true
}); });
}) let params = {
phone: phoneNumber.value,
smsCode: verifyCode.value,
username: account.value,
password: password.value
}
getRegisterUser(params).then(res => {
if (res.code === 200) {
uni.hideLoading();
uni.showToast({
title: '注册成功',
icon: 'success'
});
setTimeout(() => {
uni.redirectTo({
url: '/pageSubPack/loginSub/pwd-login'
});
}, 1500);
} else {
}; uni.showToast({
title: '注册失败',
// 处理注册逻辑 icon: 'error'
const handleRegister = () => { });
if (!phoneNumber.value) { }
uni.showToast({ title: '请输入手机号', icon: 'none' }); }).catch((err) => {
return;
}
if (!/^1[3-9]\d{9}$/.test(phoneNumber.value)) {
uni.showToast({ title: '请输入正确的手机号', icon: 'none' });
return;
}
if (!verifyCode.value) {
uni.showToast({ title: '请输入验证码', icon: 'none' });
return;
}
if (!/^\d{6}$/.test(verifyCode.value)) {
uni.showToast({ title: '验证码为 6 位数字', icon: 'none' });
return;
}
if (!account.value) {
uni.showToast({ title: '请输入账号', icon: 'none' });
return;
}
if (account.value.length < 4 || account.value.length > 20) {
uni.showToast({ title: '账号长度需为 4-20 位', icon: 'none' });
return;
}
if (!password.value) {
uni.showToast({ title: '请输入密码', icon: 'none' });
return;
}
if (password.value.length < 6) {
uni.showToast({ title: '密码至少输入 6 位', icon: 'none' });
return;
}
if (password.value.length > 16) {
uni.showToast({ title: '密码不能超过 16 位', icon: 'none' });
return;
}
if (!agreeAgreement.value) {
uni.showToast({ title: '请勾选协议', icon: 'none' });
return;
}
uni.showLoading({
title: '注册中...',
mask: true
});
let params = {
phone: phoneNumber.value,
smsCode: verifyCode.value,
username: account.value,
password: password.value
}
getRegisterUser(params).then(res => {
if (res.code === 200) {
uni.hideLoading(); uni.hideLoading();
uni.showToast({ uni.showToast({
title: '注册成功', title: err.msg || '网络异常',
icon: 'success'
});
setTimeout(() => {
uni.redirectTo({
url: '/pageSubPack/loginSub/pwd-login'
});
}, 1500);
} else {
uni.showToast({
title: '注册失败',
icon: 'error' icon: 'error'
}); });
})
};
// ========== 生命周期 ==========
// 页面卸载时清除定时器
onUnmounted(() => {
if (timer) {
clearInterval(timer);
} }
}).catch((err) => { });
uni.hideLoading(); </script>
uni.showToast({
title: err.msg || '网络异常',
icon: 'error'
});
})
// 注册成功后跳转到登录页
// uni.redirectTo({
// url: '/pages/login/pwd-login'
// });
// setTimeout(() => { <style scoped>
/* 页面容器 */
// }, 1500); .register-page {
}; padding: 20rpx 40rpx 40rpx;
/* background-color: #f8f9fa; */
// ========== 生命周期 ========== min-height: 100vh;
// 页面卸载时清除定时器 background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF);
onUnmounted(() => {
if (timer) {
clearInterval(timer);
} }
});
</script>
<style scoped> .status_bar {
/* 页面容器 */ height: 46px;
.register-page { width: 100%;
padding: 20rpx 40rpx 40rpx; }
/* background-color: #f8f9fa; */
min-height: 100vh;
background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF);
}
.status_bar { /* 顶部导航栏 */
height: 46px; .nav-bar {
width: 100%; display: flex;
} align-items: center;
/* height: 88rpx; */
margin-bottom: 70rpx;
}
/* 顶部导航栏 */ .nav-title {
.nav-bar { flex: 1;
display: flex; text-align: center;
align-items: center; font-size: 36rpx;
/* height: 88rpx; */ font-weight: 500;
margin-bottom: 70rpx; color: #333;
} margin-right: 100rpx;
}
.nav-title { /* 注册标题 */
flex: 1; .register-title {
text-align: center; font-size: 40rpx;
font-size: 36rpx; font-weight: 600;
font-weight: 500; color: #333;
color: #333; margin-bottom: 60rpx;
margin-right: 100rpx; }
}
/* 注册标题 */ /* 输入框通用样式 */
.register-title { .input-item {
font-size: 40rpx; display: flex;
font-weight: 600; align-items: center;
color: #333; background-color: #fff;
margin-bottom: 60rpx; border-radius: 40rpx;
} padding: 0 30rpx;
height: 88rpx;
margin-bottom: 30rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
}
/* 输入框通用样式 */ /* 验证码输入项特殊布局 */
.input-item { .verify-item {
display: flex; position: relative;
align-items: center; padding-right: 220rpx;
background-color: #fff; }
border-radius: 40rpx;
padding: 0 30rpx;
height: 88rpx;
margin-bottom: 30rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
}
/* 验证码输入项特殊布局 */ /* 输入框图标 */
.verify-item { .input-icon {
position: relative; margin-right: 20rpx;
padding-right: 220rpx; color: #999;
} width: 50rpx;
height: 50rpx;
}
/* 输入框图标 */ /* 输入框内容 */
.input-icon { .input-content {
margin-right: 20rpx; flex: 1;
color: #999; font-size: 32rpx;
width: 50rpx; color: #333;
height: 50rpx; height: 100%;
} }
/* 输入框内容 */ /* 深度覆盖 uni-easyinput 内部默认样式,解决高度偏移 */
.input-content { .input-content :deep(.uni-easyinput__content) {
flex: 1; height: 100% !important;
font-size: 32rpx; min-height: unset !important;
color: #333; padding: 0 !important;
height: 100%; background-color: transparent !important;
} }
/* 深度覆盖 uni-easyinput 内部默认样式,解决高度偏移 */ .input-content :deep(.uni-easyinput__content-input) {
.input-content :deep(.uni-easyinput__content) { height: 100% !important;
height: 100% !important; min-height: unset !important;
min-height: unset !important; padding: 0 !important;
padding: 0 !important; line-height: 88rpx;
background-color: transparent !important; }
}
.input-content :deep(.uni-easyinput__content-input) { .verify-input {
height: 100% !important; padding-right: 20rpx;
min-height: unset !important; }
padding: 0 !important;
line-height: 88rpx;
}
.verify-input { /* 获取验证码按钮 */
padding-right: 20rpx; .get-verify-btn {
} position: absolute;
right: 10rpx;
top: 50%;
transform: translateY(-50%);
width: 200rpx;
height: 70rpx;
line-height: 70rpx;
background-color: #007aff;
color: #fff;
border-radius: 35rpx;
font-size: 26rpx;
padding: 0;
margin: 0;
}
/* 获取验证码按钮 */ .get-verify-btn:disabled {
.get-verify-btn { background-color: #ccc;
position: absolute; color: #fff;
right: 10rpx; }
top: 50%;
transform: translateY(-50%);
width: 200rpx;
height: 70rpx;
line-height: 70rpx;
background-color: #007aff;
color: #fff;
border-radius: 35rpx;
font-size: 26rpx;
padding: 0;
margin: 0;
}
.get-verify-btn:disabled { .get-verify-btn::after {
background-color: #ccc; border-radius: 50px;
color: #fff; }
}
.get-verify-btn::after { /* 协议勾选项 */
border-radius: 50px; .agreement-item {
} display: flex;
align-items: center;
margin: 70rpx 0 28rpx 0;
padding-left: 10rpx;
}
/* 协议勾选项 */ .agreement-text {
.agreement-item { font-size: 24rpx;
display: flex; color: #666;
align-items: center; margin-left: 10rpx;
margin: 70rpx 0 28rpx 0; }
padding-left: 10rpx;
}
.agreement-text { .agreePrivacy {
font-size: 24rpx; color: #2F77FD;
color: #666; }
margin-left: 10rpx;
}
.agreePrivacy { /* 立即注册按钮 */
color: #2F77FD; .register-btn {
} width: 100%;
height: 88rpx;
line-height: 88rpx;
background-color: #007aff;
color: #fff;
border-radius: 8rpx;
font-size: 28rpx;
margin-bottom: 40rpx;
}
/* 立即注册按钮 */ button:after {
.register-btn { border-radius: 8px;
width: 100%; }
height: 88rpx;
line-height: 88rpx;
background-color: #007aff;
color: #fff;
border-radius: 8rpx;
font-size: 28rpx;
margin-bottom: 40rpx;
}
button:after { .register-btn:disabled {
border-radius: 8px; background-color: #99c8ff;
} color: #fff;
}
.register-btn:disabled { /* 跳转登录链接 */
background-color: #99c8ff; .login-link {
color: #fff; text-align: center;
} }
/* 跳转登录链接 */ .link-item {
.login-link { font-size: 28rpx;
text-align: center; color: #007aff;
} text-decoration: none;
}
.link-item { </style>
font-size: 28rpx;
color: #007aff;
text-decoration: none;
}
</style>

View File

@@ -20,10 +20,10 @@
<view class="car-bindParkingSpace">{{ item.bindParkingSpace }}</view> <view class="car-bindParkingSpace">{{ item.bindParkingSpace }}</view>
</view> </view>
<!-- certificationStatus --> <!-- certificationStatus -->
<view class="status-tag" <!-- <view class="status-tag"
:class="{ underReview: item.certificationStatus === '审核中', unbound: item.certificationStatus === '未绑定', bounded: item.certificationStatus === ''}"> :class="{ underReview: item.certificationStatus === '审核中', unbound: item.certificationStatus === '未绑定', bounded: item.certificationStatus === ''}">
{{ item.certificationStatus }} {{ item.certificationStatus }}
</view> </view> -->
</view> </view>
</scroll-view> </scroll-view>
<view class="bottom-btn"> <view class="bottom-btn">

View File

@@ -88,10 +88,11 @@
<script setup> <script setup>
import { ref, computed } from 'vue' import { ref, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app' import { onLoad, onShow } from '@dcloudio/uni-app'
import { getQuestionnaireDetail, submitQuestionnair } from '../api/apiSub.js' import { getQuestionnaireDetail, submitQuestionnair } from '../api/apiSub.js'
const detailItem = ref({}) const detailItem = ref({})
const questionnaireId = ref('') // 保存问卷ID用于 onShow 重新获取
const questionList = computed(() => { const questionList = computed(() => {
const content = detailItem.value?.content const content = detailItem.value?.content
@@ -108,7 +109,10 @@ const answers = ref({})
// 获取问卷调查 // 获取问卷调查
const getDetailData = async (id) => { const getDetailData = async (id) => {
try { try {
const res = await getQuestionnaireDetail({ id }) let params = {
villageId:uni.getStorageSync('currentVillageId')
}
const res = await getQuestionnaireDetail(id,params)
// console.log('接口返回:', JSON.stringify(res)) // console.log('接口返回:', JSON.stringify(res))
if (res.code === 200) { if (res.code === 200) {
const data = Array.isArray(res.data) ? res.data[0] : res.data const data = Array.isArray(res.data) ? res.data[0] : res.data
@@ -123,12 +127,20 @@ const getDetailData = async (id) => {
onLoad((option) => { onLoad((option) => {
if (option.id) { if (option.id) {
questionnaireId.value = option.id
getDetailData(option.id) getDetailData(option.id)
} else { } else {
uni.showToast({ title: '缺少问卷ID', icon: 'none' }) uni.showToast({ title: '缺少问卷ID', icon: 'none' })
} }
}) })
// 切换小区后返回页面时,重新获取数据
onShow(() => {
if (questionnaireId.value) {
getDetailData(questionnaireId.value)
}
})
const selectRadio = (cid, label) => { const selectRadio = (cid, label) => {
answers.value[cid] = label answers.value[cid] = label
} }
@@ -170,10 +182,13 @@ const handleSubmit = async () => {
answerList.push({ cid: q.cid, value: val }) answerList.push({ cid: q.cid, value: val })
} }
} }
uni.showLoading({ title: "提交中...", mask: true })
uni.showLoading({ title: '提交中...', mask: true })
try { try {
const res = await submitQuestionnair(detailItem.value.questionnaireId, answerList) let params = {
answerList,
villageId: uni.getStorageSync("currentVillageId")
}
const res = await submitQuestionnair(detailItem.value.id,params)
uni.hideLoading() uni.hideLoading()
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ title: '提交成功', icon: 'success' }) uni.showToast({ title: '提交成功', icon: 'success' })