优化代码

This commit is contained in:
java110 2023-07-18 19:34:18 +08:00
parent c523af1e9d
commit 37e1e6f894
2 changed files with 45 additions and 41 deletions

View File

@ -120,8 +120,8 @@ export default {
queryRoomRenovationRecordDetail: baseUrl + "app/roomRenovation/queryRoomRenovationRecordDetail",
queryContract: baseUrl + "app/contract/queryContract",
queryQuestionAnswer: baseUrl + "app/question.queryOwnerQuestionAnswer",
queryQuestionAnswerTitle: baseUrl + "app/questionAnswer/queryQuestionAnswerTitle",
saveUserQuestionAnswerValue: baseUrl + "app/userQuestionAnswer/saveUserQuestionAnswerValue",
queryQuestionAnswerTitle: baseUrl + "app/question.listQuestionTitle",
saveUserQuestionAnswerValue: baseUrl + "app/question.saveOwnerQuestionAnswer",
listMachineTranslates: baseUrl + "app/machineTranslate.listMachineTranslates",
generatorHcCode: baseUrl + "app/userLogin/generatorHcCode",
queryApplyRoomDiscount: baseUrl + "app/applyRoomDiscount/queryApplyRoomDiscount",

View File

@ -1,21 +1,27 @@
<template>
<view>
<view v-show="qaInfo.fileUrls.length > 0" class="img-bg">
<image :src="qaInfo.fileUrls[0]" class="qa-img" mode="widthFix"></image>
</view>
<view class="qa-title text-center text-bold text-lg margin-top-lg">
{{qaInfo.qaName}}
</view>
<view class="qa-endtime text-center text-sm text-grey">
结束时间{{qaInfo.endTime}}
<view class="flex justify-between padding-lr-sm margin-top-xs">
<view>投票人姓名业主</view>
<view>{{qaInfo.ownerName}}</view>
</view>
<view v-show="qaInfo.remark" class="qa-remark text-center margin-top-lg">
{{qaInfo.remark}}
<view class="flex justify-between padding-lr-sm margin-top-xs">
<view>联系电话</view>
<view>{{qaInfo.link}}</view>
</view>
<view class="flex justify-between padding-lr-sm margin-top-xs">
<view>房产</view>
<view>{{qaInfo.roomName}}</view>
</view>
<view class="qa-remark margin">
<view v-html="qaInfo.content"></view>
</view>
<view class="" v-for="(item,index) in titles" :key="index">
<view class="block__title">{{item.qaTitle}}</view>
<radio-group class="block" @change="radioChange($event,item)" v-if="item.titleType == '1001'">
<view class="cu-form-group" v-for="(valueItem,valueIndex) in item.questionAnswerTitleValues"
<view class="cu-form-group" v-for="(valueItem,valueIndex) in item.titleValues"
:key="valueIndex">
<view class="title">{{valueItem.qaValue}}</view>
<radio :class="item.radio==valueItem.valueId?'checked':''"
@ -24,7 +30,7 @@
</view>
</radio-group>
<checkbox-group class="block" @change="checkboxChange($event,item)" v-else-if="item.titleType == '2002'">
<view class="cu-form-group " v-for="(valueItem,valueIndex) in item.questionAnswerTitleValues">
<view class="cu-form-group " v-for="(valueItem,valueIndex) in item.titleValues">
<view class="title">{{valueIndex + 1}}{{valueItem.qaValue}}</view>
<checkbox :class="item.radio[valueIndex].selected == '1'?'checked':''"
:checked="item.radio[valueIndex].selected == '1'?true:false" :value="valueItem.valueId">
@ -38,14 +44,10 @@
</view>
</view>
</view>
<view class="button_up_blank"></view>
<view class="flex flex-direction">
<button class="cu-btn bg-green margin-tb-sm lg" @click="submitQuestionAnswer()">提交</button>
</view>
</view>
</template>
@ -63,10 +65,16 @@
export default {
data() {
return {
qaInfo: {},
qaInfo: {
qaName:'',
ownerName:'',
link:'',
roomName:'',
userQaId:''
},
titles: [],
qaId: '',
objType: ''
communityId: ''
};
},
@ -76,16 +84,15 @@
onLoad: function(options) {
let that = this;
context.onLoad(options);
this.communityId = context.getCurrentCommunity().communityId;
this.qaId = options.qaId;
this.objType = options.objType
this._queryQuestionAnswer();
queryQuestionAnswerTitle({
objType: this.objType,
qaId: this.qaId,
page: 1,
row: 100,
objId:''
communityId: this.communityId
})
.then(_data => {
_data.data.forEach(item => {
@ -94,7 +101,7 @@
} else if (item.titleType == '2002') {
// checked: false
item.radio = [];
item.questionAnswerTitleValues.forEach(value => {
item.titleValues.forEach(value => {
item.radio.push({
checked: false,
valueId: value.valueId,
@ -119,9 +126,8 @@
queryQuestionAnswer({
page: 1,
row: 1,
qaTypes:'1001,3003',
objType:'3306',
qaId: that.qaId,
qaType: '3003',
communityId: that.communityId,
})
.then(_data => {
that.qaInfo = _data.data[0];
@ -158,7 +164,6 @@
let _titles = this.titles;
let _valueId = '';
_titles.forEach(item => {
if (item.titleType == '2002') {
item.radio.forEach(_radio => {
if (_radio.selected == '1') {
@ -181,9 +186,9 @@
let obj = {
"qaId": this.qaId,
"objType": this.objType,
"objId": context.getCurrentCommunity().communityId,
"communityId": this.communityId,
"answerType": '1002',
"userQaId":this.qaInfo.userQaId,
questionAnswerTitles: _questionAnswerTitles
}
@ -217,16 +222,15 @@
font-weight: 400;
font-size: 14px;
color: rgba(69, 90, 100, .6);
padding: 40rpx 30rpx 0rpx;
padding: 10rpx 20rpx 15upx;
}
.button_up_blank {
height: 40rpx;
}
.img-bg{
.img-bg {}
}
.qa-img {
width: 100%;
}