# Conflicts:
#	frontend/src/pages/activity/team-form/index.vue
This commit is contained in:
那些花儿
2025-04-30 14:50:29 +08:00
4 changed files with 73 additions and 35 deletions
@@ -5,6 +5,7 @@ import com.budwk.app.client.module.activity.service.ClientItemService;
import com.budwk.app.client.module.activity.vo.ClientItemSignUpVO;
import com.budwk.app.module.activity.models.ActGroupUser;
import com.budwk.app.module.activity.models.Activity;
import com.budwk.app.module.activity.models.ActivityItem;
import com.budwk.app.module.activity.models.ActivityItemUser;
import com.budwk.app.web.commons.auth.satoken.StpClientUtil;
import org.nutz.aop.interceptor.ioc.TransAop;
@@ -27,9 +28,14 @@ public class ClientItemServiceImpl extends BaseServiceImpl<ActivityItemUser> imp
@Aop(TransAop.READ_COMMITTED)
public void signUp(ClientItemSignUpVO signVO) {
Activity activity = dao().fetch(Activity.class, Cnd.where(Activity::getId, "=", signVO.getActivityId()));
if (activity.getItemEndTime().isBefore(LocalDateTime.now())){
if (activity.getItemEndTime().isBefore(LocalDateTime.now())) {
throw new RuntimeException("项目报名已结束!");
}
//查询报名项目
ActivityItem activityItem = dao().fetch(ActivityItem.class, Cnd.where(ActivityItem::getId, "=", signVO.getItemId()));
if (activityItem.getNum() > 0 && signVO.getUserList().size() != activityItem.getNum()) {
throw new RuntimeException("报名人数不正确!");
}
//找到自己的团队
ActGroupUser groupUser = dao().fetch(ActGroupUser.class,
Cnd.where(ActGroupUser::getActivityId, "=", signVO.getActivityId())
@@ -46,6 +46,11 @@ public class ActivityItem extends BaseModel {
@ColDefine(type = ColType.INT)
private Integer num;
@Comment("是否团体报名")
@Column
@ColDefine(type = ColType.BOOLEAN)
private Boolean isTeamApply;
@Comment("排序")
@Column
@ColDefine(type = ColType.INT)
@@ -20,12 +20,26 @@ const itemForm = {
<el-input v-model="row.rule" placeholder="请输入评分规则"></el-input>
</template>
</el-table-column>
<el-table-column label="图片">
<el-table-column label="是否团队合作">
<template #default="{row}">
{{row.img}}
<image-upload v-model="row.img" :max-count="1"></image-upload>
<el-radio-group v-model="row.isTeamApply" size="medium" @change="row.num=0">
<el-radio-button :label="true">是</el-radio-button>
<el-radio-button :label="false">否</el-radio-button>
</el-radio-group>
</template>
</el-table-column>
<el-table-column label="报名人数">
<template #default="{row}">
<el-input-number v-model="row.num" :disabled="row.isTeamApply"
placeholder="请输入报名人数"></el-input-number>
</template>
</el-table-column>
<!-- <el-table-column label="图片">
<template #default="{row}">
{{row.img}}
<image-upload v-model="row.img" :max-count="1"></image-upload>
</template>
</el-table-column>-->
<el-table-column label="操作" fixed="right" width="100px">
<template #default="{$index}">
<el-button type="text" class="text-danger" @click="removeRow($index)">删除</el-button>
@@ -62,7 +76,7 @@ const itemForm = {
})
},
addRow() {
this.form.tableData.push({})
this.form.tableData.push({isTeamApply:false,applyNum:0})
},
removeRow(index) {
this.form.tableData.splice(index, 1)
+43 -30
View File
@@ -10,31 +10,30 @@
<text class="page-subtitle">点击项目报名</text>
</view>
<!-- 项目列表 -->
<view class="project-cards">
<view
v-for="project in itemOptions"
:key="project.id"
class="project-card"
:class="{'project-card--registered': registrationStatus.get(project.id)?.length}"
@click="selectProject(project.id)"
>
<view class="project-card__content">
<view class="project-card__title">{{ project.name }}</view>
<view class="project-card__desc">{{ project.description }}</view>
</view>
<view class="project-card__status">
<t-tag v-if="registrationStatus.get(project.id)?.length" theme="success" variant="light-outline">
已报名 {{ registrationStatus.get(project.id)?.length }}人
</t-tag>
<view v-else class="project-card__action">
<t-icon name="chevron-right" color="#999"/>
</view>
</view>
<!-- <view v-if="registrationStatus.get(project.id)?.length" class="project-card__checkmark">
<t-icon name="check" color="#52c41a"/>
</view>-->
<!-- 项目列表 -->
<view class="project-cards">
<view
v-for="project in itemOptions"
:key="project.id"
class="project-card"
:class="{'project-card--registered': registrationStatus.get(project.id)?.length}"
@click="selectProject(project)"
>
<view class="project-card__content">
<view class="project-card__title">{{ project.name }}</view>
<view class="project-card__desc">{{ project.description }}</view>
</view>
<view class="project-card__status">
<t-tag v-if="registrationStatus.get(project.id)?.length" theme="success" variant="light-outline">
已报名 {{ registrationStatus.get(project.id)?.length }}人
</t-tag>
<view v-else class="project-card__action">
<t-icon name="chevron-right" color="#999"/>
</view>
</view>
<!-- <view v-if="registrationStatus.get(project.id)?.length" class="project-card__checkmark">
<t-icon name="check" color="#52c41a"/>
</view>-->
</view>
</view>
</template>
@@ -45,6 +44,7 @@
style="flex: 1">
</t-empty>
</view>
<t-popup v-model:visible="showMemberPicker" placement="bottom" destroy-on-close>
<view class="member-picker">
<view class="picker-header">
@@ -54,6 +54,14 @@
<view class="picker-subtitle" v-if="selectedItemId">
{{ itemOptions.find(p => p.id === selectedItemId)?.name }}
<view v-if="itemOptions.find(p => p.id === selectedItemId)?.isTeamApply">
此项目是团队协作需要全体成员参与
</view>
<view v-else>
此项目需【{{itemOptions.find(p => p.id === selectedItemId)?.num}}】名成员参与
</view>
</view>
<view class="member-list">
@@ -66,7 +74,7 @@
:value="member.userId"
:label="member.userName+'-'+member.sex"
:content="member.unitName"
:disabled="!isSelfLeader"
:disabled="!isSelfLeader||team.isTeamApply"
icon-size="20px"
/>
</view>
@@ -206,14 +214,19 @@ const fetchRegistrationStatus = () => {
return acc;
}, new Map());
registrationStatus.value = resultMap;
console.log(resultMap)
};
// 点击的当前项目
const team = ref({})
// 选择项目
const selectProject = (projectId) => {
selectedItemId.value = projectId;
selectedMemberIds.value = selectedMemberList.value.filter(v => v.itemId === projectId).map(v => v.userId)
const selectProject = (project) => {
selectedItemId.value = project.id;
team.value=project
if (project.isTeamApply){
selectedMemberIds.value = teamMembers.value.map(v => v.userId)
}else{
selectedMemberIds.value = selectedMemberList.value.filter(v => v.itemId === project.id).map(v => v.userId)
}
showMemberPicker.value = true;
};