info.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. if (!Array) {
  4. const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  5. _easycom_uni_icons2();
  6. }
  7. const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
  8. if (!Math) {
  9. (_easycom_uni_icons + circle)();
  10. }
  11. const circle = () => "./components/circle.js";
  12. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  13. __name: "info",
  14. setup(__props) {
  15. var _a;
  16. const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  17. const list = common_vendor.ref([{ id: 1, name: "测试球队" }, { id: 1, name: "肝帝集团队" }]);
  18. const pageNum = common_vendor.ref(1);
  19. const pageSize = common_vendor.ref(10);
  20. const total = common_vendor.ref(0);
  21. const info = common_vendor.ref({});
  22. const id = common_vendor.ref("");
  23. const config = common_vendor.ref({ logoUrl: "" });
  24. const user = common_vendor.ref({});
  25. const statusList = common_vendor.ref([]);
  26. common_vendor.onLoad(async (options) => {
  27. id.value = options && options.id;
  28. await searchConfig();
  29. await searchOther();
  30. await search();
  31. await searchGame();
  32. });
  33. const searchConfig = async () => {
  34. config.value = common_vendor.index.getStorageSync("config");
  35. user.value = common_vendor.index.getStorageSync("user");
  36. };
  37. const searchOther = async () => {
  38. let res;
  39. res = await $api(`dict/data/list`, "GET", { dictType: "sys_game_status", status: "0" });
  40. if (res.code === 200 && res.total > 0)
  41. statusList.value = res.rows;
  42. };
  43. const search = async () => {
  44. if (id.value) {
  45. const res = await $api(`team/${id.value}`, "GET", {});
  46. if (res.code === 200) {
  47. if (res.data)
  48. info.value = res.data;
  49. } else {
  50. common_vendor.index.showToast({
  51. title: res.msg || "",
  52. icon: "error"
  53. });
  54. }
  55. }
  56. };
  57. const searchGame = async () => {
  58. if (id.value) {
  59. const res = await $api("game/list", "GET", {
  60. pageNum: pageNum.value,
  61. pageSize: pageSize.value,
  62. userId: user.value.id
  63. });
  64. if (res.code === 200) {
  65. list.value = res.rows;
  66. total.value = res.total;
  67. } else {
  68. common_vendor.index.showToast({
  69. title: res.msg || "",
  70. icon: "error"
  71. });
  72. }
  73. }
  74. };
  75. const menuList = common_vendor.ref([
  76. { name: "队员", icon: "icon-a-14-chengyuanguanli", color: "#333333", route: "/pagesHome/team/person" },
  77. { name: "相册", icon: "icon-xiangce", color: "#333333", route: "/pagesHome/team/album" },
  78. { name: "账本", icon: "icon-zhangben", color: "#333333", route: "/pagesHome/team/book" },
  79. { name: "战术板", icon: "icon-cricket-pitch", color: "#333333", route: "/pagesHome/team/board" }
  80. ]);
  81. const toEdit = (item) => {
  82. common_vendor.index.navigateTo({
  83. url: `/pagesHome/team/index?id=${item._id || item.id}`
  84. });
  85. };
  86. const toInfo = (item) => {
  87. common_vendor.index.navigateTo({
  88. url: `${item.route}?id=${id.value}`
  89. });
  90. };
  91. const toActivity = (item) => {
  92. common_vendor.index.navigateTo({
  93. url: `/pagesHome/activity/info?id=${item._id || item.id}&name=${item.name || ""}`
  94. });
  95. };
  96. const toSave = () => {
  97. common_vendor.index.navigateTo({
  98. url: `/pagesHome/create/index?id=${id.value}`
  99. });
  100. };
  101. const getDayOfWeek = (dateString) => {
  102. if (dateString) {
  103. const date = new Date(dateString);
  104. const dayOfWeek = date.getDay();
  105. const weekdays = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
  106. return weekdays[dayOfWeek];
  107. } else
  108. return "暂无日期";
  109. };
  110. const getStatus = (value) => {
  111. if (value) {
  112. const data = statusList.value.find((i) => i.dictValue == value);
  113. if (data)
  114. return data.dictLabel;
  115. } else
  116. return "暂无状态";
  117. };
  118. return (_ctx, _cache) => {
  119. return {
  120. a: info.value.logo || "/static/qiudui.png",
  121. b: common_vendor.t(info.value.name || "暂无名称"),
  122. c: common_vendor.t(info.value.ranking || "暂无排名"),
  123. d: common_vendor.o(($event) => toEdit(info.value)),
  124. e: common_vendor.p({
  125. type: "plusempty",
  126. size: "12",
  127. color: "#ffffff"
  128. }),
  129. f: common_vendor.o(toSave),
  130. g: common_vendor.o(toSave),
  131. h: common_vendor.p({
  132. type: "list",
  133. size: "18"
  134. }),
  135. i: common_vendor.o(($event) => toInfo({
  136. route: "/pagesHome/activity/index"
  137. })),
  138. j: common_vendor.f(menuList.value, (item, index, i0) => {
  139. return {
  140. a: "b14ffc51-2-" + i0,
  141. b: common_vendor.p({
  142. ["custom-prefix"]: "iconfont",
  143. type: item.icon,
  144. size: "25",
  145. color: item.color
  146. }),
  147. c: common_vendor.t(item.name),
  148. d: index,
  149. e: common_vendor.o(($event) => toInfo(item), index)
  150. };
  151. }),
  152. k: common_vendor.t(total.value || 0),
  153. l: common_vendor.p({
  154. pro: 16 / 100,
  155. border_back_color: "#f1f1f1",
  156. border_color: "#FF0000",
  157. content: "16"
  158. }),
  159. m: common_vendor.p({
  160. pro: 5 / 100,
  161. border_back_color: "#f1f1f1",
  162. border_color: "#35BD7B",
  163. content: "5"
  164. }),
  165. n: common_vendor.p({
  166. pro: 17 / 100,
  167. border_back_color: "#f1f1f1",
  168. border_color: "#FFA500",
  169. content: "17"
  170. }),
  171. o: common_vendor.p({
  172. type: "forward",
  173. size: "25",
  174. color: "#858585"
  175. }),
  176. p: common_vendor.p({
  177. ["custom-prefix"]: "iconfont",
  178. type: "icon-xiangce",
  179. size: "20",
  180. color: "#333333"
  181. }),
  182. q: common_vendor.o(($event) => toInfo({
  183. route: "/pagesHome/team/album"
  184. })),
  185. r: common_vendor.f(list.value, (item, index, i0) => {
  186. var _a2, _b, _c, _d, _e, _f;
  187. return common_vendor.e({
  188. a: common_vendor.t(common_vendor.unref(common_vendor.hooks)(item.startTime).format("MM-DD") || "暂无日期"),
  189. b: common_vendor.t(getDayOfWeek(item.startTime)),
  190. c: common_vendor.t(getStatus(item.status)),
  191. d: common_vendor.n(item.status == "0" ? "status0" : item.status == "1" ? "status1" : item.status == "2" ? "status2" : "status3"),
  192. e: item.type == "0"
  193. }, item.type == "0" ? {
  194. f: common_vendor.t(((_a2 = item == null ? void 0 : item.matchInfo) == null ? void 0 : _a2.title) || "友谊赛")
  195. } : {
  196. g: common_vendor.t(((_b = item == null ? void 0 : item.leagueInfo) == null ? void 0 : _b.title) || "联赛")
  197. }, {
  198. h: common_vendor.t(((_c = item == null ? void 0 : item.redInfo) == null ? void 0 : _c.name) || "暂无红方名称"),
  199. i: ((_d = item == null ? void 0 : item.redInfo) == null ? void 0 : _d.logo) || config.value.logoUrl,
  200. j: common_vendor.t(item.redScore || 0),
  201. k: common_vendor.t(item.blueScore || 0),
  202. l: ((_e = item == null ? void 0 : item.blueInfo) == null ? void 0 : _e.logo) || config.value.logoUrl,
  203. m: common_vendor.t(((_f = item == null ? void 0 : item.blueInfo) == null ? void 0 : _f.name) || "暂无蓝方名称"),
  204. n: index,
  205. o: common_vendor.o(($event) => toActivity(item), index)
  206. });
  207. })
  208. };
  209. };
  210. }
  211. });
  212. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-b14ffc51"], ["__file", "D:/project/足球比赛/match_applet/pagesHome/team/info.vue"]]);
  213. wx.createPage(MiniProgramPage);