123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- "use strict";
- const common_vendor = require("../../common/vendor.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_popup2 = common_vendor.resolveComponent("uni-popup");
- (_easycom_uni_segmented_control2 + _easycom_uni_icons2 + _easycom_uni_popup2)();
- }
- 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_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
- if (!Math) {
- (_easycom_uni_segmented_control + _easycom_uni_icons + _easycom_uni_popup)();
- }
- const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
- __name: "info",
- setup(__props) {
- var _a, _b;
- const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
- const $config = (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$config;
- const config = common_vendor.ref({ logoUrl: "" });
- const info = common_vendor.ref({});
- const list = common_vendor.ref(["出勤报名", "数据统计"]);
- const current = common_vendor.ref(0);
- const id = common_vendor.ref("");
- const user = common_vendor.ref({});
- const numberList = common_vendor.ref([]);
- const popup = common_vendor.ref(null);
- common_vendor.onLoad(async (options) => {
- id.value = options && options.id;
- common_vendor.index.setNavigationBarTitle({
- title: options && options.name || "活动详情"
- });
- await searchUser();
- await searchOther();
- await searchConfig();
- await search();
- await searchShare();
- });
- const searchUser = async () => {
- user.value = common_vendor.index.getStorageSync("user");
- };
- const searchOther = async () => {
- let res;
- res = await $api(`dict/data/list`, "GET", { dictType: "sys_match_number", status: "0" });
- if (res.code === 200 && res.total > 0)
- numberList.value = res.rows;
- };
- const searchConfig = async () => {
- config.value = common_vendor.index.getStorageSync("config");
- };
- const search = async () => {
- if (id.value) {
- const res = await $api(`game/${id.value}`, "GET", {});
- if (res.code === 200) {
- if (res.data) {
- const date1 = common_vendor.hooks(res.data.startTime).format("YYYY-MM-DD");
- const date2 = common_vendor.hooks(res.data.endTime).format("YYYY-MM-DD");
- if (common_vendor.hooks(date1).isSame(date2))
- res.data.time = common_vendor.hooks(res.data.startTime).format("MM-DD") + " " + common_vendor.hooks(res.data.startTime).format("HH:mm") + "-" + common_vendor.hooks(res.data.endTime).format("HH:mm");
- else
- res.data.time = common_vendor.hooks(res.data.startTime).format("MM-DD") + "/" + common_vendor.hooks(res.data.endTime).format("MM-DD");
- info.value = res.data;
- }
- } else {
- common_vendor.index.showToast({
- title: res.msg || "",
- icon: "error"
- });
- }
- }
- };
- const onClickItem = (e) => {
- if (current.value !== e.currentIndex)
- current.value = e.currentIndex;
- };
- const getDayOfWeek = (dateString) => {
- if (dateString) {
- const date = new Date(dateString);
- const dayOfWeek = date.getDay();
- const weekdays = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
- return weekdays[dayOfWeek];
- } else
- return "暂无日期";
- };
- const getNumber = (value) => {
- if (value) {
- const data = numberList.value.find((i) => i.dictValue == value);
- if (data)
- return data.dictLabel;
- } else
- return "0制";
- };
- const toInfo = (name) => {
- common_vendor.index.navigateTo({
- url: `/pagesHome/enroll/index?id=${info.value.id}&name=${name || ""}`
- });
- };
- const toEdit = async () => {
- popup.value.open();
- };
- const toAgain = async () => {
- common_vendor.index.navigateTo({
- url: `/pagesHome/create/index?gameId=${info.value.id}`
- });
- };
- const toCancel = async () => {
- common_vendor.index.showModal({
- title: "提示",
- content: "您确定取消比赛吗?",
- success: async function(res) {
- if (res.confirm) {
- const res2 = await $api(`game/${info.value.id}`, "DELETE", {});
- if (res2.code == 200) {
- common_vendor.index.navigateBack({
- delta: 1
- });
- } else {
- common_vendor.index.showToast({
- title: res2.msg,
- icon: "none"
- });
- }
- }
- }
- });
- };
- const toCopy = async () => {
- console.log("复用");
- common_vendor.index.navigateTo({
- url: `/pagesHome/draft/index?id=${info.value.id}`
- });
- };
- const onLeave = async () => {
- common_vendor.index.showModal({
- title: "提示",
- content: "您确定请假该比赛吗?",
- success: async function(res) {
- if (res.confirm) {
- const data = {
- gameId: info.value.id,
- userId: user.value.id,
- user_type: "0",
- status: "1",
- is_response: "Y"
- };
- const res2 = await $api(`enroll`, "POST", data);
- if (res2.code == 200) {
- common_vendor.index.navigateBack({
- delta: 1
- });
- } else {
- common_vendor.index.showToast({
- title: res2.msg,
- icon: "none"
- });
- }
- }
- }
- });
- };
- const onEnroll = async () => {
- common_vendor.index.showModal({
- title: "提示",
- content: "您确定报名该比赛吗?",
- success: async function(res) {
- if (res.confirm) {
- const data = {
- gameId: info.value.id,
- userId: user.value.id,
- user_type: "0",
- status: "2",
- is_response: "Y"
- };
- const res2 = await $api(`enroll`, "POST", data);
- if (res2.code == 200) {
- common_vendor.index.navigateBack({
- delta: 1
- });
- } else {
- common_vendor.index.showToast({
- title: res2.msg,
- icon: "none"
- });
- }
- }
- }
- });
- };
- const searchShare = () => {
- let titleName = "";
- if (info.value.type == "0")
- titleName = "友谊赛";
- else if (info.value.type == "1")
- titleName = "联赛";
- $config.share = {
- title: `${user.value.name || user.value.nickname || "暂无昵称"}邀请你报名${titleName || "暂无比赛名称"}`,
- path: `/pagesHome/share/index?id=${info.value.id}`
- //后面是路径上要传递的参数
- };
- };
- const toClose = () => {
- popup.value.close();
- };
- return (_ctx, _cache) => {
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
- return common_vendor.e({
- a: info.value.type == "0"
- }, info.value.type == "0" ? common_vendor.e({
- b: info.value.status == "0"
- }, info.value.status == "0" ? {} : {}, {
- c: common_vendor.t(getNumber((_b2 = (_a2 = info.value) == null ? void 0 : _a2.matchInfo) == null ? void 0 : _b2.number))
- }) : {
- d: common_vendor.t(getNumber((_d = (_c = info.value) == null ? void 0 : _c.matchInfo) == null ? void 0 : _d.number)),
- e: common_vendor.t(info.value.wheel || 0)
- }, {
- f: ((_f = (_e = info.value) == null ? void 0 : _e.redInfo) == null ? void 0 : _f.logo) || config.value.logoUrl,
- g: common_vendor.t(((_h = (_g = info.value) == null ? void 0 : _g.redInfo) == null ? void 0 : _h.name) || "暂无红方名称"),
- h: info.value.status == "0"
- }, info.value.status == "0" ? {} : {
- i: common_vendor.t(info.value.redScore || 0),
- j: common_vendor.t(info.value.blueScore || 0)
- }, {
- k: ((_j = (_i = info.value) == null ? void 0 : _i.blueInfo) == null ? void 0 : _j.logo) || config.value.logoUrl,
- l: common_vendor.t(((_l = (_k = info.value) == null ? void 0 : _k.blueInfo) == null ? void 0 : _l.name) || "暂无蓝方名称"),
- m: common_vendor.t(getDayOfWeek(info.value.startTime)),
- n: common_vendor.t(info.value.time || "暂无时间"),
- o: info.value.type == "0"
- }, info.value.type == "0" ? {
- p: common_vendor.t(((_n = (_m = info.value) == null ? void 0 : _m.matchInfo) == null ? void 0 : _n.address) || "暂无地点")
- } : {
- q: common_vendor.t(((_p = (_o = info.value) == null ? void 0 : _o.leagueInfo) == null ? void 0 : _p.address) || "暂无地点")
- }, {
- r: common_vendor.o(onClickItem),
- s: common_vendor.p({
- current: current.value,
- values: list.value,
- styleType: "text",
- activeColor: "#dd524d"
- }),
- t: common_vendor.t(((_r = (_q = info.value) == null ? void 0 : _q.matchInfo) == null ? void 0 : _r.member) || "0"),
- v: common_vendor.p({
- type: "right",
- size: "20",
- color: "#999999"
- }),
- w: common_vendor.o(($event) => toInfo("未回应队员")),
- x: common_vendor.p({
- type: "redo-filled",
- size: "15",
- color: "#ffffff"
- }),
- y: common_vendor.t(((_t = (_s = info.value) == null ? void 0 : _s.matchInfo) == null ? void 0 : _t.member) || "0"),
- z: common_vendor.p({
- type: "right",
- size: "20",
- color: "#999999"
- }),
- A: common_vendor.o(($event) => toInfo("已回应队员")),
- B: common_vendor.t(((_v = (_u = info.value) == null ? void 0 : _u.matchInfo) == null ? void 0 : _v.member) || "0"),
- C: common_vendor.n(info.value.status == "3" ? "count_1" : "count_2"),
- D: common_vendor.t(((_x = (_w = info.value) == null ? void 0 : _w.matchInfo) == null ? void 0 : _x.member) || "0"),
- E: common_vendor.n(info.value.status == "3" ? "count_1" : "count_2"),
- F: info.value.status == "3"
- }, info.value.status == "3" ? {
- G: common_vendor.t(((_z = (_y = info.value) == null ? void 0 : _y.matchInfo) == null ? void 0 : _z.member) || "0"),
- H: common_vendor.n(info.value.status == "3" ? "count_1" : "count_2")
- } : {}, {
- I: current.value === 0,
- J: current.value === 1,
- K: info.value.status == "0" || info.value.status == "1"
- }, info.value.status == "0" || info.value.status == "1" ? {
- L: common_vendor.o(toEdit),
- M: common_vendor.p({
- type: "compose",
- size: "20",
- color: "#696969"
- }),
- N: common_vendor.o(toCopy),
- O: common_vendor.p({
- ["custom-prefix"]: "iconfont",
- type: "icon-icon_cz",
- size: "20",
- color: "#696969"
- }),
- P: common_vendor.o(onLeave),
- Q: common_vendor.o(onEnroll)
- } : {}, {
- R: common_vendor.o(toAgain),
- S: common_vendor.o(toCancel),
- T: common_vendor.o(toClose),
- U: common_vendor.sr(popup, "24c37ea1-6", {
- "k": "popup"
- }),
- V: common_vendor.o(_ctx.change),
- W: common_vendor.p({
- ["background-color"]: "rgba(0,0,0,0)",
- type: "center"
- })
- });
- };
- }
- });
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-24c37ea1"], ["__file", "D:/project/足球比赛/match_applet/pagesHome/activity/info.vue"]]);
- wx.createPage(MiniProgramPage);
|