info.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. if (!Array) {
  4. const _easycom_uni_segmented_control2 = common_vendor.resolveComponent("uni-segmented-control");
  5. const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  6. const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
  7. (_easycom_uni_segmented_control2 + _easycom_uni_icons2 + _easycom_uni_popup2)();
  8. }
  9. const _easycom_uni_segmented_control = () => "../../uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.js";
  10. const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
  11. const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
  12. if (!Math) {
  13. (_easycom_uni_segmented_control + _easycom_uni_icons + _easycom_uni_popup)();
  14. }
  15. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  16. __name: "info",
  17. setup(__props) {
  18. var _a, _b;
  19. const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  20. const $config = (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$config;
  21. const config = common_vendor.ref({ logoUrl: "" });
  22. const info = common_vendor.ref({});
  23. const list = common_vendor.ref(["出勤报名", "数据统计"]);
  24. const current = common_vendor.ref(0);
  25. const id = common_vendor.ref("");
  26. const user = common_vendor.ref({});
  27. const numberList = common_vendor.ref([]);
  28. const popup = common_vendor.ref(null);
  29. common_vendor.onLoad(async (options) => {
  30. id.value = options && options.id;
  31. common_vendor.index.setNavigationBarTitle({
  32. title: options && options.name || "活动详情"
  33. });
  34. await searchUser();
  35. await searchOther();
  36. await searchConfig();
  37. await search();
  38. await searchShare();
  39. });
  40. const searchUser = async () => {
  41. user.value = common_vendor.index.getStorageSync("user");
  42. };
  43. const searchOther = async () => {
  44. let res;
  45. res = await $api(`dict/data/list`, "GET", { dictType: "sys_match_number", status: "0" });
  46. if (res.code === 200 && res.total > 0)
  47. numberList.value = res.rows;
  48. };
  49. const searchConfig = async () => {
  50. config.value = common_vendor.index.getStorageSync("config");
  51. };
  52. const search = async () => {
  53. if (id.value) {
  54. const res = await $api(`game/${id.value}`, "GET", {});
  55. if (res.code === 200) {
  56. if (res.data) {
  57. const date1 = common_vendor.hooks(res.data.startTime).format("YYYY-MM-DD");
  58. const date2 = common_vendor.hooks(res.data.endTime).format("YYYY-MM-DD");
  59. if (common_vendor.hooks(date1).isSame(date2))
  60. 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");
  61. else
  62. res.data.time = common_vendor.hooks(res.data.startTime).format("MM-DD") + "/" + common_vendor.hooks(res.data.endTime).format("MM-DD");
  63. info.value = res.data;
  64. }
  65. } else {
  66. common_vendor.index.showToast({
  67. title: res.msg || "",
  68. icon: "error"
  69. });
  70. }
  71. }
  72. };
  73. const onClickItem = (e) => {
  74. if (current.value !== e.currentIndex)
  75. current.value = e.currentIndex;
  76. };
  77. const getDayOfWeek = (dateString) => {
  78. if (dateString) {
  79. const date = new Date(dateString);
  80. const dayOfWeek = date.getDay();
  81. const weekdays = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
  82. return weekdays[dayOfWeek];
  83. } else
  84. return "暂无日期";
  85. };
  86. const getNumber = (value) => {
  87. if (value) {
  88. const data = numberList.value.find((i) => i.dictValue == value);
  89. if (data)
  90. return data.dictLabel;
  91. } else
  92. return "0制";
  93. };
  94. const toInfo = (name) => {
  95. common_vendor.index.navigateTo({
  96. url: `/pagesHome/enroll/index?id=${info.value.id}&name=${name || ""}`
  97. });
  98. };
  99. const toEdit = async () => {
  100. popup.value.open();
  101. };
  102. const toAgain = async () => {
  103. common_vendor.index.navigateTo({
  104. url: `/pagesHome/create/index?gameId=${info.value.id}`
  105. });
  106. };
  107. const toCancel = async () => {
  108. common_vendor.index.showModal({
  109. title: "提示",
  110. content: "您确定取消比赛吗?",
  111. success: async function(res) {
  112. if (res.confirm) {
  113. const res2 = await $api(`game/${info.value.id}`, "DELETE", {});
  114. if (res2.code == 200) {
  115. common_vendor.index.navigateBack({
  116. delta: 1
  117. });
  118. } else {
  119. common_vendor.index.showToast({
  120. title: res2.msg,
  121. icon: "none"
  122. });
  123. }
  124. }
  125. }
  126. });
  127. };
  128. const toCopy = async () => {
  129. console.log("复用");
  130. common_vendor.index.navigateTo({
  131. url: `/pagesHome/draft/index?id=${info.value.id}`
  132. });
  133. };
  134. const onLeave = async () => {
  135. common_vendor.index.showModal({
  136. title: "提示",
  137. content: "您确定请假该比赛吗?",
  138. success: async function(res) {
  139. if (res.confirm) {
  140. const data = {
  141. gameId: info.value.id,
  142. userId: user.value.id,
  143. user_type: "0",
  144. status: "1",
  145. is_response: "Y"
  146. };
  147. const res2 = await $api(`enroll`, "POST", data);
  148. if (res2.code == 200) {
  149. common_vendor.index.navigateBack({
  150. delta: 1
  151. });
  152. } else {
  153. common_vendor.index.showToast({
  154. title: res2.msg,
  155. icon: "none"
  156. });
  157. }
  158. }
  159. }
  160. });
  161. };
  162. const onEnroll = async () => {
  163. common_vendor.index.showModal({
  164. title: "提示",
  165. content: "您确定报名该比赛吗?",
  166. success: async function(res) {
  167. if (res.confirm) {
  168. const data = {
  169. gameId: info.value.id,
  170. userId: user.value.id,
  171. user_type: "0",
  172. status: "2",
  173. is_response: "Y"
  174. };
  175. const res2 = await $api(`enroll`, "POST", data);
  176. if (res2.code == 200) {
  177. common_vendor.index.navigateBack({
  178. delta: 1
  179. });
  180. } else {
  181. common_vendor.index.showToast({
  182. title: res2.msg,
  183. icon: "none"
  184. });
  185. }
  186. }
  187. }
  188. });
  189. };
  190. const searchShare = () => {
  191. let titleName = "";
  192. if (info.value.type == "0")
  193. titleName = "友谊赛";
  194. else if (info.value.type == "1")
  195. titleName = "联赛";
  196. $config.share = {
  197. title: `${user.value.name || user.value.nickname || "暂无昵称"}邀请你报名${titleName || "暂无比赛名称"}`,
  198. path: `/pagesHome/share/index?id=${info.value.id}`
  199. //后面是路径上要传递的参数
  200. };
  201. };
  202. const toClose = () => {
  203. popup.value.close();
  204. };
  205. return (_ctx, _cache) => {
  206. 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;
  207. return common_vendor.e({
  208. a: info.value.type == "0"
  209. }, info.value.type == "0" ? common_vendor.e({
  210. b: info.value.status == "0"
  211. }, info.value.status == "0" ? {} : {}, {
  212. c: common_vendor.t(getNumber((_b2 = (_a2 = info.value) == null ? void 0 : _a2.matchInfo) == null ? void 0 : _b2.number))
  213. }) : {
  214. d: common_vendor.t(getNumber((_d = (_c = info.value) == null ? void 0 : _c.matchInfo) == null ? void 0 : _d.number)),
  215. e: common_vendor.t(info.value.wheel || 0)
  216. }, {
  217. f: ((_f = (_e = info.value) == null ? void 0 : _e.redInfo) == null ? void 0 : _f.logo) || config.value.logoUrl,
  218. g: common_vendor.t(((_h = (_g = info.value) == null ? void 0 : _g.redInfo) == null ? void 0 : _h.name) || "暂无红方名称"),
  219. h: info.value.status == "0"
  220. }, info.value.status == "0" ? {} : {
  221. i: common_vendor.t(info.value.redScore || 0),
  222. j: common_vendor.t(info.value.blueScore || 0)
  223. }, {
  224. k: ((_j = (_i = info.value) == null ? void 0 : _i.blueInfo) == null ? void 0 : _j.logo) || config.value.logoUrl,
  225. l: common_vendor.t(((_l = (_k = info.value) == null ? void 0 : _k.blueInfo) == null ? void 0 : _l.name) || "暂无蓝方名称"),
  226. m: common_vendor.t(getDayOfWeek(info.value.startTime)),
  227. n: common_vendor.t(info.value.time || "暂无时间"),
  228. o: info.value.type == "0"
  229. }, info.value.type == "0" ? {
  230. p: common_vendor.t(((_n = (_m = info.value) == null ? void 0 : _m.matchInfo) == null ? void 0 : _n.address) || "暂无地点")
  231. } : {
  232. q: common_vendor.t(((_p = (_o = info.value) == null ? void 0 : _o.leagueInfo) == null ? void 0 : _p.address) || "暂无地点")
  233. }, {
  234. r: common_vendor.o(onClickItem),
  235. s: common_vendor.p({
  236. current: current.value,
  237. values: list.value,
  238. styleType: "text",
  239. activeColor: "#dd524d"
  240. }),
  241. t: common_vendor.t(((_r = (_q = info.value) == null ? void 0 : _q.matchInfo) == null ? void 0 : _r.member) || "0"),
  242. v: common_vendor.p({
  243. type: "right",
  244. size: "20",
  245. color: "#999999"
  246. }),
  247. w: common_vendor.o(($event) => toInfo("未回应队员")),
  248. x: common_vendor.p({
  249. type: "redo-filled",
  250. size: "15",
  251. color: "#ffffff"
  252. }),
  253. y: common_vendor.t(((_t = (_s = info.value) == null ? void 0 : _s.matchInfo) == null ? void 0 : _t.member) || "0"),
  254. z: common_vendor.p({
  255. type: "right",
  256. size: "20",
  257. color: "#999999"
  258. }),
  259. A: common_vendor.o(($event) => toInfo("已回应队员")),
  260. B: common_vendor.t(((_v = (_u = info.value) == null ? void 0 : _u.matchInfo) == null ? void 0 : _v.member) || "0"),
  261. C: common_vendor.n(info.value.status == "3" ? "count_1" : "count_2"),
  262. D: common_vendor.t(((_x = (_w = info.value) == null ? void 0 : _w.matchInfo) == null ? void 0 : _x.member) || "0"),
  263. E: common_vendor.n(info.value.status == "3" ? "count_1" : "count_2"),
  264. F: info.value.status == "3"
  265. }, info.value.status == "3" ? {
  266. G: common_vendor.t(((_z = (_y = info.value) == null ? void 0 : _y.matchInfo) == null ? void 0 : _z.member) || "0"),
  267. H: common_vendor.n(info.value.status == "3" ? "count_1" : "count_2")
  268. } : {}, {
  269. I: current.value === 0,
  270. J: current.value === 1,
  271. K: info.value.status == "0" || info.value.status == "1"
  272. }, info.value.status == "0" || info.value.status == "1" ? {
  273. L: common_vendor.o(toEdit),
  274. M: common_vendor.p({
  275. type: "compose",
  276. size: "20",
  277. color: "#696969"
  278. }),
  279. N: common_vendor.o(toCopy),
  280. O: common_vendor.p({
  281. ["custom-prefix"]: "iconfont",
  282. type: "icon-icon_cz",
  283. size: "20",
  284. color: "#696969"
  285. }),
  286. P: common_vendor.o(onLeave),
  287. Q: common_vendor.o(onEnroll)
  288. } : {}, {
  289. R: common_vendor.o(toAgain),
  290. S: common_vendor.o(toCancel),
  291. T: common_vendor.o(toClose),
  292. U: common_vendor.sr(popup, "24c37ea1-6", {
  293. "k": "popup"
  294. }),
  295. V: common_vendor.o(_ctx.change),
  296. W: common_vendor.p({
  297. ["background-color"]: "rgba(0,0,0,0)",
  298. type: "center"
  299. })
  300. });
  301. };
  302. }
  303. });
  304. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-24c37ea1"], ["__file", "D:/project/足球比赛/match_applet/pagesHome/activity/info.vue"]]);
  305. wx.createPage(MiniProgramPage);