index.js 6.25 KB
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_match = require("../../common/match.js");
require("../../common/request.js");
require("../../config.js");
require("../../common/login.js");
require("../../common/api.js");
if (!Array) {
  const _easycom_uni_search_bar2 = common_vendor.resolveComponent("uni-search-bar");
  const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  const _easycom_uni_segmented_control2 = common_vendor.resolveComponent("uni-segmented-control");
  (_easycom_uni_search_bar2 + _easycom_uni_icons2 + _easycom_uni_segmented_control2)();
}
const _easycom_uni_search_bar = () => "../../uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.js";
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
const _easycom_uni_segmented_control = () => "../../uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.js";
if (!Math) {
  (_easycom_uni_search_bar + _easycom_uni_icons + _easycom_uni_segmented_control)();
}
const _sfc_main = {
  __name: "index",
  setup(__props) {
    const app = getApp();
    const data = common_vendor.reactive({
      // 1 报名未开始 2 报名进行中 3 即将开始 4 进行中 5已经结束
      items: ["全部", "报名中", "进行中", "即将开始", "已结束"],
      activeColor: "#00CAA6",
      queryParam: {
        projectId: "",
        progressStatusCode: "",
        name: ""
      },
      current: 0,
      index: 0,
      list: [],
      projectList: [],
      projectName: ""
    });
    const { items, activeColor, queryParam, current, index, list, projectList, projectName } = common_vendor.toRefs(data);
    common_vendor.onShow((option) => {
      projectList.value = [];
      if (app.globalData.isLogin) {
        getProjectList();
        getList();
      } else {
        app.firstLoadCallback = () => {
          getProjectList();
          getList();
        };
      }
    });
    function getProjectList() {
      common_match.getBaseProject().then((res) => {
        projectList.value = res.rows;
        let obj = {
          id: "",
          name: "全部"
        };
        projectList.value.unshift(obj);
      });
    }
    function getList() {
      common_match.getMaList(queryParam.value).then((res) => {
        list.value = res.rows;
      });
    }
    function changeProject(e) {
      console.log(e.detail.value);
      index.value = e.detail.value;
      projectName.value = projectList.value[index.value].name;
      queryParam.value.projectId = projectList.value[index.value].id;
      getList();
    }
    function onclear() {
      queryParam.value.name = "";
      getList();
    }
    function onconfirm() {
      console.log(queryParam.value.name);
      getList();
    }
    function onClickItem(e) {
      current.value = e.currentIndex;
      if (current.value == 1) {
        queryParam.value.progressStatusCode = "2";
      } else if (current.value == 2) {
        queryParam.value.progressStatusCode = "4";
      } else if (current.value == 3) {
        queryParam.value.progressStatusCode = "3";
      } else if (current.value == 4) {
        queryParam.value.progressStatusCode = "5";
      } else {
        queryParam.value.progressStatusCode = "";
      }
      getList();
    }
    function goSingle(item) {
      if (item.type == 0) {
        let path = `/pages_match/match/single?id=${item.id}`;
        common_vendor.index.navigateTo({
          url: path
        });
      } else {
        let path = `/pages_match/match/singleLs?id=${item.id}`;
        common_vendor.index.navigateTo({
          url: path
        });
      }
    }
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.o(($event) => onclear()),
        b: common_vendor.o(($event) => onconfirm()),
        c: common_vendor.o(($event) => common_vendor.unref(queryParam).name = $event),
        d: common_vendor.p({
          clearButton: "auto",
          cancelButton: "none",
          modelValue: common_vendor.unref(queryParam).name
        }),
        e: common_vendor.t(common_vendor.unref(projectName) ? common_vendor.unref(projectName) : "全部"),
        f: common_vendor.p({
          type: "bottom",
          size: "16"
        }),
        g: common_vendor.o(changeProject),
        h: common_vendor.unref(index),
        i: common_vendor.unref(projectList),
        j: common_vendor.o(onClickItem),
        k: common_vendor.p({
          current: common_vendor.unref(current),
          values: common_vendor.unref(items),
          ["style-type"]: "text",
          ["active-color"]: common_vendor.unref(activeColor)
        }),
        l: common_vendor.f(common_vendor.unref(list), (item, index2, i0) => {
          return common_vendor.e({
            a: item.type == 0
          }, item.type == 0 ? {} : {}, {
            b: item.type == 1
          }, item.type == 1 ? {} : {}, {
            c: item.coverUrl,
            d: common_vendor.t(item.name),
            e: item.progressStatusCode == 3
          }, item.progressStatusCode == 3 ? {} : {}, {
            f: item.progressStatusCode == 2
          }, item.progressStatusCode == 2 ? {} : {}, {
            g: item.progressStatusCode == 4
          }, item.progressStatusCode == 4 ? {} : {}, {
            h: item.progressStatusCode == 5
          }, item.progressStatusCode == 5 ? {} : {}, {
            i: item.progressStatusCode == 1
          }, item.progressStatusCode == 1 ? {} : {}, {
            j: item.type == 0
          }, item.type == 0 ? {
            k: common_vendor.t(item.signEndTime.substring(0, 10))
          } : {
            l: common_vendor.t(item.beginTime.substring(0, 10))
          }, {
            m: item.type == 1
          }, item.type == 1 ? {
            n: common_vendor.t(item.endTime.substring(0, 10))
          } : {}, {
            o: common_vendor.o(($event) => goSingle(item), index2),
            p: index2
          });
        }),
        m: common_vendor.unref(list).length == 0
      }, common_vendor.unref(list).length == 0 ? {} : {});
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-3bb03d67"], ["__file", "/Users/yangyang/project/j-mini/Venue/pages_match/match/index.vue"]]);
_sfc_main.__runtimeHooks = 6;
wx.createPage(MiniProgramPage);