teamList.js 3.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_group2 = common_vendor.resolveComponent("uni-group");
  _easycom_uni_group2();
}
const _easycom_uni_group = () => "../../uni_modules/uni-group/components/uni-group/uni-group.js";
if (!Math) {
  _easycom_uni_group();
}
const _sfc_main = {
  __name: "teamList",
  setup(__props) {
    common_vendor.ref({});
    const dataList = common_vendor.ref([]);
    common_vendor.ref([{ id: 1 }, { id: 2 }]);
    common_vendor.ref("");
    common_vendor.ref(["全部", "运动员", "教练", "领队", "其他"]);
    common_vendor.ref([{ text: "运动员", value: 0 }, { text: "教练", value: 1 }, { text: "领队", value: 2 }, { text: "其他", value: 3 }]);
    common_vendor.ref([{ text: "学校", value: 0 }, { text: "场馆", value: 1 }, { text: "俱乐部", value: 2 }, { text: "机构", value: 3 }]);
    const regionsList = common_vendor.ref([]);
    common_vendor.ref(0);
    common_vendor.ref(false);
    common_vendor.ref(false);
    common_vendor.ref({
      type: 0
    });
    common_vendor.onShow(() => {
      getRegionsList();
      getList();
    });
    function getList() {
      common_match.getMyGroupList().then((res) => {
        dataList.value = res.data;
      });
    }
    function newGroup() {
      common_vendor.index.navigateTo({
        url: `/pages/usercenter/teamInfo`
      });
    }
    function getRegionsList() {
      common_match.regionsList().then((res) => {
        regionsList.value = res.data;
      });
    }
    function view(g) {
      common_vendor.index.navigateTo({
        url: `/pages/usercenter/teamInfo?groupId=${g.id}`
      });
    }
    function del(g) {
      common_vendor.index.showModal({
        title: "提示",
        content: "确定删除吗",
        success: function(res) {
          if (res.confirm) {
            common_match.deleteMyGroup(g.id).then((res2) => {
              common_vendor.index.showToast({
                icon: "none",
                title: res2.msg
              });
              getList();
            });
          } else if (res.cancel) {
            console.log("用户点击取消");
          }
        }
      });
    }
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.o(newGroup),
        b: common_vendor.f(dataList.value, (g, index, i0) => {
          return {
            a: g.imgUrl,
            b: common_vendor.t(g.name),
            c: common_vendor.t(g.regionStr),
            d: common_vendor.t(g.typeStr),
            e: common_vendor.o(($event) => view(g), index),
            f: common_vendor.o(($event) => del(g), index),
            g: index
          };
        }),
        c: dataList.value.length == 0
      }, dataList.value.length == 0 ? {} : {}, {
        d: common_vendor.p({
          mode: "card",
          title: "我的参赛队",
          top: "20"
        })
      });
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "/Users/yangyang/project/j-mini/Venue/pages/usercenter/teamList.vue"]]);
wx.createPage(MiniProgramPage);