person.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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. } else {
  60. common_vendor.index.showToast({
  61. title: res.msg || "",
  62. icon: "error"
  63. });
  64. }
  65. }
  66. };
  67. const toInfo = async (item) => {
  68. common_vendor.index.navigateTo({
  69. url: `/pagesHome/share/index?id=${id.value}`
  70. });
  71. };
  72. const toSort = async (item) => {
  73. let list2;
  74. if (item.sort === -1) {
  75. list2 = sortList.value.map((i) => {
  76. if (i.type === item.type) {
  77. i.sort = 1;
  78. i.color1 = "#999999";
  79. i.color2 = "#121212";
  80. } else {
  81. i.color1 = "#121212";
  82. i.color2 = "#121212";
  83. }
  84. return i;
  85. });
  86. } else {
  87. list2 = sortList.value.map((i) => {
  88. if (i.type === item.type) {
  89. i.sort = -1;
  90. i.color1 = "#121212";
  91. i.color2 = "#999999";
  92. } else {
  93. i.color1 = "#121212";
  94. i.color2 = "#121212";
  95. }
  96. return i;
  97. });
  98. }
  99. sortList.value = list2;
  100. };
  101. const searchShare = () => {
  102. $config.share = {
  103. title: `${user.value.name || "暂无名称"}邀请你加入${teamInfo.value.name || "暂无团队"}`,
  104. path: `/pagesHome/share/index?id=${id.value}`
  105. //后面是路径上要传递的参数
  106. };
  107. };
  108. const toCreate = () => {
  109. popup.value.open();
  110. };
  111. const toClose = () => {
  112. popup.value.close();
  113. };
  114. const toAdd = (e) => {
  115. console.log(e.deatil.value);
  116. };
  117. const change = (e) => {
  118. show.value = e.show;
  119. };
  120. return (_ctx, _cache) => {
  121. return {
  122. a: "overflow:" + (show.value ? "hidden" : "visible"),
  123. b: common_vendor.f(sortList.value, (item, index, i0) => {
  124. return {
  125. a: common_vendor.t(item.name),
  126. b: "fdda92d4-0-" + i0,
  127. c: common_vendor.p({
  128. ["custom-prefix"]: "iconfont",
  129. type: "icon-shangjiantou",
  130. size: "10",
  131. color: item.color1
  132. }),
  133. d: "fdda92d4-1-" + i0,
  134. e: common_vendor.p({
  135. ["custom-prefix"]: "iconfont",
  136. type: "icon-xiajiantou",
  137. size: "10",
  138. color: item.color2
  139. }),
  140. f: index,
  141. g: common_vendor.o(($event) => toSort(item), index)
  142. };
  143. }),
  144. c: common_vendor.p({
  145. ["custom-prefix"]: "iconfont",
  146. type: "icon-yaoqinghuida",
  147. size: "20",
  148. color: "#121212"
  149. }),
  150. d: common_vendor.f(list.value, (item, index, i0) => {
  151. return {
  152. a: common_vendor.t(item.type || ""),
  153. b: item.icon || config.value.logoUrl,
  154. c: common_vendor.t(item.name || item.phone),
  155. d: "fdda92d4-3-" + i0,
  156. e: index,
  157. f: common_vendor.o(($event) => toInfo(), index)
  158. };
  159. }),
  160. e: common_vendor.p({
  161. ["custom-prefix"]: "iconfont",
  162. type: "icon-31dianhua",
  163. size: "25",
  164. color: "#20B2AA"
  165. }),
  166. f: common_vendor.p({
  167. ["custom-prefix"]: "iconfont",
  168. type: "icon-yaoqinghuida",
  169. size: "25",
  170. color: "#121212"
  171. }),
  172. g: common_vendor.o(toCreate),
  173. h: common_vendor.o(toClose),
  174. i: common_vendor.p({
  175. type: "closeempty",
  176. size: "18",
  177. color: "#999999"
  178. }),
  179. j: form.value.phone,
  180. k: form.value.name,
  181. l: form.value.num,
  182. m: common_vendor.o(toAdd),
  183. n: common_vendor.sr(popup, "fdda92d4-5", {
  184. "k": "popup"
  185. }),
  186. o: common_vendor.o(change),
  187. p: common_vendor.p({
  188. ["background-color"]: "rgba(0,0,0,0)",
  189. type: "center"
  190. })
  191. };
  192. };
  193. }
  194. });
  195. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-fdda92d4"], ["__file", "D:/project/足球比赛/match_applet/pagesHome/team/person.vue"]]);
  196. wx.createPage(MiniProgramPage);