"use strict"; const common_vendor = require("../../common/vendor.js"); const request_index = require("../../request/index.js"); const pages_addstaff_api_addjigou = require("./api/addjigou.js"); const compontent_public_long = require("../../compontent/public/long.js"); 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({ urls: [`${request_index.media_base_url}${imgArray[imgetarget.value]}`], // 必填,所有要预览的图片地址数组 // 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) => { common_vendor.index.__f__("error", "at pages/addstaff/healthcertificate.vue:203", "拍照失败:", err); } }); } common_vendor.ref(""); common_vendor.ref(""); const uping = common_vendor.ref(true); common_vendor.ref(""); const savephoto = (filePath) => { uping.value = false; 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`; } 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: path }, 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)}` ); const next = () => { if (!uping.value) { return; } let data = common_vendor.index.getStorageSync("backhuancun"); data.healthZmPath = imgArray[0]; data.healthFmPath = imgArray[1]; data.qualificationPath = imgArray[2]; data.noCrimeCertificate = imgArray[3]; if (data.endTime == "长期") { data.endTime = compontent_public_long.swapLongTerm(data.endTime); } data.orgCode = common_vendor.index.getStorageSync("changeyuangongorgCode"); 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) => { 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({ title: `当前无变更,无需提交`, icon: "none" }); return; } if (res.success) { common_vendor.index.setStorageSync("changeyuangongorgCode", ""); gopush(); } }); }; 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; } }); 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` }); } }; 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), d: `${common_vendor.index.getStorageSync("moveHeight") + 40}px`, e: `${common_vendor.index.getStorageSync("moveHeight") + 30}px`, f: imgArray[0] ? `${common_vendor.unref(request_index.media_base_url)}${imgArray[0]}` : `https://www.focusnu.com/media/directive/index/healfront.png`, g: imgArray[0] ? `` : `https://www.focusnu.com/media/directive/index/bian.png`, h: !imgArray[0] }, !imgArray[0] ? {} : {}, { i: common_vendor.o(($event) => selectphoto(0)), j: imgArray[2] ? `${common_vendor.unref(request_index.media_base_url)}${imgArray[2]}` : `https://www.focusnu.com/media/directive/index/zizhi.png`, k: imgArray[2] ? `` : `https://www.focusnu.com/media/directive/index/bian.png`, l: !imgArray[2] }, !imgArray[2] ? {} : {}, { m: common_vendor.o(($event) => selectphoto(2)), n: imgArray[3] ? `${common_vendor.unref(request_index.media_base_url)}${imgArray[3]}` : `https://www.focusnu.com/media/directive/index/fanzui.png`, o: imgArray[3] ? `` : `https://www.focusnu.com/media/directive/index/bian.png`, p: !imgArray[3] }, !imgArray[3] ? {} : {}, { 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({ 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