diff --git a/backend/src/main/java/com/budwk/app/client/module/activity/controller/ClientGroupController.java b/backend/src/main/java/com/budwk/app/client/module/activity/controller/ClientGroupController.java index 34c773d..51c163c 100644 --- a/backend/src/main/java/com/budwk/app/client/module/activity/controller/ClientGroupController.java +++ b/backend/src/main/java/com/budwk/app/client/module/activity/controller/ClientGroupController.java @@ -118,7 +118,12 @@ public class ClientGroupController { @At("/apply-leader/?") @AdaptBy(type = JsonAdaptor.class) @SaCheckLogin(type = StpClientUtil.TYPE) - public Result applyLeader(Long groupId) { + public synchronized Result applyLeader(Long groupId) { + int count = clientActivityService.dao().count(ActGroupUser.class, Cnd.where(ActGroupUser::getGroupId, "=", groupId) + .and(ActGroupUser::getIsLeader, "=", 1)); + if (count > 0){ + return Result.error("该团队已有队长!"); + } clientActivityService.dao().update(ActGroupUser.class, Chain.make("isLeader", true), Cnd.where(ActGroupUser::getGroupId, "=", groupId) @@ -126,6 +131,17 @@ public class ClientGroupController { return Result.success(); } + @At("/cancel-leader/?") + @AdaptBy(type = JsonAdaptor.class) + @SaCheckLogin(type = StpClientUtil.TYPE) + public synchronized Result cancelLeader(Long groupId) { + clientActivityService.dao().update(ActGroupUser.class, + Chain.make("isLeader", false), + Cnd.where(ActGroupUser::getGroupId, "=", groupId) + .and(ActGroupUser::getUserId, "=", StpClientUtil.STP.getLoginIdAsLong())); + return Result.success(); + } + @At("/list-team/?") @SaCheckLogin(type = StpClientUtil.TYPE) public Result listTeam(Long activityId) { diff --git a/backend/src/main/java/com/budwk/app/module/activity/controller/ActScoreEnterController.java b/backend/src/main/java/com/budwk/app/module/activity/controller/ActScoreEnterController.java index 123be7d..72ceb46 100644 --- a/backend/src/main/java/com/budwk/app/module/activity/controller/ActScoreEnterController.java +++ b/backend/src/main/java/com/budwk/app/module/activity/controller/ActScoreEnterController.java @@ -167,6 +167,7 @@ public class ActScoreEnterController { List listMap = activityService.listMap(sql); List itemList = activityService.dao().query(ActivityItem.class, Cnd.where(ActivityItem::getActivityId, "=", activityId).asc(ActivityItem::getSort)); itemList.forEach(item -> { + item.setCjName("成绩"); item.setScoreName("得分"); item.setRankingName("名次"); }); @@ -181,10 +182,12 @@ public class ActScoreEnterController { Map itemListMap = new HashMap<>(); itemList.forEach(item -> { itemListMap.put("name",item.getName()); - itemListMap.put("scoreName","成绩"); + itemListMap.put("cjName","成绩"); itemListMap.put("rankingName","名次"); - itemListMap.put("scoreVal","t." + item.getName() + ".score"); + itemListMap.put("scoreName","积分"); + itemListMap.put("cjVal","t." + item.getName() + ".cj"); itemListMap.put("rankingVal","t." + item.getName() + ".ranking"); + itemListMap.put("scoreVal","t." + item.getName() + ".score"); itemLists.add(itemListMap); }); for (int j = 0; j < listMap.size(); j++) { @@ -198,8 +201,9 @@ public class ActScoreEnterController { ActItemGroupScore itemGroupScore = scoreList.stream().filter(score -> score.getGroupId().equals(group.getLong("id")) && score.getItemId().equals(item.getId())).findFirst().orElse(null); - group.put("score", itemGroupScore.getScore()); + group.put("cj", itemGroupScore.getCj()); group.put("ranking", itemGroupScore.getRanking()); + group.put("score", itemGroupScore.getScore()); } } } diff --git a/backend/src/main/java/com/budwk/app/module/activity/controller/ActScoreEntryController.java b/backend/src/main/java/com/budwk/app/module/activity/controller/ActScoreEntryController.java index 21cf7ae..adb5056 100644 --- a/backend/src/main/java/com/budwk/app/module/activity/controller/ActScoreEntryController.java +++ b/backend/src/main/java/com/budwk/app/module/activity/controller/ActScoreEntryController.java @@ -95,15 +95,21 @@ public class ActScoreEntryController { @At("/save-score") @SaCheckPermission("activity.group") @ApiOperation(value = "保存成绩", nickname = "/save-score", httpMethod = "POST") - public Result saveScore(@Param("scores") ActItemGroupScore[] actItemGroupScore) { + public Result saveScore(@Param("scores") ActItemGroupScore[] actItemGroupScore, @Param("activityId") String activityId) { // 更新分数和名次 dao.updateIgnoreNull(actItemGroupScore); - // 更新总得分 -// ActGroup actGroup = dao.fetch(ActGroup.class, actItemGroupScore.getGroupId()); -// BigDecimal newTotalScore = actGroup.getTotalScore().add(actItemGroupScore.getScore()); -// actGroup.setTotalScore(newTotalScore); -// dao.update(actGroup); + //查询这个活动所有成绩 + List scoreList = dao.query(ActItemGroupScore.class, Cnd.where(ActItemGroupScore::getActivityId, "=", activityId)); + for (ActItemGroupScore score : actItemGroupScore) { + Long groupId = score.getGroupId(); + //在找出这个队伍下面所有的分数 + List groupScoreList = scoreList.stream().filter(itemScore -> itemScore.getGroupId().equals(groupId)).toList(); + BigDecimal totalScore = groupScoreList.stream() + .map(ActItemGroupScore::getScore) // 提取每个 score(BigDecimal) + .reduce(BigDecimal.ZERO, BigDecimal::add); + dao.update(ActGroup.class, Chain.make("totalScore", totalScore), Cnd.where(ActGroup::getId, "=", groupId)); + } return Result.success(); } diff --git a/backend/src/main/java/com/budwk/app/module/activity/models/ActItemGroupScore.java b/backend/src/main/java/com/budwk/app/module/activity/models/ActItemGroupScore.java index ff4bab3..31a963f 100644 --- a/backend/src/main/java/com/budwk/app/module/activity/models/ActItemGroupScore.java +++ b/backend/src/main/java/com/budwk/app/module/activity/models/ActItemGroupScore.java @@ -47,4 +47,9 @@ public class ActItemGroupScore extends BaseModel { @Comment("队伍排名") @ColDefine(type = ColType.VARCHAR, width = 50) private String ranking; + + @Column + @Comment("成绩") + @ColDefine(type = ColType.VARCHAR, width = 20) + private String cj; } diff --git a/backend/src/main/java/com/budwk/app/module/activity/models/ActRankScore.java b/backend/src/main/java/com/budwk/app/module/activity/models/ActRankScore.java index 5c76790..f0d5302 100644 --- a/backend/src/main/java/com/budwk/app/module/activity/models/ActRankScore.java +++ b/backend/src/main/java/com/budwk/app/module/activity/models/ActRankScore.java @@ -27,4 +27,5 @@ public class ActRankScore extends BaseModel { @ColDefine(customType = "decimal", width = 10, precision = 2) private BigDecimal score; + } diff --git a/backend/src/main/java/com/budwk/app/module/activity/models/ActUser.java b/backend/src/main/java/com/budwk/app/module/activity/models/ActUser.java index c1a69cc..e822f4b 100644 --- a/backend/src/main/java/com/budwk/app/module/activity/models/ActUser.java +++ b/backend/src/main/java/com/budwk/app/module/activity/models/ActUser.java @@ -166,4 +166,9 @@ public class ActUser extends BaseModel { @Default("0") private Boolean isParty; + @Column + @Comment("体重KG") + @ColDefine(type = ColType.DOUBLE) + private Double weight; + } diff --git a/backend/src/main/java/com/budwk/app/module/activity/models/ActivityItem.java b/backend/src/main/java/com/budwk/app/module/activity/models/ActivityItem.java index 79fa38c..eac6708 100644 --- a/backend/src/main/java/com/budwk/app/module/activity/models/ActivityItem.java +++ b/backend/src/main/java/com/budwk/app/module/activity/models/ActivityItem.java @@ -60,6 +60,7 @@ public class ActivityItem extends BaseModel { @Column @ColDefine(type = ColType.INT) private Integer sort; + private String cjName; private String scoreName; private String rankingName; private String scoreVal; diff --git a/backend/src/main/resources/templates/scoreEnter.xlsx b/backend/src/main/resources/templates/scoreEnter.xlsx index 6880a0e..a8f200b 100644 Binary files a/backend/src/main/resources/templates/scoreEnter.xlsx and b/backend/src/main/resources/templates/scoreEnter.xlsx differ diff --git a/backend/src/main/resources/views/platform/activity/scoreEnter/index.html b/backend/src/main/resources/views/platform/activity/scoreEnter/index.html index 15b5a85..6ae0f75 100644 --- a/backend/src/main/resources/views/platform/activity/scoreEnter/index.html +++ b/backend/src/main/resources/views/platform/activity/scoreEnter/index.html @@ -42,25 +42,28 @@ layout("/layouts/platform_1.html"){ 打开成绩大屏 导出 - + - + - + - + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -78,9 +77,10 @@ - + + :rules="[{required:true,message: '请输入姓名'}]"> @@ -89,74 +89,83 @@ + + + + :rules="[{required:true,message: '请输入职务'}]"> + :rules="[{required:true,message: '请输入身份证号码'},{idcard:true, message: '请输入正确的身份证号码'}]"> + :rules="[{required:true,message: '请输入联系电话'},{telnumber:true, message: '请输入正确的联系电话'}]"> + :rules="[{required:true,message: '请选择是否住宿'}]"> + :rules="[{required:true,message: '请选择是否为联系人'}]"> - + - + - + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -182,7 +191,7 @@ shape="round" @click="onSubmit" > - {{ isSignUp ? '重新提交报名信息' : '提交报名'}} + {{ isSignUp ? '重新提交报名信息' : '提交报名' }} @@ -202,13 +211,14 @@ - + 取消 - + {{ canConfirmAgreement ? '确定并报名' : `请阅读(${agreementCountdown}秒)` }} @@ -225,7 +235,9 @@ 重要提醒 - 请务必准确填写手机号码和身份证号码,信息有误将导致现场签到失败,影响您的正常使用。 + + 请务必准确填写手机号码和身份证号码,信息有误将导致现场签到失败,影响您的正常使用。 + @@ -244,7 +256,7 @@ import {onLoad} from "@dcloudio/uni-app"; import {useUserStore} from "@/store"; const request = useRequest() -const userStore= useUserStore() +const userStore = useUserStore() // 当前选中的选项卡索引 const activeTabIndex = ref(0) @@ -339,16 +351,16 @@ function scrollFormToTop() { // 引导部分 const guideCurrent = ref(-1) const guideSteps = [ - { - element:()=> document.querySelector('.header-add-btn'), - title: '添加活动报名人员', - placement: 'top' - }, - { - element:()=> document.querySelector('.footer'), - title: '提交报名信息', - placement: 'top' - } + { + element: () => document.querySelector('.header-add-btn'), + title: '添加活动报名人员', + placement: 'top' + }, + { + element: () => document.querySelector('.footer'), + title: '提交报名信息', + placement: 'top' + } ] // 报名信息 @@ -377,7 +389,7 @@ onLoad(async (option) => { await getIsSignUp() await getAgreement() // 没报名进行引导 - if(!formData.value.userList || formData.value.userList.length === 0){ + if (!formData.value.userList || formData.value.userList.length === 0) { guideCurrent.value = 0 // 默认是本人的信息 formData.value.userList.push({ @@ -406,7 +418,7 @@ async function getAgreement() { if (code === 0 && data) { agreementContent.value = data } - }catch (e){ + } catch (e) { console.error(e) } } @@ -905,8 +917,12 @@ function closeNoticePopup() { } @keyframes fadeIn { - from { opacity: 0.6; } - to { opacity: 1; } + from { + opacity: 0.6; + } + to { + opacity: 1; + } } .user-actions { @@ -1023,7 +1039,7 @@ function closeNoticePopup() { height: 44px; } -::v-deep .t-form__label--required::before{ +::v-deep .t-form__label--required::before { position: absolute; left: 8px; color: #ee0a24; diff --git a/frontend/src/pages/activity/team-form/index.vue b/frontend/src/pages/activity/team-form/index.vue index cc05601..62a4a84 100644 --- a/frontend/src/pages/activity/team-form/index.vue +++ b/frontend/src/pages/activity/team-form/index.vue @@ -47,7 +47,7 @@ diff --git a/frontend/src/pages/activity/team/index.vue b/frontend/src/pages/activity/team/index.vue index 96db3ad..103caa0 100644 --- a/frontend/src/pages/activity/team/index.vue +++ b/frontend/src/pages/activity/team/index.vue @@ -10,10 +10,10 @@
- - - - + + + +
{{ team.groupName }}
@@ -24,23 +24,23 @@
- +
成员:{{ team.groupUsers?.length }}
- +
- +
排名:{{ team.totalRank ? team.totalRank : '--' }}
- +
@@ -80,19 +80,29 @@
-
-
- -
-
-
您是队长
-
拥有团队所有管理权限
+
+
+
+ +
+
+
您是队长
+
拥有团队所有管理权限
+
+
+ + 取消成为队长 +
- +
您是普通成员
@@ -104,7 +114,7 @@
- +
您是普通成员
@@ -125,7 +135,7 @@ @@ -161,10 +171,10 @@ {{ userInfo.userName }} - {{userInfo.sex}} - {{userInfo.phone}} - {{userInfo.position}} - {{userInfo.unitName}} + {{ userInfo.sex }} + {{ userInfo.phone }} + {{ userInfo.position }} + {{ userInfo.unitName }} @@ -214,6 +224,35 @@ const actChange = (val) => { getListAct() } +// 取消成为队长 +const cancelLeader = async () => { + // 弹出确认框 + Dialog.confirm({ + title: '温馨提示', + content: '确定要取消队长身份吗?', + confirmBtn: '确认取消', + cancelBtn: '再想想', + onConfirm: async () => { + try { + const {code, msg} = await useRequest().post('/client/group/cancel-leader/' + team.value.id); + if (code === 0) { + await getTeamInfo(); + Toast({message: '取消成功', theme: 'success'}); + } else { + await getTeamInfo(); + Toast({message: msg, theme: 'error'}); + } + } catch (e) { + Toast({message: e.message || '操作失败', theme: 'error'}); + } + }, + onCancel: () => { + // 用户取消,可选提示或什么都不做 + // Toast({ message: '已取消操作', theme: 'warning' }); + }, + }); +}; + // 申请成为队长 const onLeaderConfirm = async () => { try { @@ -224,6 +263,7 @@ const onLeaderConfirm = async () => { Toast({message: '申请成功', theme: 'success'}); leaderConfirmVisible.value = false } else { + await getTeamInfo(); Toast({message: msg, theme: 'error'}); } } catch (e) { @@ -241,7 +281,7 @@ const getTeamInfo = async () => { try { const {code, msg, data} = await useRequest().post('/client/group/info/' + pageForm.actId); if (code === 0) { - if(data){ + if (data) { team.value = data team.value.teamIsLeader = !!team.value.groupUsers.find(t => t.isLeader) } @@ -618,18 +658,16 @@ onLoad(() => { width: 40px; height: 40px; border-radius: 20px; - background: linear-gradient(120deg, #ff5f5c, #ff8c8a); + //background: linear-gradient(120deg, #ff5f5c, #ff8c8a); display: flex; align-items: center; justify-content: center; margin-right: 12px; - box-shadow: 0 4px 12px rgba(255, 95, 92, 0.2); + //box-shadow: 0 4px 12px rgba(255, 95, 92, 0.2); + color: #ff5f5c; + font-size: 22px; } -.role-icon i { - font-size: 20px; - color: white; -} .role-info { flex: 1;