index.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. if (!Array) {
  4. const _easycom_u_search2 = common_vendor.resolveComponent("u-search");
  5. _easycom_u_search2();
  6. }
  7. const _easycom_u_search = () => "../../node-modules/uview-plus/components/u-search/u-search.js";
  8. if (!Math) {
  9. _easycom_u_search();
  10. }
  11. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  12. __name: "index",
  13. setup(__props) {
  14. var _a, _b;
  15. (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  16. (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$config;
  17. const config = common_vendor.ref({ logoUrl: [] });
  18. const list = common_vendor.ref([]);
  19. const total = common_vendor.ref(0);
  20. const skip = common_vendor.ref(0);
  21. const limit = common_vendor.ref(6);
  22. const page = common_vendor.ref(0);
  23. const is_bottom = common_vendor.ref(false);
  24. common_vendor.ref(0);
  25. common_vendor.onShow(async () => {
  26. await searchConfig();
  27. await clearPage();
  28. await search();
  29. });
  30. common_vendor.onPullDownRefresh(async () => {
  31. await clearPage();
  32. await search();
  33. common_vendor.index.stopPullDownRefresh();
  34. });
  35. const searchConfig = async () => {
  36. config.value = common_vendor.index.getStorageSync("config");
  37. };
  38. const search = async () => {
  39. ({
  40. skip: skip.value,
  41. limit: limit.value,
  42. status: "0"
  43. });
  44. };
  45. const toChange = () => {
  46. common_vendor.index.navigateTo({
  47. url: `/pagesHome/type/index`
  48. });
  49. };
  50. const toView = (item) => {
  51. common_vendor.index.navigateTo({
  52. url: `/pagesHome/car/index?id=${item.id || item._id}`
  53. });
  54. };
  55. const toPage = () => {
  56. if (total.value > list.value.length) {
  57. common_vendor.index.showLoading({
  58. title: "加载中",
  59. mask: true
  60. });
  61. page.value = page.value + 1;
  62. skip.value = page.value * limit.value;
  63. search();
  64. common_vendor.index.hideLoading();
  65. } else
  66. is_bottom.value = true;
  67. };
  68. const clearPage = () => {
  69. list.value = [];
  70. skip.value = 0;
  71. limit.value = 6;
  72. page.value = 0;
  73. };
  74. return (_ctx, _cache) => {
  75. return common_vendor.e({
  76. a: common_vendor.o(toChange),
  77. b: common_vendor.p({
  78. shape: "square",
  79. ["show-action"]: false,
  80. placeholder: "品牌/车系"
  81. }),
  82. c: common_vendor.f(list.value, (item, index, i0) => {
  83. return {
  84. a: item.file && item.file.length > 0 ? item.file[0].url : "",
  85. b: common_vendor.t(item.series || "暂无"),
  86. c: common_vendor.t(item.year || "暂无"),
  87. d: common_vendor.t(item.style || "暂无"),
  88. e: common_vendor.t(item.total_money || "0"),
  89. f: index,
  90. g: common_vendor.o(($event) => toView(item), index)
  91. };
  92. }),
  93. d: is_bottom.value
  94. }, is_bottom.value ? {
  95. e: common_vendor.t(config.value.bottom_title || "没有更多了!")
  96. } : {}, {
  97. f: common_vendor.o(toPage)
  98. });
  99. };
  100. }
  101. });
  102. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-4978fed5"], ["__file", "D:/project/赋强公证/notarization_applet/pages/home/index.vue"]]);
  103. wx.createPage(MiniProgramPage);