问卷调查详情显示问题、已结束不能点击提交;
This commit is contained in:
@@ -234,7 +234,6 @@
|
||||
.bottom-btn-wrap {
|
||||
padding: 20rpx 30rpx 40rpx;
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.btn-modify {
|
||||
@@ -246,6 +245,7 @@
|
||||
font-size: 30rpx;
|
||||
border-radius: 8rpx;
|
||||
border: none;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.btn-delete {
|
||||
@@ -257,5 +257,6 @@
|
||||
border: 1rpx solid #f53f3f;
|
||||
font-size: 30rpx;
|
||||
border-radius: 8rpx;
|
||||
margin-right: 0rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -108,10 +108,10 @@ const mapData = (data) => {
|
||||
repairInfo.value = {
|
||||
house: data.houseName || '',
|
||||
project: data.maintenanceItemName || '',
|
||||
title: data.title || data.maintenanceItemName || '',
|
||||
title: data.item || '',
|
||||
description: data.problem || '',
|
||||
phone: data.phone || '',
|
||||
time: data.orderDate || '',
|
||||
time: data.createTime || '',
|
||||
images
|
||||
}
|
||||
setStep(data.problemStatus)
|
||||
|
||||
@@ -454,6 +454,7 @@
|
||||
color: #fff;
|
||||
background-color: #E34D59;
|
||||
margin-left: 10rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
|
||||
@@ -60,7 +60,7 @@ const questionList = computed(() => {
|
||||
})
|
||||
|
||||
const answerMap = computed(() => {
|
||||
const answerContent = detailItem.value?.answerContent
|
||||
const answerContent = detailItem.value?.myAnswer
|
||||
if (!answerContent) return {}
|
||||
try {
|
||||
const list = JSON.parse(answerContent)
|
||||
@@ -77,8 +77,8 @@ const answerMap = computed(() => {
|
||||
|
||||
const getDetailData = async () => {
|
||||
try {
|
||||
const params = { questionnairedId: currentId.value }
|
||||
const res = await getQuestionnaireDetail(params)
|
||||
const params = { villageId: uni.getStorageSync('currentVillageId') }
|
||||
const res = await getQuestionnaireDetail(currentId.value, params)
|
||||
if (res.code === 200) {
|
||||
const data = Array.isArray(res.data) ? res.data[0] : res.data
|
||||
detailItem.value = data || {}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
:key="oIdx"
|
||||
class="radio-item"
|
||||
:class="{ checked: answers[q.cid] === opt.label }"
|
||||
@click="selectRadio(q.cid, opt.label)"
|
||||
@click="!isEndedAndUnjoined && selectRadio(q.cid, opt.label)"
|
||||
>
|
||||
<view class="radio-circle" :class="{ active: answers[q.cid] === opt.label }">
|
||||
<text v-if="answers[q.cid] === opt.label" class="check-icon">✓</text>
|
||||
@@ -48,7 +48,7 @@
|
||||
:key="oIdx"
|
||||
class="checkbox-item"
|
||||
:class="{ checked: isChecked(q.cid, opt.label) }"
|
||||
@click="toggleCheckbox(q.cid, opt.label)"
|
||||
@click="!isEndedAndUnjoined && toggleCheckbox(q.cid, opt.label)"
|
||||
>
|
||||
<view class="checkbox-box" :class="{ active: isChecked(q.cid, opt.label) }">
|
||||
<text v-if="isChecked(q.cid, opt.label)" class="check-icon">✓</text>
|
||||
@@ -61,8 +61,10 @@
|
||||
<view v-if="q.type === 'input'">
|
||||
<input
|
||||
class="text-input"
|
||||
:class="{ 'input-disabled': isEndedAndUnjoined }"
|
||||
v-model="answers[q.cid]"
|
||||
placeholder="请输入"
|
||||
:disabled="isEndedAndUnjoined"
|
||||
/>
|
||||
</view>
|
||||
|
||||
@@ -70,9 +72,11 @@
|
||||
<view v-if="q.type === 'textarea'">
|
||||
<textarea
|
||||
class="textarea-input"
|
||||
:class="{ 'input-disabled': isEndedAndUnjoined }"
|
||||
v-model="answers[q.cid]"
|
||||
placeholder="请输入"
|
||||
maxlength="500"
|
||||
:disabled="isEndedAndUnjoined"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
@@ -81,7 +85,12 @@
|
||||
|
||||
<!-- 固定底部提交按钮 -->
|
||||
<view class="submit-btn-wrap">
|
||||
<button class="submit-btn" @click="handleSubmit">提交</button>
|
||||
<button
|
||||
v-if="isEndedAndUnjoined"
|
||||
class="submit-btn disabled-btn"
|
||||
disabled
|
||||
>已结束</button>
|
||||
<button v-else class="submit-btn" @click="handleSubmit">提交</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -105,7 +114,20 @@ const questionList = computed(() => {
|
||||
}
|
||||
})
|
||||
|
||||
// 是否已结束且未参与
|
||||
const isEndedAndUnjoined = computed(() => {
|
||||
const endTime = detailItem.value?.endTime
|
||||
const participated = detailItem.value?.participated
|
||||
// participated 不存在(null/undefined)说明接口没返回参与状态,按未参与处理
|
||||
const isNotParticipated = !participated
|
||||
// endTime 存在且已过期
|
||||
const isEnded = endTime && new Date(endTime.replace(/-/g, '/')).getTime() < Date.now()
|
||||
return isEnded && isNotParticipated
|
||||
})
|
||||
|
||||
const answers = ref({})
|
||||
let hasLoaded = false
|
||||
|
||||
// 获取问卷调查
|
||||
const getDetailData = async (id) => {
|
||||
try {
|
||||
@@ -136,6 +158,10 @@ onLoad((option) => {
|
||||
|
||||
// 切换小区后返回页面时,重新获取数据
|
||||
onShow(() => {
|
||||
if (!hasLoaded) {
|
||||
hasLoaded = true
|
||||
return
|
||||
}
|
||||
if (questionnaireId.value) {
|
||||
getDetailData(questionnaireId.value)
|
||||
}
|
||||
@@ -387,6 +413,11 @@ page {
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
|
||||
.input-disabled {
|
||||
background-color: #f5f5f5;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* 提交按钮 */
|
||||
.submit-btn-wrap {
|
||||
padding: 20rpx 30rpx 40rpx;
|
||||
@@ -407,6 +438,11 @@ page {
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
&.disabled-btn {
|
||||
background-color: #ccc;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user