Commit 832c63d4 by 李嘉林

修改

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