浏览代码

修改比赛管理

zs 1 年之前
父节点
当前提交
5b2a989df8

+ 5 - 2
pagesHome/activity/info.vue

@@ -75,7 +75,7 @@
 												<text>人</text>
 												<text>人</text>
 											</view>
 											</view>
 										</view>
 										</view>
-										<view :class="[info.status=='3'?'count_1':'count_2']"  v-if="info.status=='3'">
+										<view :class="[info.status=='3'?'count_1':'count_2']" v-if="info.status=='3'">
 											<view class="left"><text>出勤</text></view>
 											<view class="left"><text>出勤</text></view>
 											<view class="right">
 											<view class="right">
 												<text style="color: red;">{{info?.matchInfo?.member||'0'}}</text>
 												<text style="color: red;">{{info?.matchInfo?.member||'0'}}</text>
@@ -229,7 +229,9 @@
 	};
 	};
 	// 重新编辑
 	// 重新编辑
 	const toAgain = async () => {
 	const toAgain = async () => {
-		console.log('重新编辑');
+		uni.navigateTo({
+			url: `/pagesHome/create/index?gameId=${info.value.id}`,
+		})
 	};
 	};
 	// 取消比赛
 	// 取消比赛
 	const toCancel = async () => {
 	const toCancel = async () => {
@@ -425,6 +427,7 @@
 								font-size: var(--font12Size);
 								font-size: var(--font12Size);
 								background-color: var(--footColor);
 								background-color: var(--footColor);
 							}
 							}
+
 							.count_2 {
 							.count_2 {
 								display: flex;
 								display: flex;
 								justify-content: space-between;
 								justify-content: space-between;

+ 27 - 3
pagesHome/create/components/match.vue

@@ -107,7 +107,7 @@
 
 
 <script setup lang="ts">
 <script setup lang="ts">
 	import moment from 'moment';
 	import moment from 'moment';
-	import { ref, toRefs, getCurrentInstance, defineExpose } from 'vue';
+	import { ref, toRefs, getCurrentInstance, defineExpose, watch } from 'vue';
 	//该依赖已内置不需要单独安装
 	//该依赖已内置不需要单独安装
 	import { onShow } from "@dcloudio/uni-app";
 	import { onShow } from "@dcloudio/uni-app";
 	// 请求接口
 	// 请求接口
@@ -141,18 +141,35 @@
 	});
 	});
 	const props = defineProps({
 	const props = defineProps({
 		id: { type: String, default: () => '' },
 		id: { type: String, default: () => '' },
+		gameId: { type: String, default: () => '' },
 		typeList: { type: Array, default: () => [] },
 		typeList: { type: Array, default: () => [] },
 		numberList: { type: Array, default: () => [] },
 		numberList: { type: Array, default: () => [] },
 		openList: { type: Array, default: () => [] },
 		openList: { type: Array, default: () => [] },
 		durationList: { type: Array, default: () => [] },
 		durationList: { type: Array, default: () => [] },
 	});
 	});
-	const { id, typeList, durationList, numberList, openList } = toRefs(props);
+	const { id, gameId, typeList, durationList, numberList, openList } = toRefs(props);
 	onShow(() => {
 	onShow(() => {
 		uni.$on('opponentInfo', function (item) {
 		uni.$on('opponentInfo', function (item) {
 			form.value.opponent = item.id
 			form.value.opponent = item.id
 			opponent_name.value = item.name
 			opponent_name.value = item.name
 		})
 		})
 	})
 	})
+	watch(() => gameId.value, (newVal, oldVal) => { search(); })
+
+	// 查询
+	const search = async () => {
+		if (gameId.value) {
+			const res = await $api(`game/${gameId.value}`, 'GET', {});
+			if (res.code === 200) {
+				if (res.data) form.value = res.data.matchInfo
+			} else {
+				uni.showToast({
+					title: res.msg || '',
+					icon: 'error',
+				});
+			}
+		}
+	};
 	// 类型选择
 	// 类型选择
 	const typeChange = (e) => {
 	const typeChange = (e) => {
 		const data = typeList.value[e.detail.value]
 		const data = typeList.value[e.detail.value]
@@ -252,8 +269,11 @@
 			form.value.maxPerson = maxPerson.value
 			form.value.maxPerson = maxPerson.value
 			form.value.title = title.value
 			form.value.title = title.value
 			form.value.brief = brief.value
 			form.value.brief = brief.value
-			const arr = await $api(`friendship`, 'POST', form.value);
+			let arr;
+			if (form.value.id) arr = await $api(`friendship`, 'PUT', form.value);
+			else arr = await $api(`friendship`, 'POST', form.value);
 			if (arr.code === 200) {
 			if (arr.code === 200) {
+				if (form.value.id && gameId.value) await $api(`game/${gameId.value}`, 'DELETE', {})
 				const data = {
 				const data = {
 					matchId: arr.id,
 					matchId: arr.id,
 					type: '0',
 					type: '0',
@@ -313,6 +333,10 @@
 			align-items: center;
 			align-items: center;
 			background-color: var(--mainColor);
 			background-color: var(--mainColor);
 
 
+			.title {
+				width: 26vw;
+			}
+
 			.label {
 			.label {
 				.input {
 				.input {
 					text-align: right;
 					text-align: right;

+ 5 - 7
pagesHome/create/index.vue

@@ -8,8 +8,8 @@
 						activeColor="#dd524d"></uni-segmented-control>
 						activeColor="#dd524d"></uni-segmented-control>
 					<view class="one_2">
 					<view class="one_2">
 						<view v-show="current === 0">
 						<view v-show="current === 0">
-							<match ref="childRef0" :id="id" :typeList="typeList" :numberList="numberList"
-								:durationList='durationList' :openList="openList"></match>
+							<match ref="childRef0" :id="id" :gameId="gameId" :typeList="typeList"
+								:numberList="numberList" :durationList='durationList' :openList="openList"></match>
 						</view>
 						</view>
 						<view v-show="current === 1">
 						<view v-show="current === 1">
 							<activity ref="childRef1" :id="id" :typeList="matchList" :durationList='durationList'
 							<activity ref="childRef1" :id="id" :typeList="matchList" :durationList='durationList'
@@ -55,6 +55,7 @@
 	const config = ref({});
 	const config = ref({});
 	// 详情信息id
 	// 详情信息id
 	const id = ref('');
 	const id = ref('');
+	const gameId = ref('');
 	const list = ref(['友谊赛', '训练', '活动']);
 	const list = ref(['友谊赛', '训练', '活动']);
 	const current = ref(0);
 	const current = ref(0);
 	// 字典表
 	// 字典表
@@ -70,9 +71,10 @@
 	onLoad(async (options) => {
 	onLoad(async (options) => {
 		// 球队id
 		// 球队id
 		id.value = options && options.id
 		id.value = options && options.id
+		// 友谊赛id
+		gameId.value = options && options.gameId
 		await searchConfig();
 		await searchConfig();
 		await searchOther();
 		await searchOther();
-		await search();
 	})
 	})
 	// config信息
 	// config信息
 	const searchConfig = async () => {
 	const searchConfig = async () => {
@@ -100,10 +102,6 @@
 		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
 		if (res.code === 200 && res.total > 0) openList.value = res.rows
 	};
 	};
-	// 查询
-	const search = async () => {
-		if (id.value) { }
-	};
 	// 点击分页器
 	// 点击分页器
 	const onClickItem = (e) => {
 	const onClickItem = (e) => {
 		if (current.value !== e.currentIndex) current.value = e.currentIndex
 		if (current.value !== e.currentIndex) current.value = e.currentIndex

+ 1 - 1
pagesHome/match/info.vue

@@ -1,7 +1,7 @@
 <template>
 <template>
 	<view class="content">
 	<view class="content">
 		<view class="one">
 		<view class="one">
-			草稿箱
+			赛事详情
 		</view>
 		</view>
 	</view>
 	</view>
 </template>
 </template>

+ 1 - 0
unpackage/dist/dev/mp-weixin/common/vendor.js

@@ -13761,4 +13761,5 @@ exports.sr = sr;
 exports.t = t$1;
 exports.t = t$1;
 exports.toRefs = toRefs;
 exports.toRefs = toRefs;
 exports.unref = unref;
 exports.unref = unref;
+exports.watch = watch;
 exports.wx$1 = wx$1;
 exports.wx$1 = wx$1;

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

@@ -100,7 +100,9 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
       popup.value.open();
       popup.value.open();
     };
     };
     const toAgain = async () => {
     const toAgain = async () => {
-      console.log("重新编辑");
+      common_vendor.index.navigateTo({
+        url: `/pagesHome/create/index?gameId=${info.value.id}`
+      });
     };
     };
     const toCancel = async () => {
     const toCancel = async () => {
       common_vendor.index.showModal({
       common_vendor.index.showModal({

+ 26 - 2
unpackage/dist/dev/mp-weixin/pagesHome/create/components/match.js

@@ -14,6 +14,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
   __name: "match",
   __name: "match",
   props: {
   props: {
     id: { type: String, default: () => "" },
     id: { type: String, default: () => "" },
+    gameId: { type: String, default: () => "" },
     typeList: { type: Array, default: () => [] },
     typeList: { type: Array, default: () => [] },
     numberList: { type: Array, default: () => [] },
     numberList: { type: Array, default: () => [] },
     openList: { type: Array, default: () => [] },
     openList: { type: Array, default: () => [] },
@@ -44,13 +45,30 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
         radius: "2px"
         radius: "2px"
       }
       }
     });
     });
-    const { id, typeList, durationList, numberList, openList } = common_vendor.toRefs(props);
+    const { id, gameId, typeList, durationList, numberList, openList } = common_vendor.toRefs(props);
     common_vendor.onShow(() => {
     common_vendor.onShow(() => {
       common_vendor.index.$on("opponentInfo", function(item) {
       common_vendor.index.$on("opponentInfo", function(item) {
         form.value.opponent = item.id;
         form.value.opponent = item.id;
         opponent_name.value = item.name;
         opponent_name.value = item.name;
       });
       });
     });
     });
+    common_vendor.watch(() => gameId.value, (newVal, oldVal) => {
+      search();
+    });
+    const search = async () => {
+      if (gameId.value) {
+        const res = await $api(`game/${gameId.value}`, "GET", {});
+        if (res.code === 200) {
+          if (res.data)
+            form.value = res.data.matchInfo;
+        } else {
+          common_vendor.index.showToast({
+            title: res.msg || "",
+            icon: "error"
+          });
+        }
+      }
+    };
     const typeChange = (e) => {
     const typeChange = (e) => {
       const data = typeList.value[e.detail.value];
       const data = typeList.value[e.detail.value];
       if (data) {
       if (data) {
@@ -143,8 +161,14 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
         form.value.maxPerson = maxPerson.value;
         form.value.maxPerson = maxPerson.value;
         form.value.title = title.value;
         form.value.title = title.value;
         form.value.brief = brief.value;
         form.value.brief = brief.value;
-        const arr = await $api(`friendship`, "POST", form.value);
+        let arr;
+        if (form.value.id)
+          arr = await $api(`friendship`, "PUT", form.value);
+        else
+          arr = await $api(`friendship`, "POST", form.value);
         if (arr.code === 200) {
         if (arr.code === 200) {
+          if (form.value.id && gameId.value)
+            await $api(`game/${gameId.value}`, "DELETE", {});
           const data = {
           const data = {
             matchId: arr.id,
             matchId: arr.id,
             type: "0",
             type: "0",

+ 3 - 0
unpackage/dist/dev/mp-weixin/pagesHome/create/components/match.wxss

@@ -26,6 +26,9 @@
   align-items: center;
   align-items: center;
   background-color: var(--mainColor);
   background-color: var(--mainColor);
 }
 }
+.form .value .title.data-v-6bad03e0 {
+  width: 26vw;
+}
 .form .value .label .input.data-v-6bad03e0 {
 .form .value .label .input.data-v-6bad03e0 {
   text-align: right;
   text-align: right;
 }
 }

+ 3 - 5
unpackage/dist/dev/mp-weixin/pagesHome/create/index.js

@@ -19,6 +19,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
     const $api = (_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 config = common_vendor.ref({});
     const config = common_vendor.ref({});
     const id = common_vendor.ref("");
     const id = common_vendor.ref("");
+    const gameId = common_vendor.ref("");
     const list = common_vendor.ref(["友谊赛", "训练", "活动"]);
     const list = common_vendor.ref(["友谊赛", "训练", "活动"]);
     const current = common_vendor.ref(0);
     const current = common_vendor.ref(0);
     const typeList = common_vendor.ref([]);
     const typeList = common_vendor.ref([]);
@@ -32,9 +33,9 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
     const childRef2 = common_vendor.ref();
     const childRef2 = common_vendor.ref();
     common_vendor.onLoad(async (options) => {
     common_vendor.onLoad(async (options) => {
       id.value = options && options.id;
       id.value = options && options.id;
+      gameId.value = options && options.gameId;
       await searchConfig();
       await searchConfig();
       await searchOther();
       await searchOther();
-      await search();
     });
     });
     const searchConfig = async () => {
     const searchConfig = async () => {
       config.value = common_vendor.index.getStorageSync("config");
       config.value = common_vendor.index.getStorageSync("config");
@@ -60,10 +61,6 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
       if (res.code === 200 && res.total > 0)
       if (res.code === 200 && res.total > 0)
         openList.value = res.rows;
         openList.value = res.rows;
     };
     };
-    const search = async () => {
-      if (id.value)
-        ;
-    };
     const onClickItem = (e) => {
     const onClickItem = (e) => {
       if (current.value !== e.currentIndex)
       if (current.value !== e.currentIndex)
         current.value = e.currentIndex;
         current.value = e.currentIndex;
@@ -97,6 +94,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
         d: id.value,
         d: id.value,
         e: common_vendor.p({
         e: common_vendor.p({
           id: id.value,
           id: id.value,
+          gameId: gameId.value,
           typeList: typeList.value,
           typeList: typeList.value,
           numberList: numberList.value,
           numberList: numberList.value,
           durationList: durationList.value,
           durationList: durationList.value,

+ 1 - 1
unpackage/dist/dev/mp-weixin/pagesHome/match/info.wxml

@@ -1 +1 @@
-<view class="content data-v-dc3bb826"><view class="one data-v-dc3bb826"> 草稿箱 </view></view>
+<view class="content data-v-dc3bb826"><view class="one data-v-dc3bb826"> 赛事详情 </view></view>