2025-06-27 08:56:14 +08:00
|
|
|
|
"use strict";
|
|
|
|
|
|
const common_vendor = require("../../common/vendor.js");
|
2025-09-28 10:58:31 +08:00
|
|
|
|
const request_index = require("../../request/index.js");
|
2025-09-15 17:23:33 +08:00
|
|
|
|
const api_loginApi = require("../../api/loginApi.js");
|
2025-10-29 17:28:17 +08:00
|
|
|
|
if (!Array) {
|
|
|
|
|
|
const _easycom_u_action_sheet2 = common_vendor.resolveComponent("u-action-sheet");
|
|
|
|
|
|
_easycom_u_action_sheet2();
|
|
|
|
|
|
}
|
|
|
|
|
|
const _easycom_u_action_sheet = () => "../../uni_modules/vk-uview-ui/components/u-action-sheet/u-action-sheet.js";
|
|
|
|
|
|
if (!Math) {
|
|
|
|
|
|
_easycom_u_action_sheet();
|
|
|
|
|
|
}
|
2025-06-27 08:56:14 +08:00
|
|
|
|
const _sfc_main = {
|
|
|
|
|
|
__name: "IDcard",
|
|
|
|
|
|
setup(__props) {
|
2025-10-29 17:28:17 +08:00
|
|
|
|
const bottomshow = common_vendor.ref(false);
|
2025-09-15 17:23:33 +08:00
|
|
|
|
const form = common_vendor.reactive({
|
|
|
|
|
|
name: "",
|
|
|
|
|
|
tel: "",
|
|
|
|
|
|
advisoryType: 1,
|
|
|
|
|
|
status: 2,
|
|
|
|
|
|
idCard: "",
|
|
|
|
|
|
homeAddress: "",
|
|
|
|
|
|
workUnit: "",
|
|
|
|
|
|
izJs: 1,
|
2025-09-28 14:43:44 +08:00
|
|
|
|
openId: common_vendor.index.getStorageSync("openid"),
|
|
|
|
|
|
relationship: ""
|
2025-09-15 17:23:33 +08:00
|
|
|
|
});
|
2025-10-29 17:28:17 +08:00
|
|
|
|
const bottomlist = [{
|
|
|
|
|
|
text: "拍摄图片",
|
|
|
|
|
|
fontSize: 40
|
|
|
|
|
|
}, {
|
|
|
|
|
|
text: "图片预览",
|
|
|
|
|
|
fontSize: 40
|
|
|
|
|
|
}];
|
2025-09-15 17:23:33 +08:00
|
|
|
|
function isValid11DigitNumber(val) {
|
2025-10-29 17:28:17 +08:00
|
|
|
|
return /^1[3-9]\d{9}$/.test(val);
|
2025-09-15 17:23:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
function isValid18DigitNumber(val) {
|
|
|
|
|
|
return /^(\d{18})$/.test(val);
|
2025-06-27 08:56:14 +08:00
|
|
|
|
}
|
2025-10-29 17:28:17 +08:00
|
|
|
|
const photoclick = (element) => {
|
|
|
|
|
|
if (element) {
|
|
|
|
|
|
common_vendor.index.previewImage({
|
|
|
|
|
|
urls: [specialImgeshow.value],
|
|
|
|
|
|
// 必填,所有要预览的图片地址数组
|
|
|
|
|
|
current: specialImgeshow.value,
|
|
|
|
|
|
// 可选,当前显示图片的地址,默认是 urls[0]
|
|
|
|
|
|
indicator: "default",
|
|
|
|
|
|
// 可选,指示器样式,H5/App 有效,值为 'default'(圆点)或 'number'(数字)
|
|
|
|
|
|
longPressActions: {
|
|
|
|
|
|
// 可选,仅 App 支持,长按图片时弹出的操作项
|
|
|
|
|
|
itemList: ["保存图片到相册"]
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
angetMessage();
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
const specialImge = common_vendor.ref("");
|
|
|
|
|
|
const uping = common_vendor.ref(true);
|
|
|
|
|
|
const selectphoto = () => {
|
|
|
|
|
|
if (!uping.value) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (specialImge.value) {
|
|
|
|
|
|
bottomshow.value = true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
angetMessage();
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
function angetMessage() {
|
|
|
|
|
|
common_vendor.index.chooseImage({
|
|
|
|
|
|
count: 1,
|
|
|
|
|
|
sourceType: ["album", "camera"],
|
|
|
|
|
|
success: (chooseRes) => {
|
|
|
|
|
|
common_vendor.index.navigateTo({
|
|
|
|
|
|
url: `/compontent/public/camera?url=${chooseRes.tempFilePaths[0]}&type=0`
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
fail: (err) => {
|
|
|
|
|
|
common_vendor.index.__f__("error", "at pages/addoldman/IDcard.vue:174", "拍照失败:", err);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2025-10-16 16:23:30 +08:00
|
|
|
|
const ukey = common_vendor.ref(
|
|
|
|
|
|
`${common_vendor.index.getStorageSync("openid") || ""}jhbg${String(Date.now()).slice(-5)}${String(Math.floor(Math.random() * 900) + 100)}`
|
|
|
|
|
|
);
|
2025-09-15 17:23:33 +08:00
|
|
|
|
const next = () => {
|
2025-10-29 17:28:17 +08:00
|
|
|
|
if (!form.name) {
|
2025-09-15 17:23:33 +08:00
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
|
|
title: "请填写姓名",
|
|
|
|
|
|
icon: "error"
|
|
|
|
|
|
});
|
|
|
|
|
|
} else if (!form.tel) {
|
|
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
|
|
title: "请填写电话",
|
|
|
|
|
|
icon: "error"
|
|
|
|
|
|
});
|
|
|
|
|
|
} else if (!isValid11DigitNumber(form.tel)) {
|
|
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
|
|
title: "电话格式错误",
|
|
|
|
|
|
icon: "none"
|
|
|
|
|
|
});
|
|
|
|
|
|
return;
|
|
|
|
|
|
} else if (!form.idCard) {
|
|
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
|
|
title: "请填写身份证号",
|
|
|
|
|
|
icon: "error"
|
|
|
|
|
|
});
|
|
|
|
|
|
} else if (!isValid18DigitNumber(form.idCard)) {
|
|
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
|
|
title: "身份证号格式错误",
|
|
|
|
|
|
icon: "none"
|
|
|
|
|
|
});
|
|
|
|
|
|
return;
|
|
|
|
|
|
} else if (!form.homeAddress) {
|
|
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
|
|
title: "请填写家庭住址",
|
|
|
|
|
|
icon: "error"
|
|
|
|
|
|
});
|
|
|
|
|
|
} else if (!form.workUnit) {
|
|
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
|
|
title: "请填写工作单位",
|
|
|
|
|
|
icon: "error"
|
|
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (common_vendor.index.getStorageSync("allinfo").name) {
|
2025-09-26 16:46:17 +08:00
|
|
|
|
let data = common_vendor.index.getStorageSync("allinfo");
|
2025-09-28 10:58:31 +08:00
|
|
|
|
data.guardianName = form.name;
|
|
|
|
|
|
data.guardianPhone = form.tel;
|
|
|
|
|
|
data.guardianIdCard = form.idCard;
|
|
|
|
|
|
data.guardianHomeAddress = form.homeAddress;
|
|
|
|
|
|
data.guardianWorkUnit = form.workUnit;
|
2025-09-28 14:43:44 +08:00
|
|
|
|
data.relationship = form.relationship;
|
2025-10-29 17:28:17 +08:00
|
|
|
|
data.guardianIdCardPositive = specialImge.value;
|
2025-09-28 11:18:34 +08:00
|
|
|
|
data.modifyType = "jhr";
|
2025-10-16 16:23:30 +08:00
|
|
|
|
const urlpost = `${request_index.base_url}/api/elderInfo/updateElderInfo?ukey=${ukey.value}`;
|
2025-09-26 16:46:17 +08:00
|
|
|
|
common_vendor.index.request({
|
|
|
|
|
|
url: urlpost,
|
|
|
|
|
|
method: "POST",
|
|
|
|
|
|
header: {
|
|
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
|
|
"X-Access-Token": common_vendor.index.getStorageSync("token") || ""
|
|
|
|
|
|
},
|
|
|
|
|
|
data,
|
|
|
|
|
|
success: (res) => {
|
2025-10-16 16:23:30 +08:00
|
|
|
|
if (res.data.result == "重复提交") {
|
2025-10-17 10:03:13 +08:00
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
|
|
title: `重复提交`,
|
|
|
|
|
|
icon: "error"
|
|
|
|
|
|
});
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (res.data.result == "未做变更") {
|
|
|
|
|
|
common_vendor.index.showToast({
|
2025-10-17 10:51:10 +08:00
|
|
|
|
title: `当前无变更,无需提交`,
|
2025-10-17 13:18:01 +08:00
|
|
|
|
icon: "none"
|
2025-10-17 10:03:13 +08:00
|
|
|
|
});
|
2025-10-16 16:23:30 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-09-28 10:58:31 +08:00
|
|
|
|
if (res.data.success) {
|
2025-09-26 16:46:17 +08:00
|
|
|
|
api_loginApi.getMessage(common_vendor.index.getStorageSync("openid")).then((res2) => {
|
|
|
|
|
|
common_vendor.index.setStorageSync("allinfo", res2.result);
|
|
|
|
|
|
common_vendor.index.reLaunch({
|
2025-09-28 10:58:31 +08:00
|
|
|
|
url: "/pages/oldmanindex/oldmansuccess?type=1&jianhu=1"
|
2025-09-26 16:46:17 +08:00
|
|
|
|
});
|
2025-09-15 17:23:33 +08:00
|
|
|
|
});
|
2025-09-26 16:46:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
fail: (e) => {
|
2025-10-29 17:28:17 +08:00
|
|
|
|
common_vendor.index.__f__("log", "at pages/addoldman/IDcard.vue:271", "????", e);
|
2025-09-15 17:23:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
} else {
|
2025-09-28 10:58:31 +08:00
|
|
|
|
let data = {};
|
|
|
|
|
|
data.guardianName = form.name;
|
|
|
|
|
|
data.guardianPhone = form.tel;
|
|
|
|
|
|
data.guardianIdCard = form.idCard;
|
|
|
|
|
|
data.guardianHomeAddress = form.homeAddress;
|
|
|
|
|
|
data.guardianWorkUnit = form.workUnit;
|
2025-09-28 14:43:44 +08:00
|
|
|
|
data.relationship = form.relationship;
|
2025-10-29 17:28:17 +08:00
|
|
|
|
data.guardianIdCardPositive = specialImge.value;
|
2025-10-16 16:23:30 +08:00
|
|
|
|
const urlpost = `${request_index.base_url}/api/elderInfo/addElder?ukey=${ukey.value}`;
|
2025-09-28 10:58:31 +08:00
|
|
|
|
common_vendor.index.request({
|
|
|
|
|
|
url: urlpost,
|
|
|
|
|
|
method: "POST",
|
|
|
|
|
|
header: {
|
|
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
|
|
"X-Access-Token": common_vendor.index.getStorageSync("token") || ""
|
|
|
|
|
|
},
|
|
|
|
|
|
data,
|
2025-10-17 10:03:13 +08:00
|
|
|
|
success: (res) => {
|
|
|
|
|
|
if (res.data.result == "重复提交") {
|
|
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
|
|
title: `重复提交`,
|
|
|
|
|
|
icon: "error"
|
|
|
|
|
|
});
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (res.data.result == "未做变更") {
|
|
|
|
|
|
common_vendor.index.showToast({
|
2025-10-17 10:51:10 +08:00
|
|
|
|
title: `当前无变更,无需提交`,
|
2025-10-17 13:18:01 +08:00
|
|
|
|
icon: "none"
|
2025-10-17 10:03:13 +08:00
|
|
|
|
});
|
2025-10-16 16:23:30 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-10-17 10:03:13 +08:00
|
|
|
|
if (res.data.code != 200) {
|
2025-09-28 10:58:31 +08:00
|
|
|
|
common_vendor.index.showToast({
|
2025-10-17 10:03:13 +08:00
|
|
|
|
title: res.data.message,
|
2025-09-28 10:58:31 +08:00
|
|
|
|
icon: "none",
|
|
|
|
|
|
// 'success' 成功图标,'none' 无图标
|
|
|
|
|
|
duration: 2e3
|
|
|
|
|
|
// 显示时长 ms
|
|
|
|
|
|
});
|
|
|
|
|
|
return;
|
|
|
|
|
|
} else {
|
2025-09-19 17:12:59 +08:00
|
|
|
|
common_vendor.index.reLaunch({
|
2025-09-28 10:58:31 +08:00
|
|
|
|
url: "/pages/oldmanindex/oldmansuccess?type=1&jianhu=1"
|
2025-09-15 17:23:33 +08:00
|
|
|
|
});
|
2025-09-28 10:58:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
fail: (e) => {
|
2025-09-15 17:23:33 +08:00
|
|
|
|
}
|
2025-06-27 08:56:14 +08:00
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2025-09-15 17:23:33 +08:00
|
|
|
|
const goBack = () => {
|
|
|
|
|
|
common_vendor.index.navigateBack();
|
2025-06-27 08:56:14 +08:00
|
|
|
|
};
|
2025-10-29 17:28:17 +08:00
|
|
|
|
const specialImgeshow = common_vendor.ref("");
|
2025-09-15 17:23:33 +08:00
|
|
|
|
common_vendor.onLoad(() => {
|
|
|
|
|
|
if (common_vendor.index.getStorageSync("allinfo").name) {
|
|
|
|
|
|
let data = common_vendor.index.getStorageSync("allinfo");
|
|
|
|
|
|
const keys = [
|
|
|
|
|
|
"openId",
|
|
|
|
|
|
"name",
|
|
|
|
|
|
"tel",
|
|
|
|
|
|
"advisoryType",
|
|
|
|
|
|
"status",
|
|
|
|
|
|
"idCard",
|
|
|
|
|
|
"homeAddress",
|
|
|
|
|
|
"workUnit",
|
2025-09-28 14:43:44 +08:00
|
|
|
|
"izJs",
|
|
|
|
|
|
"relationship"
|
2025-09-15 17:23:33 +08:00
|
|
|
|
];
|
|
|
|
|
|
keys.forEach((key) => {
|
|
|
|
|
|
form[key] = data[key] || "";
|
|
|
|
|
|
});
|
2025-10-29 17:28:17 +08:00
|
|
|
|
specialImge.value = data.guardianIdCardPositive;
|
|
|
|
|
|
specialImgeshow.value = request_index.media_base_url + data.guardianIdCardPositive;
|
|
|
|
|
|
common_vendor.index.__f__("log", "at pages/addoldman/IDcard.vue:406", "????", common_vendor.index.getStorageSync("allinfo"));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
function uploadImage(filePath) {
|
|
|
|
|
|
uping.value = false;
|
|
|
|
|
|
common_vendor.index.showLoading();
|
|
|
|
|
|
common_vendor.index.uploadFile({
|
|
|
|
|
|
url: `${request_index.base_url}/api/ocr/idCard`,
|
|
|
|
|
|
// 替换为您的POST接口地址
|
|
|
|
|
|
filePath,
|
|
|
|
|
|
name: "file",
|
|
|
|
|
|
// 后端接收时的字段名
|
|
|
|
|
|
header: {
|
|
|
|
|
|
"X-Access-Token": common_vendor.index.getStorageSync("token") || ""
|
|
|
|
|
|
},
|
|
|
|
|
|
formData: {},
|
|
|
|
|
|
success: (uploadRes) => {
|
|
|
|
|
|
if (!JSON.parse(uploadRes.data).success) {
|
|
|
|
|
|
common_vendor.index.hideLoading();
|
|
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
|
|
title: "识别失败",
|
|
|
|
|
|
icon: "error",
|
|
|
|
|
|
duration: 2e3
|
|
|
|
|
|
});
|
|
|
|
|
|
uping.value = true;
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (JSON.parse(JSON.parse(uploadRes.data).result.data).data.face) {
|
|
|
|
|
|
let father = JSON.parse(JSON.parse(uploadRes.data).result.data).data.face.data;
|
|
|
|
|
|
specialImgeshow.value = filePath;
|
|
|
|
|
|
form.name = father.name;
|
|
|
|
|
|
form.idCard = father.idNumber;
|
|
|
|
|
|
form.homeAddress = father.address;
|
|
|
|
|
|
savephoto(filePath);
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
fail: (err) => {
|
|
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
|
|
title: "上传出错",
|
|
|
|
|
|
icon: "error"
|
|
|
|
|
|
});
|
|
|
|
|
|
common_vendor.index.hideLoading();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
const savephoto = (filePath, type) => {
|
|
|
|
|
|
common_vendor.index.uploadFile({
|
|
|
|
|
|
url: `${request_index.base_url}/sys/common/upload`,
|
|
|
|
|
|
// 替换为您的POST接口地址
|
|
|
|
|
|
filePath,
|
|
|
|
|
|
name: "file",
|
|
|
|
|
|
// 后端接收时的字段名
|
|
|
|
|
|
header: {
|
|
|
|
|
|
"X-Access-Token": common_vendor.index.getStorageSync("token") || ""
|
|
|
|
|
|
},
|
|
|
|
|
|
formData: {
|
|
|
|
|
|
biz: `temp`
|
|
|
|
|
|
},
|
|
|
|
|
|
success: (uploadRes) => {
|
|
|
|
|
|
specialImge.value = JSON.parse(uploadRes.data).message;
|
|
|
|
|
|
common_vendor.index.hideLoading();
|
|
|
|
|
|
uping.value = true;
|
|
|
|
|
|
},
|
|
|
|
|
|
fail: (err) => {
|
|
|
|
|
|
common_vendor.index.showToast({
|
|
|
|
|
|
title: "上传出错",
|
|
|
|
|
|
icon: "error"
|
|
|
|
|
|
});
|
|
|
|
|
|
common_vendor.index.hideLoading();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
common_vendor.onShow(() => {
|
|
|
|
|
|
const img = common_vendor.index.getStorageSync("imgkey0");
|
|
|
|
|
|
if (img) {
|
|
|
|
|
|
uploadImage(img);
|
|
|
|
|
|
common_vendor.index.removeStorageSync("imgkey0");
|
2025-09-15 17:23:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
2025-06-27 08:56:14 +08:00
|
|
|
|
return (_ctx, _cache) => {
|
2025-10-29 17:28:17 +08:00
|
|
|
|
return common_vendor.e({
|
2025-09-15 17:23:33 +08:00
|
|
|
|
a: common_vendor.o(goBack),
|
2025-10-20 09:29:15 +08:00
|
|
|
|
b: `${common_vendor.index.getStorageSync("moveHeight") + 40}px`,
|
2025-10-20 16:59:27 +08:00
|
|
|
|
c: `${common_vendor.index.getStorageSync("moveHeight") + 40}px`,
|
2025-10-29 17:28:17 +08:00
|
|
|
|
d: specialImge.value ? `${common_vendor.unref(request_index.media_base_url)}${specialImge.value}` : `https://www.focusnu.com/media/directive/index/IDfront.png`,
|
|
|
|
|
|
e: specialImge.value ? `` : `https://www.focusnu.com/media/directive/index/bian.png`,
|
|
|
|
|
|
f: !specialImge.value
|
|
|
|
|
|
}, !specialImge.value ? {} : {}, {
|
|
|
|
|
|
g: common_vendor.o(($event) => selectphoto()),
|
|
|
|
|
|
h: form.name,
|
|
|
|
|
|
i: common_vendor.o(($event) => form.name = $event.detail.value),
|
|
|
|
|
|
j: form.tel,
|
|
|
|
|
|
k: common_vendor.o(($event) => form.tel = $event.detail.value),
|
|
|
|
|
|
l: form.idCard,
|
|
|
|
|
|
m: common_vendor.o(($event) => form.idCard = $event.detail.value),
|
|
|
|
|
|
n: form.homeAddress,
|
|
|
|
|
|
o: common_vendor.o(($event) => form.homeAddress = $event.detail.value),
|
|
|
|
|
|
p: form.workUnit,
|
|
|
|
|
|
q: common_vendor.o(($event) => form.workUnit = $event.detail.value),
|
|
|
|
|
|
r: common_vendor.o(next),
|
|
|
|
|
|
s: common_vendor.o(photoclick),
|
|
|
|
|
|
t: common_vendor.o(($event) => bottomshow.value = $event),
|
|
|
|
|
|
v: common_vendor.p({
|
|
|
|
|
|
list: bottomlist,
|
|
|
|
|
|
modelValue: bottomshow.value
|
|
|
|
|
|
})
|
|
|
|
|
|
});
|
2025-06-27 08:56:14 +08:00
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-5fcb8e22"]]);
|
|
|
|
|
|
wx.createPage(MiniProgramPage);
|
|
|
|
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/addoldman/IDcard.js.map
|