"use strict"; const common_vendor = require("../../../common/vendor.js"); const common_libraries_IsHouseExist = require("../../../common/libraries/IsHouseExist.js"); require("../../../common/libraries/request.js"); const common_store_useWeAppAuthStore = require("../../../common/store/useWeAppAuthStore.js"); const common_store_useWorkStore = require("../../../common/store/useWorkStore.js"); const pages_index_model = require("../model.js"); require("../../../gen/Apis.js"); require("../../../common/libraries/setTabBar.js"); require("../../../common/libraries/apiLoading.js"); if (!Array) { const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon"); const _easycom_hs_popup_switch_house2 = common_vendor.resolveComponent("hs-popup-switch-house"); (_easycom_up_icon2 + _easycom_hs_popup_switch_house2)(); } const _easycom_up_icon = () => "../../../node-modules/uview-plus/components/u-icon/u-icon.js"; const _easycom_hs_popup_switch_house = () => "../../../components/hs-popup-switch-house/hs-popup-switch-house.js"; if (!Math) { (_easycom_up_icon + _easycom_hs_popup_switch_house)(); } const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ __name: "PageHeadTitle", props: ["title", "objStyle", "data"], setup(__props) { const props = __props; const work = common_store_useWorkStore.useWorkStore(); const show = common_vendor.ref(false); const titleValue = common_vendor.ref("标题"); const capsuleRect = common_vendor.ref({}); const userData = common_vendor.ref({}); const auth = common_store_useWeAppAuthStore.useWeAppAuthStore(); const handlePopupSwitchHouse = () => { if (!common_libraries_IsHouseExist.getIsHouseExist()) return; show.value = true; }; common_vendor.watch( () => work == null ? void 0 : work.selectedHouse, () => { if (work == null ? void 0 : work.selectedHouse) { show.value = true; } console.log("work?.selectedHouse", work == null ? void 0 : work.selectedHouse); } ); const handleSelectedHouse = (e) => { show.value = false; }; const getPageBgFun = () => { var _a, _b, _c, _d, _e, _f, _g, _h; let cssStrColor = ((_d = (_c = (_b = (_a = pages_index_model.useModel) == null ? void 0 : _a.pageConfig) == null ? void 0 : _b.value) == null ? void 0 : _c.pageColorValue) == null ? void 0 : _d[0]) || "#d3d7ff"; let cssEndColor = ((_h = (_g = (_f = (_e = pages_index_model.useModel) == null ? void 0 : _e.pageConfig) == null ? void 0 : _f.value) == null ? void 0 : _g.pageColorValue) == null ? void 0 : _h[1]) || "#dffff3"; let bhg = `background:linear-gradient(180deg,rgba(208, 229, 255, 0.44) 0%,#f7f7f7 100%,rgba(255, 255, 255, 0) 100%),linear-gradient(145deg, ${cssStrColor} 100%,rgba(255, 255, 255, 0) 100%),linear-gradient(222deg, ${cssEndColor} 100%,#F7F7F7 40%);`; return bhg; }; const truncateString = (str) => { if (!str) return "-"; const maxLength = 15; if (str.length <= maxLength) return str; const start = 6; const end = 6; return str.slice(0, start) + "..." + str.slice(-end); }; common_vendor.watch( () => { var _a; return (_a = auth == null ? void 0 : auth.data) == null ? void 0 : _a.user; }, () => { var _a, _b; if (((_a = auth == null ? void 0 : auth.data) == null ? void 0 : _a.house_occupant) && !((_b = auth == null ? void 0 : auth.data) == null ? void 0 : _b.selected_house)) { show.value = false; } }, { deep: true } ); common_vendor.onShow(() => { userData.value = auth == null ? void 0 : auth.data; console.log("2k2k", userData.value); }); common_vendor.onMounted(() => { titleValue.value = props.title; capsuleRect.value = common_vendor.index.getMenuButtonBoundingClientRect(); console.log(capsuleRect.value, "capsuleRect"); }); common_vendor.onHide(() => { show.value = false; }); return (_ctx, _cache) => { var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z; return common_vendor.e({ a: (_f = (_e = (_d = (_c = (_b = (_a = userData.value) == null ? void 0 : _a.config) == null ? void 0 : _b.companyConfig) == null ? void 0 : _c.config_value) == null ? void 0 : _d.logo) == null ? void 0 : _e[0]) == null ? void 0 : _f.url }, ((_l = (_k = (_j = (_i = (_h = (_g = userData.value) == null ? void 0 : _g.config) == null ? void 0 : _h.companyConfig) == null ? void 0 : _i.config_value) == null ? void 0 : _j.logo) == null ? void 0 : _k[0]) == null ? void 0 : _l.url) ? { b: ((_r = (_q = (_p = (_o = (_n = (_m = userData.value) == null ? void 0 : _m.config) == null ? void 0 : _n.companyConfig) == null ? void 0 : _o.config_value) == null ? void 0 : _p.logo) == null ? void 0 : _q[0]) == null ? void 0 : _r.url) || "" } : {}, { c: !((_s = userData.value) == null ? void 0 : _s.user) }, !((_t = userData.value) == null ? void 0 : _t.user) ? {} : !((_u = userData.value) == null ? void 0 : _u.selected_house) ? {} : { e: common_vendor.t(truncateString(((_w = (_v = userData.value) == null ? void 0 : _v.selected_house) == null ? void 0 : _w.full_name) || "")) }, { d: !((_x = userData.value) == null ? void 0 : _x.selected_house), f: common_vendor.p({ name: "arrow-down-fill", size: "12", color: "#333" }), g: common_vendor.o(handlePopupSwitchHouse), h: common_vendor.o(($event) => show.value = false), i: common_vendor.o(handleSelectedHouse), j: common_vendor.p({ show: show.value }), k: common_vendor.s(`padding-top:${capsuleRect.value.top}px;height:${capsuleRect.value.height}px;line-height:${capsuleRect.value.height}px;${props == null ? void 0 : props.objStyle};${((_z = (_y = common_vendor.unref(pages_index_model.useModel)) == null ? void 0 : _y.scrollTop) == null ? void 0 : _z.value) > 10 ? getPageBgFun() : ""}`) }); }; } }); const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f5a8911c"], ["__file", "/Users/zsq/Sources/github/2025property-pay/pay-customer/src/pages/index/components/PageHeadTitle.vue"]]); wx.createComponent(Component);