"use strict"; const common_vendor = require("../../../common/vendor.js"); const common_assets = require("../../../common/assets.js"); const config_site_config = require("../../../config/site.config.js"); const store_index = require("../../../store/index.js"); const config_api = require("../../../config/api.js"); if (!Array) { const _easycom_up_navbar2 = common_vendor.resolveComponent("up-navbar"); const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon"); const _easycom_oneBtn2 = common_vendor.resolveComponent("oneBtn"); const _easycom_up_popup2 = common_vendor.resolveComponent("up-popup"); (_easycom_up_navbar2 + _easycom_u_icon2 + _easycom_oneBtn2 + _easycom_up_popup2)(); } const _easycom_up_navbar = () => "../../../uni_modules/uview-plus/components/u-navbar/u-navbar.js"; const _easycom_u_icon = () => "../../../uni_modules/uview-plus/components/u-icon/u-icon.js"; const _easycom_oneBtn = () => "../../../components/oneBtn/oneBtn.js"; const _easycom_up_popup = () => "../../../uni_modules/uview-plus/components/u-popup/u-popup.js"; if (!Math) { (_easycom_up_navbar + _easycom_u_icon + notice + _easycom_oneBtn + _easycom_up_popup)(); } const notice = () => "./comp/notice.js"; const _sfc_main = { __name: "index", setup(__props) { const { imgUrl, tmplIds } = config_site_config.obj; const counterStore = store_index.userStore(); console.log(counterStore.token); const show = common_vendor.ref(false); let params = common_vendor.ref({ pageNo: 1, pageSize: 20 }); let noticeList = common_vendor.ref([]); async function getNoticeListFn() { const { data: res } = await config_api.getNoticeList(params); noticeList.value = res.list; } const myHouse = common_vendor.ref([]); async function getHousesFn() { console.log("counterStore.token"); console.log(counterStore.token); if (!counterStore.token) { myHouse.value = []; return true; } const { data: res } = await config_api.getHouses(); if (!res.length) { show.value = true; return; } myHouse.value = res; counterStore.upDateUseInfo("myHouse", res); } function goSever(url) { if (!myHouse.value) return; goHome(url); } async function goHome(url) { if (show.value) show.value = false; let token = counterStore.token; if (token) { const openId = counterStore.loginInfo.openId; common_vendor.index.requestSubscribeMessage({ tmplIds, async success(res) { let acceptArr = []; tmplIds.forEach((item) => { if (res[item] == "accept") { acceptArr.push(item); } }); console.log("订阅成功: ", acceptArr); if (!acceptArr.length) return; await config_api.appletSubscribe({ openId, templateIds: acceptArr }); }, fail(err) { console.log("订阅失败:", err); }, complete() { common_vendor.index.$u.route({ url }); } }); } else { common_vendor.index.$u.route({ url: "/pages/subPage/login/login" }); } } common_vendor.onPullDownRefresh(async () => { await getNoticeListFn(); await getHousesFn(); common_vendor.index.stopPullDownRefresh(); }); common_vendor.onShow(() => { getNoticeListFn(); getHousesFn(); }); return (_ctx, _cache) => { return common_vendor.e({ a: common_vendor.p({ leftText: " ", title: "事务通", safeAreaInsetTop: false, autoBack: false, fixed: false }), b: common_vendor.unref(imgUrl) + "homebanner.png", c: common_vendor.o(($event) => goHome("/pages/subPage/authentication/authentication")), d: !common_vendor.unref(counterStore).token }, !common_vendor.unref(counterStore).token ? { e: common_vendor.p({ name: "arrow-right" }), f: common_vendor.unref(imgUrl) + "homebanner3.png", g: common_vendor.o(($event) => _ctx.$goPage("/pages/subPage/login/login")) } : {}, { h: myHouse.value.length }, myHouse.value.length ? { i: common_vendor.f(myHouse.value, (item, index, i0) => { return { a: common_vendor.t(item.roomAddress), b: common_vendor.t(item.roomSize), c: index }; }), j: common_vendor.unref(imgUrl) + "homebanner3.png" } : {}, { k: common_vendor.unref(imgUrl) + "homebanner2.png", l: common_vendor.o(($event) => goSever("/pages/subPage/ballots/ballotsList/ballotsList")), m: common_assets._imports_0, n: common_vendor.o(($event) => _ctx.$goPage("/pages/subPage/notice/notice")), o: common_vendor.p({ list: common_vendor.unref(noticeList) }), p: common_vendor.o(($event) => goHome("/pages/subPage/authentication/authentication")), q: common_vendor.p({ text: "点击认证业主" }), r: common_vendor.o(($event) => show.value = false), s: common_vendor.p({ show: show.value, mode: "center", round: 10, customStyle: { width: "90%" }, closeable: true }) }); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-184b8d5d"]]); wx.createPage(MiniProgramPage);