This commit is contained in:
2025-04-29 17:58:58 +08:00
parent 095d8335ac
commit 086643b834
5 changed files with 99 additions and 61 deletions
+21 -24
View File
@@ -1,6 +1,6 @@
<template>
<view class="page-container">
<view v-if="actList&&actList?.length>0">
<view v-if="team">
<t-sticky>
<t-dropdown-menu class="top-dropdown-menu">
<t-dropdown-item :options="actOptions" :value="pageForm.actId" @change="actChange"/>
@@ -17,7 +17,7 @@
<div class="team-basic-info">
<div class="team-name">{{ team.groupName }}</div>
<div class="team-meta">创建于 {{moment(team.createdAt).format("YYYY-MM-DD HH:mm")}}</div>
<div class="team-meta">创建于 {{ moment(team.createdAt).format("YYYY-MM-DD HH:mm") }}</div>
</div>
</div>
@@ -41,9 +41,9 @@
</div>
<!-- 项目报名按钮 -->
<div class="action-section" v-if="team.isSelfLeader">
<div class="action-section" >
<t-button block theme="danger" size="large" class="register-btn" @click="goToEventRegistration">
参与项目报名
{{ team.isSelfLeader ? '参与项目报名' : '查看项目报名' }}
</t-button>
</div>
@@ -103,9 +103,20 @@
</div>
</div>
</view>
<view v-else>暂无团队</view>
</view>
<view v-else style="background-color: #FFFFFF">
<view >
<t-result>
<template #image>
<t-image src="https://tdesign.gtimg.com/mobile/demos/result1.png" class="external-class-image" />
</template>
<template #title>
<div>暂无团队</div>
</template>
</t-result>
</view>
</view>
</view>
<t-dialog
v-model:visible="leaderConfirmVisible"
title="申请成为队长"
@@ -126,8 +137,6 @@
</div>
</template>
</t-dialog>
</template>
<script setup>
@@ -155,21 +164,7 @@ const pageForm = reactive({
const teamId = ''
let team = ref({
id: teamId,
name: 'xx队',
logoUrl: null,
createdDate: '2023-10-15',
eventId: '',
eventName: '',
memberCount: 12,
rank: 5,
score: 256,
description: 'xxxxxxxxxxxxxxxxxxx',
// 团队成员
groupUsers: []
});
let team = ref(null);
// 申请成为队长弹框提示
const leaderConfirmVisible = ref(false)
@@ -190,6 +185,7 @@ const onLeaderConfirm = async () => {
pageForm.groupId = team.value.id
const {code, msg} = await useRequest().post('/client/group/apply-leader/' + team.value.id);
if (code === 0) {
await getTeamInfo();
Toast({message: '申请成功', theme: 'success'});
leaderConfirmVisible.value = false
} else {
@@ -205,13 +201,14 @@ const goToEventRegistration = () => {
uni.navigateTo({url: '/pages/activity/team-form/index?id=' + pageForm.actId})
};
// 根据活动查询队伍信息
const getTeamInfo = async () => {
try {
const {code, msg, data} = await useRequest().post('/client/group/info/' + pageForm.actId);
if (code === 0) {
team.value = data
console.log(team.value.groupUsers.find(t=>t.userId===uni.getStorageSync('userId')))
console.log()
} else {
Toast({message: msg, theme: 'error'});
}