activity.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. if (!Array) {
  4. const _easycom_uni_file_picker2 = common_vendor.resolveComponent("uni-file-picker");
  5. _easycom_uni_file_picker2();
  6. }
  7. const _easycom_uni_file_picker = () => "../../../uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.js";
  8. if (!Math) {
  9. _easycom_uni_file_picker();
  10. }
  11. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  12. __name: "activity",
  13. props: {
  14. type: { type: String, default: () => "0" },
  15. typeList: { type: Array, default: () => [] },
  16. activityList: { type: Array, default: () => [] },
  17. durationList: { type: Array, default: () => [] }
  18. },
  19. setup(__props) {
  20. var _a, _b;
  21. const props = __props;
  22. (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  23. const $apifile = (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$apifile;
  24. const form = common_vendor.ref({ file: [] });
  25. common_vendor.ref({
  26. width: 64,
  27. height: 64,
  28. border: {
  29. color: "#ff5a5f",
  30. width: 2,
  31. style: "dashed",
  32. radius: "2px"
  33. }
  34. });
  35. const { type, typeList, activityList, durationList } = common_vendor.toRefs(props);
  36. const typeChange = (e) => {
  37. let data;
  38. if (type.value == 0) {
  39. data = typeList.value[e.detail.value];
  40. if (data)
  41. form.value.type = data.dictLabel;
  42. } else {
  43. data = activityList.value[e.detail.value];
  44. if (data)
  45. form.value.type = data.dictLabel;
  46. }
  47. };
  48. const durationChange = (e) => {
  49. const data = durationList.value[e.detail.value];
  50. if (data)
  51. form.value.duration = data.dictLabel;
  52. };
  53. const dateChange = (e) => {
  54. form.value.date = e.detail.value;
  55. };
  56. const timeChange = (e) => {
  57. form.value.time = e.detail.value;
  58. };
  59. const toUpload = async (e) => {
  60. const arr = await $apifile(
  61. `/common/upload`,
  62. "file",
  63. e.tempFilePaths[0],
  64. "file"
  65. );
  66. if (arr.code == 200) {
  67. form.value.file.push({
  68. newFileName: arr.newFileName,
  69. originalFilename: arr.originalFilename,
  70. url: arr.url
  71. });
  72. console.log(form.value.file);
  73. } else {
  74. common_vendor.index.showToast({
  75. title: arr.msg,
  76. icon: "none"
  77. });
  78. }
  79. };
  80. const toDelete = async (e) => {
  81. form.value.file = form.value.file.filter((i) => i.originalFilename != e.tempFile.name);
  82. console.log(form.value.file);
  83. };
  84. return (_ctx, _cache) => {
  85. return common_vendor.e({
  86. a: common_vendor.unref(type) == "0"
  87. }, common_vendor.unref(type) == "0" ? {
  88. b: common_vendor.t(form.value.type || "普通训练"),
  89. c: common_vendor.o(typeChange),
  90. d: _ctx.index,
  91. e: common_vendor.unref(typeList)
  92. } : {
  93. f: common_vendor.t(form.value.type || "请选择"),
  94. g: common_vendor.o(typeChange),
  95. h: _ctx.index,
  96. i: common_vendor.unref(activityList)
  97. }, {
  98. j: common_vendor.t(form.value.date || "请选择"),
  99. k: common_vendor.o(dateChange),
  100. l: _ctx.index,
  101. m: common_vendor.t(form.value.time || "请选择"),
  102. n: common_vendor.o(timeChange),
  103. o: _ctx.index,
  104. p: common_vendor.t(form.value.duration || "请选择时长"),
  105. q: common_vendor.o(durationChange),
  106. r: _ctx.index,
  107. s: common_vendor.unref(durationList),
  108. t: form.value.address,
  109. v: form.value.money,
  110. w: form.value.number,
  111. x: form.value.sign,
  112. y: form.value.address,
  113. z: form.value.time,
  114. A: form.value.address,
  115. B: form.value.address,
  116. C: form.value.title,
  117. D: form.value.brief,
  118. E: common_vendor.o(toUpload),
  119. F: common_vendor.o(toDelete),
  120. G: common_vendor.o(($event) => form.value.file = $event),
  121. H: common_vendor.p({
  122. fileMediatype: "image",
  123. ["list-styles"]: _ctx.imageStyles,
  124. limit: "6",
  125. title: "最多选择6张图片",
  126. modelValue: form.value.file
  127. }),
  128. I: common_vendor.o(
  129. //@ts-ignore
  130. (...args) => _ctx.formSubmit && _ctx.formSubmit(...args)
  131. )
  132. });
  133. };
  134. }
  135. });
  136. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-b4c340fa"], ["__file", "D:/project/足球比赛/match_applet/pagesHome/create/components/activity.vue"]]);
  137. wx.createComponent(Component);