Merge branch 'main' of https://dd3skj.picp.vip/zhaoxinyu/hmc_gbhd
This commit is contained in:
+58
-10
@@ -4,15 +4,21 @@ import cn.dev33.satoken.annotation.SaCheckLogin;
|
|||||||
import com.budwk.app.base.result.Result;
|
import com.budwk.app.base.result.Result;
|
||||||
import com.budwk.app.client.module.activity.service.ClientActivityService;
|
import com.budwk.app.client.module.activity.service.ClientActivityService;
|
||||||
import com.budwk.app.module.activity.models.ActGroup;
|
import com.budwk.app.module.activity.models.ActGroup;
|
||||||
|
import com.budwk.app.module.activity.models.ActGroupUser;
|
||||||
import com.budwk.app.module.activity.models.ActUser;
|
import com.budwk.app.module.activity.models.ActUser;
|
||||||
|
import com.budwk.app.module.activity.models.ActivityItem;
|
||||||
import com.budwk.app.web.commons.auth.satoken.StpClientUtil;
|
import com.budwk.app.web.commons.auth.satoken.StpClientUtil;
|
||||||
|
import org.nutz.dao.Chain;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
import org.nutz.dao.Dao;
|
import org.nutz.dao.Dao;
|
||||||
import org.nutz.dao.Sqls;
|
import org.nutz.dao.Sqls;
|
||||||
import org.nutz.dao.sql.Sql;
|
import org.nutz.dao.sql.Sql;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
import org.nutz.lang.Lang;
|
||||||
import org.nutz.lang.util.NutMap;
|
import org.nutz.lang.util.NutMap;
|
||||||
|
import org.nutz.mvc.adaptor.JsonAdaptor;
|
||||||
|
import org.nutz.mvc.annotation.AdaptBy;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
import org.nutz.mvc.annotation.Ok;
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
|
||||||
@@ -37,11 +43,12 @@ public class ClientGroupController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询我的活动
|
* 查询我的活动
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@At("/list-act")
|
@At("/list-act")
|
||||||
@SaCheckLogin(type = StpClientUtil.TYPE)
|
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||||
public Result listAct(){
|
public Result listAct() {
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
t1.id,
|
t1.id,
|
||||||
@@ -64,19 +71,60 @@ public class ClientGroupController {
|
|||||||
|
|
||||||
@At("/info/?")
|
@At("/info/?")
|
||||||
@SaCheckLogin(type = StpClientUtil.TYPE)
|
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||||
public Result info(Long activityId){
|
public Result info(Long activityId) {
|
||||||
ActGroup group = dao.fetch(ActGroup.class, Cnd.where(ActGroup::getActivityId, "=", activityId));
|
Sql sql = Sqls.create("select * from act_group where activityId=@activityId").setParam("activityId", activityId);
|
||||||
|
sql.setCallback(Sqls.callback.map());
|
||||||
|
NutMap map = (NutMap) dao.execute(sql).getResult();
|
||||||
|
Sql sqlGroupUser = Sqls.create("""
|
||||||
|
SELECT
|
||||||
|
t1.*,
|
||||||
|
t2.userName,
|
||||||
|
t2.unitName,
|
||||||
|
t2.sex
|
||||||
|
FROM
|
||||||
|
`act_group_user` t1
|
||||||
|
LEFT JOIN act_user t2 ON t1.userId = t2.userId
|
||||||
|
WHERE t1.groupId=@groupId
|
||||||
|
""").setParam("groupId", map.getString("id"));
|
||||||
|
List<NutMap> groupUsers = clientActivityService.listMap(sqlGroupUser);
|
||||||
|
map.put("groupUsers", groupUsers);
|
||||||
|
NutMap leader = groupUsers.stream().filter(nutMap -> nutMap.getBoolean("isLeader")).findFirst().orElse(null);
|
||||||
|
map.put("isSelfLeader", "");
|
||||||
|
if (Lang.isNotEmpty(leader)) {
|
||||||
|
map.put("isSelfLeader", leader.getString("userId").equals(StpClientUtil.STP.getLoginIdAsString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.success(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@At("/apply-leader/?")
|
||||||
|
@AdaptBy(type = JsonAdaptor.class)
|
||||||
|
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||||
|
public Result applyLeader(Long groupId) {
|
||||||
|
clientActivityService.dao().update(ActGroupUser.class,
|
||||||
|
Chain.make("isLeader", true),
|
||||||
|
Cnd.where(ActGroupUser::getGroupId, "=", groupId)
|
||||||
|
.and(ActGroupUser::getUserId, "=", StpClientUtil.STP.getLoginIdAsLong()));
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@At("/list-team/?")
|
||||||
/**
|
|
||||||
* 查询团队成员
|
|
||||||
*/
|
|
||||||
@At("/list-team-user/?")
|
|
||||||
@SaCheckLogin(type = StpClientUtil.TYPE)
|
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||||
public Result listTeamUser(Long activityId){
|
public Result listTeam(Long activityId){
|
||||||
List<ActUser> list = dao.query(ActUser.class, Cnd.where(ActUser::getActivityId, "=", activityId).and(ActUser::getIsSignIn, "=", 1));
|
Sql sql = Sqls.create("""
|
||||||
|
SELECT
|
||||||
|
t1.*,
|
||||||
|
COUNT( t2.id ) isSignUp
|
||||||
|
FROM
|
||||||
|
activity_item t1
|
||||||
|
LEFT JOIN act_item_user t2 ON t1.id = t2.itemId
|
||||||
|
WHERE
|
||||||
|
t1.activityId = @activityId
|
||||||
|
GROUP BY
|
||||||
|
t1.id
|
||||||
|
""").setParam("activityId",activityId);
|
||||||
|
List<NutMap> list = clientActivityService.listMap(sql);
|
||||||
return Result.success(list);
|
return Result.success(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+35
-3
@@ -5,14 +5,18 @@ import com.budwk.app.base.result.Result;
|
|||||||
import com.budwk.app.client.module.activity.service.ClientItemService;
|
import com.budwk.app.client.module.activity.service.ClientItemService;
|
||||||
import com.budwk.app.client.module.activity.vo.ClientActivitySignVO;
|
import com.budwk.app.client.module.activity.vo.ClientActivitySignVO;
|
||||||
import com.budwk.app.client.module.activity.vo.ClientItemSignUpVO;
|
import com.budwk.app.client.module.activity.vo.ClientItemSignUpVO;
|
||||||
|
import com.budwk.app.module.activity.models.ActGroup;
|
||||||
import com.budwk.app.module.activity.models.ActUser;
|
import com.budwk.app.module.activity.models.ActUser;
|
||||||
import com.budwk.app.module.activity.models.ActivityItem;
|
import com.budwk.app.module.activity.models.ActivityItem;
|
||||||
import com.budwk.app.module.activity.models.ActivityItemUser;
|
import com.budwk.app.module.activity.models.ActivityItemUser;
|
||||||
import com.budwk.app.web.commons.auth.satoken.StpClientUtil;
|
import com.budwk.app.web.commons.auth.satoken.StpClientUtil;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
import org.nutz.dao.Dao;
|
import org.nutz.dao.Dao;
|
||||||
|
import org.nutz.dao.Sqls;
|
||||||
|
import org.nutz.dao.sql.Sql;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
import org.nutz.lang.util.NutMap;
|
||||||
import org.nutz.mvc.adaptor.JsonAdaptor;
|
import org.nutz.mvc.adaptor.JsonAdaptor;
|
||||||
import org.nutz.mvc.annotation.AdaptBy;
|
import org.nutz.mvc.annotation.AdaptBy;
|
||||||
import org.nutz.mvc.annotation.At;
|
import org.nutz.mvc.annotation.At;
|
||||||
@@ -41,6 +45,19 @@ public class ClientItemController {
|
|||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询出这个活动所有报名的人
|
||||||
|
* @param activityId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@At("/list-apply-user/?")
|
||||||
|
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||||
|
public Result listApplyUser(String activityId){
|
||||||
|
List<ActivityItemUser> userList = dao.query(ActivityItemUser.class, Cnd.where(ActivityItemUser::getActivityId, "=", activityId));
|
||||||
|
return Result.success(userList);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取项目列表
|
* 获取项目列表
|
||||||
*/
|
*/
|
||||||
@@ -56,8 +73,23 @@ public class ClientItemController {
|
|||||||
*/
|
*/
|
||||||
@At("/list-team-user/?")
|
@At("/list-team-user/?")
|
||||||
@SaCheckLogin(type = StpClientUtil.TYPE)
|
@SaCheckLogin(type = StpClientUtil.TYPE)
|
||||||
public Result listTeamUser(Long activityId){
|
public Result listTeamUser(Long activityId) {
|
||||||
List<ActUser> list = dao.query(ActUser.class, Cnd.where(ActUser::getActivityId, "=", activityId).and(ActUser::getIsSignIn, "=", 1));
|
Sql sql = Sqls.create("""
|
||||||
|
SELECT
|
||||||
|
t1.groupId,
|
||||||
|
t1.userId,
|
||||||
|
t2.activityId,
|
||||||
|
t3.userName,
|
||||||
|
t3.unitName,
|
||||||
|
t3.sex
|
||||||
|
FROM
|
||||||
|
`act_group_user` t1
|
||||||
|
LEFT JOIN act_group t2 ON t2.id = t1.groupId
|
||||||
|
LEFT JOIN act_user t3 ON t3.userId = t1.userId
|
||||||
|
WHERE
|
||||||
|
t2.activityId = @activityId
|
||||||
|
""").setParam("activityId", activityId);
|
||||||
|
List<NutMap> list = clientItemService.listMap(sql);
|
||||||
return Result.success(list);
|
return Result.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +98,7 @@ public class ClientItemController {
|
|||||||
*/
|
*/
|
||||||
@At("/list-signup-user")
|
@At("/list-signup-user")
|
||||||
@SaCheckLogin
|
@SaCheckLogin
|
||||||
public Result listSignUpUser(Long activityId,Long itemId) {
|
public Result listSignUpUser(Long activityId, Long itemId) {
|
||||||
List<ActivityItemUser> itemUsers = dao.query(ActivityItemUser.class, Cnd.where(ActivityItemUser::getActivityId, "=", activityId).and(ActivityItemUser::getItemId, "=", itemId));
|
List<ActivityItemUser> itemUsers = dao.query(ActivityItemUser.class, Cnd.where(ActivityItemUser::getActivityId, "=", activityId).and(ActivityItemUser::getItemId, "=", itemId));
|
||||||
return Result.success(itemUsers);
|
return Result.success(itemUsers);
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-2
@@ -3,6 +3,7 @@ package com.budwk.app.client.module.activity.service.impl;
|
|||||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||||
import com.budwk.app.client.module.activity.service.ClientItemService;
|
import com.budwk.app.client.module.activity.service.ClientItemService;
|
||||||
import com.budwk.app.client.module.activity.vo.ClientItemSignUpVO;
|
import com.budwk.app.client.module.activity.vo.ClientItemSignUpVO;
|
||||||
|
import com.budwk.app.module.activity.models.Activity;
|
||||||
import com.budwk.app.module.activity.models.ActivityItemUser;
|
import com.budwk.app.module.activity.models.ActivityItemUser;
|
||||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
@@ -10,6 +11,8 @@ import org.nutz.dao.Dao;
|
|||||||
import org.nutz.ioc.aop.Aop;
|
import org.nutz.ioc.aop.Aop;
|
||||||
import org.nutz.ioc.loader.annotation.IocBean;
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@IocBean(args = {"refer:dao"})
|
@IocBean(args = {"refer:dao"})
|
||||||
@@ -21,17 +24,24 @@ public class ClientItemServiceImpl extends BaseServiceImpl<ActivityItemUser> imp
|
|||||||
@Override
|
@Override
|
||||||
@Aop(TransAop.READ_COMMITTED)
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
public void signUp(ClientItemSignUpVO signVO) {
|
public void signUp(ClientItemSignUpVO signVO) {
|
||||||
|
Activity activity = dao().fetch(Activity.class, Cnd.where(Activity::getId, "=", signVO.getActivityId()));
|
||||||
|
if (activity.getItemEndTime().isBefore(LocalDateTime.now())){
|
||||||
|
throw new RuntimeException("项目报名已结束!");
|
||||||
|
}
|
||||||
// 删除掉之前的
|
// 删除掉之前的
|
||||||
clear(Cnd.where(ActivityItemUser::getActivityId, "=", signVO.getActivityId())
|
clear(Cnd.where(ActivityItemUser::getActivityId, "=", signVO.getActivityId())
|
||||||
.and(ActivityItemUser::getGroupId, "=", signVO.getGroupId())
|
.and(ActivityItemUser::getGroupId, "=", signVO.getGroupId())
|
||||||
.and(ActivityItemUser::getItemId, "=", signVO.getItemId())
|
.and(ActivityItemUser::getItemId, "=", signVO.getItemId())
|
||||||
);
|
);
|
||||||
|
|
||||||
List<ActivityItemUser> userList = signVO.getUserList();
|
List<ActivityItemUser> userList = new ArrayList<>();
|
||||||
for (ActivityItemUser itemUser : userList) {
|
for (Long userId : signVO.getUserList()) {
|
||||||
|
ActivityItemUser itemUser = new ActivityItemUser();
|
||||||
itemUser.setActivityId(signVO.getActivityId());
|
itemUser.setActivityId(signVO.getActivityId());
|
||||||
itemUser.setItemId(signVO.getItemId());
|
itemUser.setItemId(signVO.getItemId());
|
||||||
itemUser.setGroupId(signVO.getGroupId());
|
itemUser.setGroupId(signVO.getGroupId());
|
||||||
|
itemUser.setUserId(userId);
|
||||||
|
userList.add(itemUser);
|
||||||
}
|
}
|
||||||
insert(userList);
|
insert(userList);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -14,6 +14,6 @@ public class ClientItemSignUpVO {
|
|||||||
|
|
||||||
private Long groupId;
|
private Long groupId;
|
||||||
|
|
||||||
private List<ActivityItemUser> userList;
|
private List<Long> userList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+81
@@ -0,0 +1,81 @@
|
|||||||
|
package com.budwk.app.module.activity.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import com.budwk.app.base.result.Result;
|
||||||
|
import com.budwk.app.module.activity.models.ActGroup;
|
||||||
|
import com.budwk.app.module.activity.models.Activity;
|
||||||
|
import com.budwk.app.module.activity.service.ActivityManageService;
|
||||||
|
import com.budwk.app.module.activity.vo.page.ActScoreEnterPageForm;
|
||||||
|
import com.budwk.app.module.activity.vo.page.ActSignInUserPageForm;
|
||||||
|
import org.nutz.dao.Cnd;
|
||||||
|
import org.nutz.dao.Dao;
|
||||||
|
import org.nutz.dao.Sqls;
|
||||||
|
import org.nutz.dao.sql.Sql;
|
||||||
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
|
import org.nutz.ioc.loader.annotation.IocBean;
|
||||||
|
import org.nutz.lang.util.NutMap;
|
||||||
|
import org.nutz.mvc.annotation.At;
|
||||||
|
import org.nutz.mvc.annotation.Ok;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhf
|
||||||
|
* @date 2025/4/29 15:56
|
||||||
|
* @description 成绩录入
|
||||||
|
*/
|
||||||
|
@IocBean
|
||||||
|
@At("/platform/activity/scoreEnter")
|
||||||
|
@Ok("json:full")
|
||||||
|
public class ActScoreEnterController {
|
||||||
|
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Dao dao;
|
||||||
|
@Inject
|
||||||
|
private ActivityManageService activityService;
|
||||||
|
|
||||||
|
@At("")
|
||||||
|
@SaCheckPermission("activity.scoreEnter")
|
||||||
|
@Ok("beetl:/platform/activity/scoreEnter/index.html")
|
||||||
|
public void index() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@At()
|
||||||
|
@SaCheckPermission("activity.scoreEnter")
|
||||||
|
public Result getActivityOptions(Integer year) {
|
||||||
|
return Result.success(activityService.dao().query(Activity.class, Cnd.NEW().andEX("YEAR(startTime)", "=", year)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@At()
|
||||||
|
@SaCheckPermission("activity.scoreEnter")
|
||||||
|
public Result pageData(ActScoreEnterPageForm pageForm) {
|
||||||
|
|
||||||
|
Sql sql = Sqls.create("""
|
||||||
|
SELECT
|
||||||
|
t1.*
|
||||||
|
FROM
|
||||||
|
`activity_item` t1
|
||||||
|
WHERE t1.activityId=@id
|
||||||
|
ORDER BY t1.sort asc
|
||||||
|
""").setParam("id", pageForm.getActivityId());
|
||||||
|
|
||||||
|
return Result.success(activityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(),sql));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取分组列表
|
||||||
|
* @param activityId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@At()
|
||||||
|
@SaCheckPermission("activity.scoreEnter")
|
||||||
|
public Result getGroupList(Long activityId){
|
||||||
|
List<ActGroup> groupList = activityService.dao().query(ActGroup.class, Cnd.where(ActGroup::getActivityId, "=", activityId));
|
||||||
|
return Result.success(groupList);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -50,6 +50,16 @@ public class Activity extends BaseModel {
|
|||||||
@ColDefine(type = ColType.DATETIME)
|
@ColDefine(type = ColType.DATETIME)
|
||||||
private LocalDateTime signEndTime;
|
private LocalDateTime signEndTime;
|
||||||
|
|
||||||
|
@Comment("项目报名开始时间")
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.DATETIME)
|
||||||
|
private LocalDateTime itemStartTime;
|
||||||
|
|
||||||
|
@Comment("项目报名结束时间")
|
||||||
|
@Column
|
||||||
|
@ColDefine(type = ColType.DATETIME)
|
||||||
|
private LocalDateTime itemEndTime;
|
||||||
|
|
||||||
@Comment("主办单位")
|
@Comment("主办单位")
|
||||||
@Column
|
@Column
|
||||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.budwk.app.module.activity.models;
|
||||||
|
|
||||||
|
import com.budwk.app.base.model.BaseModel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.nutz.dao.entity.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhf
|
||||||
|
* @date 2025/4/29 16:41
|
||||||
|
* @description 活动成绩
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Table("activity_item")
|
||||||
|
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||||
|
@Comment("活动成绩")
|
||||||
|
@Data
|
||||||
|
public class ActivityItemScore extends BaseModel {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Comment("ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("活动ID")
|
||||||
|
@ColDefine(type = ColType.INT)
|
||||||
|
private Long activityId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package com.budwk.app.module.activity.vo.page;
|
||||||
|
|
||||||
|
import com.budwk.app.base.page.PageForm;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhf
|
||||||
|
* @date 2025/4/29 16:08
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class ActScoreEnterPageForm extends PageForm {
|
||||||
|
|
||||||
|
// 活动ID
|
||||||
|
private Long activityId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ const addOrUpdate = {
|
|||||||
<!-- <el-step title="项目信息" icon="el-icon-upload"></el-step>-->
|
<!-- <el-step title="项目信息" icon="el-icon-upload"></el-step>-->
|
||||||
<!-- </el-steps>-->
|
<!-- </el-steps>-->
|
||||||
<!-- class="mt-3"-->
|
<!-- class="mt-3"-->
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="140px">
|
||||||
<el-form-item label="标题" prop="title">
|
<el-form-item label="标题" prop="title">
|
||||||
<el-input v-model="form.title" placeholder="请输入标题"></el-input>
|
<el-input v-model="form.title" placeholder="请输入标题"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -43,6 +43,22 @@ const addOrUpdate = {
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<el-row type="flex" :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="项目报名开始时间" prop="itemStartTime">
|
||||||
|
<el-date-picker v-model="form.itemStartTime" type="datetime"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
placeholder="请选择项目报名开始时间"></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="项目报名结束时间" prop="itemEndTime">
|
||||||
|
<el-date-picker v-model="form.itemEndTime" type="datetime"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
placeholder="请选择项目报名结束时间"></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
<el-form-item label="主办单位" prop="hostUnit">
|
<el-form-item label="主办单位" prop="hostUnit">
|
||||||
<el-input v-model="form.hostUnit" placeholder="请输入主办单位"></el-input>
|
<el-input v-model="form.hostUnit" placeholder="请输入主办单位"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -95,6 +111,12 @@ const addOrUpdate = {
|
|||||||
signEndTime: [
|
signEndTime: [
|
||||||
{required: true, message: '请选择报名结束时间', trigger: ['blur', 'change']}
|
{required: true, message: '请选择报名结束时间', trigger: ['blur', 'change']}
|
||||||
],
|
],
|
||||||
|
itemStartTime: [
|
||||||
|
{required: true, message: '请选择项目报名开始时间', trigger: ['blur', 'change']}
|
||||||
|
],
|
||||||
|
itemEndTime: [
|
||||||
|
{required: true, message: '请选择项目报名结束时间', trigger: ['blur', 'change']}
|
||||||
|
],
|
||||||
hostUnit: [{required: true, message: '请输入主办单位', trigger: ['blur', 'change']}],
|
hostUnit: [{required: true, message: '请输入主办单位', trigger: ['blur', 'change']}],
|
||||||
coHostUnit: [{required: true, message: '请输入承办单位', trigger: ['blur', 'change']}],
|
coHostUnit: [{required: true, message: '请输入承办单位', trigger: ['blur', 'change']}],
|
||||||
contact: [{required: true, message: '请输入联系人', trigger: ['blur', 'change']}],
|
contact: [{required: true, message: '请输入联系人', trigger: ['blur', 'change']}],
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
const addOrUpdate = {
|
||||||
|
template: /*language=HTML*/ `
|
||||||
|
<el-dialog title="录入成绩" :visible.sync="visible" width="70%">
|
||||||
|
|
||||||
|
<el-table show-overflow-tooltip :data="tableData" height="500">
|
||||||
|
<el-table-column label="序号" type="index" header-align="center" align="center"
|
||||||
|
width="50"></el-table-column>
|
||||||
|
<el-table-column label="团队名称" prop="groupId">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-select v-model="scope.row.groupId" placeholder="请选择" style="width: 100%">
|
||||||
|
<el-option v-for="item in groupList" :key="item.id" :label="item.groupName"
|
||||||
|
:value="item.id"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="成绩" prop="score">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input-number v-model="scope.row.score"></el-input-number>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="得分" prop="fraction">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input-number v-model="scope.row.fraction"></el-input-number>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" fixed="right" width="150">
|
||||||
|
<template slot="header" slot-scope="scope">
|
||||||
|
<el-button type="primary" size="mini" @click="tableData.push({})">添加</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="visible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="onSubmit">确定</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
`,
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
title: '',
|
||||||
|
visible: false,
|
||||||
|
infoData: {},
|
||||||
|
tableData: [],
|
||||||
|
groupList: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onOpen(row) {
|
||||||
|
this.infoData = row
|
||||||
|
this.getGroupList()
|
||||||
|
this.visible = true
|
||||||
|
|
||||||
|
},
|
||||||
|
getGroupList() {
|
||||||
|
$.get('/platform/activity/scoreEnter/getGroupList', {activityId: this.infoData.activityId}).then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.groupList = res.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onSubmit() {
|
||||||
|
$.post('/platform/activity/scoreEnter/addOrUpdate', {
|
||||||
|
activityId: this.infoData.activityId,
|
||||||
|
itemId: this.infoData.id,
|
||||||
|
scores: JSON.stringify(this.tableData)
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.$message.success('保存成功')
|
||||||
|
this.visible = false
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
<!--#
|
||||||
|
layout("/layouts/platform_1.html"){
|
||||||
|
#-->
|
||||||
|
<div id="app">
|
||||||
|
<el-card shadow="never">
|
||||||
|
<div class="search">
|
||||||
|
|
||||||
|
<div class="search-item">
|
||||||
|
<div class="search-item-label">年度</div>
|
||||||
|
<div class="search-item-option">
|
||||||
|
<el-date-picker
|
||||||
|
:clearable="false"
|
||||||
|
placeholder="选择年"
|
||||||
|
style="width: 100%"
|
||||||
|
@change="getActivityOptions"
|
||||||
|
type="year"
|
||||||
|
v-model="pageForm.year"
|
||||||
|
value-format="yyyy"
|
||||||
|
></el-date-picker>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="search-item">
|
||||||
|
<div class="search-item-label">所属活动</div>
|
||||||
|
<div class="search-item-option">
|
||||||
|
<el-select v-model="pageForm.activityId" placeholder="请选择活动">
|
||||||
|
<el-option
|
||||||
|
v-for="item in activityOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.title"
|
||||||
|
:value="item.id">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="search-query">
|
||||||
|
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
<el-card shadow="never" class="mt-3">
|
||||||
|
<el-table v-loading="tableLoading" show-overflow-tooltip :data="tableData">
|
||||||
|
<el-table-column label="序号" prop="index" header-align="center" align="center" width="50">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="项目名称" prop="name"></el-table-column>
|
||||||
|
<el-table-column label="操作" width="200">
|
||||||
|
<template slot-scope="{row}">
|
||||||
|
<el-button type="text" @click="$refs.addOrUpdateRef.onOpen(row)">录入成绩</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!--#include("/layouts/pagination.html"){}#-->
|
||||||
|
</el-card>
|
||||||
|
<add-or-update ref="addOrUpdateRef" @refresh="doSearch"></add-or-update>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
<!--#include('addOrUpdate.js'){}#-->
|
||||||
|
new Vue({
|
||||||
|
el: "#app",
|
||||||
|
mixins: [initTableMixins],
|
||||||
|
components: {
|
||||||
|
"add-or-update": addOrUpdate,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
pageForm: {
|
||||||
|
year: new Date().getFullYear() + ""
|
||||||
|
},
|
||||||
|
activityOptions: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getActivityOptions() {
|
||||||
|
$.post("/platform/activity/scoreEnter/getActivityOptions", {year: this.pageForm.year}).then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
if (res.data && res.data.length > 0) {
|
||||||
|
this.$set(this.pageForm, "activityId", res.data[0].id)
|
||||||
|
} else {
|
||||||
|
this.$set(this.pageForm, "activityId", "")
|
||||||
|
}
|
||||||
|
this.activityOptions = res.data;
|
||||||
|
this.doSearch()
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getActivityOptions()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--#
|
||||||
|
}
|
||||||
|
#-->
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
v-for="project in itemOptions"
|
v-for="project in itemOptions"
|
||||||
:key="project.id"
|
:key="project.id"
|
||||||
class="project-card"
|
class="project-card"
|
||||||
:class="{'project-card--registered': registrationStatus[project.id]?.length}"
|
:class="{'project-card--registered': registrationStatus.get(project.id)?.length}"
|
||||||
@click="selectProject(project.id)"
|
@click="selectProject(project.id)"
|
||||||
>
|
>
|
||||||
<view class="project-card__content">
|
<view class="project-card__content">
|
||||||
@@ -24,14 +24,14 @@
|
|||||||
<view class="project-card__desc">{{ project.description }}</view>
|
<view class="project-card__desc">{{ project.description }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="project-card__status">
|
<view class="project-card__status">
|
||||||
<t-tag v-if="registrationStatus[project.id]?.length" theme="success" variant="light-outline">
|
<t-tag v-if="registrationStatus.get(project.id)?.length" theme="success" variant="light-outline">
|
||||||
已报名 {{ registrationStatus[project.id]?.length }}人
|
已报名 {{ registrationStatus.get(project.id)?.length }}人
|
||||||
</t-tag>
|
</t-tag>
|
||||||
<view v-else class="project-card__action">
|
<view v-else class="project-card__action">
|
||||||
<t-icon name="chevron-right" color="#999"/>
|
<t-icon name="chevron-right" color="#999"/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="registrationStatus[project.id]?.length" class="project-card__checkmark">
|
<view v-if="registrationStatus.get(project.id)?.length" class="project-card__checkmark">
|
||||||
<t-icon name="check" color="#52c41a"/>
|
<t-icon name="check" color="#52c41a"/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -53,24 +53,19 @@
|
|||||||
<t-checkbox-group v-model="selectedMemberIds">
|
<t-checkbox-group v-model="selectedMemberIds">
|
||||||
<view
|
<view
|
||||||
v-for="member in teamMembers"
|
v-for="member in teamMembers"
|
||||||
:key="member.id"
|
:key="member.userId"
|
||||||
>
|
>
|
||||||
<t-checkbox
|
<t-checkbox
|
||||||
:value="member.id"
|
:value="member.userId"
|
||||||
:label="member.userName"
|
:label="member.userName+'-'+member.sex"
|
||||||
:content="member.unitName"
|
:content="member.unitName"
|
||||||
:disabled="registrationStatus[selectedItemId]?.includes(member.id)"
|
|
||||||
icon-size="20px"
|
icon-size="20px"
|
||||||
/>
|
/>
|
||||||
<view class="member-status" v-if="registrationStatus[selectedItemId]?.includes(member.id)">
|
|
||||||
已报名
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</t-checkbox-group>
|
</t-checkbox-group>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="picker-footer">
|
<view class="picker-footer">
|
||||||
<t-button block theme="primary" @click="submitRegistration" :disabled="!selectedMemberIds.length">
|
<t-button block theme="primary" @click="submitRegistration" >
|
||||||
确认报名 ({{ selectedMemberIds.length }}人)
|
确认报名 ({{ selectedMemberIds.length }}人)
|
||||||
</t-button>
|
</t-button>
|
||||||
</view>
|
</view>
|
||||||
@@ -116,14 +111,15 @@ const teamMembers = ref([]);
|
|||||||
|
|
||||||
onLoad((option) => {
|
onLoad((option) => {
|
||||||
if (option.id) {
|
if (option.id) {
|
||||||
selectActId.value = option.id;
|
selectActId.value = Number(option.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await listActs()
|
await listActs()
|
||||||
await listItems();
|
await listItems();
|
||||||
listTeamUser()
|
await listTeamUser();
|
||||||
// fetchRegistrationStatus();
|
await getApplyUsers();
|
||||||
|
fetchRegistrationStatus();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 选中的团队成员
|
// 选中的团队成员
|
||||||
@@ -132,8 +128,7 @@ const selectedMemberIds = ref([]);
|
|||||||
// 成员选择弹窗显示状态
|
// 成员选择弹窗显示状态
|
||||||
const showMemberPicker = ref(false);
|
const showMemberPicker = ref(false);
|
||||||
|
|
||||||
// 当前项目的报名状态
|
|
||||||
const registrationStatus = ref({});
|
|
||||||
|
|
||||||
// 获取活动列表
|
// 获取活动列表
|
||||||
async function listActs() {
|
async function listActs() {
|
||||||
@@ -146,9 +141,9 @@ async function listActs() {
|
|||||||
label: item.title
|
label: item.title
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if(selectActId.value === null && data.length){
|
// if(selectActId.value === null && data.length){
|
||||||
selectActId.value = data[0].id
|
// selectActId.value = data[0].id
|
||||||
}
|
// }
|
||||||
} else {
|
} else {
|
||||||
Toast.error(msg)
|
Toast.error(msg)
|
||||||
}
|
}
|
||||||
@@ -171,61 +166,80 @@ async function listItems() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取团队成员
|
// 获取团队成员
|
||||||
async function listTeamUser(){
|
async function listTeamUser() {
|
||||||
try {
|
try {
|
||||||
const {code, data, msg} = await request.get('/client/item/list-team-user/'+selectActId.value)
|
const {code, data, msg} = await request.get('/client/item/list-team-user/' + selectActId.value)
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
teamMembers.value = data;
|
teamMembers.value = data;
|
||||||
}else{
|
} else {
|
||||||
Toast.error(msg)
|
Toast.error(msg)
|
||||||
}
|
}
|
||||||
}catch (e){
|
} catch (e) {
|
||||||
Toast.error(msg)
|
Toast.error(msg)
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 当前项目的报名状态
|
||||||
|
const registrationStatus = ref(new Map());
|
||||||
// 获取报名状态 - 使用静态数据
|
// 获取报名状态 - 使用静态数据
|
||||||
const fetchRegistrationStatus = async () => {
|
const fetchRegistrationStatus = () => {
|
||||||
|
|
||||||
|
const resultMap = selectedMemberList.value.reduce((acc, item) => {
|
||||||
|
const key = item.itemId;
|
||||||
|
if (!acc.has(key)) {
|
||||||
|
acc.set(key, []);
|
||||||
|
}
|
||||||
|
acc.get(key).push(item);
|
||||||
|
return acc;
|
||||||
|
}, new Map());
|
||||||
|
registrationStatus.value = resultMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 选择项目
|
// 选择项目
|
||||||
const selectProject = (projectId) => {
|
const selectProject = (projectId) => {
|
||||||
selectedItemId.value = projectId;
|
selectedItemId.value = projectId;
|
||||||
selectedMemberIds.value = [];
|
selectedMemberIds.value = selectedMemberList.value.filter(v => v.itemId === projectId).map(v => v.userId)
|
||||||
|
|
||||||
showMemberPicker.value = true;
|
showMemberPicker.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const selectedMemberList = ref([])
|
||||||
|
// 每个项目报名的user
|
||||||
|
const getApplyUsers = async () => {
|
||||||
|
try {
|
||||||
|
const {code, data, msg} = await useRequest().post('/client/item/list-apply-user/' + selectActId.value)
|
||||||
|
if (code === 0) {
|
||||||
|
selectedMemberList.value = data
|
||||||
|
} else {
|
||||||
|
Toast.error(msg)
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
Toast.error(e.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 提交报名 - 使用静态数据模拟
|
// 提交报名 - 使用静态数据模拟
|
||||||
const submitRegistration = async () => {
|
const submitRegistration = async () => {
|
||||||
if (!selectedMemberIds.value.length) {
|
|
||||||
Toast.warning('请选择团队成员');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log(selectedMemberIds.value)
|
let data = {}
|
||||||
console.log(selectedItemId.value)
|
data.activityId = selectActId.value
|
||||||
console.log(selectActId.value)
|
data.itemId = selectedItemId.value
|
||||||
|
data.userList = selectedMemberIds.value
|
||||||
const teamUser = teamMembers.value.filter(v=>selectedMemberIds.value.includes(v.id))
|
const {code, msg} = await useRequest().post('/client/item/sign-up', {...data})
|
||||||
|
if (code === 0) {
|
||||||
// const {code, msg} = await request.post('/client/item/sign-up', {
|
Toast.success('报名成功')
|
||||||
// activityId: selectActId.value,
|
showMemberPicker.value = false;
|
||||||
// itemId: selectedItemId.value,
|
selectedMemberIds.value = []
|
||||||
// userList: selectedMemberIds.value
|
await getApplyUsers();
|
||||||
// })
|
fetchRegistrationStatus();
|
||||||
// if (code === 0) {
|
} else {
|
||||||
// Toast.success('报名成功')
|
Toast.error(msg)
|
||||||
// showMemberPicker.value = false;
|
}
|
||||||
// selectedMemberIds.value = []
|
} catch (e) {
|
||||||
// }else{
|
|
||||||
// Toast.error(msg)
|
|
||||||
// }
|
|
||||||
}catch (e){
|
|
||||||
Toast.error(e.message)
|
Toast.error(e.message)
|
||||||
console.error(e)
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,118 +1,109 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="page-container" :style="{ backgroundColor: '#f7f7f9' }">
|
<view class="page-container">
|
||||||
<t-sticky>
|
<view v-if="actList&&actList?.length>0">
|
||||||
<t-dropdown-menu class="top-dropdown-menu">
|
<t-sticky>
|
||||||
<t-dropdown-item :options="actOptions" :value="pageForm.actId" @change="actChange" />
|
<t-dropdown-menu class="top-dropdown-menu">
|
||||||
</t-dropdown-menu>
|
<t-dropdown-item :options="actOptions" :value="pageForm.actId" @change="actChange"/>
|
||||||
</t-sticky>
|
</t-dropdown-menu>
|
||||||
|
</t-sticky>
|
||||||
|
<!-- 团队卡片 -->
|
||||||
|
<div class="content-area">
|
||||||
|
<div class="team-card">
|
||||||
|
<div class="team-header">
|
||||||
|
<div class="team-logo">
|
||||||
|
<i class="bi bi-people-fill" v-if="!team.logoUrl"></i>
|
||||||
|
<img :src="team.logoUrl" alt="团队logo" v-if="team.logoUrl">
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 团队卡片 -->
|
<div class="team-basic-info">
|
||||||
<div class="content-area">
|
<div class="team-name">{{ team.groupName }}</div>
|
||||||
<div class="team-card">
|
<div class="team-meta">创建于 {{moment(team.createdAt).format("YYYY-MM-DD HH:mm")}}</div>
|
||||||
<div class="team-header">
|
|
||||||
<div class="team-logo">
|
|
||||||
<i class="bi bi-people-fill" v-if="!team.logoUrl"></i>
|
|
||||||
<img :src="team.logoUrl" alt="团队logo" v-if="team.logoUrl">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="team-basic-info">
|
|
||||||
<div class="team-name">{{ team.name }}</div>
|
|
||||||
<div class="team-meta">创建于 {{ team.createdDate }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="team-stats">
|
|
||||||
<div class="stat-item">
|
|
||||||
<div class="stat-icon"><i class="bi bi-people"></i></div>
|
|
||||||
<div class="stat-content">
|
|
||||||
<div class="stat-value">{{ team.memberCount }}</div>
|
|
||||||
<div class="stat-label">成员</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-divider"></div>
|
|
||||||
<div class="stat-item">
|
<div class="team-stats">
|
||||||
<div class="stat-icon"><i class="bi bi-trophy"></i></div>
|
<div class="stat-item">
|
||||||
<div class="stat-content">
|
<div class="stat-icon"><i class="bi bi-people"></i></div>
|
||||||
<div class="stat-value">{{ team.rank }}</div>
|
<div class="stat-content">
|
||||||
<div class="stat-label">排名</div>
|
<div class="stat-value">{{ team.groupUsers?.length }}</div>
|
||||||
|
<div class="stat-label">成员</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="stat-divider"></div>
|
||||||
</div>
|
<div class="stat-item">
|
||||||
|
<div class="stat-icon"><i class="bi bi-trophy"></i></div>
|
||||||
<div v-if="team.description" class="team-desc-toggle" @click="showDesc = !showDesc">
|
<div class="stat-content">
|
||||||
<span>团队介绍</span>
|
<div class="stat-value">{{ team.totalRank ? team.totalRank : '--' }}</div>
|
||||||
<i class="bi" :class="showDesc ? 'bi-chevron-up' : 'bi-chevron-down'"></i>
|
<div class="stat-label">排名</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="showDesc && team.description" class="team-desc">
|
|
||||||
<i class="bi bi-quote"></i>
|
|
||||||
{{ team.description }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 项目报名按钮 -->
|
|
||||||
<div class="action-section">
|
|
||||||
<t-button block theme="danger" size="large" class="register-btn" @click="goToEventRegistration">
|
|
||||||
参与项目报名
|
|
||||||
</t-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 团队成员列表 -->
|
|
||||||
<div class="members-section">
|
|
||||||
<div class="section-header">
|
|
||||||
<div class="section-title">
|
|
||||||
<i class="bi bi-people-fill"></i>
|
|
||||||
团队成员
|
|
||||||
</div>
|
|
||||||
<div class="section-badge">{{ team.memberCount }}</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="member-grid">
|
|
||||||
<div class="member-grid-item" v-for="member in team.members" :key="member.id">
|
|
||||||
<div class="member-name">
|
|
||||||
{{ member.name }}
|
|
||||||
<t-tag theme="danger" size="small" v-if="member.role === 'leader'">队长</t-tag>
|
|
||||||
</div>
|
|
||||||
<div class="member-details">
|
|
||||||
<span><i class="bi bi-gender-ambiguous"></i> {{ member.gender }}</span>
|
|
||||||
<span><i class="bi bi-building"></i> {{ member.organization }}</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 当前角色与申请队长 -->
|
<!-- 项目报名按钮 -->
|
||||||
<div class="role-section">
|
<div class="action-section" v-if="team.isSelfLeader">
|
||||||
<div class="role-card" v-if="currentUserRole === 'leader'">
|
<t-button block theme="danger" size="large" class="register-btn" @click="goToEventRegistration">
|
||||||
<div class="role-icon">
|
参与项目报名
|
||||||
<i class="bi bi-trophy"></i>
|
</t-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 团队成员列表 -->
|
||||||
|
<div class="members-section">
|
||||||
|
<div class="section-header">
|
||||||
|
<div class="section-title">
|
||||||
|
<i class="bi bi-people-fill"></i>
|
||||||
|
团队成员
|
||||||
</div>
|
</div>
|
||||||
<div class="role-info">
|
<div class="section-badge">{{ team.groupUsers.length }}</div>
|
||||||
<div class="role-title">您是队长</div>
|
</div>
|
||||||
<div class="role-desc">拥有团队所有管理权限</div>
|
<div class="member-grid">
|
||||||
|
<div class="member-grid-item" v-for="member in team.groupUsers" :key="member.id">
|
||||||
|
<div class="member-name">
|
||||||
|
{{ member.userName }}
|
||||||
|
<t-tag theme="danger" size="small" v-if="member.isLeader">队长</t-tag>
|
||||||
|
</div>
|
||||||
|
<div class="member-details">
|
||||||
|
<span><i class="bi bi-gender-ambiguous"></i>{{ member.sex }}</span>
|
||||||
|
<span><i class="bi bi-building"></i>{{ member.unitName }}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else>
|
<!-- 当前角色与申请队长 -->
|
||||||
<div class="role-card">
|
<div class="role-section">
|
||||||
|
<div class="role-card" v-if="team.isSelfLeader">
|
||||||
<div class="role-icon">
|
<div class="role-icon">
|
||||||
<i class="bi bi-person"></i>
|
<i class="bi bi-trophy"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="role-info">
|
<div class="role-info">
|
||||||
<div class="role-title">您是普通成员</div>
|
<div class="role-title">您是队长</div>
|
||||||
<div class="role-desc">申请成为队长可获得更多权限</div>
|
<div class="role-desc">拥有团队所有管理权限</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<t-button block
|
|
||||||
class="leader-apply-btn"
|
<div v-else>
|
||||||
theme="danger"
|
<div class="role-card">
|
||||||
variant="outline"
|
<div class="role-icon">
|
||||||
@click="leaderConfirmVisible = true">
|
<i class="bi bi-person"></i>
|
||||||
申请成为队长
|
</div>
|
||||||
</t-button>
|
<div class="role-info">
|
||||||
|
<div class="role-title">您是普通成员</div>
|
||||||
|
<div class="role-desc">申请成为队长可获得更多权限</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<t-button block
|
||||||
|
class="leader-apply-btn"
|
||||||
|
theme="danger"
|
||||||
|
variant="outline"
|
||||||
|
@click="leaderConfirmVisible = true">
|
||||||
|
申请成为队长
|
||||||
|
</t-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</view>
|
||||||
|
<view v-else>暂无团队</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<t-dialog
|
<t-dialog
|
||||||
@@ -135,21 +126,36 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</t-dialog>
|
</t-dialog>
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {ref, reactive} from "vue";
|
import {ref, reactive, onMounted, computed} from 'vue';
|
||||||
|
import {Dialog, Toast} from 'tdesign-mobile-vue';
|
||||||
|
import {useRequest} from "@/utils/request";
|
||||||
|
import moment from "moment";
|
||||||
|
import {onLoad} from "@dcloudio/uni-app";
|
||||||
|
|
||||||
const actOptions = ref([])
|
const actList = ref([])
|
||||||
const showDesc = ref(false)
|
const showDesc = ref(false)
|
||||||
|
|
||||||
|
const actOptions = computed(() => {
|
||||||
|
return actList.value.map(item => {
|
||||||
|
return {
|
||||||
|
value: item.id,
|
||||||
|
label: item.title
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
const pageForm = reactive({
|
const pageForm = reactive({
|
||||||
actId: null,
|
actId: null,
|
||||||
})
|
})
|
||||||
|
|
||||||
const teamId = ''
|
const teamId = ''
|
||||||
|
|
||||||
const team = reactive({
|
let team = ref({
|
||||||
id: teamId,
|
id: teamId,
|
||||||
name: 'xx队',
|
name: 'xx队',
|
||||||
logoUrl: null,
|
logoUrl: null,
|
||||||
@@ -162,70 +168,79 @@ const team = reactive({
|
|||||||
description: 'xxxxxxxxxxxxxxxxxxx',
|
description: 'xxxxxxxxxxxxxxxxxxx',
|
||||||
|
|
||||||
// 团队成员
|
// 团队成员
|
||||||
members: [
|
groupUsers: []
|
||||||
{
|
|
||||||
id: '101',
|
|
||||||
name: '张伟',
|
|
||||||
role: 'leader',
|
|
||||||
gender: '男',
|
|
||||||
organization: '江苏体育学院',
|
|
||||||
avatar: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '102',
|
|
||||||
name: '李娜',
|
|
||||||
role: 'admin',
|
|
||||||
gender: '女',
|
|
||||||
organization: '南京体育局',
|
|
||||||
avatar: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '103',
|
|
||||||
name: '王强',
|
|
||||||
role: 'member',
|
|
||||||
gender: '男',
|
|
||||||
organization: '南京体育学院',
|
|
||||||
avatar: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '104',
|
|
||||||
name: '刘芳',
|
|
||||||
role: 'member',
|
|
||||||
gender: '女',
|
|
||||||
organization: '江苏大学',
|
|
||||||
avatar: null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '105',
|
|
||||||
name: '陈明',
|
|
||||||
role: 'member',
|
|
||||||
gender: '男',
|
|
||||||
organization: '苏州体育中心',
|
|
||||||
avatar: null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const currentUserRole = ref('')
|
|
||||||
// 申请成为队长弹框提示
|
// 申请成为队长弹框提示
|
||||||
const leaderConfirmVisible = ref(false)
|
const leaderConfirmVisible = ref(false)
|
||||||
|
|
||||||
function handleMenuOpened(){
|
const handleMenuOpened = () => {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleMenuClosed(){}
|
const handleMenuClosed = () => {
|
||||||
|
}
|
||||||
|
|
||||||
function actChange(val){
|
const actChange = (val) => {
|
||||||
console.log(val)
|
getListAct()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 申请成为队长
|
// 申请成为队长
|
||||||
function onLeaderConfirm(){
|
const onLeaderConfirm = async () => {
|
||||||
|
try {
|
||||||
|
pageForm.groupId = team.value.id
|
||||||
|
const {code, msg} = await useRequest().post('/client/group/apply-leader/' + team.value.id);
|
||||||
|
if (code === 0) {
|
||||||
|
Toast({message: '申请成功', theme: 'success'});
|
||||||
|
leaderConfirmVisible.value = false
|
||||||
|
} else {
|
||||||
|
Toast({message: msg, theme: 'error'});
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
Toast({message: e, theme: 'error'});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function goToEventRegistration(){}
|
// 点击参与项目报名
|
||||||
|
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
|
||||||
|
} else {
|
||||||
|
Toast({message: msg, theme: 'error'});
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
Toast({message: e, theme: 'error'});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 查询自己已经签到的活动
|
||||||
|
const getListAct = async () => {
|
||||||
|
try {
|
||||||
|
const {code, msg, data} = await useRequest().post('/client/group/list-act');
|
||||||
|
if (code === 0) {
|
||||||
|
actList.value = data;
|
||||||
|
if (data.length > 0) {
|
||||||
|
pageForm.actId = data[0].id;
|
||||||
|
await getTeamInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
Toast({message: error, theme: 'error'});
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// 初始化
|
||||||
|
onLoad(() => {
|
||||||
|
getListAct();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
|
|||||||
Reference in New Issue
Block a user