2025-12-15 18:19:04 +08:00

102 lines
4.4 KiB
JavaScript

"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/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;
};
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;
return common_vendor.e({
a: !((_a = userData.value) == null ? void 0 : _a.user)
}, !((_b = userData.value) == null ? void 0 : _b.user) ? {} : !((_c = userData.value) == null ? void 0 : _c.selected_house) ? {} : {
c: common_vendor.t(((_e = (_d = userData.value) == null ? void 0 : _d.selected_house) == null ? void 0 : _e.full_name) || "-")
}, {
b: !((_f = userData.value) == null ? void 0 : _f.selected_house),
d: common_vendor.p({
name: "arrow-down-fill",
size: "12",
color: "#333"
}),
e: common_vendor.o(handlePopupSwitchHouse),
f: common_vendor.o(($event) => show.value = false),
g: common_vendor.o(handleSelectedHouse),
h: common_vendor.p({
show: show.value
}),
i: common_vendor.n(`custom-title ${((_h = (_g = common_vendor.unref(pages_index_model.useModel)) == null ? void 0 : _g.scrollTop) == null ? void 0 : _h.value) > 10 ? "custom_title_scroll_bg" : ""}`),
j: 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}`)
});
};
}
});
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);