Commit 3b758ca6 by 李嘉林

接口对接

parent 4718a23f
......@@ -24,5 +24,14 @@ console.log(process.env,'-----------------config------')
getShopUserProtocol() {
return requestPOST(`${process.env.OLSHOP_URL}/getShopUserProtocol`)
},
//小程序认证信息查询
get_certified_info(options) {
return requestPOST(`${process.env.OLSHOP_URL}/wx/get_certified_info`,options)
},
//微信小程序确认填报信息
mini_certified(options) {
return requestPOST(`${process.env.OLSHOP_URL}wx/mini_certified`,options)
},
}
\ No newline at end of file
......@@ -162,7 +162,8 @@ export default {
});
},
cancelSelect() {
this.$emit("cancelSelect");
// this.$emit("cancelSelect");
wx.navigateBack();
},
},
onLoad() {
......
......@@ -229,24 +229,41 @@ export default {
}
console.log(this.$store.state.mixid,'mixid------230')
//冬奥会测试赛(mixid=CL)定制一键登录直接返回不用手机号
if(this.$store.state.mixid == 'antgood') {
res.data.data.isHaveUnion = "true"
}
if (res.data.data.isHaveUnion == "true") {
//有账号
this.backParams += `&sessionid=${
res.data.data.sessionId
}&needCertified=${res.data.data.NEED_CERTIFIED}`;
this.NEED_CERTIFIED = res.data.data.NEED_CERTIFIED;
wx.setStorage({
key: "sessionid",
data: res.data.data.sessionId
});
this.isHaveUnion = true;
let isCertified = false;
if(this.$store.state.mixid == 'CL') {
isCertified = res.data.data.isCertified == 'true'
if(isCertified && res.data.data.sessionId) {
//有账号
wx.setStorage({
key: "sessionid",
data: res.data.data.sessionId
});
wx.reLaunch({
url: '/pages/home/main' // 指定页面的url
});
return;
} else{
wx.reLaunch({
url: `/pages/wo/writeInformation/main`
});
}
} else {
//需要绑定
this.isHaveUnion = false;
if (res.data.data.isHaveUnion == "true") {
//有账号
this.backParams += `&sessionid=${
res.data.data.sessionId
}&needCertified=${res.data.data.NEED_CERTIFIED}`;
this.NEED_CERTIFIED = res.data.data.NEED_CERTIFIED;
wx.setStorage({
key: "sessionid",
data: res.data.data.sessionId
});
this.isHaveUnion = true;
} else {
//需要绑定
this.isHaveUnion = false;
}
}
this.appid = res.data.data.appid;
......
......@@ -13,7 +13,7 @@
<div class="img">
<image
mode="widthFix"
src="http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/png/f96b596d-e1e4-43c1-b707-226ff7d107bd.png"
:src="userInfo.headPortraitUrl"
alt=""
></image>
</div>
......@@ -23,7 +23,7 @@
<p>姓名</p>
</div>
<div class="text">
<p>{{ "xxxxxxxxxxx" }}</p>
<p>{{ userInfo.realname }}</p>
</div>
</div>
<div class="cell flex">
......@@ -31,7 +31,7 @@
<p>身份证号码</p>
</div>
<div class="text">
<p>{{ "42030319990909283" }}</p>
<p>{{ userInfo.identityCard }}</p>
</div>
</div>
<div class="cell flex">
......@@ -39,7 +39,7 @@
<p>单位</p>
</div>
<div class="text">
<p>{{ "张家口市公安局冬奥办" }}</p>
<p>{{ userInfo.company }}</p>
</div>
</div>
<div class="cell flex">
......@@ -47,25 +47,23 @@
<p>职务职级</p>
</div>
<div class="text">
<p>{{ "党委委员、驻局纪检组书记" }}</p>
<p>{{ userInfo.identity }}</p>
</div>
</div>
<div class="cell selectCell" @click="selectworkRegion">
<div class="label flex">
<p>工作区域</p>
<!-- <i class="iconfont icon-you"></i> -->
</div>
<p class="val" v-if="workArea">
{{ workArea }}
{{ userInfo.workArea }}
</p>
</div>
<div class="cell selectCell" @click="selectDiningPlace">
<div class="label flex">
<p>就餐地点</p>
<!-- <i class="iconfont icon-you"></i> -->
</div>
<p class="val" v-if="diningPlace">
{{ diningPlace }}
{{ userInfo.diningPlace }}
</p>
</div>
</div>
......@@ -77,12 +75,14 @@
</template>
<script>
import live from "@/api/live";
export default {
name: "improveInformation",
data() {
return {
workAreaList: [],
diningPlaceList: [],
userInfo:{},
};
},
components: {},
......@@ -117,9 +117,20 @@ export default {
if(diningPlaceList){
this.diningPlaceList = JSON.parse(diningPlaceList);
}
this.init();
},
methods: {
cReady() {},
init(){
// wx.showLoading({
// title: "加载中...",
// });
live.getUserInfo().then(res=>{
// wx.hideLoading();
if(res.data.ok=='true'){
this.userInfo = res.data.data;
}
})
},
selectworkRegion() {
return;
wx.setStorageSync('wo-selectWorkAreaList', JSON.stringify(this.workAreaList));
......
......@@ -53,13 +53,16 @@
</div>
</div>
<div class="btm">
<p class="btm-info">本次操作遵守国家相关法律法规,采集信息仅用于测试赛相关核验查询</p>
<div class="btn" :class="{'btn1':onInput}" @click="next">下一步</div>
<p class="btm-info">
本次操作遵守国家相关法律法规,采集信息仅用于测试赛相关核验查询
</p>
<div class="btn" :class="{ btn1: onInput }" @click="next">下一步</div>
</div>
</div>
</template>
<script>
import login from "@/api/login";
export default {
name: "writeInformation",
data() {
......@@ -67,69 +70,184 @@ export default {
idPhoto: "",
name: "",
idNum: "",
code: "",
};
},
components: {},
computed: {
onInput() {
return this.name.trim() == '' || this.idNum.trim() == ''
}
return this.name.trim() == "" || this.idNum.trim() == "";
},
},
onReady() {
console.log('---onready')
console.log("---onready");
wx.setNavigationBarTitle({ title: "填报资料" });
},
onLoad(){
console.log('---onLoad')
onLoad() {
console.log("---onLoad");
},
onShow(){
// 已经填写过信息的重定向到首页
// if(wx.getStorageSync('sessionid')) {
// wxtt.redirectTo({
// url: '/pages/home/main' // 指定页面的url
// });
// }
let idPhoto = wx.getStorageSync('wo-selectImgUrl');
if(idPhoto) {
onShow() {
wx.checkSession({
success: () => {
//session_key 未过期,并且在本生命周期一直有效
wx.login({
success: (res) => {
this.code = res.code;
},
fail: (err) => {},
}); //重新登录
},
fail: () => {
// session_key 已经失效,需要重新执行登录流程
wx.login({
success: (res) => {
this.code = res.code;
},
fail: (err) => {},
}); //重新登录
},
});
let idPhoto = wx.getStorageSync("wo-selectImgUrl");
if (idPhoto) {
this.idPhoto = idPhoto;
wx.removeStorageSync('wo-selectImgUrl');
wx.removeStorageSync("wo-selectImgUrl");
}
console.log('---onShow')
console.log("---onShow");
},
methods: {
// 上传图片
upLoadImg(){
upLoadImg() {
let self = this;
wx.chooseImage({
count: 1, // 默认9
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
sizeType: ["original", "compressed"], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ["album", "camera"], // 可以指定来源是相册还是相机,默认二者都有
success(res) {
const src = res.tempFilePaths[0]
console.log(src,'---------------chooseImage')
const src = res.tempFilePaths[0];
console.log(src, "---------------chooseImage");
if (src) {
// 将图片参数传递给插件
// 将图片参数传递给插件
self.chooseImg = true;
wx.navigateTo({
url: `/pages/wo/editPicture/main?src=${src}` // 指定页面的url
url: `/pages/wo/editPicture/main?src=${src}`, // 指定页面的url
});
};
wx.hideToast()
}
wx.hideToast();
},
fail(res) {
wx.hideToast();
wx.navigateBack()
}
})
wx.navigateBack();
},
});
},
// 下一步
next(){
console.log('--下一步--');
if(this.check_id_number()){
wx.navigateTo({
url: `/pages/wo/improveInformation/main`
next() {
console.log("--下一步--");
this.check_id_number();
if (this.idPhoto == "") {
wx.showToast({
title: "请上传证件照",
icon: "error",
duration: 1000,
});
return;
}
if (this.name == "") {
wx.showToast({
title: "请输入姓名",
icon: "error",
duration: 1000,
});
return;
}
if (this.idNum == "身份证号码有误,请重新输入") {
wx.showToast({
title: this.idNum,
icon: "error",
duration: 1000,
});
return;
}
this.get_certified_info();
},
//信息认证
get_certified_info() {
wx.showLoading({
title: "认证中...",
});
let query = { customerName: this.name, identityCard: this.idNum };
login.get_certified_info(query).then((res) => {
if (res.data.ok == "true") {
wx.showToast({
title: "认证通过",
icon: "success",
duration: 1000,
});
let infoData = res.data.data;
this.mini_certified(infoData);
} else {
wx.hideLoading();
wx.showModal({
title: "错误",
content: "姓名身份证号不匹配或不存在",
showCancel: false,
confirmColor: "#229df1",
success(res) {
if (res.confirm) {
console.log("用户点击确定");
} else if (res.cancel) {
console.log("用户点击取消");
}
},
});
}
});
},
mini_certified(infoData) {
let _this = this;
let query = {
customerId: infoData.customerId,
handImage: this.idPhoto,
code: this.code,
};
login.mini_certified(query).then((res) => {
if (res.data.ok == "true") {
wx.login({
success: (res) => {
_this.code = res.code;
login
.miniLogin({
code: _this.code,
spokesmanRelId: "",
spokesmanGroupId: "",
spokesmanShopId: "",
})
.then((res) => {
if (res.data.code == 200 && res.data.data.sessionId) {
wx.setStorage({
key: "sessionid",
data: res.data.data.sessionId
});
wx.reLaunch({
url: '/pages/wo/improveInformation/main' // 指定页面的url
});
} else {
wx.showToast({
title: '登录失败,请重试!',
icon: "error",
duration: 1000,
});
}
})
.catch((err) => {
reject(err);
});
},
fail: (err) => {},
}); //重新登录
}
});
},
input_id_number() {
let n = this.idNum.match(/\d{0,17}(\d|x)/i);
......@@ -139,6 +257,10 @@ export default {
}
},
check_id_number() {
if (this.idNum.length < 18) {
this.idNum = "身份证号码有误,请重新输入";
return false;
}
let n = this.idNum.match(
/^[1-9][1-7]\d{4}(18|19|20)?\d{2}((0[1-9])|(1[012]))((0[1-9])|([12]\d)|(3[01]))\d{3}(\d|x)$/i
);
......@@ -292,17 +414,17 @@ export default {
margin-left: 6px;
}
}
.btm{
.btm {
position: fixed;
bottom: 22px;
padding: 0 20px;
.btm-info{
.btm-info {
font-size: 12px;
color: #999;
font-weight: 400;
margin-bottom: 10px;
}
.btn{
.btn {
display: flex;
align-items: center;
justify-content: center;
......@@ -310,10 +432,10 @@ export default {
height: 46px;
border-radius: 4px;
color: #fff;
background: #229DF1;
background: #229df1;
}
.btn1{
background: #C8DEFC;
.btn1 {
background: #c8defc;
pointer-events: none;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment