Commit 3b758ca6 by 李嘉林

接口对接

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