123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- "use strict";
- const common_vendor = require("../../../common/vendor.js");
- if (!Array) {
- const _easycom_uni_datetime_picker2 = common_vendor.resolveComponent("uni-datetime-picker");
- const _easycom_uni_file_picker2 = common_vendor.resolveComponent("uni-file-picker");
- (_easycom_uni_datetime_picker2 + _easycom_uni_file_picker2)();
- }
- const _easycom_uni_datetime_picker = () => "../../../uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.js";
- const _easycom_uni_file_picker = () => "../../../uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.js";
- if (!Math) {
- (_easycom_uni_datetime_picker + _easycom_uni_file_picker)();
- }
- const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
- __name: "activity",
- props: {
- type: { type: String, default: () => "0" },
- typeList: { type: Array, default: () => [] },
- activityList: { type: Array, default: () => [] },
- openList: { type: Array, default: () => [] },
- durationList: { type: Array, default: () => [] }
- },
- setup(__props) {
- var _a, _b;
- const props = __props;
- (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
- const $apifile = (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$apifile;
- const form = common_vendor.ref({ file: [] });
- common_vendor.ref({
- width: 64,
- height: 64,
- border: {
- color: "#ff5a5f",
- width: 2,
- style: "dashed",
- radius: "2px"
- }
- });
- const { type, typeList, activityList, durationList, openList } = common_vendor.toRefs(props);
- const typeChange = (e) => {
- let data;
- if (type.value == 0) {
- data = typeList.value[e.detail.value];
- if (data)
- form.value.type = data.dictLabel;
- } else {
- data = activityList.value[e.detail.value];
- if (data)
- form.value.type = data.dictLabel;
- }
- };
- const durationChange = (e) => {
- const data = durationList.value[e.detail.value];
- if (data)
- form.value.duration = data.dictLabel;
- };
- const dateChange = (e) => {
- form.value.date = e.detail.value;
- };
- const timeChange = (e) => {
- form.value.time = e.detail.value;
- };
- const openChange = (e) => {
- form.value.is_open = e.detail.value;
- };
- const toUpload = async (e) => {
- const arr = await $apifile(
- `/common/upload`,
- "file",
- e.tempFilePaths[0],
- "file"
- );
- if (arr.code == 200) {
- form.value.file.push({
- newFileName: arr.newFileName,
- originalFilename: arr.originalFilename,
- url: arr.url
- });
- console.log(form.value.file);
- } else {
- common_vendor.index.showToast({
- title: arr.msg,
- icon: "none"
- });
- }
- };
- const toDelete = async (e) => {
- form.value.file = form.value.file.filter((i) => i.originalFilename != e.tempFile.name);
- console.log(form.value.file);
- };
- return (_ctx, _cache) => {
- return common_vendor.e({
- a: common_vendor.unref(type) == "0"
- }, common_vendor.unref(type) == "0" ? {
- b: common_vendor.t(form.value.type || "普通训练"),
- c: common_vendor.o(typeChange),
- d: _ctx.index,
- e: common_vendor.unref(typeList)
- } : {
- f: common_vendor.t(form.value.type || "请选择"),
- g: common_vendor.o(typeChange),
- h: _ctx.index,
- i: common_vendor.unref(activityList)
- }, {
- j: common_vendor.t(form.value.date || "请选择"),
- k: common_vendor.o(dateChange),
- l: _ctx.index,
- m: common_vendor.t(form.value.time || "请选择"),
- n: common_vendor.o(timeChange),
- o: _ctx.index,
- p: common_vendor.t(form.value.duration || "请选择时长"),
- q: common_vendor.o(durationChange),
- r: _ctx.index,
- s: common_vendor.unref(durationList),
- t: form.value.address,
- v: form.value.money,
- w: form.value.max_person,
- x: common_vendor.t(form.value.is_open || "请选择"),
- y: common_vendor.o(openChange),
- z: _ctx.index,
- A: common_vendor.unref(openList),
- B: form.value.date && form.value.time
- }, form.value.date && form.value.time ? {
- C: common_vendor.o(($event) => form.value.end_time = $event),
- D: common_vendor.p({
- start: form.value.date,
- border: false,
- modelValue: form.value.end_time
- })
- } : {}, {
- E: form.value.title,
- F: form.value.brief,
- G: common_vendor.o(toUpload),
- H: common_vendor.o(toDelete),
- I: common_vendor.o(($event) => form.value.file = $event),
- J: common_vendor.p({
- fileMediatype: "image",
- ["list-styles"]: _ctx.imageStyles,
- limit: "6",
- title: "最多选择6张图片",
- modelValue: form.value.file
- }),
- K: common_vendor.o(
- //@ts-ignore
- (...args) => _ctx.formSubmit && _ctx.formSubmit(...args)
- )
- });
- };
- }
- });
- const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-b4c340fa"], ["__file", "D:/project/足球比赛/match_applet/pagesHome/create/components/activity.vue"]]);
- wx.createComponent(Component);
|