index.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  4. __name: "index",
  5. setup(__props) {
  6. var _a, _b, _c;
  7. const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  8. (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$config;
  9. const $apifile = (_c = common_vendor.getCurrentInstance()) == null ? void 0 : _c.appContext.config.globalProperties.$apifile;
  10. common_vendor.computed(() => {
  11. return common_vendor.index.getStorageSync("openid");
  12. });
  13. const id = common_vendor.ref("");
  14. const form = common_vendor.ref({ icon: "" });
  15. const typeList = common_vendor.ref([]);
  16. common_vendor.onLoad(async (options) => {
  17. id.value = options && options.id;
  18. await searchOther();
  19. await search();
  20. });
  21. common_vendor.onShow(() => {
  22. common_vendor.index.$on("setCity", function(city) {
  23. form.value.city = city;
  24. });
  25. });
  26. const searchOther = async () => {
  27. let res;
  28. res = await $api(`dict/data/list`, "GET", { dictType: "sys_user_type" });
  29. if (res.code === 200 && res.total > 0)
  30. typeList.value = res.rows;
  31. };
  32. const search = async () => {
  33. };
  34. const typeChange = (e) => {
  35. const data = typeList.value[e.detail.value];
  36. if (data)
  37. form.value.type = data.dictLabel;
  38. };
  39. const dateChange = (e) => {
  40. form.value.date = e.detail.value;
  41. };
  42. const toCity = () => {
  43. if (form.value.city) {
  44. common_vendor.index.navigateTo({
  45. url: `/pagesHome/city/index?city=${form.value.city}`
  46. });
  47. } else {
  48. common_vendor.index.navigateTo({
  49. url: `/pagesHome/city/index`
  50. });
  51. }
  52. };
  53. const Preview = () => {
  54. common_vendor.index.chooseImage({
  55. count: 1,
  56. sizeType: ["original", "compressed"],
  57. sourceType: ["album", "camera"],
  58. success: async function(res) {
  59. let tempFile = JSON.parse(JSON.stringify(res.tempFilePaths));
  60. const arr = await $apifile(
  61. `/common/upload`,
  62. "file",
  63. tempFile[0],
  64. "file"
  65. );
  66. if (arr.code == 200) {
  67. form.value.logo = arr.url;
  68. } else {
  69. common_vendor.index.showToast({
  70. title: arr.msg,
  71. icon: "none"
  72. });
  73. }
  74. }
  75. });
  76. };
  77. return (_ctx, _cache) => {
  78. return common_vendor.e({
  79. a: form.value.logo || "/static/qiudui.png",
  80. b: common_vendor.o(Preview),
  81. c: form.value.name,
  82. d: common_vendor.t(form.value.type || "请选择类型"),
  83. e: common_vendor.o(typeChange),
  84. f: _ctx.index,
  85. g: typeList.value,
  86. h: form.value.city
  87. }, form.value.city ? {
  88. i: common_vendor.t(form.value.city)
  89. } : {}, {
  90. j: common_vendor.o(toCity),
  91. k: common_vendor.t(form.value.date || "请选择成立时间"),
  92. l: common_vendor.o(dateChange),
  93. m: _ctx.index,
  94. n: form.value.color,
  95. o: form.value.brief,
  96. p: common_vendor.o(
  97. //@ts-ignore
  98. (...args) => _ctx.formSubmit && _ctx.formSubmit(...args)
  99. )
  100. });
  101. };
  102. }
  103. });
  104. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-01c8185c"], ["__file", "D:/project/足球比赛/match_applet/pagesHome/team/index.vue"]]);
  105. wx.createPage(MiniProgramPage);