person.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
  6. (_easycom_uni_icons2 + _easycom_uni_popup2)();
  7. }
  8. const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
  9. const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
  10. if (!Math) {
  11. (_easycom_uni_icons + _easycom_uni_popup)();
  12. }
  13. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  14. __name: "person",
  15. setup(__props) {
  16. var _a, _b;
  17. const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  18. const $config = (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$config;
  19. const config = common_vendor.ref({ logoUrl: "" });
  20. const show = common_vendor.ref(false);
  21. const id = common_vendor.ref("");
  22. const sortList = common_vendor.ref([
  23. { name: "A-Z", type: "0", sort: -1, color1: "#121212", color2: "#999999" },
  24. { name: "位置", type: "1", sort: 1, color1: "#121212", color2: "#121212" },
  25. { name: "职位", type: "2", sort: 1, color1: "#121212", color2: "#121212" },
  26. { name: "号码", type: "3", sort: 1, color1: "#121212", color2: "#121212" }
  27. ]);
  28. const list = common_vendor.ref([{ id: 1, phone: "1234567890" }, { id: 1, name: "肝帝集团队" }]);
  29. common_vendor.ref(0);
  30. common_vendor.ref(6);
  31. common_vendor.ref(0);
  32. const total = common_vendor.ref(0);
  33. const popup = common_vendor.ref(null);
  34. const form = common_vendor.ref({});
  35. const user = common_vendor.ref({});
  36. const teamInfo = common_vendor.ref({});
  37. common_vendor.onLoad(async (options) => {
  38. id.value = options && options.id;
  39. await searchUser();
  40. await searchConfig();
  41. await search();
  42. await searchShare();
  43. });
  44. const searchUser = async () => {
  45. user.value = common_vendor.index.getStorageSync("user");
  46. };
  47. const searchConfig = async () => {
  48. config.value = common_vendor.index.getStorageSync("config");
  49. };
  50. const search = async () => {
  51. if (id.value) {
  52. common_vendor.index.setNavigationBarTitle({
  53. title: `球队阵容(${total.value})`
  54. });
  55. const res = await $api(`team/${id.value}`, "GET", {});
  56. if (res.code === 200) {
  57. if (res.data) {
  58. teamInfo.value = res.data;
  59. list.value = res.data.member || [];
  60. }
  61. } else {
  62. common_vendor.index.showToast({
  63. title: res.msg || "",
  64. icon: "error"
  65. });
  66. }
  67. }
  68. };
  69. const toInfo = async (item) => {
  70. common_vendor.index.navigateTo({
  71. url: `/pagesHome/share/index?id=${id.value}`
  72. });
  73. };
  74. const toSort = async (item) => {
  75. let list2;
  76. if (item.sort === -1) {
  77. list2 = sortList.value.map((i) => {
  78. if (i.type === item.type) {
  79. i.sort = 1;
  80. i.color1 = "#999999";
  81. i.color2 = "#121212";
  82. } else {
  83. i.color1 = "#121212";
  84. i.color2 = "#121212";
  85. }
  86. return i;
  87. });
  88. } else {
  89. list2 = sortList.value.map((i) => {
  90. if (i.type === item.type) {
  91. i.sort = -1;
  92. i.color1 = "#121212";
  93. i.color2 = "#999999";
  94. } else {
  95. i.color1 = "#121212";
  96. i.color2 = "#121212";
  97. }
  98. return i;
  99. });
  100. }
  101. sortList.value = list2;
  102. };
  103. const searchShare = () => {
  104. $config.share = {
  105. title: `${user.value.name || user.value.nickname || "暂无昵称"}邀请你加入${teamInfo.value.name || "暂无团队"}`,
  106. path: `/pagesHome/share/index?id=${id.value}`
  107. //后面是路径上要传递的参数
  108. };
  109. };
  110. const toCreate = () => {
  111. popup.value.open();
  112. };
  113. const toClose = () => {
  114. popup.value.close();
  115. };
  116. const toAdd = (e) => {
  117. console.log(e.deatil.value);
  118. };
  119. const change = (e) => {
  120. show.value = e.show;
  121. };
  122. return (_ctx, _cache) => {
  123. return {
  124. a: "overflow:" + (show.value ? "hidden" : "visible"),
  125. b: common_vendor.f(sortList.value, (item, index, i0) => {
  126. return {
  127. a: common_vendor.t(item.name),
  128. b: "fdda92d4-0-" + i0,
  129. c: common_vendor.p({
  130. ["custom-prefix"]: "iconfont",
  131. type: "icon-shangjiantou",
  132. size: "10",
  133. color: item.color1
  134. }),
  135. d: "fdda92d4-1-" + i0,
  136. e: common_vendor.p({
  137. ["custom-prefix"]: "iconfont",
  138. type: "icon-xiajiantou",
  139. size: "10",
  140. color: item.color2
  141. }),
  142. f: index,
  143. g: common_vendor.o(($event) => toSort(item), index)
  144. };
  145. }),
  146. c: common_vendor.p({
  147. ["custom-prefix"]: "iconfont",
  148. type: "icon-yaoqinghuida",
  149. size: "20",
  150. color: "#121212"
  151. }),
  152. d: common_vendor.f(list.value, (item, index, i0) => {
  153. return {
  154. a: common_vendor.t(item.type || ""),
  155. b: item.icon || config.value.logoUrl,
  156. c: common_vendor.t(item.name || item.phone),
  157. d: "fdda92d4-3-" + i0,
  158. e: index,
  159. f: common_vendor.o(($event) => toInfo(), index)
  160. };
  161. }),
  162. e: common_vendor.p({
  163. ["custom-prefix"]: "iconfont",
  164. type: "icon-31dianhua",
  165. size: "25",
  166. color: "#20B2AA"
  167. }),
  168. f: common_vendor.p({
  169. ["custom-prefix"]: "iconfont",
  170. type: "icon-yaoqinghuida",
  171. size: "20",
  172. color: "#121212"
  173. }),
  174. g: common_vendor.o(toCreate),
  175. h: common_vendor.o(toClose),
  176. i: common_vendor.p({
  177. type: "closeempty",
  178. size: "18",
  179. color: "#999999"
  180. }),
  181. j: form.value.phone,
  182. k: form.value.name,
  183. l: form.value.num,
  184. m: common_vendor.o(toAdd),
  185. n: common_vendor.sr(popup, "fdda92d4-5", {
  186. "k": "popup"
  187. }),
  188. o: common_vendor.o(change),
  189. p: common_vendor.p({
  190. ["background-color"]: "rgba(0,0,0,0)",
  191. type: "center"
  192. })
  193. };
  194. };
  195. }
  196. });
  197. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-fdda92d4"], ["__file", "D:/project/足球比赛/match_applet/pagesHome/team/person.vue"]]);
  198. wx.createPage(MiniProgramPage);