hldy_xcx/unpackage/dist/dev/mp-weixin/pages/addstaff/healthcertificate.js

312 lines
12 KiB
JavaScript
Raw Normal View History

2025-08-21 16:52:59 +08:00
"use strict";
const common_vendor = require("../../common/vendor.js");
const request_index = require("../../request/index.js");
2025-08-22 14:30:39 +08:00
const pages_addstaff_api_addjigou = require("./api/addjigou.js");
2025-09-15 17:23:33 +08:00
const compontent_public_long = require("../../compontent/public/long.js");
2025-08-21 16:52:59 +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) {
(model + _easycom_u_action_sheet)();
}
const model = () => "../../compontent/public/model.js";
const _sfc_main = {
__name: "healthcertificate",
setup(__props) {
const show = common_vendor.ref(false);
const content = common_vendor.ref("");
const imgArray = common_vendor.reactive(["", "", "", ""]);
common_vendor.reactive(["", "", "", ""]);
const bottomlist = [{
text: "拍摄图片",
fontSize: 40
}, {
text: "图片预览",
fontSize: 40
}];
const bottomshow = common_vendor.ref(false);
const tempImagePath = common_vendor.ref("");
const imgetarget = common_vendor.ref(0);
const selectphoto = (number) => {
if (!uping.value) {
return;
}
imgetarget.value = number;
if (imgArray[number]) {
bottomshow.value = true;
} else {
getMessage();
}
};
const photoclick = (element) => {
if (element) {
common_vendor.index.previewImage({
2025-10-28 14:36:13 +08:00
urls: [`${request_index.media_base_url}${imgArray[imgetarget.value]}`],
2025-08-21 16:52:59 +08:00
// 必填,所有要预览的图片地址数组
// current: headImge.value, // 可选,当前显示图片的地址,默认是 urls[0]
indicator: "default",
// 可选指示器样式H5/App 有效,值为 'default'(圆点)或 'number'(数字)
longPressActions: {
// 可选,仅 App 支持,长按图片时弹出的操作项
itemList: ["保存图片到相册"]
}
});
} else {
getMessage();
}
};
function getMessage() {
common_vendor.index.chooseImage({
count: 1,
sourceType: ["album", "camera"],
success: (chooseRes) => {
tempImagePath.value = chooseRes.tempFilePaths[0];
common_vendor.index.navigateTo({
url: `/compontent/public/camera?url=${chooseRes.tempFilePaths[0]}&type=0&size=1`
});
},
fail: (err) => {
2025-11-25 11:25:32 +08:00
common_vendor.index.__f__("error", "at pages/addstaff/healthcertificate.vue:203", "拍照失败:", err);
2025-08-21 16:52:59 +08:00
}
});
}
common_vendor.ref("");
common_vendor.ref("");
const uping = common_vendor.ref(true);
common_vendor.ref("");
const savephoto = (filePath) => {
uping.value = false;
2025-11-25 11:25:32 +08:00
const now = /* @__PURE__ */ new Date();
const yyyy = now.getFullYear();
const mm = String(now.getMonth() + 1).padStart(2, "0");
let path = "";
switch ("yg") {
case "jg":
path = `${yyyy}/${mm}/jgxx/jg`;
break;
case "yg":
path = `${yyyy}/${mm}/ygxx/yg`;
break;
case "zz":
path = `${yyyy}/${mm}/zzxx/zz`;
break;
case "jhr":
path = `${yyyy}/${mm}/zzxx/jhr`;
break;
default:
path = `${yyyy}/${mm}/temp`;
}
2025-08-21 16:52:59 +08:00
common_vendor.index.uploadFile({
2025-11-19 15:40:09 +08:00
url: `${request_index.base_url}/sys/common/upload`,
2025-08-21 16:52:59 +08:00
// 替换为您的POST接口地址
filePath,
name: "file",
// 后端接收时的字段名
header: {
"X-Access-Token": common_vendor.index.getStorageSync("token") || ""
},
formData: {
2025-11-25 11:25:32 +08:00
biz: path
2025-08-21 16:52:59 +08:00
},
success: (uploadRes) => {
imgArray[imgetarget.value] = JSON.parse(uploadRes.data).message;
uping.value = true;
common_vendor.index.hideLoading();
},
fail: (err) => {
common_vendor.index.showToast({
title: "上传出错",
icon: "error"
});
common_vendor.index.hideLoading();
}
});
};
const ukey = common_vendor.ref(
`${common_vendor.index.getStorageSync("openid") || ""}ygbg${String(Date.now()).slice(-5)}${String(Math.floor(Math.random() * 900) + 100)}`
);
2025-08-21 16:52:59 +08:00
const next = () => {
if (!uping.value) {
return;
}
2025-09-09 17:45:04 +08:00
let data = common_vendor.index.getStorageSync("backhuancun");
data.healthZmPath = imgArray[0];
data.healthFmPath = imgArray[1];
data.qualificationPath = imgArray[2];
data.noCrimeCertificate = imgArray[3];
2025-10-20 11:05:46 +08:00
if (data.endTime == "长期") {
data.endTime = compontent_public_long.swapLongTerm(data.endTime);
}
2025-09-25 17:30:11 +08:00
data.orgCode = common_vendor.index.getStorageSync("changeyuangongorgCode");
2025-11-25 11:25:32 +08:00
common_vendor.index.__f__("log", "at pages/addstaff/healthcertificate.vue:302", "AAAA", data, ukey.value);
pages_addstaff_api_addjigou.changemessage(data, ukey.value).then((res) => {
2025-11-25 11:25:32 +08:00
common_vendor.index.__f__("log", "at pages/addstaff/healthcertificate.vue:304", "BBBB", res);
if (res.result == "重复提交") {
common_vendor.index.showToast({
title: `重复提交`,
icon: "error"
});
return;
}
if (res.result == "未做变更") {
common_vendor.index.showToast({
2025-10-17 10:51:10 +08:00
title: `当前无变更,无需提交`,
2025-10-17 13:18:01 +08:00
icon: "none"
});
return;
}
if (res.success) {
2025-10-17 13:37:41 +08:00
common_vendor.index.setStorageSync("changeyuangongorgCode", "");
2025-09-23 17:15:17 +08:00
gopush();
2025-08-22 14:30:39 +08:00
}
});
2025-08-21 16:52:59 +08:00
};
common_vendor.onLoad(() => {
if (common_vendor.index.getStorageSync("backhuancun").healthZmPath) {
let data = common_vendor.index.getStorageSync("backhuancun");
imgArray[0] = data.healthZmPath;
imgArray[1] = data.healthFmPath;
imgArray[2] = data.qualificationPath;
imgArray[3] = data.noCrimeCertificate;
} else if (common_vendor.index.getStorageSync("baddata")) {
let data = common_vendor.index.getStorageSync("baddata");
imgArray[0] = data.healthZmPath;
imgArray[1] = data.healthFmPath;
imgArray[2] = data.qualificationPath;
imgArray[3] = data.noCrimeCertificate;
}
});
2025-09-23 17:15:17 +08:00
const gopush = () => {
if (common_vendor.index.getStorageSync("nostaffmessage")) {
pages_addstaff_api_addjigou.getMessageList().then((res) => {
if (res.success) {
let data = res.result[0];
data = {
...data,
dateOfBirth: data.birthDate,
marriedOrNot: data.maritalStatus,
address: data.address,
emergencyContact: data.contactName,
emergencyTel: data.contactTel,
emergencyRelationship: data.contactRelationship,
hukouNature: data.hukouType,
idCardPositive: data.cardZmPath,
idCardNegative: data.cardFmPath,
healthCertificatePositive: data.healthZmPath,
healthCertificateNegative: data.healthFmPath,
bankPositive: data.bankZmPath,
bankNegative: data.bankFmPath,
qualification: data.qualificationPath,
noCrimeCertificate: data.noCrimeCertificate,
houseAddress: data.idCardAddress,
employeeId: data.id,
id: null,
createTime: null,
updateBy: null,
updateTime: null,
orgCode: common_vendor.index.getStorageSync("nostaffmessage")
};
pages_addstaff_api_addjigou.Apply(data).then((data2) => {
if (data2.success) {
common_vendor.index.requestSubscribeMessage({
// 这里填后台申请好的 templateId 数组
tmplIds: [
"cWVzXm1C-iitx1gNFn1nZdijq9R_3fCv8vLbiqs9zww"
],
success: (res2) => {
common_vendor.index.setStorageSync(
"nostaffmessage",
""
);
common_vendor.index.reLaunch({
url: `/pages/addstaff/successpush`
});
},
fail: (err) => {
common_vendor.index.setStorageSync(
"nostaffmessage",
""
);
common_vendor.index.reLaunch({
url: `/pages/addstaff/successpush`
});
common_vendor.index.showToast({
title: "订阅失败",
icon: "none"
});
}
});
}
});
}
});
} else {
common_vendor.index.reLaunch({
url: `/pages/addstaff/successpush`
});
}
};
2025-08-21 16:52:59 +08:00
const goBack = () => {
if (!uping.value) {
return;
}
if (imgArray[0] || imgArray[1] || imgArray[2] || imgArray[3]) {
let data = common_vendor.index.getStorageSync("backhuancun");
data.healthZmPath = imgArray[0];
data.healthFmPath = imgArray[1];
data.qualificationPath = imgArray[2];
data.noCrimeCertificate = imgArray[3];
common_vendor.index.setStorageSync("backhuancun", data);
}
common_vendor.index.navigateBack();
};
common_vendor.onShow(() => {
const img = common_vendor.index.getStorageSync("imgkey0");
if (img) {
savephoto(img);
common_vendor.index.removeStorageSync("imgkey0");
}
});
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.o(($event) => show.value = false),
b: common_vendor.p({
show: show.value,
content: content.value
}),
c: common_vendor.o(goBack),
2025-10-20 09:29:15 +08:00
d: `${common_vendor.index.getStorageSync("moveHeight") + 40}px`,
2025-10-13 14:58:45 +08:00
e: `${common_vendor.index.getStorageSync("moveHeight") + 30}px`,
2025-10-28 14:36:13 +08:00
f: imgArray[0] ? `${common_vendor.unref(request_index.media_base_url)}${imgArray[0]}` : `https://www.focusnu.com/media/directive/index/healfront.png`,
2025-10-13 14:58:45 +08:00
g: imgArray[0] ? `` : `https://www.focusnu.com/media/directive/index/bian.png`,
h: !imgArray[0]
2025-08-21 16:52:59 +08:00
}, !imgArray[0] ? {} : {}, {
2025-10-13 14:58:45 +08:00
i: common_vendor.o(($event) => selectphoto(0)),
2025-10-28 14:36:13 +08:00
j: imgArray[2] ? `${common_vendor.unref(request_index.media_base_url)}${imgArray[2]}` : `https://www.focusnu.com/media/directive/index/zizhi.png`,
2025-10-13 14:58:45 +08:00
k: imgArray[2] ? `` : `https://www.focusnu.com/media/directive/index/bian.png`,
l: !imgArray[2]
2025-08-21 16:52:59 +08:00
}, !imgArray[2] ? {} : {}, {
2025-10-13 14:58:45 +08:00
m: common_vendor.o(($event) => selectphoto(2)),
2025-10-28 14:36:13 +08:00
n: imgArray[3] ? `${common_vendor.unref(request_index.media_base_url)}${imgArray[3]}` : `https://www.focusnu.com/media/directive/index/fanzui.png`,
2025-10-13 14:58:45 +08:00
o: imgArray[3] ? `` : `https://www.focusnu.com/media/directive/index/bian.png`,
p: !imgArray[3]
2025-08-21 16:52:59 +08:00
}, !imgArray[3] ? {} : {}, {
2025-10-13 14:58:45 +08:00
q: common_vendor.o(($event) => selectphoto(3)),
r: common_vendor.o(goBack),
s: common_vendor.o(next),
t: common_vendor.o(photoclick),
v: common_vendor.o(($event) => bottomshow.value = $event),
w: common_vendor.p({
2025-08-21 16:52:59 +08:00
list: bottomlist,
modelValue: bottomshow.value
})
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-bef94c05"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/addstaff/healthcertificate.js.map