index.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. if (!Math) {
  4. cityPicker();
  5. }
  6. const cityPicker = () => "../../components/cityPicker.js";
  7. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  8. __name: "index",
  9. setup(__props) {
  10. var _a, _b, _c;
  11. const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  12. (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$config;
  13. const $apifile = (_c = common_vendor.getCurrentInstance()) == null ? void 0 : _c.appContext.config.globalProperties.$apifile;
  14. const openid = common_vendor.computed(() => {
  15. return common_vendor.index.getStorageSync("openid");
  16. });
  17. const config = common_vendor.ref({ logoUrl: "" });
  18. const form = common_vendor.ref({ icon: "" });
  19. const showSheetView = common_vendor.ref(true);
  20. const sexList = common_vendor.ref([]);
  21. const typeList = common_vendor.ref([]);
  22. const placeList = common_vendor.ref([]);
  23. common_vendor.onLoad(async () => {
  24. await searchOther();
  25. await searchConfig();
  26. await search();
  27. });
  28. const searchOther = async () => {
  29. let res;
  30. res = await $api(`dict/data/list`, "GET", { dictType: "sys_user_sex" });
  31. if (res.code === 200 && res.total > 0)
  32. sexList.value = res.rows;
  33. res = await $api(`dict/data/list`, "GET", { dictType: "sys_user_type" });
  34. if (res.code === 200 && res.total > 0)
  35. typeList.value = res.rows;
  36. res = await $api(`dict/data/list`, "GET", { dictType: "sys_user_place" });
  37. if (res.code === 200 && res.total > 0)
  38. placeList.value = res.rows;
  39. };
  40. const searchConfig = async () => {
  41. config.value = common_vendor.index.getStorageSync("config");
  42. };
  43. const search = async () => {
  44. const res = await $api(`matchUser/find`, "GET", {
  45. openid: openid.value
  46. });
  47. if (res.code === 200) {
  48. if (res.data)
  49. console.log(res.data);
  50. else {
  51. common_vendor.index.navigateTo({
  52. url: `/pages/login/index`
  53. });
  54. }
  55. } else {
  56. common_vendor.index.showToast({
  57. title: res.msg || "",
  58. icon: "error"
  59. });
  60. }
  61. };
  62. const onSelected = (row) => {
  63. console.log(row, "1");
  64. showSheetView.value = false;
  65. };
  66. const sexChange = (e) => {
  67. const data = sexList.value[e.detail.value];
  68. if (data)
  69. form.value.sex = data.dictLabel;
  70. };
  71. const typeChange = (e) => {
  72. const data = typeList.value[e.detail.value];
  73. if (data)
  74. form.value.type = data.dictLabel;
  75. };
  76. const placeChange = (e) => {
  77. const data = placeList.value[e.detail.value];
  78. if (data)
  79. form.value.place = data.dictLabel;
  80. };
  81. const Preview = () => {
  82. common_vendor.index.chooseImage({
  83. count: 1,
  84. sizeType: ["original", "compressed"],
  85. sourceType: ["album", "camera"],
  86. success: async function(res) {
  87. let tempFile = JSON.parse(JSON.stringify(res.tempFilePaths));
  88. const arr = await $apifile(
  89. `/common/upload`,
  90. "file",
  91. tempFile[0],
  92. "file"
  93. );
  94. if (arr.code == 200) {
  95. form.value.icon = arr.url;
  96. } else {
  97. common_vendor.index.showToast({
  98. title: arr.msg,
  99. icon: "none"
  100. });
  101. }
  102. }
  103. });
  104. };
  105. return (_ctx, _cache) => {
  106. return {
  107. a: form.value.icon || config.value.logoUrl,
  108. b: common_vendor.o(Preview),
  109. c: form.value.name,
  110. d: form.value.nickname,
  111. e: common_vendor.t(form.value.sex || "请选择性别"),
  112. f: common_vendor.o(sexChange),
  113. g: _ctx.index,
  114. h: sexList.value,
  115. i: form.value.phone,
  116. j: common_vendor.o(onSelected),
  117. k: common_vendor.p({
  118. showSheetView: showSheetView.value,
  119. defaultIndexs: [0, 0, 0]
  120. }),
  121. l: form.value.height,
  122. m: form.value.weight,
  123. n: common_vendor.t(form.value.type || "请选择主要项目"),
  124. o: common_vendor.o(typeChange),
  125. p: _ctx.index,
  126. q: typeList.value,
  127. r: form.value.ballYears,
  128. s: common_vendor.t(form.value.place || "请选择队内位置"),
  129. t: common_vendor.o(placeChange),
  130. v: _ctx.index,
  131. w: placeList.value,
  132. x: common_vendor.o(
  133. //@ts-ignore
  134. (...args) => _ctx.formSubmit && _ctx.formSubmit(...args)
  135. )
  136. };
  137. };
  138. }
  139. });
  140. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-bf1a7b85"], ["__file", "D:/project/足球比赛/match_applet/pagesMy/basic/index.vue"]]);
  141. wx.createPage(MiniProgramPage);