优化代码

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",
queryShopCommunity: baseUrl + "app/shop/queryShopCommunity",
saveAddVisit: baseUrl + "callComponent/addVisit/save",
queryReportInfoAnswerByOpenId : baseUrl + "app/reportInfoAnswer/queryReportInfoAnswerByOpenId",
NEED_NOT_LOGIN_PAGE: [
'pages/login/login',

View File

@ -37,12 +37,13 @@
</view>
<view class="cu-form-group">
<view class="title">身份证</view>
<input :value="idCard" @input="bindInput" data-name="idCard" required label="身份证" clearable placeholder="请输入身份证"
name="idCard"></input>
<input :value="idCard" @input="bindInput" data-name="idCard" required label="身份证" clearable
placeholder="请输入身份证" name="idCard"></input>
</view>
<view class="cu-form-group">
<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 class="button_up_blank"></view>
<view class="flex flex-direction">
@ -57,9 +58,15 @@
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 {
@ -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({
@ -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
});
});
},
@ -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;
})
}
},
};
</script>
<style>