You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

166 lines
5.6 KiB

4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
4 months ago
2 weeks ago
4 months ago
2 weeks ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
3 months ago
3 months ago
3 months ago
4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
2 weeks ago
4 months ago
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const common_assets = require("../../../common/assets.js");
  4. const config_site_config = require("../../../config/site.config.js");
  5. const store_index = require("../../../store/index.js");
  6. const config_api = require("../../../config/api.js");
  7. if (!Array) {
  8. const _easycom_up_navbar2 = common_vendor.resolveComponent("up-navbar");
  9. const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
  10. const _easycom_oneBtn2 = common_vendor.resolveComponent("oneBtn");
  11. const _easycom_up_popup2 = common_vendor.resolveComponent("up-popup");
  12. (_easycom_up_navbar2 + _easycom_u_icon2 + _easycom_oneBtn2 + _easycom_up_popup2)();
  13. }
  14. const _easycom_up_navbar = () => "../../../uni_modules/uview-plus/components/u-navbar/u-navbar.js";
  15. const _easycom_u_icon = () => "../../../uni_modules/uview-plus/components/u-icon/u-icon.js";
  16. const _easycom_oneBtn = () => "../../../components/oneBtn/oneBtn.js";
  17. const _easycom_up_popup = () => "../../../uni_modules/uview-plus/components/u-popup/u-popup.js";
  18. if (!Math) {
  19. (_easycom_up_navbar + _easycom_u_icon + notice + _easycom_oneBtn + _easycom_up_popup)();
  20. }
  21. const notice = () => "./comp/notice.js";
  22. const _sfc_main = {
  23. __name: "index",
  24. setup(__props) {
  25. const {
  26. imgUrl,
  27. tmplIds
  28. } = config_site_config.obj;
  29. const counterStore = store_index.userStore();
  30. console.log(counterStore.token);
  31. const show = common_vendor.ref(false);
  32. let params = common_vendor.ref({
  33. pageNo: 1,
  34. pageSize: 20
  35. });
  36. let noticeList = common_vendor.ref([]);
  37. async function getNoticeListFn() {
  38. const {
  39. data: res
  40. } = await config_api.getNoticeList(params);
  41. noticeList.value = res.list;
  42. }
  43. const myHouse = common_vendor.ref([]);
  44. async function getHousesFn() {
  45. console.log("counterStore.token");
  46. console.log(counterStore.token);
  47. if (!counterStore.token) {
  48. myHouse.value = [];
  49. return true;
  50. }
  51. const {
  52. data: res
  53. } = await config_api.getHouses();
  54. if (!res.length) {
  55. show.value = true;
  56. return;
  57. }
  58. myHouse.value = res;
  59. counterStore.upDateUseInfo("myHouse", res);
  60. }
  61. function goSever(url) {
  62. if (!myHouse.value)
  63. return;
  64. goHome(url);
  65. }
  66. async function goHome(url) {
  67. if (show.value)
  68. show.value = false;
  69. let token = counterStore.token;
  70. if (token) {
  71. const openId = counterStore.loginInfo.openId;
  72. common_vendor.index.requestSubscribeMessage({
  73. tmplIds,
  74. async success(res) {
  75. let acceptArr = [];
  76. tmplIds.forEach((item) => {
  77. if (res[item] == "accept") {
  78. acceptArr.push(item);
  79. }
  80. });
  81. console.log("订阅成功: ", acceptArr);
  82. if (!acceptArr.length)
  83. return;
  84. await config_api.appletSubscribe({ openId, templateIds: acceptArr });
  85. },
  86. fail(err) {
  87. console.log("订阅失败:", err);
  88. },
  89. complete() {
  90. common_vendor.index.$u.route({
  91. url
  92. });
  93. }
  94. });
  95. } else {
  96. common_vendor.index.$u.route({
  97. url: "/pages/subPage/login/login"
  98. });
  99. }
  100. }
  101. common_vendor.onPullDownRefresh(async () => {
  102. await getNoticeListFn();
  103. await getHousesFn();
  104. common_vendor.index.stopPullDownRefresh();
  105. });
  106. common_vendor.onShow(() => {
  107. getNoticeListFn();
  108. getHousesFn();
  109. });
  110. return (_ctx, _cache) => {
  111. return common_vendor.e({
  112. a: common_vendor.p({
  113. leftText: " ",
  114. title: "事务通",
  115. safeAreaInsetTop: false,
  116. autoBack: false,
  117. fixed: false
  118. }),
  119. b: common_vendor.unref(imgUrl) + "homebanner.png",
  120. c: common_vendor.o(($event) => goHome("/pages/subPage/authentication/authentication")),
  121. d: !common_vendor.unref(counterStore).token
  122. }, !common_vendor.unref(counterStore).token ? {
  123. e: common_vendor.p({
  124. name: "arrow-right"
  125. }),
  126. f: common_vendor.unref(imgUrl) + "homebanner3.png",
  127. g: common_vendor.o(($event) => _ctx.$goPage("/pages/subPage/login/login"))
  128. } : {}, {
  129. h: myHouse.value.length
  130. }, myHouse.value.length ? {
  131. i: common_vendor.f(myHouse.value, (item, index, i0) => {
  132. return {
  133. a: common_vendor.t(item.roomAddress),
  134. b: common_vendor.t(item.roomSize),
  135. c: index
  136. };
  137. }),
  138. j: common_vendor.unref(imgUrl) + "homebanner3.png"
  139. } : {}, {
  140. k: common_vendor.unref(imgUrl) + "homebanner2.png",
  141. l: common_vendor.o(($event) => goSever("/pages/subPage/ballots/ballotsList/ballotsList")),
  142. m: common_assets._imports_0,
  143. n: common_vendor.o(($event) => _ctx.$goPage("/pages/subPage/notice/notice")),
  144. o: common_vendor.p({
  145. list: common_vendor.unref(noticeList)
  146. }),
  147. p: common_vendor.o(($event) => goHome("/pages/subPage/authentication/authentication")),
  148. q: common_vendor.p({
  149. text: "点击认证业主"
  150. }),
  151. r: common_vendor.o(($event) => show.value = false),
  152. s: common_vendor.p({
  153. show: show.value,
  154. mode: "center",
  155. round: 10,
  156. customStyle: {
  157. width: "90%"
  158. },
  159. closeable: true
  160. })
  161. });
  162. };
  163. }
  164. };
  165. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-184b8d5d"]]);
  166. wx.createPage(MiniProgramPage);