index.js 3.4 KB

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