index.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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;
  11. const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  12. const openid = common_vendor.computed(() => {
  13. return common_vendor.index.getStorageSync("openid");
  14. });
  15. const config = common_vendor.ref({ logoUrl: "" });
  16. const form = common_vendor.ref({ icon: "" });
  17. const showSheetView = common_vendor.ref(true);
  18. const sexList = common_vendor.ref([]);
  19. const typeList = common_vendor.ref([]);
  20. const placeList = common_vendor.ref([]);
  21. common_vendor.onLoad(async () => {
  22. await searchOther();
  23. await searchConfig();
  24. await search();
  25. });
  26. const searchOther = async () => {
  27. let res;
  28. res = await $api(`dict/data/list`, "GET", { dictType: "sys_user_sex" });
  29. if (res.code === 200 && res.total > 0)
  30. sexList.value = res.rows;
  31. res = await $api(`dict/data/list`, "GET", { dictType: "sys_user_type" });
  32. if (res.code === 200 && res.total > 0)
  33. typeList.value = res.rows;
  34. res = await $api(`dict/data/list`, "GET", { dictType: "sys_user_place" });
  35. if (res.code === 200 && res.total > 0)
  36. placeList.value = res.rows;
  37. };
  38. const searchConfig = async () => {
  39. config.value = common_vendor.index.getStorageSync("config");
  40. };
  41. const search = async () => {
  42. const res = await $api(`matchUser/find`, "GET", {
  43. openid: openid.value
  44. });
  45. if (res.code === 200) {
  46. if (res.data)
  47. console.log(res.data);
  48. else {
  49. common_vendor.index.navigateTo({
  50. url: `/pages/login/index`
  51. });
  52. }
  53. } else {
  54. common_vendor.index.showToast({
  55. title: res.msg || "",
  56. icon: "error"
  57. });
  58. }
  59. };
  60. const onSelected = (row) => {
  61. console.log(row, "1");
  62. showSheetView.value = false;
  63. };
  64. const sexChange = (e) => {
  65. const data = sexList.value[e.detail.value];
  66. if (data)
  67. form.value.sex = data.dictLabel;
  68. };
  69. const typeChange = (e) => {
  70. const data = typeList.value[e.detail.value];
  71. if (data)
  72. form.value.type = data.dictLabel;
  73. };
  74. const placeChange = (e) => {
  75. const data = placeList.value[e.detail.value];
  76. if (data)
  77. form.value.place = data.dictLabel;
  78. };
  79. return (_ctx, _cache) => {
  80. return {
  81. a: form.value.icon || config.value.logoUrl,
  82. b: form.value.name,
  83. c: form.value.nickname,
  84. d: common_vendor.t(form.value.sex || "请选择性别"),
  85. e: common_vendor.o(sexChange),
  86. f: _ctx.index,
  87. g: sexList.value,
  88. h: form.value.phone,
  89. i: common_vendor.o(onSelected),
  90. j: common_vendor.p({
  91. showSheetView: showSheetView.value,
  92. defaultIndexs: [0, 0, 0]
  93. }),
  94. k: form.value.height,
  95. l: form.value.weight,
  96. m: common_vendor.t(form.value.type || "请选择主要项目"),
  97. n: common_vendor.o(typeChange),
  98. o: _ctx.index,
  99. p: typeList.value,
  100. q: form.value.ballYears,
  101. r: common_vendor.t(form.value.place || "请选择队内位置"),
  102. s: common_vendor.o(placeChange),
  103. t: _ctx.index,
  104. v: placeList.value,
  105. w: common_vendor.o(
  106. //@ts-ignore
  107. (...args) => _ctx.formSubmit && _ctx.formSubmit(...args)
  108. )
  109. };
  110. };
  111. }
  112. });
  113. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-bf1a7b85"], ["__file", "D:/project/足球比赛/match_applet/pagesMy/basic/index.vue"]]);
  114. wx.createPage(MiniProgramPage);