"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"); 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.base_url}/sys/common/static/${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:197", "拍照失败:", err); } }); } common_vendor.ref(""); common_vendor.ref(""); const uping = common_vendor.ref(true); common_vendor.ref(""); const savephoto = (filePath) => { uping.value = false; 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) => { 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 next = () => { if (!uping.value) { return; } pages_addstaff_api_addjigou.changemessage(common_vendor.index.getStorageSync("backhuancun")).then((res) => { if (res.success) { common_vendor.index.requestSubscribeMessage({ // 这里填后台申请好的 templateId 数组 tmplIds: ["CJ6NDNV4mTTyOdYhbksyA_YjDORVemJRmzEVAUZMBis"], success: (res2) => { common_vendor.index.setStorageSync("specicalid", ""); common_vendor.index.reLaunch({ url: `/pages/addstaff/successpush` }); }, fail: (err) => { common_vendor.index.showToast({ title: "订阅失败", icon: "none" }); } }); } else { common_vendor.index.showToast({ title: res.message, icon: "error" }); } }); }; 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 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: imgArray[0] ? `${common_vendor.unref(request_index.base_url)}/sys/common/static/${imgArray[0]}` : `https://www.focusnu.com/media/directive/index/healfront.png`, e: imgArray[0] ? `` : `https://www.focusnu.com/media/directive/index/bian.png`, f: !imgArray[0] }, !imgArray[0] ? {} : {}, { g: common_vendor.o(($event) => selectphoto(0)), h: imgArray[1] ? `${common_vendor.unref(request_index.base_url)}/sys/common/static/${imgArray[1]}` : `https://www.focusnu.com/media/directive/index/healend.png`, i: imgArray[1] ? `` : `https://www.focusnu.com/media/directive/index/bian.png`, j: !imgArray[1] }, !imgArray[1] ? {} : {}, { k: common_vendor.o(($event) => selectphoto(1)), l: imgArray[2] ? `${common_vendor.unref(request_index.base_url)}/sys/common/static/${imgArray[2]}` : `https://www.focusnu.com/media/directive/index/zizhi.png`, m: imgArray[2] ? `` : `https://www.focusnu.com/media/directive/index/bian.png`, n: !imgArray[2] }, !imgArray[2] ? {} : {}, { o: common_vendor.o(($event) => selectphoto(2)), p: imgArray[3] ? `${common_vendor.unref(request_index.base_url)}/sys/common/static/${imgArray[3]}` : `https://www.focusnu.com/media/directive/index/fanzui.png`, q: imgArray[3] ? `` : `https://www.focusnu.com/media/directive/index/bian.png`, r: !imgArray[3] }, !imgArray[3] ? {} : {}, { s: common_vendor.o(($event) => selectphoto(3)), t: common_vendor.o(goBack), v: common_vendor.o(next), w: common_vendor.o(photoclick), x: common_vendor.o(($event) => bottomshow.value = $event), y: 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