"use strict"; const common_vendor = require("../../common/vendor.js"); const common_assets = require("../../common/assets.js"); const utils_homeApi = require("../../utils/homeApi.js"); if (!Array) { const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput"); const _easycom_uni_forms_item2 = common_vendor.resolveComponent("uni-forms-item"); const _easycom_uni_forms2 = common_vendor.resolveComponent("uni-forms"); const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup"); (_easycom_uni_easyinput2 + _easycom_uni_forms_item2 + _easycom_uni_forms2 + _easycom_uni_popup2)(); } const _easycom_uni_easyinput = () => "../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js"; const _easycom_uni_forms_item = () => "../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.js"; const _easycom_uni_forms = () => "../../uni_modules/uni-forms/components/uni-forms/uni-forms.js"; const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js"; if (!Math) { (_easycom_uni_easyinput + _easycom_uni_forms_item + UploadImage + _easycom_uni_forms + _easycom_uni_popup)(); } const UploadImage = () => "../components/imageUpload.js"; const _sfc_main = { __name: "detail", setup(__props) { const mapContext = common_vendor.ref(null); const longitude = common_vendor.ref(113.943); const latitude = common_vendor.ref(30.926); const markerList = common_vendor.ref([]); const ifStar = common_vendor.ref("0"); const projectObj = common_vendor.ref({ sysFileList: [] }); const popup = common_vendor.ref(null); const valiForm = common_vendor.ref(null); const imagesUp = common_vendor.ref(null); const formData = common_vendor.ref({ coverPhotosFileList: [], desc: "", title: null, projectId: null, wechatMiniuserId: common_vendor.index.getStorageSync("userIdXGWXMN") }); const rules = common_vendor.ref({ title: { rules: [{ required: true, errorMessage: "标题不能为空" }] }, desc: { rules: [{ required: true, errorMessage: "描述不能为空" }] }, coverPhotosFileList: { rules: [{ required: true, type: "array", errorMessage: "请上传图片" }] } }); function initMap() { mapContext.value = common_vendor.index.createMapContext("mapProject"); mapContext.value.moveToLocation({ longitude: longitude.value, latitude: latitude.value }); } function setProject() { markerList.value = [ { id: 10, latitude: latitude.value, longitude: longitude.value, width: 30, height: 30, iconPath: common_assets.markerG, callout: { content: projectObj.value.projectName, borderRadius: 8, bgColor: "#fff", padding: 6, display: "ALWAYS" } } ]; initMap(); } function collect() { let params = { projectId: projectObj.value.id, wechatMiniuserId: common_vendor.index.getStorageSync("userIdXGWXMN") }; if (ifStar.value == 0) { utils_homeApi.projectInfoCollect(params).then((res) => { ifStar.value = "1"; }); } else { utils_homeApi.projectInfoRemove(params).then((res) => { ifStar.value = "0"; }); } } function gotoSay() { popup.value.open(); formData.value.coverPhotosFileList = []; formData.value.desc = null; formData.value.title = null; } function submitData() { valiForm.value.validate().then((res) => { utils_homeApi.projectCommentAdd(formData.value).then((res2) => { common_vendor.index.showToast({ icon: "none", title: "提交成功" }); popup.value.close(); imagesUp.value.clearImages(); }); }).catch((err) => { console.log("err", err); }); } common_vendor.onLoad((option) => { projectObj.value = JSON.parse(localStorage.getItem("xgProjectObj")); formData.value.projectId = projectObj.value.id; let lonlat = projectObj.value.projectLocation.split(","); longitude.value = lonlat[0]; latitude.value = lonlat[1]; ifStar.value = projectObj.value.collectStatus; setProject(); }); common_vendor.onShareAppMessage((res) => { return { title: "转发给朋友", path: "/pages/projectHM/detail" }; }); return (_ctx, _cache) => { return common_vendor.e({ a: longitude.value, b: latitude.value, c: markerList.value, d: common_vendor.t(projectObj.value.projectName), e: ifStar.value == 0 }, ifStar.value == 0 ? { f: common_vendor.o(($event) => collect()) } : {}, { g: ifStar.value == 1 }, ifStar.value == 1 ? { h: common_vendor.o(($event) => collect()) } : {}, { i: common_vendor.t(projectObj.value.projectOverview), j: projectObj.value.sysFileList.length > 0 }, projectObj.value.sysFileList.length > 0 ? { k: common_vendor.f(projectObj.value.sysFileList, (item, k0, i0) => { return { a: item.url, b: item.id }; }) } : {}, { l: common_vendor.o(($event) => gotoSay()), m: common_vendor.o(($event) => formData.value.title = $event), n: common_vendor.p({ type: "text", autoHeight: true, placeholder: "请输入", modelValue: formData.value.title }), o: common_vendor.p({ label: "留言标题", required: true, ["label-width"]: "100%", name: "title" }), p: common_vendor.o(($event) => formData.value.desc = $event), q: common_vendor.p({ type: "textarea", autoHeight: true, placeholder: "请输入", modelValue: formData.value.desc }), r: common_vendor.p({ label: "具体描述", required: true, ["label-width"]: "100%", name: "desc" }), s: common_vendor.sr(imagesUp, "6a7f2d0c-7,6a7f2d0c-6", { "k": "imagesUp" }), t: common_vendor.p({ saveFileArr: formData.value.coverPhotosFileList, limit: 3, refField: "commentPhotos", refType: "public_project_miniuser_comment" }), v: common_vendor.p({ label: "现场图片(最多3张)", required: true, ["label-width"]: "100%", name: "coverPhotosFileList" }), w: common_vendor.o(submitData), x: common_vendor.sr(valiForm, "6a7f2d0c-1,6a7f2d0c-0", { "k": "valiForm" }), y: common_vendor.p({ modelValue: formData.value, rules: rules.value }), z: common_vendor.sr(popup, "6a7f2d0c-0", { "k": "popup" }), A: common_vendor.p({ type: "bottom", ["mask-click"]: true }) }); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "E:/项目/孝感海绵城市/XiaoGanWXMini/pages/projectHM/detail.vue"]]); _sfc_main.__runtimeHooks = 2; wx.createPage(MiniProgramPage);