diff --git a/api/reportInfo/reportInfoApi.js b/api/reportInfo/reportInfoApi.js index 4fa67af..e0456b5 100644 --- a/api/reportInfo/reportInfoApi.js +++ b/api/reportInfo/reportInfoApi.js @@ -108,3 +108,25 @@ export function saveReportInfoBackCity(_data){ }); }) } + + +export function queryReportInfoAnswerByOpenId(_data) { + return new Promise((resolve, reject) => { + requestNoAuth({ + url: url.queryReportInfoAnswerByOpenId, + 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); + } + }); + }) +} \ No newline at end of file diff --git a/constant/url.js b/constant/url.js index 0e12a9d..cafe10b 100755 --- a/constant/url.js +++ b/constant/url.js @@ -145,6 +145,7 @@ export default { queryMainCategory: baseUrl + "app/productCategory/queryMainCategoryAllGoods", queryShopCommunity: baseUrl + "app/shop/queryShopCommunity", saveAddVisit: baseUrl + "callComponent/addVisit/save", + queryReportInfoAnswerByOpenId : baseUrl + "app/reportInfoAnswer/queryReportInfoAnswerByOpenId", NEED_NOT_LOGIN_PAGE: [ 'pages/login/login', diff --git a/pages/reportInfoDetail/reportInfoDetail.vue b/pages/reportInfoDetail/reportInfoDetail.vue index 680d8b7..1d6dc42 100644 --- a/pages/reportInfoDetail/reportInfoDetail.vue +++ b/pages/reportInfoDetail/reportInfoDetail.vue @@ -28,21 +28,22 @@ - + 人员信息 姓名 + name="name"> 身份证 - + 手机号 - + @@ -57,16 +58,22 @@ import { saveReportInfoAnswerValue, querySettingTitle, - querySetting + querySetting, + queryReportInfoAnswerByOpenId } from '../../api/reportInfo/reportInfoApi.js' + // #ifdef H5 + import { + wechatRefreshToken + } from '@/lib/java110/page/PageH5.js' + // #endif export default { data() { return { name: '', idCard: '', tel: '', - setting:{}, + setting: {}, titles: [], qaId: '', objType: '' @@ -77,6 +84,13 @@ */ onLoad: function(options) { let that = this; + // #ifdef H5 + if (!options.openId) { + wechatRefreshToken(window.location.href, 2, window.location.href); + return; + } + this._loadUserInfo(options.openId); + // #endif this.settingId = options.settingId; this.communityId = options.communityId; querySetting({ @@ -112,8 +126,10 @@ item.radio = '' } }) - - that.titles = _data.data.sort(function(a,b){return a.seq - b.seq}); + + that.titles = _data.data.sort(function(a, b) { + return a.seq - b.seq + }); }); }, @@ -138,7 +154,7 @@ value.checked = false; }) item.radio.forEach(value => { - e.detail.value.forEach(_dValue =>{ + e.detail.value.forEach(_dValue => { if (value.valueId == _dValue) { if (value.selected == '0') { value.selected = '1'; @@ -160,13 +176,13 @@ "source": this.source, "bindDate": this.bindDate, "bindTime": this.bindTime, - "remark":this.remark, - "backTime":this.bindDate + " " + this.bindTime + ":00", + "remark": this.remark, + "backTime": this.bindDate + " " + this.bindTime + ":00", }; let msg = ""; - if(obj.communityId == "") { + if (obj.communityId == "") { msg = "请从新扫码"; - }else if(obj.name == "") { + } else if (obj.name == "") { msg = "请填写姓名"; } else if (obj.idCard == "" || obj.idCard.length != 18) { msg = "请正确填写身份证号"; @@ -210,7 +226,7 @@ }); let reflag = false; _questionAnswerTitles.forEach(item => { - if(item.valueContent.toString().length == 0){ + if (item.valueContent.toString().length == 0) { uni.showToast({ icon: 'none', title: '保存成功' @@ -219,7 +235,7 @@ return false; } }); - if(reflag){ + if (reflag) { uni.showToast({ icon: 'none', title: '有未答项,请作答!' @@ -228,7 +244,7 @@ } obj = { "settingId": this.settingId, - "communityId":this.communityId, + "communityId": this.communityId, "personName": this.name, "idCard": this.idCard, "tel": this.tel, @@ -247,7 +263,22 @@ title: err }) }) - }} + }, + _loadUserInfo: function(_openId) { + let _that = this; + queryReportInfoAnswerByOpenId({ + openId: _openId + }).then(_data => { + let _params = _data.data; + if (!_params || _params.length < 1) { + return; + } + _that.name = _params[0].personName; + _that.idCard = _params[0].idCard; + _that.tel = _params[0].tel; + }) + } + }, };