activity.js 5.3 KB

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