index.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. if (!Array) {
  4. const _easycom_u_subsection2 = common_vendor.resolveComponent("u-subsection");
  5. const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
  6. (_easycom_u_subsection2 + _easycom_u_icon2)();
  7. }
  8. const _easycom_u_subsection = () => "../../node-modules/uview-plus/components/u-subsection/u-subsection.js";
  9. const _easycom_u_icon = () => "../../node-modules/uview-plus/components/u-icon/u-icon.js";
  10. if (!Math) {
  11. (_easycom_u_subsection + _easycom_u_icon)();
  12. }
  13. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  14. __name: "index",
  15. setup(__props) {
  16. var _a, _b;
  17. (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  18. (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$config;
  19. common_vendor.ref(["-2px", "355px"]);
  20. const tabList = common_vendor.ref(["销量榜", "保值榜", "店铺规模榜"]);
  21. const curNow = common_vendor.ref(0);
  22. const config = common_vendor.ref({ logoUrl: [] });
  23. const list = common_vendor.ref([
  24. {
  25. id: "1",
  26. file: [{ url: "https://cdn.uviewui.com/uview/album/1.jpg" }],
  27. brand: "夏朗",
  28. year: "2014年 ",
  29. city: "丹东",
  30. kilometer: "8万公里",
  31. money: "7.80"
  32. },
  33. {
  34. id: "1",
  35. file: [{ url: "https://cdn.uviewui.com/uview/album/2.jpg" }],
  36. brand: "捷豹",
  37. year: "2014年 ",
  38. city: "丹东",
  39. kilometer: "8万公里",
  40. money: "7.80"
  41. },
  42. {
  43. id: "1",
  44. file: [{ url: "https://cdn.uviewui.com/uview/album/3.jpg" }],
  45. brand: "大众",
  46. year: "2014年 ",
  47. city: "丹东",
  48. kilometer: "8万公里",
  49. money: "7.80"
  50. },
  51. {
  52. id: "1",
  53. file: [{ url: "https://cdn.uviewui.com/uview/album/4.jpg" }],
  54. brand: "大众",
  55. year: "2014年 ",
  56. city: "丹东",
  57. kilometer: "8万公里",
  58. money: "7.80"
  59. },
  60. {
  61. id: "1",
  62. file: [{ url: "https://cdn.uviewui.com/uview/album/5.jpg" }],
  63. brand: "大众",
  64. year: "2014年 ",
  65. city: "丹东",
  66. kilometer: "8万公里",
  67. money: "7.80"
  68. },
  69. {
  70. id: "1",
  71. file: [{ url: "https://cdn.uviewui.com/uview/album/6.jpg" }],
  72. brand: "大众",
  73. year: "2014年 ",
  74. city: "丹东",
  75. kilometer: "8万公里",
  76. money: "7.80"
  77. },
  78. {
  79. id: "1",
  80. file: [{ url: "https://cdn.uviewui.com/uview/album/7.jpg" }],
  81. brand: "奔驰",
  82. year: "2014年 ",
  83. city: "丹东",
  84. kilometer: "8万公里",
  85. money: "7.80"
  86. },
  87. {
  88. id: "1",
  89. file: [{ url: "https://cdn.uviewui.com/uview/album/8.jpg" }],
  90. brand: "丰田",
  91. year: "2014年 ",
  92. city: "丹东",
  93. kilometer: "8万公里",
  94. money: "7.80"
  95. },
  96. {
  97. id: "1",
  98. file: [{ url: "https://cdn.uviewui.com/uview/album/9.jpg" }],
  99. brand: "大众",
  100. year: "2014年 ",
  101. city: "丹东",
  102. kilometer: "8万公里",
  103. money: "7.80"
  104. },
  105. {
  106. id: "1",
  107. file: [{ url: "https://cdn.uviewui.com/uview/album/10.jpg" }],
  108. brand: "本田",
  109. year: "2014年 ",
  110. city: "丹东",
  111. kilometer: "8万公里",
  112. money: "7.80"
  113. }
  114. ]);
  115. const total = common_vendor.ref(0);
  116. const skip = common_vendor.ref(0);
  117. const limit = common_vendor.ref(6);
  118. const page = common_vendor.ref(0);
  119. const is_bottom = common_vendor.ref(false);
  120. common_vendor.ref(0);
  121. common_vendor.onLoad(async () => {
  122. await searchConfig();
  123. await search();
  124. });
  125. const searchConfig = async () => {
  126. config.value = common_vendor.index.getStorageSync("config");
  127. };
  128. const search = async () => {
  129. };
  130. const sectionChange = (index) => {
  131. curNow.value = index;
  132. };
  133. const toView = (item) => {
  134. common_vendor.index.navigateTo({
  135. url: `/pagesHome/car/index?id=${item.id || item._id}`
  136. });
  137. };
  138. const toPage = () => {
  139. if (total.value > list.value.length) {
  140. common_vendor.index.showLoading({
  141. title: "加载中",
  142. mask: true
  143. });
  144. page.value = page.value + 1;
  145. skip.value = page.value * limit.value;
  146. search();
  147. common_vendor.index.hideLoading();
  148. } else
  149. is_bottom.value = true;
  150. };
  151. return (_ctx, _cache) => {
  152. return common_vendor.e({
  153. a: common_vendor.o(sectionChange),
  154. b: common_vendor.p({
  155. mode: "subsection",
  156. activeColor: "#ffbc00",
  157. list: tabList.value,
  158. current: curNow.value
  159. }),
  160. c: common_vendor.f(list.value, (item, index, i0) => {
  161. return {
  162. a: common_vendor.t(index + 1),
  163. b: common_vendor.n(`rank${index + 1}`),
  164. c: item.file && item.file.length > 0 ? item.file[0].url : "",
  165. d: common_vendor.t(item.brand || "暂无"),
  166. e: common_vendor.t(item.money || "0"),
  167. f: "581af8d0-1-" + i0,
  168. g: index,
  169. h: common_vendor.o(($event) => toView(item), index)
  170. };
  171. }),
  172. d: common_vendor.p({
  173. color: "#000",
  174. name: "heart",
  175. size: "20"
  176. }),
  177. e: is_bottom.value
  178. }, is_bottom.value ? {
  179. f: common_vendor.t(config.value.bottom_title || "没有更多了!")
  180. } : {}, {
  181. g: common_vendor.o(toPage)
  182. });
  183. };
  184. }
  185. });
  186. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-581af8d0"], ["__file", "D:/project/二手车/car_applet/pagesHome/rank/index.vue"]]);
  187. wx.createPage(MiniProgramPage);