From 856b3ff2caeeb87266df5f797e8da3c4773e0e32 Mon Sep 17 00:00:00 2001 From: shane <88386378@qq.com> Date: Fri, 27 Aug 2021 20:26:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=96=AB=E6=83=85=E9=97=AE=E5=8D=B7=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/reportInfo/reportInfoApi.js | 3 -- pages/reportInfoDetail/reportInfoDetail.vue | 59 +++++++++++++-------- 2 files changed, 37 insertions(+), 25 deletions(-) diff --git a/api/reportInfo/reportInfoApi.js b/api/reportInfo/reportInfoApi.js index 13b60c9..4654633 100644 --- a/api/reportInfo/reportInfoApi.js +++ b/api/reportInfo/reportInfoApi.js @@ -41,7 +41,6 @@ export function querySetting(_data){ */ export function querySettingTitle(_data) { return new Promise((resolve, reject) => { - let moreRooms = []; requestNoAuth({ url: url.querySettingTitle, method: "GET", @@ -66,7 +65,6 @@ export function querySettingTitle(_data) { */ export function saveReportInfoAnswerValue(_data){ return new Promise((resolve, reject) => { - let moreRooms = []; requestNoAuth({ url: url.saveReportInfoAnswerValue, method: "POST", @@ -92,7 +90,6 @@ export function saveReportInfoAnswerValue(_data){ */ export function saveReportInfoBackCity(_data){ return new Promise((resolve, reject) => { - let moreRooms = []; requestNoAuth({ url: url.saveReportInfoBackCity, method: "POST", diff --git a/pages/reportInfoDetail/reportInfoDetail.vue b/pages/reportInfoDetail/reportInfoDetail.vue index dfe5406..34f25ac 100644 --- a/pages/reportInfoDetail/reportInfoDetail.vue +++ b/pages/reportInfoDetail/reportInfoDetail.vue @@ -3,7 +3,7 @@ {{setting.name}} - {{item.title}} + {{index+1}},{{item.title}} @@ -130,7 +130,6 @@ _that[name] = value; // }, radioChange: function(e, item) { - console.log(e, item) item.radio = e.detail.value; }, checkboxChange: function(e, item) { @@ -151,7 +150,6 @@ }, submitQuestionAnswer: function(e) { let obj = { - "areaCode": this.areaCode, "communityId": this.communityId, "communityName": this.communityName, "name": this.name, @@ -166,7 +164,9 @@ "backTime":this.bindDate + " " + this.bindTime + ":00", }; let msg = ""; - if(obj.name == "") { + if(obj.communityId == "") { + msg = "请从新扫码"; + }else if(obj.name == "") { msg = "请填写姓名"; } else if (obj.idCard == "" || obj.idCard.length != 18) { msg = "请正确填写身份证号"; @@ -186,53 +186,68 @@ let _valueId = ''; _titles.forEach(item => { if (item.titleType == '2002') { + let _valueContent = []; item.radio.forEach(_radio => { if (_radio.selected == '1') { - _questionAnswerTitles.push({ - valueContent: _radio.valueId, - titleId: item.titleId, - titleType: item.titleType - }) + _valueContent.push(_radio.valueId) } }) + _questionAnswerTitles.push({ + communityId: this.communityId, + valueContent: _valueContent, + titleId: item.titleId, + titleType: item.titleType + }) } else { _valueId = item.radio; _questionAnswerTitles.push({ + communityId: this.communityId, valueContent: _valueId, titleId: item.titleId, titleType: item.titleType }) } - console.log(item); }); + let reflag = false; + _questionAnswerTitles.forEach(item => { + if(item.valueContent.toString().length == 0){ + uni.showToast({ + icon: 'none', + title: '保存成功' + }); + reflag = true; + return false; + } + }); + if(reflag){ + uni.showToast({ + icon: 'none', + title: '有未答项,请作答!' + }); + return false; + } obj = { "settingId": this.settingId, "communityId":this.communityId, - "questionAnswerTitles": _questionAnswerTitles + "personName": this.name, + "idCard": this.idCard, + "tel": this.tel, + questionAnswerTitles: _questionAnswerTitles, } - console.log("提交数据", obj); saveReportInfoAnswerValue(obj) .then(_data => { uni.showToast({ icon: 'none', title: '保存成功' }); - uni.navigateBack({ - delta: 1 - }) + this.communityId = ""; }, err => { uni.showToast({ icon: 'none', title: err }) }) - - - - } - - - } + }} };