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

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

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