Commit 832c63d4 by 李嘉林

修改

parent 4d9ee245
......@@ -152,6 +152,7 @@ export default {
//do something
},
fail(res) {
console.log(res,'-----------------fail')
wx.showToast({
title: "生成失败",
icon: "error",
......
......@@ -10,7 +10,7 @@
<div class="label">
<p>证件照</p>
</div>
<div class="img">
<div class="img" @click="upLoadImg">
<image
v-if="userInfo.headPortraitUrl"
mode="aspectFill"
......@@ -83,6 +83,7 @@
<script>
import live from "@/api/live";
import index from "@/api/index";
import { DFSImg } from '@/utils/common.js'
export default {
name: "improveInformation",
......@@ -91,6 +92,7 @@ export default {
workAreaList: [],
diningPlaceList: [],
userInfo:{},
editImg: false,
};
},
components: {},
......@@ -132,11 +134,19 @@ export default {
wx.showLoading({
title: "加载中...",
});
this.editImg = false;
live.getUserInfo().then(res=>{
wx.hideLoading();
if(res.data.ok=='true'){
this.userInfo = res.data.data;
this.userInfo.headPortraitUrl = this.userInfo.headPortraitUrl?DFSImg(this.userInfo.headPortraitUrl) : '';
let idPhoto = wx.getStorageSync("wo-selectImgUrl");
if (idPhoto) {
this.editImg = true;
this.userInfo.headPortraitUrl = idPhoto;
wx.removeStorageSync("wo-selectImgUrl");
} else {
this.userInfo.headPortraitUrl = this.userInfo.headPortraitUrl?DFSImg(this.userInfo.headPortraitUrl) : '';
}
}
})
},
......@@ -154,11 +164,44 @@ export default {
url: `/pages/wo/diningPlace/main`,
});
},
// 上传图片
upLoadImg() {
let self = this;
wx.chooseImage({
count: 1, // 默认9
sizeType: ["original", "compressed"], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ["album", "camera"], // 可以指定来源是相册还是相机,默认二者都有
success(res) {
const src = res.tempFilePaths[0];
console.log(src, "---------------chooseImage");
if (src) {
// 将图片参数传递给插件
wx.navigateTo({
url: `/pages/wo/editPicture/main?src=${src}`, // 指定页面的url
});
}
wx.hideToast();
},
fail(res) {
wx.hideToast();
wx.navigateBack();
},
});
},
confirm() {
console.log("--提交--");
// wx.reLaunch({
// url: '/pages/home/main' // 指定页面的url
// });
if(this.userInfo.headPortraitUrl == ""){
wx.showToast({
title: "请上传证件照",
icon: "error",
duration: 1000,
});
return;
}
if(this.editImg == true) {
console.log('----需要修改证件照')
this.update_info();
}
if(getCurrentPages().length>1){
wx.navigateBack();
} else {
......@@ -167,6 +210,15 @@ export default {
});
}
},
update_info() {
let query = {
userId: this.userInfo.userId,
headPortraitUrl: this.userInfo.headPortraitUrl
}
index.update_info(query).then(res=>{
if(res.data.ok == 'true'){}
})
},
},
onHide() {
console.log("--onHide");
......
......@@ -3,7 +3,7 @@
<div class="writeInformation">
<div class="info flex">
<i class="iconfont icon-gantanhao"></i>
<p>输入真实姓名和身份证号码并上传证件照以校验您的身份</p>
<p>输入真实姓名和身份证号码以校验您的身份</p>
</div>
<div class="user">
<div class="cell flex idPhoto">
......@@ -127,7 +127,6 @@ export default {
console.log(src, "---------------chooseImage");
if (src) {
// 将图片参数传递给插件
self.chooseImg = true;
wx.navigateTo({
url: `/pages/wo/editPicture/main?src=${src}`, // 指定页面的url
});
......@@ -144,14 +143,14 @@ export default {
next() {
console.log("--下一步--");
// this.check_id_number();
if (this.idPhoto == "") {
wx.showToast({
title: "请上传证件照",
icon: "error",
duration: 1000,
});
return;
}
// if (this.idPhoto == "") {
// wx.showToast({
// title: "请上传证件照",
// icon: "error",
// duration: 1000,
// });
// return;
// }
if (this.name == "") {
wx.showToast({
title: "请输入姓名",
......@@ -253,9 +252,9 @@ export default {
input_id_number() {
let n = this.idNum.match(/\d{0,17}(\d|x)/i);
this.idNum = n === null ? "" : n[0];
if (this.idNum.length == 18) {
this.check_id_number();
}
// if (this.idNum.length == 18) {
// this.check_id_number();
// }
},
check_id_number() {
if (this.idNum.length < 18) {
......
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