Browse Source

修改友谊赛

zs 1 year ago
parent
commit
be2bfa0347

+ 3 - 1
pagesHome/activity/info.vue

@@ -64,7 +64,9 @@
 	};
 	// 查询
 	const search = async () => {
-		if (id.value) { }
+		if (id.value) {
+			console.log(id.value);
+		}
 	};
 	// 点击分页器
 	const onClickItem = (e) => {

+ 13 - 4
pagesHome/create/components/activity.vue

@@ -4,7 +4,7 @@
 			<view class="value other">
 				<view class="title">类型</view>
 				<view class="label">
-					<picker v-if="type=='0'" name="type" @change="typeChange" :value="index" :range="typeList"
+					<picker v-if="type=='1'" name="type" @change="typeChange" :value="index" :range="typeList"
 						range-key="dictLabel">
 						<view class="picker">{{form.type||'普通训练'}}</view>
 					</picker>
@@ -94,7 +94,7 @@
 </template>
 
 <script setup lang="ts">
-	import { ref, toRefs, getCurrentInstance } from 'vue';
+	import { ref, toRefs, getCurrentInstance, defineExpose } from 'vue';
 	// 请求接口
 	const $api = getCurrentInstance()?.appContext.config.globalProperties.$api;
 	const $apifile = getCurrentInstance()?.appContext.config.globalProperties.$apifile;
@@ -111,17 +111,18 @@
 		}
 	});
 	const props = defineProps({
+		id: { type: String, default: () => '' },
 		type: { type: String, default: () => '0' },
 		typeList: { type: Array, default: () => [] },
 		activityList: { type: Array, default: () => [] },
 		openList: { type: Array, default: () => [] },
 		durationList: { type: Array, default: () => [] },
 	});
-	const { type, typeList, activityList, durationList, openList } = toRefs(props);
+	const { id, type, typeList, activityList, durationList, openList } = toRefs(props);
 	// 类型选择
 	const typeChange = (e) => {
 		let data
-		if (type.value == 0) {
+		if (type.value == '1') {
 			data = typeList.value[e.detail.value]
 			if (data) form.value.type = data.dictLabel
 		} else {
@@ -169,6 +170,14 @@
 		form.value.file = form.value.file.filter(i => i.originalFilename != e.tempFile.name)
 		console.log(form.value.file);
 	};
+	// 创建
+	const formSubmit = () => {
+		console.log(form.value)
+	}
+	// 第二部:暴露方法
+	defineExpose({
+		formSubmit
+	})
 </script>
 <style lang="scss" scoped>
 	.form {

+ 153 - 104
pagesHome/create/components/match.vue

@@ -1,127 +1,129 @@
 <template>
 	<view class="form">
-		<form @submit="formSubmit">
-			<view class="value other">
-				<view class="title">类型</view>
-				<view class="label">
-					<picker name="type" @change="typeChange" :value="index" :range="typeList" range-key="dictLabel">
-						<view class="picker">{{form.type||'请选择类型'}}</view>
-					</picker>
-				</view>
+		<view class="value other">
+			<view class="title">类型</view>
+			<view class="label">
+				<picker name="type" @change="typeChange" :value="index" :range="typeList" range-key="dictLabel">
+					<view class="picker">{{type_name||'请选择类型'}}</view>
+				</picker>
 			</view>
-			<view class="value other margin">
-				<view class="title">人数</view>
-				<view class="label">
-					<picker name="number" @change="numberChange" :value="index" :range="numberList"
-						range-key="dictLabel">
-						<view class="picker">{{form.number||'请选择人数'}}</view>
-					</picker>
-				</view>
+		</view>
+		<view class="value other margin">
+			<view class="title">人数</view>
+			<view class="label">
+				<picker name="number" @change="numberChange" :value="index" :range="numberList" range-key="dictLabel">
+					<view class="picker">{{number_name||'请选择人数'}}</view>
+				</picker>
 			</view>
-			<view class="value other">
-				<view class="title">对手</view>
-				<view class="label" @tap="toOpponent">
-					<text v-if="form.opponent">{{opponent_name}}</text>
-					<text v-else>请选择</text>
-				</view>
+		</view>
+		<view class="value other">
+			<view class="title">对手</view>
+			<view class="label" @tap="toOpponent">
+				<text v-if="form.opponent">{{opponent_name}}</text>
+				<text v-else>请选择</text>
 			</view>
-			<view class="value other">
-				<view class="title">日期</view>
-				<view class="label">
-					<picker name="date" mode="date" @change="dateChange" :value="index">
-						<view class="picker">{{form.date||'请选择日期'}}</view>
-					</picker>
-				</view>
+		</view>
+		<view class="value other">
+			<view class="title">日期</view>
+			<view class="label">
+				<picker name="date" mode="date" @change="dateChange" :value="index">
+					<view class="picker">{{form.date||'请选择日期'}}</view>
+				</picker>
 			</view>
-			<view class="value other">
-				<view class="title">时间</view>
-				<view class="label">
-					<picker name="time" mode="time" @change="timeChange" :value="index">
-						<view class="picker">{{form.time||'请选择时间'}}</view>
-					</picker>
-				</view>
+		</view>
+		<view class="value other">
+			<view class="title">时间</view>
+			<view class="label">
+				<picker name="time" mode="time" @change="timeChange" :value="index">
+					<view class="picker">{{form.time||'请选择时间'}}</view>
+				</picker>
 			</view>
-			<view class="value other">
-				<view class="title">时长</view>
-				<view class="label">
-					<picker name="duration" @change="durationChange" :value="index" :range="durationList"
-						range-key="dictLabel">
-						<view class="picker">{{form.duration||'请选择时长'}}</view>
-					</picker>
-				</view>
+		</view>
+		<view class="value other">
+			<view class="title">时长</view>
+			<view class="label">
+				<picker name="duration" @change="durationChange" :value="index" :range="durationList"
+					range-key="dictLabel">
+					<view class="picker">{{duration_name||'请选择时长'}}</view>
+				</picker>
 			</view>
-			<view class="value other">
-				<view class="title">地点</view>
-				<view class="label" @tap="toLocaltion">
-					<text v-if="form.address">{{form.address}}</text>
-					<text v-else>请选择</text>
-				</view>
+		</view>
+		<view class="value other margin">
+			<view class="title">地点</view>
+			<view class="label" @tap="toLocaltion">
+				<text v-if="form.address">{{form.address}}</text>
+				<text v-else>请选择</text>
 			</view>
-			<view class="value other margin">
-				<view class="title">队服颜色</view>
-				<view class="label">
-					<input name="color" class="input" :value="form.color" placeholder="请输入队服颜色" />
-				</view>
+		</view>
+		<view class="value other">
+			<view class="title">费用</view>
+			<view class="label">
+				<input name="money" class="input" :value="form.money" placeholder="请输入费用" />
 			</view>
-			<view class="value other">
-				<view class="title">费用</view>
-				<view class="label">
-					<input name="money" class="input" :value="form.money" placeholder="请输入费用" />
-				</view>
+		</view>
+		<view class="value other">
+			<view class="title">人数上限</view>
+			<view class="label">
+				<input name="name" class="input" :value="form.max_person" placeholder="请输入人数上限" />
 			</view>
-			<view class="value other">
-				<view class="title">人数上限</view>
-				<view class="label">
-					<input name="name" class="input" :value="form.max_person" placeholder="请输入人数上限" />
-				</view>
+		</view>
+		<view class="value other">
+			<view class="title">公开报名</view>
+			<view class="label">
+				<picker name="is_open" @change="openChange" :value="index" :range="openList" range-key="dictLabel">
+					<view class="picker">{{open_name||'请选择'}}</view>
+				</picker>
 			</view>
-			<view class="value other">
-				<view class="title">公开报名</view>
-				<view class="label">
-					<picker name="is_open" @change="openChange" :value="index" :range="openList" range-key="dictLabel">
-						<view class="picker">{{form.is_open||'请选择'}}</view>
-					</picker>
-				</view>
+		</view>
+		<view class="value other" v-if="form.date&&form.time">
+			<view class="title">报名截止时间</view>
+			<view class="label">
+				<uni-datetime-picker :start="form.date" :border="false" v-model="form.end_time" />
 			</view>
-			<view class="value other" v-if="form.date&&form.time">
-				<view class="title">报名截止时间</view>
-				<view class="label">
-					<uni-datetime-picker :start="form.date" :border="false" v-model="form.end_time" />
-				</view>
+		</view>
+		<view class="value other">
+			<view class="title">活动标题</view>
+			<view class="label">
+				<input name="title" class="input" :value="form.title" placeholder="请输入活动标题" />
 			</view>
-			<view class="value other">
-				<view class="title">活动标题</view>
-				<view class="label">
-					<input name="title" class="input" :value="form.title" placeholder="请输入活动标题" />
-				</view>
+		</view>
+		<view class="remark margin">
+			<view class="label">
+				<textarea name="brief" :value="form.brief" placeholder="请输入简介" />
 			</view>
-			<view class="remark margin">
-				<view class="label">
-					<textarea name="brief" :value="form.brief" placeholder="请输入简介" />
-				</view>
+		</view>
+		<view class="remark">
+			<view class="title">上传图片</view>
+			<view class="label">
+				<uni-file-picker v-model="form.file" fileMediatype="image" :list-styles="imageStyles" limit="6"
+					title="最多选择6张图片" @select="toUpload" @delete="toDelete"></uni-file-picker>
 			</view>
-			<view class="remark">
-				<view class="title">上传图片</view>
-				<view class="label">
-					<uni-file-picker v-model="form.file" fileMediatype="image" :list-styles="imageStyles" limit="6"
-						title="最多选择6张图片" @select="toUpload" @delete="toDelete"></uni-file-picker>
-				</view>
-			</view>
-		</form>
+		</view>
+		<view class="btn" style="display: none;">
+			<button form-type="submit">保存</button>
+		</view>
 	</view>
 </template>
 
 <script setup lang="ts">
-	import { ref, toRefs, getCurrentInstance } from 'vue';
+	import { ref, toRefs, getCurrentInstance, defineExpose } from 'vue';
 	//该依赖已内置不需要单独安装
 	import { onShow } from "@dcloudio/uni-app";
 	// 请求接口
 	const $api = getCurrentInstance()?.appContext.config.globalProperties.$api;
 	const $apifile = getCurrentInstance()?.appContext.config.globalProperties.$apifile;
 	// 信息
-	const form = ref({ file: [] });
+	const form = ref({ file: [], number: '5', type: '0', duration: '3', is_open: 'Y' });
 	// 对手名称
 	const opponent_name = ref('');
+	// 类型
+	const type_name = ref('足球');
+	// 人数
+	const number_name = ref('五人制');
+	// 是否公开
+	const open_name = ref('');
+	// 时长
+	const duration_name = ref('2.0小时');
 	const listStyles = ref({
 		width: 64,
 		height: 64,
@@ -133,12 +135,13 @@
 		}
 	});
 	const props = defineProps({
+		id: { type: String, default: () => '' },
 		typeList: { type: Array, default: () => [] },
 		numberList: { type: Array, default: () => [] },
 		openList: { type: Array, default: () => [] },
 		durationList: { type: Array, default: () => [] },
 	});
-	const { typeList, durationList, numberList, openList } = toRefs(props);
+	const { id, typeList, durationList, numberList, openList } = toRefs(props);
 	onShow(() => {
 		uni.$on('opponentInfo', function (item) {
 			form.value.opponent = item.id
@@ -148,12 +151,18 @@
 	// 类型选择
 	const typeChange = (e) => {
 		const data = typeList.value[e.detail.value]
-		if (data) form.value.type = data.dictLabel
+		if (data) {
+			type_name.value = data.dictLabel
+			form.value.type = data.dictValue
+		}
 	};
 	// 人数选择
 	const numberChange = (e) => {
 		const data = numberList.value[e.detail.value]
-		if (data) form.value.number = data.dictLabel
+		if (data) {
+			number_name.value = data.dictLabel
+			form.value.number = data.dictValue
+		}
 	};
 	// 日期选择器
 	const dateChange = (e) => {
@@ -166,11 +175,18 @@
 	// 时长选择选择
 	const durationChange = (e) => {
 		const data = durationList.value[e.detail.value]
-		if (data) form.value.duration = data.dictLabel
+		if (data) {
+			duration_name.value = data.dictLabel
+			form.value.duration = data.dictValue
+		}
 	};
 	// 是否公开选择器
 	const openChange = (e) => {
-		form.value.is_open = e.detail.value
+		const data = numberList.value[e.detail.value]
+		if (data) {
+			open_name.value = data.dictLabel
+			form.value.is_open = data.dictValue
+		}
 	};
 	// 定位
 	const toLocaltion = (e) => {
@@ -190,8 +206,7 @@
 			'file');
 		if (arr.code == 200) {
 			form.value.file.push({
-				newFileName: arr.newFileName,
-				originalFilename: arr.originalFilename,
+				name: arr.originalFilename,
 				url: arr.url
 			})
 			console.log(form.value.file);
@@ -204,7 +219,7 @@
 	};
 	// 删除图片
 	const toDelete = async (e) => {
-		form.value.file = form.value.file.filter(i => i.originalFilename != e.tempFile.name)
+		form.value.file = form.value.file.filter(i => i.name != e.tempFile.name)
 		console.log(form.value.file);
 	};
 	// 对手选择
@@ -213,6 +228,40 @@
 			url: `/pagesHome/create/person`,
 		})
 	};
+	// 创建
+	const formSubmit = async () => {
+		if (!form.value.opponent) {
+			uni.showToast({ title: '请选择比赛对手', icon: 'none' });
+			return
+		} else if (!form.value.date) {
+			uni.showToast({ title: '请选择活动日期', icon: 'none' });
+			return
+		} else if (!form.value.time) {
+			uni.showToast({ title: '请选择活动时间', icon: 'none' });
+			return
+		} else if (!form.value.address) {
+			uni.showToast({ title: '请选择活动场地', icon: 'none' });
+			return
+		} else {
+			if (form.value.file && form.value.file.length == 0) delete form.value.file
+			form.value.teamId = id.value
+			const arr = await $api(`friendship`, 'POST', form.value);
+			if (arr.code === 200) {
+				uni.navigateTo({
+					url: `/pagesHome/activity/info?id=${arr.data.id}`,
+				})
+			} else {
+				uni.showToast({
+					title: arr.msg,
+					icon: 'error'
+				});
+			}
+		}
+	}
+	// 第二部:暴露方法
+	defineExpose({
+		formSubmit
+	})
 </script>
 <style lang="scss" scoped>
 	.form {

+ 17 - 9
pagesHome/create/index.vue

@@ -8,13 +8,16 @@
 						activeColor="#dd524d"></uni-segmented-control>
 					<view class="one_2">
 						<view v-show="current === 0">
-							<match :typeList="typeList" :numberList="numberList" :durationList='durationList' :openList="openList"></match>
+							<match ref="childRef0" :id="id" :typeList="typeList" :numberList="numberList"
+								:durationList='durationList' :openList="openList"></match>
 						</view>
 						<view v-show="current === 1">
-							<activity :typeList="matchList" :durationList='durationList' :openList="openList" type="0"></activity>
+							<activity ref="childRef1" :id="id" :typeList="matchList" :durationList='durationList'
+								:openList="openList" :type="current"></activity>
 						</view>
 						<view v-show="current === 2">
-							<activity :activityList="activityList" :durationList='durationList' :openList="openList" type="1"></activity>
+							<activity ref="childRef2" :id="id" :activityList="activityList" :durationList='durationList'
+								:openList="openList" :type="current"></activity>
 						</view>
 					</view>
 				</view>
@@ -34,7 +37,7 @@
 				</view>
 			</view>
 			<view class="right">
-				<button type="warn" size="mini" form-type="submit">完成</button>
+				<button type="warn" size="mini" @tap="onSubmit">完成</button>
 			</view>
 		</view>
 	</view>
@@ -61,6 +64,9 @@
 	const activityList = ref([]);
 	const durationList = ref([]);
 	const openList = ref([]);
+	const childRef0 = ref<any>();
+	const childRef1 = ref<any>();
+	const childRef2 = ref<any>()
 	onLoad(async (options) => {
 		// 球队id
 		id.value = options && options.id
@@ -88,10 +94,10 @@
 		res = await $api(`dict/data/list`, 'GET', { dictType: 'sys_activity_type', status: '0' });
 		if (res.code === 200 && res.total > 0) activityList.value = res.rows
 		// 时长
-		res = await $api(`dict/data/list`, 'GET', { dictType: 'sys_match_duration' , status: '0'});
+		res = await $api(`dict/data/list`, 'GET', { dictType: 'sys_match_duration', status: '0' });
 		if (res.code === 200 && res.total > 0) durationList.value = res.rows
 		// 是否公开
-		res = await $api(`dict/data/list`, 'GET', { dictType: 'sys_yes_no' , status: '0'});
+		res = await $api(`dict/data/list`, 'GET', { dictType: 'sys_yes_no', status: '0' });
 		if (res.code === 200 && res.total > 0) openList.value = res.rows
 	};
 	// 查询
@@ -110,9 +116,11 @@
 	const toCopy = async () => {
 		console.log('复用');
 	};
-	// 创建
-	const formSubmit = (e) => {
-		console.log(e.deatil.value);
+	// 保存
+	const onSubmit = async () => {
+		if (current.value == 0) childRef0.value.formSubmit();
+		else if (current.value == 1) childRef1.value.formSubmit();
+		else childRef2.value.formSubmit();
 	};
 </script>
 <style lang="scss" scoped>

+ 30 - 5
pagesHome/team/info.vue

@@ -132,12 +132,9 @@
 	// 列表
 	const list = ref<PropsItem[]>([{ id: 1, name: '测试球队' }, { id: 1, name: '肝帝集团队' }]);
 	// 分页
-	const skip = ref(0);
-	const limit = ref(6);
-	const page = ref(0);
 	const total = ref(0);
 	// 详情
-	const info = ref({ id: 1, name: '测试球队', score: '39' });
+	const info = ref({});
 	// 详情信息id
 	const id = ref('');
 	// 基本信息
@@ -146,6 +143,7 @@
 		id.value = options && options.id
 		await searchConfig();
 		await search();
+		await searchOther();
 	})
 	// config信息
 	const searchConfig = async () => {
@@ -153,7 +151,34 @@
 	};
 	// 查询
 	const search = async () => {
-		if (id.value) { }
+		if (id.value) {
+			const res = await $api(`team/${id.value}`, 'GET', {});
+			if (res.code === 200) {
+				if (res.data) info.value = res.data
+			} else {
+				uni.showToast({
+					title: res.msg || '',
+					icon: 'error',
+				});
+			}
+		}
+	};
+	// 查询
+	const searchOther = async () => {
+		if (id.value) {
+			const res = await $api('friendship/list', 'GET', {
+				teamId: id.value
+			});
+			if (res.code === 200) {
+				list.value = res.rows
+				total.value = res.total
+			} else {
+				uni.showToast({
+					title: res.msg || '',
+					icon: 'error',
+				});
+			}
+		}
 	};
 	// 标签列表
 	const menuList = ref([

+ 3 - 2
unpackage/dist/dev/mp-weixin/pagesHome/activity/info.js

@@ -30,8 +30,9 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
       config.value = common_vendor.index.getStorageSync("config");
     };
     const search = async () => {
-      if (id.value)
-        ;
+      if (id.value) {
+        console.log(id.value);
+      }
     };
     const onClickItem = (e) => {
       if (current.value !== e.currentIndex)

+ 13 - 9
unpackage/dist/dev/mp-weixin/pagesHome/create/components/activity.js

@@ -13,13 +13,14 @@ if (!Math) {
 const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
   __name: "activity",
   props: {
+    id: { type: String, default: () => "" },
     type: { type: String, default: () => "0" },
     typeList: { type: Array, default: () => [] },
     activityList: { type: Array, default: () => [] },
     openList: { type: Array, default: () => [] },
     durationList: { type: Array, default: () => [] }
   },
-  setup(__props) {
+  setup(__props, { expose }) {
     var _a, _b;
     const props = __props;
     (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
@@ -35,10 +36,10 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
         radius: "2px"
       }
     });
-    const { type, typeList, activityList, durationList, openList } = common_vendor.toRefs(props);
+    const { id, type, typeList, activityList, durationList, openList } = common_vendor.toRefs(props);
     const typeChange = (e) => {
       let data;
-      if (type.value == 0) {
+      if (type.value == "1") {
         data = typeList.value[e.detail.value];
         if (data)
           form.value.type = data.dictLabel;
@@ -87,10 +88,16 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
       form.value.file = form.value.file.filter((i) => i.originalFilename != e.tempFile.name);
       console.log(form.value.file);
     };
+    const formSubmit = () => {
+      console.log(form.value);
+    };
+    expose({
+      formSubmit
+    });
     return (_ctx, _cache) => {
       return common_vendor.e({
-        a: common_vendor.unref(type) == "0"
-      }, common_vendor.unref(type) == "0" ? {
+        a: common_vendor.unref(type) == "1"
+      }, common_vendor.unref(type) == "1" ? {
         b: common_vendor.t(form.value.type || "普通训练"),
         c: common_vendor.o(typeChange),
         d: _ctx.index,
@@ -139,10 +146,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
           title: "最多选择6张图片",
           modelValue: form.value.file
         }),
-        K: common_vendor.o(
-          //@ts-ignore
-          (...args) => _ctx.formSubmit && _ctx.formSubmit(...args)
-        )
+        K: common_vendor.o(formSubmit)
       });
     };
   }

+ 80 - 38
unpackage/dist/dev/mp-weixin/pagesHome/create/components/match.js

@@ -13,18 +13,23 @@ if (!Math) {
 const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
   __name: "match",
   props: {
+    id: { type: String, default: () => "" },
     typeList: { type: Array, default: () => [] },
     numberList: { type: Array, default: () => [] },
     openList: { type: Array, default: () => [] },
     durationList: { type: Array, default: () => [] }
   },
-  setup(__props) {
+  setup(__props, { expose }) {
     var _a, _b;
     const props = __props;
-    (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
+    const $api = (_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: [] });
+    const form = common_vendor.ref({ file: [], number: "5", type: "0", duration: "3", is_open: "Y" });
     const opponent_name = common_vendor.ref("");
+    const type_name = common_vendor.ref("足球");
+    const number_name = common_vendor.ref("五人制");
+    const open_name = common_vendor.ref("");
+    const duration_name = common_vendor.ref("2.0小时");
     common_vendor.ref({
       width: 64,
       height: 64,
@@ -35,7 +40,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
         radius: "2px"
       }
     });
-    const { typeList, durationList, numberList, openList } = common_vendor.toRefs(props);
+    const { id, typeList, durationList, numberList, openList } = common_vendor.toRefs(props);
     common_vendor.onShow(() => {
       common_vendor.index.$on("opponentInfo", function(item) {
         form.value.opponent = item.id;
@@ -44,13 +49,17 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
     });
     const typeChange = (e) => {
       const data = typeList.value[e.detail.value];
-      if (data)
-        form.value.type = data.dictLabel;
+      if (data) {
+        type_name.value = data.dictLabel;
+        form.value.type = data.dictValue;
+      }
     };
     const numberChange = (e) => {
       const data = numberList.value[e.detail.value];
-      if (data)
-        form.value.number = data.dictLabel;
+      if (data) {
+        number_name.value = data.dictLabel;
+        form.value.number = data.dictValue;
+      }
     };
     const dateChange = (e) => {
       form.value.date = e.detail.value;
@@ -60,11 +69,17 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
     };
     const durationChange = (e) => {
       const data = durationList.value[e.detail.value];
-      if (data)
-        form.value.duration = data.dictLabel;
+      if (data) {
+        duration_name.value = data.dictLabel;
+        form.value.duration = data.dictValue;
+      }
     };
     const openChange = (e) => {
-      form.value.is_open = e.detail.value;
+      const data = numberList.value[e.detail.value];
+      if (data) {
+        open_name.value = data.dictLabel;
+        form.value.is_open = data.dictValue;
+      }
     };
     const toLocaltion = (e) => {
       common_vendor.index.chooseLocation({
@@ -85,8 +100,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
       );
       if (arr.code == 200) {
         form.value.file.push({
-          newFileName: arr.newFileName,
-          originalFilename: arr.originalFilename,
+          name: arr.originalFilename,
           url: arr.url
         });
         console.log(form.value.file);
@@ -98,7 +112,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
       }
     };
     const toDelete = async (e) => {
-      form.value.file = form.value.file.filter((i) => i.originalFilename != e.tempFile.name);
+      form.value.file = form.value.file.filter((i) => i.name != e.tempFile.name);
       console.log(form.value.file);
     };
     const toOpponent = () => {
@@ -106,13 +120,46 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
         url: `/pagesHome/create/person`
       });
     };
+    const formSubmit = async () => {
+      if (!form.value.opponent) {
+        common_vendor.index.showToast({ title: "请选择比赛对手", icon: "none" });
+        return;
+      } else if (!form.value.date) {
+        common_vendor.index.showToast({ title: "请选择活动日期", icon: "none" });
+        return;
+      } else if (!form.value.time) {
+        common_vendor.index.showToast({ title: "请选择活动时间", icon: "none" });
+        return;
+      } else if (!form.value.address) {
+        common_vendor.index.showToast({ title: "请选择活动场地", icon: "none" });
+        return;
+      } else {
+        if (form.value.file && form.value.file.length == 0)
+          delete form.value.file;
+        form.value.teamId = id.value;
+        const arr = await $api(`friendship`, "POST", form.value);
+        if (arr.code === 200) {
+          common_vendor.index.navigateTo({
+            url: `/pagesHome/activity/info?id=${arr.data.id}`
+          });
+        } else {
+          common_vendor.index.showToast({
+            title: arr.msg,
+            icon: "error"
+          });
+        }
+      }
+    };
+    expose({
+      formSubmit
+    });
     return (_ctx, _cache) => {
       return common_vendor.e({
-        a: common_vendor.t(form.value.type || "请选择类型"),
+        a: common_vendor.t(type_name.value || "请选择类型"),
         b: common_vendor.o(typeChange),
         c: _ctx.index,
         d: common_vendor.unref(typeList),
-        e: common_vendor.t(form.value.number || "请选择人数"),
+        e: common_vendor.t(number_name.value || "请选择人数"),
         f: common_vendor.o(numberChange),
         g: _ctx.index,
         h: common_vendor.unref(numberList),
@@ -127,7 +174,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
         o: common_vendor.t(form.value.time || "请选择时间"),
         p: common_vendor.o(timeChange),
         q: _ctx.index,
-        r: common_vendor.t(form.value.duration || "请选择时长"),
+        r: common_vendor.t(duration_name.value || "请选择时长"),
         s: common_vendor.o(durationChange),
         t: _ctx.index,
         v: common_vendor.unref(durationList),
@@ -136,38 +183,33 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
         x: common_vendor.t(form.value.address)
       } : {}, {
         y: common_vendor.o(toLocaltion),
-        z: form.value.color,
-        A: form.value.money,
-        B: form.value.max_person,
-        C: common_vendor.t(form.value.is_open || "请选择"),
-        D: common_vendor.o(openChange),
-        E: _ctx.index,
-        F: common_vendor.unref(openList),
-        G: form.value.date && form.value.time
+        z: form.value.money,
+        A: form.value.max_person,
+        B: common_vendor.t(open_name.value || "请选择"),
+        C: common_vendor.o(openChange),
+        D: _ctx.index,
+        E: common_vendor.unref(openList),
+        F: form.value.date && form.value.time
       }, form.value.date && form.value.time ? {
-        H: common_vendor.o(($event) => form.value.end_time = $event),
-        I: common_vendor.p({
+        G: common_vendor.o(($event) => form.value.end_time = $event),
+        H: common_vendor.p({
           start: form.value.date,
           border: false,
           modelValue: form.value.end_time
         })
       } : {}, {
-        J: form.value.title,
-        K: form.value.brief,
-        L: common_vendor.o(toUpload),
-        M: common_vendor.o(toDelete),
-        N: common_vendor.o(($event) => form.value.file = $event),
-        O: common_vendor.p({
+        I: form.value.title,
+        J: form.value.brief,
+        K: common_vendor.o(toUpload),
+        L: common_vendor.o(toDelete),
+        M: common_vendor.o(($event) => form.value.file = $event),
+        N: common_vendor.p({
           fileMediatype: "image",
           ["list-styles"]: _ctx.imageStyles,
           limit: "6",
           title: "最多选择6张图片",
           modelValue: form.value.file
-        }),
-        P: common_vendor.o(
-          //@ts-ignore
-          (...args) => _ctx.formSubmit && _ctx.formSubmit(...args)
-        )
+        })
       });
     };
   }

File diff suppressed because it is too large
+ 1 - 1
unpackage/dist/dev/mp-weixin/pagesHome/create/components/match.wxml


+ 40 - 13
unpackage/dist/dev/mp-weixin/pagesHome/create/index.js

@@ -27,6 +27,9 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
     const activityList = common_vendor.ref([]);
     const durationList = common_vendor.ref([]);
     const openList = common_vendor.ref([]);
+    const childRef0 = common_vendor.ref();
+    const childRef1 = common_vendor.ref();
+    const childRef2 = common_vendor.ref();
     common_vendor.onLoad(async (options) => {
       id.value = options && options.id;
       await searchConfig();
@@ -71,6 +74,14 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
     const toCopy = async () => {
       console.log("复用");
     };
+    const onSubmit = async () => {
+      if (current.value == 0)
+        childRef0.value.formSubmit();
+      else if (current.value == 1)
+        childRef1.value.formSubmit();
+      else
+        childRef2.value.formSubmit();
+    };
     return (_ctx, _cache) => {
       return {
         a: common_vendor.o(onClickItem),
@@ -80,41 +91,57 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
           styleType: "text",
           activeColor: "#dd524d"
         }),
-        c: common_vendor.p({
+        c: common_vendor.sr(childRef0, "fe92273c-1", {
+          "k": "childRef0"
+        }),
+        d: id.value,
+        e: common_vendor.p({
+          id: id.value,
           typeList: typeList.value,
           numberList: numberList.value,
           durationList: durationList.value,
           openList: openList.value
         }),
-        d: current.value === 0,
-        e: common_vendor.p({
+        f: current.value === 0,
+        g: common_vendor.sr(childRef1, "fe92273c-2", {
+          "k": "childRef1"
+        }),
+        h: id.value,
+        i: common_vendor.p({
+          id: id.value,
           typeList: matchList.value,
           durationList: durationList.value,
           openList: openList.value,
-          type: "0"
+          type: current.value
+        }),
+        j: current.value === 1,
+        k: common_vendor.sr(childRef2, "fe92273c-3", {
+          "k": "childRef2"
         }),
-        f: current.value === 1,
-        g: common_vendor.p({
+        l: id.value,
+        m: common_vendor.p({
+          id: id.value,
           activityList: activityList.value,
           durationList: durationList.value,
           openList: openList.value,
-          type: "1"
+          type: current.value
         }),
-        h: current.value === 2,
-        i: common_vendor.o(toAdd),
-        j: common_vendor.p({
+        n: current.value === 2,
+        o: common_vendor.o(toAdd),
+        p: common_vendor.p({
           ["custom-prefix"]: "iconfont",
           type: "icon-caogao04",
           size: "20",
           color: "#696969"
         }),
-        k: common_vendor.o(toCopy),
-        l: common_vendor.p({
+        q: common_vendor.o(toCopy),
+        r: common_vendor.p({
           ["custom-prefix"]: "iconfont",
           type: "icon-icon_cz",
           size: "20",
           color: "#696969"
-        })
+        }),
+        s: common_vendor.o(onSubmit)
       };
     };
   }

File diff suppressed because it is too large
+ 1 - 1
unpackage/dist/dev/mp-weixin/pagesHome/create/index.wxml


+ 32 - 8
unpackage/dist/dev/mp-weixin/pagesHome/team/info.js

@@ -13,26 +13,50 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
   __name: "info",
   setup(__props) {
     var _a;
-    (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
+    const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
     const list = common_vendor.ref([{ id: 1, name: "测试球队" }, { id: 1, name: "肝帝集团队" }]);
-    common_vendor.ref(0);
-    common_vendor.ref(6);
-    common_vendor.ref(0);
-    common_vendor.ref(0);
-    const info = common_vendor.ref({ id: 1, name: "测试球队", score: "39" });
+    const total = common_vendor.ref(0);
+    const info = common_vendor.ref({});
     const id = common_vendor.ref("");
     const config = common_vendor.ref({ logoUrl: "" });
     common_vendor.onLoad(async (options) => {
       id.value = options && options.id;
       await searchConfig();
       await search();
+      await searchOther();
     });
     const searchConfig = async () => {
       config.value = common_vendor.index.getStorageSync("config");
     };
     const search = async () => {
-      if (id.value)
-        ;
+      if (id.value) {
+        const res = await $api(`team/${id.value}`, "GET", {});
+        if (res.code === 200) {
+          if (res.data)
+            info.value = res.data;
+        } else {
+          common_vendor.index.showToast({
+            title: res.msg || "",
+            icon: "error"
+          });
+        }
+      }
+    };
+    const searchOther = async () => {
+      if (id.value) {
+        const res = await $api("friendship/list", "GET", {
+          teamId: id.value
+        });
+        if (res.code === 200) {
+          list.value = res.rows;
+          total.value = res.total;
+        } else {
+          common_vendor.index.showToast({
+            title: res.msg || "",
+            icon: "error"
+          });
+        }
+      }
     };
     const menuList = common_vendor.ref([
       { name: "队员", icon: "icon-a-14-chengyuanguanli", color: "#333333", route: "/pagesHome/team/person" },