singleLs.js 15.9 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_segmented_control2 = common_vendor.resolveComponent("uni-segmented-control");
  const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card");
  (_easycom_uni_segmented_control2 + _easycom_uni_icons2 + _easycom_uni_card2)();
}
const _easycom_uni_segmented_control = () => "../../uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.js";
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
const _easycom_uni_card = () => "../../uni_modules/uni-card/components/uni-card/uni-card.js";
if (!Math) {
  (_easycom_uni_segmented_control + _easycom_uni_icons + _easycom_uni_card)();
}
const _sfc_main = {
  __name: "singleLs",
  setup(__props) {
    const app = getApp();
    const data = common_vendor.reactive({
      items: ["首页", " 分站赛", "日程"],
      current: 1,
      activeColor: "#00CAA6",
      projectList: [],
      groupList: [],
      levelList: [],
      levelListGirl: [],
      levelListBoy: [],
      popup: null,
      popupGroupList: null,
      groupListArr: [],
      matchId: 0,
      matchData: {},
      groups: [],
      groupId: "",
      cptLabelsList: []
    });
    const {
      items,
      current,
      activeColor,
      projectList,
      groupList,
      levelList,
      popup,
      popupGroupList,
      groupListArr,
      matchId,
      groups,
      matchData,
      groupId,
      levelListGirl,
      levelListBoy,
      cptLabelsList
    } = common_vendor.toRefs(data);
    common_vendor.onLoad((option) => {
      if (option.id) {
        matchId.value = option.id;
      }
      if (option.scene) {
        matchId.value = decodeURIComponent(option.scene);
      }
    });
    common_vendor.onShow((option) => {
      if (app.globalData.isLogin) {
        getMatch(matchId.value);
      } else {
        app.firstLoadCallback = () => {
          getMatch(matchId.value);
        };
      }
    });
    function getMyGroupList() {
      common_match.getMyGroupList().then((res) => {
        groups.value = res.data;
      });
    }
    function makeCall(num) {
      common_vendor.index.makePhoneCall({
        phoneNumber: num
      });
    }
    function getMatch(id) {
      common_match.getMatchById({
        id
      }).then((res) => {
        matchData.value = res.data;
        app.globalData.coachOrLeaderFlag = res.data.coachOrLeaderFlag;
        app.globalData.noPhotoCanSign = res.data.noPhotoCanSign;
        if (matchData.value.signType == 1 || matchData.value.signType == 2) {
          getMyGroupList();
        }
        if (matchData.value.signKnowUrl && matchData.value.signKnowUrl != "null") {
          matchData.value.signKnowUrlObj = JSON.parse(matchData.value.signKnowUrl)[0];
        }
        if (matchData.value.ruleUrl && matchData.value.ruleUrl != "null") {
          matchData.value.ruleUrlObj = JSON.parse(matchData.value.ruleUrl)[0];
        }
        if (matchData.value.disclaimerUrl && matchData.value.disclaimerUrl != "null") {
          matchData.value.disclaimerUrlObj = JSON.parse(matchData.value.disclaimerUrl)[0];
        }
        if (res.data.cptLabels && cptLabelsList.value.length == 0) {
          cptLabelsList.value = res.data.cptLabels;
          for (let c of cptLabelsList.value) {
            items.value.push(c.customTitle);
            c.customText = c.customText.replace(/\<img/gi, '<img style="width:100%";height:auto');
            if (c.fileUrl) {
              c.fileObj = JSON.parse(c.fileUrl)[0];
            }
          }
        }
      });
    }
    function onClickItem(e) {
      current.value = e.currentIndex;
    }
    function goSign(item) {
      let path = `/pages_match/match/single?id=${item.id}`;
      common_vendor.index.navigateTo({
        url: path
      });
    }
    function goWebView(url) {
      common_vendor.index.showLoading({
        title: "下载中"
      });
      common_vendor.index.downloadFile({
        url,
        success: function(res) {
          common_vendor.index.hideLoading();
          var filePath = res.tempFilePath;
          common_vendor.index.showLoading({
            title: "正在打开"
          });
          common_vendor.index.openDocument({
            filePath,
            showMenu: true,
            success: function(res2) {
              common_vendor.index.hideLoading();
            },
            fail: function(err) {
              common_vendor.index.hideLoading();
              common_vendor.index.showToast({
                title: err,
                icon: "none",
                duration: 2e3
              });
            }
          });
        },
        fail: function(error) {
          common_vendor.index.hideLoading();
          common_vendor.index.showToast({
            title: `下载失败`,
            icon: "none",
            duration: 2e3
          });
        }
      });
    }
    return (_ctx, _cache) => {
      var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
      return common_vendor.e({
        a: common_vendor.unref(matchData).bgImgUrl,
        b: common_vendor.unref(matchData).logoUrl,
        c: common_vendor.t(common_vendor.unref(matchData).name),
        d: common_vendor.t((_a = common_vendor.unref(matchData).beginTime) == null ? void 0 : _a.substring(0, 10)),
        e: common_vendor.t((_b = common_vendor.unref(matchData).endTime) == null ? void 0 : _b.substring(0, 10)),
        f: common_vendor.unref(matchData).type == 1
      }, common_vendor.unref(matchData).type == 1 ? {} : {}, {
        g: common_vendor.unref(matchData).progressStatusCode == 3
      }, common_vendor.unref(matchData).progressStatusCode == 3 ? {} : {}, {
        h: common_vendor.unref(matchData).progressStatusCode == 2
      }, common_vendor.unref(matchData).progressStatusCode == 2 ? {} : {}, {
        i: common_vendor.unref(matchData).progressStatusCode == 4
      }, common_vendor.unref(matchData).progressStatusCode == 4 ? {} : {}, {
        j: common_vendor.unref(matchData).progressStatusCode == 5
      }, common_vendor.unref(matchData).progressStatusCode == 5 ? {} : {}, {
        k: common_vendor.unref(matchData).progressStatusCode == 1
      }, common_vendor.unref(matchData).progressStatusCode == 1 ? {} : {}, {
        l: common_vendor.unref(matchData).ocTelno
      }, common_vendor.unref(matchData).ocTelno ? {
        m: common_vendor.t(common_vendor.unref(matchData).ocTelno),
        n: common_vendor.o(($event) => makeCall(common_vendor.unref(matchData).ocTelno))
      } : {}, {
        o: common_vendor.o(onClickItem),
        p: common_vendor.p({
          current: common_vendor.unref(current),
          values: common_vendor.unref(items),
          ["style-type"]: "text",
          ["active-color"]: common_vendor.unref(activeColor)
        }),
        q: common_vendor.unref(current) === 0
      }, common_vendor.unref(current) === 0 ? common_vendor.e({
        r: common_vendor.unref(matchData).signKnow,
        s: (_c = common_vendor.unref(matchData).signKnowUrlObj) == null ? void 0 : _c.url
      }, ((_d = common_vendor.unref(matchData).signKnowUrlObj) == null ? void 0 : _d.url) ? {
        t: common_vendor.p({
          type: "download",
          size: "16",
          color: "#54E1B9"
        }),
        v: common_vendor.t((_e = common_vendor.unref(matchData).signKnowUrlObj) == null ? void 0 : _e.name),
        w: common_vendor.o(($event) => {
          var _a2;
          return goWebView((_a2 = common_vendor.unref(matchData).signKnowUrlObj) == null ? void 0 : _a2.url);
        })
      } : {}, {
        x: (_f = common_vendor.unref(matchData).ruleUrlObj) == null ? void 0 : _f.url
      }, ((_g = common_vendor.unref(matchData).ruleUrlObj) == null ? void 0 : _g.url) ? {
        y: common_vendor.p({
          type: "download",
          size: "16",
          color: "#54E1B9"
        }),
        z: common_vendor.t((_h = common_vendor.unref(matchData).ruleUrlObj) == null ? void 0 : _h.name),
        A: common_vendor.o(($event) => {
          var _a2;
          return goWebView((_a2 = common_vendor.unref(matchData).ruleUrlObj) == null ? void 0 : _a2.url);
        })
      } : {}, {
        B: (_i = common_vendor.unref(matchData).disclaimerUrlObj) == null ? void 0 : _i.url
      }, ((_j = common_vendor.unref(matchData).disclaimerUrlObj) == null ? void 0 : _j.url) ? {
        C: common_vendor.p({
          type: "download",
          size: "16",
          color: "#54E1B9"
        }),
        D: common_vendor.t((_k = common_vendor.unref(matchData).disclaimerUrlObj) == null ? void 0 : _k.name),
        E: common_vendor.o(($event) => {
          var _a2;
          return goWebView((_a2 = common_vendor.unref(matchData).disclaimerUrlObj) == null ? void 0 : _a2.url);
        })
      } : {}, {
        F: common_vendor.p({
          title: "报名须知"
        }),
        G: common_vendor.unref(matchData).ocOrganizer
      }, common_vendor.unref(matchData).ocOrganizer ? {
        H: common_vendor.f((_l = common_vendor.unref(matchData).ocOrganizer) == null ? void 0 : _l.replace(/,/g, ",").split(","), (s, index, i0) => {
          return {
            a: common_vendor.t(s),
            b: index
          };
        })
      } : {}, {
        I: common_vendor.unref(matchData).ocDeptName
      }, common_vendor.unref(matchData).ocDeptName ? {
        J: common_vendor.f((_m = common_vendor.unref(matchData).ocDeptName) == null ? void 0 : _m.replace(/,/g, ",").split(","), (s, index, i0) => {
          return {
            a: common_vendor.t(s),
            b: index
          };
        })
      } : {}, {
        K: common_vendor.unref(matchData).ocSupportor
      }, common_vendor.unref(matchData).ocSupportor ? {
        L: common_vendor.f((_n = common_vendor.unref(matchData).ocSupportor) == null ? void 0 : _n.replace(/,/g, ",").split(","), (s, index, i0) => {
          return {
            a: common_vendor.t(s),
            b: index
          };
        })
      } : {}, {
        M: common_vendor.unref(matchData).ocToDeptName
      }, common_vendor.unref(matchData).ocToDeptName ? {
        N: common_vendor.f((_o = common_vendor.unref(matchData).ocToDeptName) == null ? void 0 : _o.replace(/,/g, ",").split(","), (s, index, i0) => {
          return {
            a: common_vendor.t(s),
            b: index
          };
        })
      } : {}, {
        O: common_vendor.unref(matchData).operatingUnit
      }, common_vendor.unref(matchData).operatingUnit ? {
        P: common_vendor.f((_p = common_vendor.unref(matchData).operatingUnit) == null ? void 0 : _p.replace(/,/g, ",").split(","), (s, index, i0) => {
          return {
            a: common_vendor.t(s),
            b: index
          };
        })
      } : {}, {
        Q: common_vendor.unref(matchData).ocTelno
      }, common_vendor.unref(matchData).ocTelno ? {
        R: common_vendor.t(common_vendor.unref(matchData).ocTelno)
      } : {}, {
        S: common_vendor.p({
          title: "组委会"
        }),
        T: common_vendor.f(common_vendor.unref(matchData).cpts, (item, index, i0) => {
          return common_vendor.e({
            a: item.bgImgUrl,
            b: common_vendor.t(item.name),
            c: item.progressStatusCode == 3
          }, item.progressStatusCode == 3 ? {} : {}, {
            d: item.progressStatusCode == 2
          }, item.progressStatusCode == 2 ? {} : {}, {
            e: item.progressStatusCode == 4
          }, item.progressStatusCode == 4 ? {} : {}, {
            f: item.progressStatusCode == 5
          }, item.progressStatusCode == 5 ? {} : {}, {
            g: item.progressStatusCode == 1
          }, item.progressStatusCode == 1 ? {} : {}, {
            h: item.type == 0
          }, item.type == 0 ? {
            i: common_vendor.t(item.signEndTime.substring(0, 10))
          } : {}, {
            j: common_vendor.o(($event) => goSign(item), index),
            k: index < 3,
            l: index
          });
        })
      }) : {}, {
        U: common_vendor.unref(current) === 1
      }, common_vendor.unref(current) === 1 ? common_vendor.e({
        V: common_vendor.f(common_vendor.unref(matchData).cpts, (item, index, i0) => {
          return common_vendor.e({
            a: item.coverUrl,
            b: common_vendor.t(item.name),
            c: item.progressStatusCode == 3
          }, item.progressStatusCode == 3 ? {} : {}, {
            d: item.progressStatusCode == 2
          }, item.progressStatusCode == 2 ? {} : {}, {
            e: item.progressStatusCode == 4
          }, item.progressStatusCode == 4 ? {} : {}, {
            f: item.progressStatusCode == 5
          }, item.progressStatusCode == 5 ? {} : {}, {
            g: item.progressStatusCode == 1
          }, item.progressStatusCode == 1 ? {} : {}, {
            h: item.type == 0
          }, item.type == 0 ? {
            i: common_vendor.t(item.signEndTime.substring(0, 10))
          } : {}, {
            j: common_vendor.o(($event) => goSign(item), index),
            k: index
          });
        }),
        W: ((_q = common_vendor.unref(matchData).cpts) == null ? void 0 : _q.length) == 0
      }, ((_r = common_vendor.unref(matchData).cpts) == null ? void 0 : _r.length) == 0 ? {} : {}) : {}, {
        X: common_vendor.unref(current) === 2
      }, common_vendor.unref(current) === 2 ? common_vendor.e({
        Y: common_vendor.f(common_vendor.unref(matchData).cptScheduleList, (s, k0, i0) => {
          return {
            a: "911ccc4f-6-" + i0,
            b: common_vendor.t(s.timeRange.split(",")[0].substring(0, 16)),
            c: common_vendor.t(s.timeRange.split(",")[1].substring(0, 16)),
            d: common_vendor.t(s.name),
            e: s.introduction,
            f: "911ccc4f-7-" + i0,
            g: common_vendor.t(s.address),
            h: s.id
          };
        }),
        Z: common_vendor.p({
          type: "calendar",
          size: "18",
          color: "#1EC886"
        }),
        aa: common_vendor.p({
          type: "location",
          size: "15"
        }),
        ab: common_vendor.unref(matchData).cptScheduleList.length == 0
      }, common_vendor.unref(matchData).cptScheduleList.length == 0 ? {} : {}) : {}, {
        ac: common_vendor.unref(current) === 3 && common_vendor.unref(cptLabelsList).length > 0
      }, common_vendor.unref(current) === 3 && common_vendor.unref(cptLabelsList).length > 0 ? common_vendor.e({
        ad: common_vendor.unref(cptLabelsList)[0].customText,
        ae: common_vendor.unref(cptLabelsList)[0].fileUrl
      }, common_vendor.unref(cptLabelsList)[0].fileUrl ? {
        af: common_vendor.p({
          type: "download",
          size: "16",
          color: "#54E1B9"
        }),
        ag: common_vendor.t(common_vendor.unref(cptLabelsList)[0].fileObj.name),
        ah: common_vendor.o(($event) => goWebView(common_vendor.unref(cptLabelsList)[0].fileObj.url))
      } : {}) : {}, {
        ai: common_vendor.unref(current) === 4 && common_vendor.unref(cptLabelsList).length > 1
      }, common_vendor.unref(current) === 4 && common_vendor.unref(cptLabelsList).length > 1 ? common_vendor.e({
        aj: common_vendor.unref(cptLabelsList)[1].customText,
        ak: common_vendor.unref(cptLabelsList)[1].fileUrl
      }, common_vendor.unref(cptLabelsList)[1].fileUrl ? {
        al: common_vendor.p({
          type: "download",
          size: "16",
          color: "#54E1B9"
        }),
        am: common_vendor.t(common_vendor.unref(cptLabelsList)[1].fileObj.name),
        an: common_vendor.o(($event) => goWebView(common_vendor.unref(cptLabelsList)[1].fileObj.url))
      } : {}) : {});
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-911ccc4f"], ["__file", "/Users/yangyang/project/j-mini/Venue/pages_match/match/singleLs.vue"]]);
_sfc_main.__runtimeHooks = 6;
wx.createPage(MiniProgramPage);