mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-06-11 06:07:24 +08:00
疫情问卷
This commit is contained in:
parent
a3c77dd333
commit
5445b81dcf
90
api/reportInfo/reportInfoApi.js
Normal file
90
api/reportInfo/reportInfoApi.js
Normal file
@ -0,0 +1,90 @@
|
||||
import {
|
||||
request
|
||||
} from '../java110Request.js'
|
||||
import
|
||||
url
|
||||
from '../../constant/url.js'
|
||||
|
||||
import
|
||||
mapping
|
||||
from '../../constant/MappingConstant.js'
|
||||
|
||||
/**
|
||||
* 疫情问卷
|
||||
* @param {Object} _data 评价内容
|
||||
*/
|
||||
export function queryQuestionAnswer(_data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let moreRooms = [];
|
||||
request({
|
||||
url: url.queryQuestionAnswer,
|
||||
method: "GET",
|
||||
data: _data, //动态数据
|
||||
success: function(res) {
|
||||
let _data = res.data;
|
||||
if (_data.code == 0) {
|
||||
resolve(_data);
|
||||
return ;
|
||||
}
|
||||
reject(_data.msg);
|
||||
},
|
||||
fail: function(e) {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 疫情问卷
|
||||
* @param {Object} _data 评价内容
|
||||
*/
|
||||
export function querySettingTitle(_data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let moreRooms = [];
|
||||
request({
|
||||
url: url.querySettingTitle,
|
||||
method: "GET",
|
||||
data: _data, //动态数据
|
||||
success: function(res) {
|
||||
let _data = res.data;
|
||||
if (_data.code == 0) {
|
||||
resolve(_data);
|
||||
return ;
|
||||
}
|
||||
reject(_data.msg);
|
||||
},
|
||||
fail: function(e) {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
/**
|
||||
* add by wuxw
|
||||
* @param {Object} _data 保存 用户地址
|
||||
*/
|
||||
export function saveReportInfoAnswerValue(_data){
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
let moreRooms = [];
|
||||
request({
|
||||
url: url.saveReportInfoAnswerValue,
|
||||
method: "POST",
|
||||
data: _data, //动态数据
|
||||
success: function(res) {
|
||||
let _data = res.data;
|
||||
if (_data.code == 0) {
|
||||
resolve(_data);
|
||||
return ;
|
||||
}
|
||||
reject(_data.msg);
|
||||
},
|
||||
fail: function(e) {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -122,8 +122,8 @@ export default {
|
||||
generatorHcCode: baseUrl + "app/userLogin/generatorHcCode",
|
||||
queryApplyRoomDiscount: baseUrl + "app/applyRoomDiscount/queryApplyRoomDiscount",
|
||||
saveReportInfoBackCity: baseUrl + "app/reportInfoBackCity/saveReportInfoBackCity",
|
||||
|
||||
|
||||
querySettingTitle: baseUrl + "app/reportInfoSettingTitle/querySettingTitle",
|
||||
saveReportInfoAnswerValue: baseUrl + "app/reportInfoAnswerValue/saveReportInfoAnswerValue",
|
||||
|
||||
NEED_NOT_LOGIN_PAGE: [
|
||||
'/pages/login/login',
|
||||
|
||||
@ -111,6 +111,14 @@
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/reportInfoDetail/reportInfoDetail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "疫情问卷上报",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "pages/repairList/detail/detail",
|
||||
"style": {}
|
||||
|
||||
@ -96,7 +96,6 @@
|
||||
*/
|
||||
onLoad: function(options) {
|
||||
let _that = this;
|
||||
context.onLoad(options);
|
||||
if(!options.communityId){
|
||||
wx.showToast({
|
||||
title: "小区信息错误",
|
||||
@ -118,19 +117,6 @@
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function() {
|
||||
if (this.areaCode == '' || this.areaCode == undefined) {
|
||||
let _currentLocation = context.getCurrentLocation();
|
||||
|
||||
let _areaName = _currentLocation.city + _currentLocation.district;
|
||||
|
||||
let _areaCode = _currentLocation.adcode;
|
||||
this.areaCode = _areaCode;
|
||||
//this.areaName = _areaName;
|
||||
// this.setData({
|
||||
// areaCode: _areaCode,
|
||||
// areaName: _areaName
|
||||
// });
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
191
pages/reportInfoDetail/reportInfoDetail.vue
Normal file
191
pages/reportInfoDetail/reportInfoDetail.vue
Normal file
@ -0,0 +1,191 @@
|
||||
<template>
|
||||
<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"
|
||||
:key="valueIndex">
|
||||
<view class="title">{{valueItem.qaValue}}</view>
|
||||
<radio :class="item.radio==valueItem.valueId?'checked':''"
|
||||
:checked="item.radio==valueItem.valueId?true:false" :value="valueItem.valueId">
|
||||
</radio>
|
||||
</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="title">{{valueItem.qaValue}}</view>
|
||||
<checkbox :class="item.radio[valueIndex].selected == '1'?'checked':''"
|
||||
:checked="item.radio[valueIndex].selected == '1'?true:false" :value="valueItem.valueId">
|
||||
</checkbox>
|
||||
</view>
|
||||
<!--:checked="item.radio[valueIndex].checked?true:false"-->
|
||||
</checkbox-group>
|
||||
<view v-else>
|
||||
<view class="cu-form-group ">
|
||||
<textarea maxlength="512" v-model="item.radio" placeholder="请回答"></textarea>
|
||||
</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>
|
||||
|
||||
<script>
|
||||
const context = require("../../context/Java110Context.js");
|
||||
const constant = context.constant;
|
||||
const factory = context.factory;
|
||||
|
||||
import {
|
||||
saveReportInfoAnswerValue,
|
||||
querySettingTitle
|
||||
} from '../../api/reportInfo/reportInfoApi.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
titles: [],
|
||||
qaId: '',
|
||||
objType: ''
|
||||
};
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function(options) {
|
||||
let that = this;
|
||||
this.qaId = options.qaId;
|
||||
querySettingTitle({
|
||||
qaId: this.qaId,
|
||||
page: 1,
|
||||
row: 100
|
||||
})
|
||||
.then(_data => {
|
||||
_data.data.forEach(item => {
|
||||
if (item.titleType == '1001') {
|
||||
item.radio = ''
|
||||
} else if (item.titleType == '2002') {
|
||||
// checked: false
|
||||
item.radio = [];
|
||||
item.questionAnswerTitleValues.forEach(value => {
|
||||
item.radio.push({
|
||||
checked: false,
|
||||
valueId: value.valueId,
|
||||
selected: '0'
|
||||
})
|
||||
})
|
||||
} else {
|
||||
item.radio = ''
|
||||
}
|
||||
})
|
||||
that.titles = _data.data;
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function() {},
|
||||
methods: {
|
||||
radioChange: function(e, item) {
|
||||
console.log(e, item)
|
||||
item.radio = e.detail.value;
|
||||
},
|
||||
checkboxChange: function(e, item) {
|
||||
item.radio.forEach(value => {
|
||||
value.selected = '0';
|
||||
value.checked = false;
|
||||
})
|
||||
|
||||
item.radio.forEach(value => {
|
||||
e.detail.value.forEach(_dValue =>{
|
||||
if (value.valueId == _dValue) {
|
||||
if (value.selected == '0') {
|
||||
value.selected = '1';
|
||||
value.checked = true;
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
console.log('item.radio', item.radio, e)
|
||||
},
|
||||
submitQuestionAnswer: function(e) {
|
||||
|
||||
console.log(this.titles);
|
||||
|
||||
let _questionAnswerTitles = [];
|
||||
let _titles = this.titles;
|
||||
let _valueId = '';
|
||||
_titles.forEach(item => {
|
||||
|
||||
if (item.titleType == '2002') {
|
||||
item.radio.forEach(_radio => {
|
||||
if (_radio.selected == '1') {
|
||||
_questionAnswerTitles.push({
|
||||
valueContent: _radio.valueId,
|
||||
titleId: item.titleId,
|
||||
titleType: item.titleType
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
_valueId = item.radio;
|
||||
_questionAnswerTitles.push({
|
||||
valueContent: _valueId,
|
||||
titleId: item.titleId,
|
||||
titleType: item.titleType
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
let obj = {
|
||||
"qaId": this.qaId,
|
||||
"objType": this.objType,
|
||||
"objId": context.getUserInfo().communityId,
|
||||
"answerType": '1002',
|
||||
questionAnswerTitles: _questionAnswerTitles
|
||||
}
|
||||
saveReportInfoAnswerValue(obj)
|
||||
.then(_data => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '保存成功'
|
||||
});
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
}, err => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: err
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.block__title {
|
||||
margin: 0;
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
color: rgba(69, 90, 100, .6);
|
||||
padding: 40rpx 30rpx 0rpx;
|
||||
}
|
||||
|
||||
.button_up_blank {
|
||||
height: 40rpx;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user