"use strict";
const common_vendor = require("../../common/vendor.js");
if (!Array) {
  const _easycom_u_index_anchor2 = common_vendor.resolveComponent("u-index-anchor");
  const _easycom_u_index_item2 = common_vendor.resolveComponent("u-index-item");
  const _easycom_u_index_list2 = common_vendor.resolveComponent("u-index-list");
  (_easycom_u_index_anchor2 + _easycom_u_index_item2 + _easycom_u_index_list2)();
}
const _easycom_u_index_anchor = () => "../../node-modules/uview-plus/components/u-index-anchor/u-index-anchor.js";
const _easycom_u_index_item = () => "../../node-modules/uview-plus/components/u-index-item/u-index-item.js";
const _easycom_u_index_list = () => "../../node-modules/uview-plus/components/u-index-list/u-index-list.js";
if (!Math) {
  (_easycom_u_index_anchor + _easycom_u_index_item + _easycom_u_index_list)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  setup(__props) {
    var _a;
    const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
    const config = common_vendor.ref({ logoUrl: [] });
    const indexList = common_vendor.ref([]);
    const itemArr = common_vendor.ref([]);
    const type = common_vendor.ref("0");
    common_vendor.onLoad(async (options) => {
      type.value = options && options.type;
      await searchConfig();
      await search();
    });
    const searchConfig = async () => {
      config.value = common_vendor.index.getStorageSync("config");
    };
    const search = async () => {
      const res = await $api("brand/index", "GET", {});
      if (res.errcode === 0) {
        itemArr.value = res.data.data1;
        indexList.value = res.data.data2;
      } else {
        common_vendor.index.showToast({
          title: res.errmsg || "",
          icon: "error"
        });
      }
    };
    const toCommon = (item) => {
      if (type.value == "4") {
        common_vendor.index.navigateTo({
          url: `/pagesHome/search/index?brand=${item.name}`
        });
      } else {
        common_vendor.index.$emit("toRoute", item);
        common_vendor.index.navigateBack({
          delta: 1
          // 返回的页面数
        });
      }
    };
    return (_ctx, _cache) => {
      return {
        a: common_vendor.f(itemArr.value, (item, index, i0) => {
          return {
            a: "bd19021e-2-" + i0 + "," + ("bd19021e-1-" + i0),
            b: common_vendor.p({
              color: "#333333",
              ["bg-color"]: "#f9f9f9",
              text: indexList.value[index]
            }),
            c: common_vendor.f(item, (cell, index2, i1) => {
              return {
                a: common_vendor.t(cell.name),
                b: common_vendor.o(($event) => toCommon(cell))
              };
            }),
            d: item.url && item.url.length > 0 ? item.url[0].url : "/static/logo.png",
            e: "bd19021e-1-" + i0 + ",bd19021e-0",
            f: index
          };
        }),
        b: common_vendor.p({
          ["index-list"]: indexList.value,
          sticky: false,
          activeColor: "#2979ff"
        })
      };
    };
  }
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-bd19021e"], ["__file", "D:/project/赋强公证/notarization_applet/pagesHome/brand/index.vue"]]);
wx.createPage(MiniProgramPage);
