index.js 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. if (!Array) {
  4. const _easycom_u_index_anchor2 = common_vendor.resolveComponent("u-index-anchor");
  5. const _easycom_u_index_item2 = common_vendor.resolveComponent("u-index-item");
  6. const _easycom_u_index_list2 = common_vendor.resolveComponent("u-index-list");
  7. (_easycom_u_index_anchor2 + _easycom_u_index_item2 + _easycom_u_index_list2)();
  8. }
  9. const _easycom_u_index_anchor = () => "../../node-modules/uview-plus/components/u-index-anchor/u-index-anchor.js";
  10. const _easycom_u_index_item = () => "../../node-modules/uview-plus/components/u-index-item/u-index-item.js";
  11. const _easycom_u_index_list = () => "../../node-modules/uview-plus/components/u-index-list/u-index-list.js";
  12. if (!Math) {
  13. (_easycom_u_index_anchor + _easycom_u_index_item + _easycom_u_index_list)();
  14. }
  15. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  16. __name: "index",
  17. setup(__props) {
  18. var _a;
  19. const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  20. const config = common_vendor.ref({ logoUrl: [] });
  21. const indexList = common_vendor.ref([]);
  22. const itemArr = common_vendor.ref([]);
  23. common_vendor.onLoad(async () => {
  24. await searchConfig();
  25. await search();
  26. });
  27. const searchConfig = async () => {
  28. config.value = common_vendor.index.getStorageSync("config");
  29. };
  30. const search = async () => {
  31. const res = await $api("brand/index", "GET", {});
  32. if (res.errcode === 0) {
  33. itemArr.value = res.data.data1;
  34. indexList.value = res.data.data2;
  35. } else {
  36. common_vendor.index.showToast({
  37. title: res.errmsg || "",
  38. icon: "error"
  39. });
  40. }
  41. };
  42. const toCommon = (item) => {
  43. common_vendor.index.$emit("toRoute", item);
  44. common_vendor.index.navigateBack({
  45. delta: 1
  46. // 返回的页面数
  47. });
  48. };
  49. return (_ctx, _cache) => {
  50. return {
  51. a: common_vendor.f(itemArr.value, (item, index, i0) => {
  52. return {
  53. a: "bd19021e-2-" + i0 + "," + ("bd19021e-1-" + i0),
  54. b: common_vendor.p({
  55. color: "#333333",
  56. ["bg-color"]: "#f9f9f9",
  57. text: indexList.value[index]
  58. }),
  59. c: common_vendor.f(item, (cell, index2, i1) => {
  60. return {
  61. a: common_vendor.t(cell.name),
  62. b: common_vendor.o(($event) => toCommon(cell))
  63. };
  64. }),
  65. d: item.url && item.url.length > 0 ? item.url[0].url : "/static/logo.png",
  66. e: "bd19021e-1-" + i0 + ",bd19021e-0",
  67. f: index
  68. };
  69. }),
  70. b: common_vendor.p({
  71. ["index-list"]: indexList.value,
  72. sticky: false,
  73. activeColor: "#ffbc00"
  74. })
  75. };
  76. };
  77. }
  78. });
  79. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-bd19021e"], ["__file", "D:/project/二手车/car_applet/pagesHome/brand/index.vue"]]);
  80. wx.createPage(MiniProgramPage);