index.js 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. const type = common_vendor.ref("0");
  24. common_vendor.onLoad(async (options) => {
  25. type.value = options && options.type;
  26. await searchConfig();
  27. await search();
  28. });
  29. const searchConfig = async () => {
  30. config.value = common_vendor.index.getStorageSync("config");
  31. };
  32. const search = async () => {
  33. const res = await $api("brand/index", "GET", {});
  34. if (res.errcode === 0) {
  35. itemArr.value = res.data.data1;
  36. indexList.value = res.data.data2;
  37. } else {
  38. common_vendor.index.showToast({
  39. title: res.errmsg || "",
  40. icon: "error"
  41. });
  42. }
  43. };
  44. const toCommon = (item) => {
  45. if (type.value == "4") {
  46. common_vendor.index.navigateTo({
  47. url: `/pagesHome/search/index?brand=${item.name}`
  48. });
  49. } else {
  50. common_vendor.index.$emit("toRoute", item);
  51. common_vendor.index.navigateBack({
  52. delta: 1
  53. // 返回的页面数
  54. });
  55. }
  56. };
  57. return (_ctx, _cache) => {
  58. return {
  59. a: common_vendor.f(itemArr.value, (item, index, i0) => {
  60. return {
  61. a: "bd19021e-2-" + i0 + "," + ("bd19021e-1-" + i0),
  62. b: common_vendor.p({
  63. color: "#333333",
  64. ["bg-color"]: "#f9f9f9",
  65. text: indexList.value[index]
  66. }),
  67. c: common_vendor.f(item, (cell, index2, i1) => {
  68. return {
  69. a: common_vendor.t(cell.name),
  70. b: common_vendor.o(($event) => toCommon(cell))
  71. };
  72. }),
  73. d: item.url && item.url.length > 0 ? item.url[0].url : "/static/logo.png",
  74. e: "bd19021e-1-" + i0 + ",bd19021e-0",
  75. f: index
  76. };
  77. }),
  78. b: common_vendor.p({
  79. ["index-list"]: indexList.value,
  80. sticky: false,
  81. activeColor: "#2979ff"
  82. })
  83. };
  84. };
  85. }
  86. });
  87. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-bd19021e"], ["__file", "D:/project/赋强公证/notarization_applet/pagesHome/brand/index.vue"]]);
  88. wx.createPage(MiniProgramPage);