Browse Source

修改活动详情

zs 1 year ago
parent
commit
8036101034

+ 16 - 11
pages/home/index.vue

@@ -69,13 +69,7 @@
 	// 禁止滚动穿透
 	const show = ref(false);
 	// 标签列表
-	const menuList = ref([
-		{ name: '球队', num: '5', icon: 'icon-qi', color: '#1E90FF' },
-		{ name: '|' },
-		{ name: '出勤', num: '16%', icon: 'icon-kaoqinchuqin', color: '#FF4500' },
-		{ name: '|' },
-		{ name: '进球', num: '1', icon: 'icon-zuqiu', color: '#FFFFFF' },
-	]);
+	const menuList = ref([]);
 	const list = ref(['球队', '活动', '赛事']);
 	const current = ref(0);
 	// 悬浮按钮
@@ -108,6 +102,10 @@
 	onPullDownRefresh(() => {
 		uni.stopPullDownRefresh()
 	})
+	// config信息
+	const searchConfig = async () => {
+		config.value = uni.getStorageSync('config');
+	};
 	// 用户信息
 	const search = async () => {
 		const res = await $api(`matchUser/find`, 'GET', {
@@ -117,6 +115,16 @@
 			if (res.data) {
 				user.value = res.data
 				uni.setStorageSync('user', res.data);
+				// 球队统计
+				const arr = await $api(`matchUser/statistics/${res.data.id}`, 'GET', {});
+				if (arr.code === 200) {
+					menuList.value = arr.data
+				} else {
+					uni.showToast({
+						title: arr.msg || '',
+						icon: 'error',
+					});
+				}
 			}
 			else popup.value.open();
 		} else {
@@ -126,10 +134,7 @@
 			});
 		}
 	};
-	// config信息
-	const searchConfig = async () => {
-		config.value = uni.getStorageSync('config');
-	};
+
 	const change = (e) => {
 		show.value = e.show
 	};

+ 52 - 2
pagesHome/activity/info.vue

@@ -264,11 +264,61 @@
 	};
 	// 请假
 	const onLeave = async () => {
-		console.log('请假');
+		uni.showModal({
+			title: '提示',
+			content: '您确定请假该比赛吗?',
+			success: async function (res) {
+				if (res.confirm) {
+					const data = {
+						gameId: info.value.id,
+						userId: user.value.id,
+						user_type: '0',
+						status: '1',
+						is_response: "Y"
+					}
+					const res = await $api(`enroll`, 'POST', data)
+					if (res.code == 200) {
+						uni.navigateBack({
+							delta: 1
+						})
+					} else {
+						uni.showToast({
+							title: res.msg,
+							icon: 'none'
+						})
+					}
+				}
+			}
+		});
 	};
 	// 报名
 	const onEnroll = async () => {
-		console.log('报名');
+		uni.showModal({
+			title: '提示',
+			content: '您确定报名该比赛吗?',
+			success: async function (res) {
+				if (res.confirm) {
+					const data = {
+						gameId: info.value.id,
+						userId: user.value.id,
+						user_type: '0',
+						status: '2',
+						is_response: "Y"
+					}
+					const res = await $api(`enroll`, 'POST', data)
+					if (res.code == 200) {
+						uni.navigateBack({
+							delta: 1
+						})
+					} else {
+						uni.showToast({
+							title: res.msg,
+							icon: 'none'
+						})
+					}
+				}
+			}
+		});
 	};
 	// 邀请分享配置
 	const searchShare = () => {

+ 19 - 4
pagesHome/team/info.vue

@@ -249,10 +249,8 @@
 				is_save.value = false
 				actInfo.value = res.rows[0]
 			} else {
-				uni.showToast({
-					title: res.msg || '',
-					icon: 'error',
-				});
+				is_save.value = true
+				actInfo.value = []
 			}
 		}
 	};
@@ -313,6 +311,23 @@
 	};
 	// 同意
 	const onAgree = async () => {
+		uni.showModal({
+			title: '提示',
+			content: '您确定接受比赛吗?',
+			success: async function (res) {
+				if (res.confirm) {
+					const res = await $api(`game`, 'PUT', { id: actInfo.value.id, status: '1' })
+					if (res.code == 200) {
+						searchGame()
+					} else {
+						uni.showToast({
+							title: res.msg,
+							icon: 'none'
+						})
+					}
+				}
+			}
+		});
 		console.log('同意');
 	};
 </script>

+ 13 - 10
unpackage/dist/dev/mp-weixin/pages/home/index.js

@@ -28,13 +28,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
     const config = common_vendor.ref({});
     const user = common_vendor.ref({});
     const show = common_vendor.ref(false);
-    const menuList = common_vendor.ref([
-      { name: "球队", num: "5", icon: "icon-qi", color: "#1E90FF" },
-      { name: "|" },
-      { name: "出勤", num: "16%", icon: "icon-kaoqinchuqin", color: "#FF4500" },
-      { name: "|" },
-      { name: "进球", num: "1", icon: "icon-zuqiu", color: "#FFFFFF" }
-    ]);
+    const menuList = common_vendor.ref([]);
     const list = common_vendor.ref(["球队", "活动", "赛事"]);
     const current = common_vendor.ref(0);
     const pattern = common_vendor.ref({
@@ -65,6 +59,9 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
     common_vendor.onPullDownRefresh(() => {
       common_vendor.index.stopPullDownRefresh();
     });
+    const searchConfig = async () => {
+      config.value = common_vendor.index.getStorageSync("config");
+    };
     const search = async () => {
       const res = await $api(`matchUser/find`, "GET", {
         openid: openid.value
@@ -73,6 +70,15 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
         if (res.data) {
           user.value = res.data;
           common_vendor.index.setStorageSync("user", res.data);
+          const arr = await $api(`matchUser/statistics/${res.data.id}`, "GET", {});
+          if (arr.code === 200) {
+            menuList.value = arr.data;
+          } else {
+            common_vendor.index.showToast({
+              title: arr.msg || "",
+              icon: "error"
+            });
+          }
         } else
           popup.value.open();
       } else {
@@ -82,9 +88,6 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
         });
       }
     };
-    const searchConfig = async () => {
-      config.value = common_vendor.index.getStorageSync("config");
-    };
     const change = (e) => {
       show.value = e.show;
     };

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

@@ -132,10 +132,60 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
       });
     };
     const onLeave = async () => {
-      console.log("请假");
+      common_vendor.index.showModal({
+        title: "提示",
+        content: "您确定请假该比赛吗?",
+        success: async function(res) {
+          if (res.confirm) {
+            const data = {
+              gameId: info.value.id,
+              userId: user.value.id,
+              user_type: "0",
+              status: "1",
+              is_response: "Y"
+            };
+            const res2 = await $api(`enroll`, "POST", data);
+            if (res2.code == 200) {
+              common_vendor.index.navigateBack({
+                delta: 1
+              });
+            } else {
+              common_vendor.index.showToast({
+                title: res2.msg,
+                icon: "none"
+              });
+            }
+          }
+        }
+      });
     };
     const onEnroll = async () => {
-      console.log("报名");
+      common_vendor.index.showModal({
+        title: "提示",
+        content: "您确定报名该比赛吗?",
+        success: async function(res) {
+          if (res.confirm) {
+            const data = {
+              gameId: info.value.id,
+              userId: user.value.id,
+              user_type: "0",
+              status: "2",
+              is_response: "Y"
+            };
+            const res2 = await $api(`enroll`, "POST", data);
+            if (res2.code == 200) {
+              common_vendor.index.navigateBack({
+                delta: 1
+              });
+            } else {
+              common_vendor.index.showToast({
+                title: res2.msg,
+                icon: "none"
+              });
+            }
+          }
+        }
+      });
     };
     const searchShare = () => {
       let titleName = "";

+ 19 - 4
unpackage/dist/dev/mp-weixin/pagesHome/team/info.js

@@ -84,10 +84,8 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
           is_save.value = false;
           actInfo.value = res.rows[0];
         } else {
-          common_vendor.index.showToast({
-            title: res.msg || "",
-            icon: "error"
-          });
+          is_save.value = true;
+          actInfo.value = [];
         }
       }
     };
@@ -141,6 +139,23 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
       console.log("报名");
     };
     const onAgree = async () => {
+      common_vendor.index.showModal({
+        title: "提示",
+        content: "您确定接受比赛吗?",
+        success: async function(res) {
+          if (res.confirm) {
+            const res2 = await $api(`game`, "PUT", { id: actInfo.value.id, status: "1" });
+            if (res2.code == 200) {
+              searchGame();
+            } else {
+              common_vendor.index.showToast({
+                title: res2.msg,
+                icon: "none"
+              });
+            }
+          }
+        }
+      });
       console.log("同意");
     };
     return (_ctx, _cache) => {