优化代码

This commit is contained in:
java110 2022-06-15 14:52:18 +08:00
parent 23a487a9b1
commit 52d644935e
3 changed files with 72 additions and 18 deletions

View File

@ -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);
}
});
})
}

View File

@ -145,6 +145,7 @@ export default {
queryMainCategory: baseUrl + "app/productCategory/queryMainCategoryAllGoods", queryMainCategory: baseUrl + "app/productCategory/queryMainCategoryAllGoods",
queryShopCommunity: baseUrl + "app/shop/queryShopCommunity", queryShopCommunity: baseUrl + "app/shop/queryShopCommunity",
saveAddVisit: baseUrl + "callComponent/addVisit/save", saveAddVisit: baseUrl + "callComponent/addVisit/save",
queryReportInfoAnswerByOpenId : baseUrl + "app/reportInfoAnswer/queryReportInfoAnswerByOpenId",
NEED_NOT_LOGIN_PAGE: [ NEED_NOT_LOGIN_PAGE: [
'pages/login/login', 'pages/login/login',

View File

@ -33,16 +33,17 @@
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title">姓名</view> <view class="title">姓名</view>
<input :value="name" @input="bindInput" data-name="name" required label="姓名" clearable placeholder="请输入名称" <input :value="name" @input="bindInput" data-name="name" required label="姓名" clearable placeholder="请输入名称"
name="name"></input> name="name"></input>
</view> </view>
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title">身份证</view> <view class="title">身份证</view>
<input :value="idCard" @input="bindInput" data-name="idCard" required label="身份证" clearable placeholder="请输入身份证" <input :value="idCard" @input="bindInput" data-name="idCard" required label="身份证" clearable
name="idCard"></input> placeholder="请输入身份证" name="idCard"></input>
</view> </view>
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title">手机号</view> <view class="title">手机号</view>
<input :value="tel" @input="bindInput" data-name="tel" required label="手机号" clearable placeholder="请输入手机号" name="tel"></input> <input :value="tel" @input="bindInput" data-name="tel" required label="手机号" clearable placeholder="请输入手机号"
name="tel"></input>
</view> </view>
<view class="button_up_blank"></view> <view class="button_up_blank"></view>
<view class="flex flex-direction"> <view class="flex flex-direction">
@ -57,16 +58,22 @@
import { import {
saveReportInfoAnswerValue, saveReportInfoAnswerValue,
querySettingTitle, querySettingTitle,
querySetting querySetting,
queryReportInfoAnswerByOpenId
} from '../../api/reportInfo/reportInfoApi.js' } from '../../api/reportInfo/reportInfoApi.js'
// #ifdef H5
import {
wechatRefreshToken
} from '@/lib/java110/page/PageH5.js'
// #endif
export default { export default {
data() { data() {
return { return {
name: '', name: '',
idCard: '', idCard: '',
tel: '', tel: '',
setting:{}, setting: {},
titles: [], titles: [],
qaId: '', qaId: '',
objType: '' objType: ''
@ -77,6 +84,13 @@
*/ */
onLoad: function(options) { onLoad: function(options) {
let that = this; 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.settingId = options.settingId;
this.communityId = options.communityId; this.communityId = options.communityId;
querySetting({ querySetting({
@ -113,7 +127,9 @@
} }
}) })
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; value.checked = false;
}) })
item.radio.forEach(value => { item.radio.forEach(value => {
e.detail.value.forEach(_dValue =>{ e.detail.value.forEach(_dValue => {
if (value.valueId == _dValue) { if (value.valueId == _dValue) {
if (value.selected == '0') { if (value.selected == '0') {
value.selected = '1'; value.selected = '1';
@ -160,13 +176,13 @@
"source": this.source, "source": this.source,
"bindDate": this.bindDate, "bindDate": this.bindDate,
"bindTime": this.bindTime, "bindTime": this.bindTime,
"remark":this.remark, "remark": this.remark,
"backTime":this.bindDate + " " + this.bindTime + ":00", "backTime": this.bindDate + " " + this.bindTime + ":00",
}; };
let msg = ""; let msg = "";
if(obj.communityId == "") { if (obj.communityId == "") {
msg = "请从新扫码"; msg = "请从新扫码";
}else if(obj.name == "") { } else if (obj.name == "") {
msg = "请填写姓名"; msg = "请填写姓名";
} else if (obj.idCard == "" || obj.idCard.length != 18) { } else if (obj.idCard == "" || obj.idCard.length != 18) {
msg = "请正确填写身份证号"; msg = "请正确填写身份证号";
@ -210,7 +226,7 @@
}); });
let reflag = false; let reflag = false;
_questionAnswerTitles.forEach(item => { _questionAnswerTitles.forEach(item => {
if(item.valueContent.toString().length == 0){ if (item.valueContent.toString().length == 0) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '保存成功' title: '保存成功'
@ -219,7 +235,7 @@
return false; return false;
} }
}); });
if(reflag){ if (reflag) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '有未答项,请作答!' title: '有未答项,请作答!'
@ -228,7 +244,7 @@
} }
obj = { obj = {
"settingId": this.settingId, "settingId": this.settingId,
"communityId":this.communityId, "communityId": this.communityId,
"personName": this.name, "personName": this.name,
"idCard": this.idCard, "idCard": this.idCard,
"tel": this.tel, "tel": this.tel,
@ -247,7 +263,22 @@
title: err 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;
})
}
},
}; };
</script> </script>
<style> <style>