var t;
(t = getApp()),
  Page({
    data: {
      leftid: 1,
      check_name: "",
      carList: [],
      show: !0,
      name: "",
      title: "没有匹配结果，换个关键词吧！",
      plate_type: 1,
    },
    onLoad: function (t) {
      (this.data.name = t.name), this._list(), this._info_set();
    },
    _info_set: function () {
      var a = this;
      t.util.request({
        url: "entry/wxapp/Api",
        data: { m: "monai_market", r: "home.index.info_set" },
        cachetime: "0",
        success: function (t) {
          2 == t.data.data.plate_type && a.setData({ plate_type: 2 });
        },
      });
    },
    _list: function () {
      var a = this;
      t.util.request({
        url: "entry/wxapp/Api",
        data: {
          m: "monai_market",
          r: "home.index.search_index",
          name: this.data.name,
          leftid: this.data.leftid++,
        },
        cachetime: "0",
        success: function (t) {
          var e;
          console.log(t),
            t.data.data.length > 0
              ? ((e = a.data.carList).push.apply(
                  e,
                  (function (t) {
                    if (Array.isArray(t)) {
                      for (var a = 0, e = Array(t.length); a < t.length; a++)
                        e[a] = t[a];
                      return e;
                    }
                    return Array.from(t);
                  })(t.data.data)
                ),
                a.setData({ carList: a.data.carList }))
              : (a.data.show = !1);
        },
      });
    },
    onReachBottom: function () {
      this.data.show && this._list();
    },
    detile: function (a) {
      var e = t.getAttr(a, "id");
      wx.navigateTo({ url: "/pages/home/carMessage/carMessage?id=" + e });
    },
    previewImage: function (a) {
      var e = t.getAttr(a, "src"),
        r = t.getAttr(a, "index");
      console.log(r);
      var i = [],
        n = !0,
        s = !1,
        o = void 0;
      try {
        for (
          var c, d = this.data.carList[r].image[Symbol.iterator]();
          !(n = (c = d.next()).done);
          n = !0
        ) {
          var l = c.value;
          i.push(l.img_patch);
        }
      } catch (a) {
        (s = !0), (o = a);
      } finally {
        try {
          !n && d.return && d.return();
        } finally {
          if (s) throw o;
        }
      }
      wx.previewImage({ current: e, urls: i });
    },
    store: function (a) {
      var e = t.getAttr(a, "uid");
      wx.navigateTo({ url: "/pages/store/index?uid=" + e });
    },
  });
