match.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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: "match",
  15. props: {
  16. typeList: { type: Array, default: () => [] },
  17. numberList: { type: Array, default: () => [] },
  18. openList: { type: Array, default: () => [] },
  19. durationList: { type: Array, default: () => [] }
  20. },
  21. setup(__props) {
  22. var _a, _b;
  23. const props = __props;
  24. (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  25. const $apifile = (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$apifile;
  26. const form = common_vendor.ref({ file: [] });
  27. const opponent_name = common_vendor.ref("");
  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 { typeList, durationList, numberList, openList } = common_vendor.toRefs(props);
  39. common_vendor.onShow(() => {
  40. common_vendor.index.$on("opponentInfo", function(item) {
  41. form.value.opponent = item.id;
  42. opponent_name.value = item.name;
  43. });
  44. });
  45. const typeChange = (e) => {
  46. const data = typeList.value[e.detail.value];
  47. if (data)
  48. form.value.type = data.dictLabel;
  49. };
  50. const numberChange = (e) => {
  51. const data = numberList.value[e.detail.value];
  52. if (data)
  53. form.value.number = data.dictLabel;
  54. };
  55. const dateChange = (e) => {
  56. form.value.date = e.detail.value;
  57. };
  58. const timeChange = (e) => {
  59. form.value.time = e.detail.value;
  60. };
  61. const durationChange = (e) => {
  62. const data = durationList.value[e.detail.value];
  63. if (data)
  64. form.value.duration = data.dictLabel;
  65. };
  66. const openChange = (e) => {
  67. form.value.is_open = e.detail.value;
  68. };
  69. const toLocaltion = (e) => {
  70. common_vendor.index.chooseLocation({
  71. success: function(res) {
  72. searchAddress(res);
  73. }
  74. });
  75. };
  76. const searchAddress = (e) => {
  77. form.value.address = e.address;
  78. };
  79. const toUpload = async (e) => {
  80. const arr = await $apifile(
  81. `/common/upload`,
  82. "file",
  83. e.tempFilePaths[0],
  84. "file"
  85. );
  86. if (arr.code == 200) {
  87. form.value.file.push({
  88. newFileName: arr.newFileName,
  89. originalFilename: arr.originalFilename,
  90. url: arr.url
  91. });
  92. console.log(form.value.file);
  93. } else {
  94. common_vendor.index.showToast({
  95. title: arr.msg,
  96. icon: "none"
  97. });
  98. }
  99. };
  100. const toDelete = async (e) => {
  101. form.value.file = form.value.file.filter((i) => i.originalFilename != e.tempFile.name);
  102. console.log(form.value.file);
  103. };
  104. const toOpponent = () => {
  105. common_vendor.index.navigateTo({
  106. url: `/pagesHome/create/person`
  107. });
  108. };
  109. return (_ctx, _cache) => {
  110. return common_vendor.e({
  111. a: common_vendor.t(form.value.type || "请选择类型"),
  112. b: common_vendor.o(typeChange),
  113. c: _ctx.index,
  114. d: common_vendor.unref(typeList),
  115. e: common_vendor.t(form.value.number || "请选择人数"),
  116. f: common_vendor.o(numberChange),
  117. g: _ctx.index,
  118. h: common_vendor.unref(numberList),
  119. i: form.value.opponent
  120. }, form.value.opponent ? {
  121. j: common_vendor.t(opponent_name.value)
  122. } : {}, {
  123. k: common_vendor.o(toOpponent),
  124. l: common_vendor.t(form.value.date || "请选择日期"),
  125. m: common_vendor.o(dateChange),
  126. n: _ctx.index,
  127. o: common_vendor.t(form.value.time || "请选择时间"),
  128. p: common_vendor.o(timeChange),
  129. q: _ctx.index,
  130. r: common_vendor.t(form.value.duration || "请选择时长"),
  131. s: common_vendor.o(durationChange),
  132. t: _ctx.index,
  133. v: common_vendor.unref(durationList),
  134. w: form.value.address
  135. }, form.value.address ? {
  136. x: common_vendor.t(form.value.address)
  137. } : {}, {
  138. y: common_vendor.o(toLocaltion),
  139. z: form.value.color,
  140. A: form.value.money,
  141. B: form.value.max_person,
  142. C: common_vendor.t(form.value.is_open || "请选择"),
  143. D: common_vendor.o(openChange),
  144. E: _ctx.index,
  145. F: common_vendor.unref(openList),
  146. G: form.value.date && form.value.time
  147. }, form.value.date && form.value.time ? {
  148. H: common_vendor.o(($event) => form.value.end_time = $event),
  149. I: common_vendor.p({
  150. start: form.value.date,
  151. border: false,
  152. modelValue: form.value.end_time
  153. })
  154. } : {}, {
  155. J: form.value.title,
  156. K: form.value.brief,
  157. L: common_vendor.o(toUpload),
  158. M: common_vendor.o(toDelete),
  159. N: common_vendor.o(($event) => form.value.file = $event),
  160. O: common_vendor.p({
  161. fileMediatype: "image",
  162. ["list-styles"]: _ctx.imageStyles,
  163. limit: "6",
  164. title: "最多选择6张图片",
  165. modelValue: form.value.file
  166. }),
  167. P: common_vendor.o(
  168. //@ts-ignore
  169. (...args) => _ctx.formSubmit && _ctx.formSubmit(...args)
  170. )
  171. });
  172. };
  173. }
  174. });
  175. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-6bad03e0"], ["__file", "D:/project/足球比赛/match_applet/pagesHome/create/components/match.vue"]]);
  176. wx.createComponent(Component);