finished almost all pages of student and teacher.

DEV
PeterAlbus 3 years ago
parent 4a48b675ac
commit 8046e1ec63

@ -23,4 +23,5 @@ public class AdminController
{ {
return new ModelAndView("/jsp/admin/home.jsp"); return new ModelAndView("/jsp/admin/home.jsp");
} }
} }

@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* The type Student controller. * The type Student controller.
@ -70,7 +71,6 @@ public class StudentController
ModelAndView modelAndView=PrincipalUtil.getBasicModelAndView(); ModelAndView modelAndView=PrincipalUtil.getBasicModelAndView();
Subject subject = SecurityUtils.getSubject(); Subject subject = SecurityUtils.getSubject();
User user=(User)subject.getPrincipal(); User user=(User)subject.getPrincipal();
modelAndView.addObject("userId",user.getUserId());
Activity activity= activityService.getActivityById(activityId); Activity activity= activityService.getActivityById(activityId);
Participate participate=participateService.getByUserAndActivity(user.getUserId(), activityId); Participate participate=participateService.getByUserAndActivity(user.getUserId(), activityId);
if(participate==null) if(participate==null)
@ -104,6 +104,8 @@ public class StudentController
} }
if(participate.getFinished()) if(participate.getFinished())
{ {
Map<String,Double> map=groupService.getScore(group.getGroupId());
modelAndView.addObject("score",map);
modelAndView.setViewName("/jsp/student/activityResult.jsp"); modelAndView.setViewName("/jsp/student/activityResult.jsp");
} }
modelAndView.addObject("activity",activity); modelAndView.addObject("activity",activity);
@ -176,4 +178,26 @@ public class StudentController
return "error"; return "error";
} }
} }
@ResponseBody
@RequestMapping("/deleteParticipate")
public String deleteActivity(Long participationId)
{
try
{
int result=participateService.deleteParticipate(participationId);
if(result>0)
{
return "success";
}
else
{
return "error";
}
}
catch (Exception e)
{
e.printStackTrace();
return "error:"+e.getMessage();
}
}
} }

@ -1,11 +1,7 @@
package com.peteralbus.controller; package com.peteralbus.controller;
import com.peteralbus.entity.Activity; import com.peteralbus.entity.*;
import com.peteralbus.entity.Group; import com.peteralbus.service.*;
import com.peteralbus.entity.User;
import com.peteralbus.service.ActivityService;
import com.peteralbus.service.GroupService;
import com.peteralbus.service.UserService;
import com.peteralbus.util.PrincipalUtil; import com.peteralbus.util.PrincipalUtil;
import net.bytebuddy.implementation.bytecode.Throw; import net.bytebuddy.implementation.bytecode.Throw;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
@ -20,6 +16,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* The type Teacher controller. * The type Teacher controller.
@ -35,6 +32,12 @@ public class TeacherController
UserService userService; UserService userService;
@Autowired @Autowired
GroupService groupService; GroupService groupService;
@Autowired
RecordService recordService;
@Autowired
ScoreGroupService scoreGroupService;
@Autowired
ScoreStuService scoreStuService;
@RequiresRoles(value={"teacher"}, logical= Logical.OR) @RequiresRoles(value={"teacher"}, logical= Logical.OR)
@RequestMapping("/activities") @RequestMapping("/activities")
public ModelAndView activities() public ModelAndView activities()
@ -78,13 +81,34 @@ public class TeacherController
modelAndView.setViewName("/jsp/teacher/modifyActivity.jsp"); modelAndView.setViewName("/jsp/teacher/modifyActivity.jsp");
return modelAndView; return modelAndView;
} }
@RequestMapping("/manageGroup")
public ModelAndView manageGroup(Long groupId)
{
ModelAndView modelAndView=PrincipalUtil.getBasicModelAndView();
Subject subject = SecurityUtils.getSubject();
User user=(User)subject.getPrincipal();
Group group=groupService.getById(groupId);
Activity activity= activityService.getActivityById(group.getActivityId());
List<Participate> memberList=groupService.getGroupMember(group.getGroupId());
List<Record> recordList=recordService.selectByGroup(groupId);
modelAndView.addObject("group",group);
modelAndView.addObject("memberList",memberList);
modelAndView.addObject("recordList",recordList);
modelAndView.addObject("activity",activity);
modelAndView.addObject("isFinished",memberList.get(0).getFinished());
modelAndView.addObject("isScored",scoreGroupService.getScored(user.getUserId(),groupId));
Map<String,Double> map=groupService.getScore(groupId);
modelAndView.addObject("score",map);
modelAndView.setViewName("/jsp/teacher/manageGroup.jsp");
return modelAndView;
}
@ResponseBody @ResponseBody
@RequestMapping("/addActivity") @RequestMapping("/addActivity")
public String addActivity(Activity activity) public String addActivity(Activity activity)
{ {
try try
{ {
int result=activityService.updateActivity(activity); int result=activityService.addActivity(activity);
if(result>0) if(result>0)
{ {
return "success"; return "success";
@ -121,6 +145,27 @@ public class TeacherController
} }
} }
@ResponseBody @ResponseBody
@RequestMapping("/deleteActivity")
public String deleteActivity(Long activityId)
{
try
{
int result=activityService.deleteActivity(activityId);
if(result>0)
{
return "success";
}
else
{
return "error";
}
}
catch (Exception e)
{
return "error:"+e.getMessage();
}
}
@ResponseBody
@RequestMapping("/addTeacherToActivity") @RequestMapping("/addTeacherToActivity")
public String addTeacherToActivity(Long userId,Long activityId) public String addTeacherToActivity(Long userId,Long activityId)
{ {
@ -135,4 +180,41 @@ public class TeacherController
} }
return "error"; return "error";
} }
@ResponseBody
@RequestMapping("/setRead")
public String setRead(Long recordId)
{
int result= recordService.setRead(recordId);
if(result>0)
{
return "success";
}
return "error";
}
@ResponseBody
@RequestMapping("/scoreStu")
public String scoreStu(ScoreStu scoreStu)
{
int result=scoreStuService.insert(scoreStu);
if(result>0)
{
return "success";
}
return "error";
}
@ResponseBody
@RequestMapping("/scoreGroup")
public String scoreGroup(ScoreGroup scoreGroup)
{
if(scoreGroupService.getScored(scoreGroup.getTeacherId(),scoreGroup.getGroupId()))
{
return "error";
}
int result=scoreGroupService.insert(scoreGroup);
if(result>0)
{
return "success";
}
return "error";
}
} }

@ -26,6 +26,8 @@ public class Group implements Serializable
private Long memberCount; private Long memberCount;
@TableField(exist = false) @TableField(exist = false)
private List<Participate> memberList; private List<Participate> memberList;
@TableField(exist = false)
private Boolean isFinished;
private Long activityId; private Long activityId;
@Version @Version
private Integer version; private Integer version;
@ -155,6 +157,16 @@ public class Group implements Serializable
this.memberList = memberList; this.memberList = memberList;
} }
public Boolean getFinished()
{
return isFinished;
}
public void setFinished(Boolean finished)
{
isFinished = finished;
}
@Override @Override
public String toString() public String toString()
{ {

@ -21,6 +21,8 @@ public class Record implements Serializable
private String recordTitle; private String recordTitle;
private String recordContent; private String recordContent;
private Boolean isRead; private Boolean isRead;
@TableField(exist = false)
private String authorName;
@Version @Version
private Integer version; private Integer version;
@TableField(fill = FieldFill.INSERT) @TableField(fill = FieldFill.INSERT)
@ -129,6 +131,16 @@ public class Record implements Serializable
this.isDelete = isDelete; this.isDelete = isDelete;
} }
public String getAuthorName()
{
return authorName;
}
public void setAuthorName(String authorName)
{
this.authorName = authorName;
}
@Override @Override
public String toString() public String toString()
{ {

@ -1,10 +1,7 @@
package com.peteralbus.service; package com.peteralbus.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.peteralbus.dao.ActivityDao; import com.peteralbus.dao.*;
import com.peteralbus.dao.GroupDao;
import com.peteralbus.dao.ManageDao;
import com.peteralbus.dao.ParticipateDao;
import com.peteralbus.entity.*; import com.peteralbus.entity.*;
import com.sun.org.apache.xpath.internal.operations.Bool; import com.sun.org.apache.xpath.internal.operations.Bool;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
@ -32,6 +29,8 @@ public class ActivityService
private ParticipateDao participateDao; private ParticipateDao participateDao;
@Autowired @Autowired
private ManageDao manageDao; private ManageDao manageDao;
@Autowired
private RecordDao recordDao;
/** /**
* Add activity int. * Add activity int.
@ -164,4 +163,27 @@ public class ActivityService
{ {
return activityDao.getCount(); return activityDao.getCount();
} }
public int deleteActivity(Long activityId)
{
int result=0;
QueryWrapper<Manage> manageQueryWrapper=new QueryWrapper<>();
manageQueryWrapper.eq("activity_id",activityId);
result=manageDao.delete(manageQueryWrapper);
QueryWrapper<Participate> participateQueryWrapper=new QueryWrapper<>();
participateQueryWrapper.eq("activity_id",activityId);
List<Participate> participateList=participateDao.selectList(participateQueryWrapper);
for(Participate participate:participateList)
{
QueryWrapper<Record> recordQueryWrapper=new QueryWrapper<>();
recordQueryWrapper.eq("participation_id",participate.getParticipationId());
result=recordDao.delete(recordQueryWrapper);
}
result=participateDao.delete(participateQueryWrapper);
QueryWrapper<Group> groupQueryWrapper=new QueryWrapper<>();
groupQueryWrapper.eq("activity_id",activityId);
result=groupDao.delete(groupQueryWrapper);
result=activityDao.deleteById(activityId);
return result;
}
} }

@ -1,17 +1,16 @@
package com.peteralbus.service; package com.peteralbus.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.peteralbus.dao.GroupDao; import com.peteralbus.dao.*;
import com.peteralbus.dao.ParticipateDao; import com.peteralbus.entity.*;
import com.peteralbus.dao.UserDao;
import com.peteralbus.entity.Group;
import com.peteralbus.entity.Participate;
import com.peteralbus.entity.User;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* The type Group service. * The type Group service.
@ -37,6 +36,12 @@ public class GroupService
@Autowired @Autowired
ParticipateDao participateDao; ParticipateDao participateDao;
@Autowired
ScoreGroupDao scoreGroupDao;
@Autowired
ScoreStuDao scoreStuDao;
/** /**
* Gets group list by activity. * Gets group list by activity.
* *
@ -54,6 +59,7 @@ public class GroupService
group.setLeaderName(user.getRealName()); group.setLeaderName(user.getRealName());
List<Participate> memberList=this.getGroupMember(group.getGroupId()); List<Participate> memberList=this.getGroupMember(group.getGroupId());
group.setMemberList(memberList); group.setMemberList(memberList);
group.setFinished(memberList.get(0).getFinished());
Long memberCount=this.getMemberCount(group.getGroupId()); Long memberCount=this.getMemberCount(group.getGroupId());
group.setMemberCount(memberCount); group.setMemberCount(memberCount);
} }
@ -109,6 +115,36 @@ public class GroupService
return memberList; return memberList;
} }
public Map<String,Double> getScore(Long groupId)
{
Map<String,Double> map=new HashMap<>();
QueryWrapper<ScoreGroup> queryWrapper=new QueryWrapper<>();
queryWrapper.eq("group_id",groupId);
List<ScoreGroup> scoreGroupList=scoreGroupDao.selectList(queryWrapper);
double sum=0;
for(ScoreGroup scoreGroup:scoreGroupList)
{
map.put(userDao.selectById(scoreGroup.getTeacherId()).getRealName()+"-小组评分:",scoreGroup.getScoreValue());
sum+=scoreGroup.getScoreValue();
}
map.put("小组总评分:",sum/scoreGroupList.size());
List<Participate> memberList=this.getGroupMember(groupId);
for(Participate member:memberList)
{
QueryWrapper<ScoreStu> scoreStuQueryWrapper=new QueryWrapper<>();
scoreStuQueryWrapper.eq("participation_id",member.getParticipationId());
List<ScoreStu> scoreStuList=scoreStuDao.selectList(scoreStuQueryWrapper);
sum=0;
for(ScoreStu scoreStu:scoreStuList)
{
map.put(userDao.selectById(scoreStu.getTeacherId()).getRealName()+"-"+member.getRealName()+":",scoreStu.getScoreValue());
sum+=scoreStu.getScoreValue();
}
map.put(member.getRealName()+"总评分:",sum/scoreStuList.size());
}
return map;
}
/** /**
* Insert group int. * Insert group int.
* *

@ -3,8 +3,10 @@ package com.peteralbus.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.peteralbus.dao.GroupDao; import com.peteralbus.dao.GroupDao;
import com.peteralbus.dao.ParticipateDao; import com.peteralbus.dao.ParticipateDao;
import com.peteralbus.dao.RecordDao;
import com.peteralbus.entity.Group; import com.peteralbus.entity.Group;
import com.peteralbus.entity.Participate; import com.peteralbus.entity.Participate;
import com.peteralbus.entity.Record;
import com.peteralbus.entity.User; import com.peteralbus.entity.User;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.UnauthorizedException; import org.apache.shiro.authz.UnauthorizedException;
@ -12,6 +14,8 @@ import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* The type Participate service. * The type Participate service.
* @author peteralbus * @author peteralbus
@ -30,6 +34,9 @@ public class ParticipateService
@Autowired @Autowired
GroupDao groupDao; GroupDao groupDao;
@Autowired
RecordDao recordDao;
/** /**
* Gets by user and activity. * Gets by user and activity.
* *
@ -142,4 +149,21 @@ public class ParticipateService
throw new UnauthorizedException(); throw new UnauthorizedException();
} }
} }
public int deleteParticipate(Long participationId)
{
Participate participate=participateDao.selectById(participationId);
Group group=groupDao.selectById(participate.getGroupId());
QueryWrapper<Participate> queryWrapper=new QueryWrapper<>();
queryWrapper.eq("group_id",group.getGroupId());
Long count=participateDao.selectCount(queryWrapper);
if(group.getLeaderId().equals(participate.getUserId())&&count>=2)
{
return 0;
}
QueryWrapper<Record> recordQueryWrapper=new QueryWrapper<>();
recordQueryWrapper.eq("participation_id",participate.getParticipationId());
recordDao.delete(recordQueryWrapper);
return participateDao.deleteById(participationId);
}
} }

@ -1,11 +1,17 @@
package com.peteralbus.service; package com.peteralbus.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.peteralbus.dao.GroupDao;
import com.peteralbus.dao.ParticipateDao;
import com.peteralbus.dao.RecordDao; import com.peteralbus.dao.RecordDao;
import com.peteralbus.dao.UserDao;
import com.peteralbus.entity.Group;
import com.peteralbus.entity.Participate;
import com.peteralbus.entity.Record; import com.peteralbus.entity.Record;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -21,6 +27,12 @@ public class RecordService
*/ */
@Autowired @Autowired
RecordDao recordDao; RecordDao recordDao;
@Autowired
GroupDao groupDao;
@Autowired
ParticipateDao participateDao;
@Autowired
UserDao userDao;
/** /**
* Insert record int. * Insert record int.
@ -45,4 +57,30 @@ public class RecordService
queryWrapper.eq("participation_id",participationId); queryWrapper.eq("participation_id",participationId);
return recordDao.selectList(queryWrapper); return recordDao.selectList(queryWrapper);
} }
public List<Record> selectByGroup(Long groupId)
{
Group group= groupDao.selectById(groupId);
QueryWrapper<Participate> queryWrapper=new QueryWrapper<>();
queryWrapper.eq("group_id",groupId);
List<Participate> participateList=participateDao.selectList(queryWrapper);
List<Record> recordList=new ArrayList<>();
for(Participate participate:participateList)
{
List<Record> records=this.selectByParticipate(participate.getParticipationId());
for(Record record:records)
{
record.setAuthorName(userDao.selectById(participate.getUserId()).getRealName());
}
recordList.addAll(records);
}
return recordList;
}
public int setRead(Long recordId)
{
Record record=recordDao.selectById(recordId);
record.setRead(true);
return recordDao.updateById(record);
}
} }

@ -0,0 +1,29 @@
package com.peteralbus.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.peteralbus.dao.ScoreGroupDao;
import com.peteralbus.entity.ScoreGroup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* The type Score group service.
* @author peteralbus
*/
@Service
public class ScoreGroupService
{
@Autowired
ScoreGroupDao scoreGroupDao;
public int insert(ScoreGroup scoreGroup)
{
return scoreGroupDao.insert(scoreGroup);
}
public Boolean getScored(Long teacherId,Long groupId)
{
QueryWrapper<ScoreGroup> queryWrapper=new QueryWrapper<>();
queryWrapper.eq("teacher_id",teacherId);
queryWrapper.eq("group_id",groupId);
return scoreGroupDao.selectCount(queryWrapper) > 0;
}
}

@ -0,0 +1,31 @@
package com.peteralbus.service;
import com.peteralbus.dao.ParticipateDao;
import com.peteralbus.dao.ScoreStuDao;
import com.peteralbus.entity.Participate;
import com.peteralbus.entity.ScoreStu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* The type Score stu service.
* @author peteralbus
*/
@Service
public class ScoreStuService
{
@Autowired
ScoreStuDao scoreStuDao;
@Autowired
ParticipateDao participateDao;
public int insert(ScoreStu scoreStu)
{
if(scoreStuDao.insert(scoreStu)>0)
{
Participate participate=participateDao.selectById(scoreStu.getParticipationId());
participate.setFinished(true);
return participateDao.updateById(participate);
}
return 0;
}
}

@ -23,6 +23,7 @@ public class PrincipalUtil
modelAndView.addObject("realName",user.getRealName()); modelAndView.addObject("realName",user.getRealName());
modelAndView.addObject("username",user.getUsername()); modelAndView.addObject("username",user.getUsername());
modelAndView.addObject("avatarSrc",user.getAvatarSrc()); modelAndView.addObject("avatarSrc",user.getAvatarSrc());
modelAndView.addObject("userId",user.getUserId());
return modelAndView; return modelAndView;
} }
} }

@ -1,42 +0,0 @@
<%--
Created by IntelliJ IDEA.
User: PeterAlbus
Date: 2021/12/8
Time: 14:28
--%>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html>
<html>
<head>
<title>管理员界面</title>
<!-- 引入Vue -->
<script src="${pageContext.request.contextPath}/iview/vue.js"></script>
<!-- 引入样式 -->
<link rel="stylesheet" href="${pageContext.request.contextPath}/iview/styles/iview.css">
<!-- 引入组件库 -->
<script src="${pageContext.request.contextPath}/iview/iview.js"></script>
</head>
<body>
<div id="app">
<h1>
<shiro:authenticated>已登录!<a href="${pageContext.request.contextPath}/logout">登出</a></shiro:authenticated>
</h1>
</div>
<script>
new Vue({
el: '#app',
data: {
user:{
username:'',
}
},
mounted(){
this.user.username='${user.username}'
},
methods: {
}
})
</script>
</body>
</html>

@ -106,7 +106,20 @@
</div> </div>
</el-card> </el-card>
</div> </div>
<div class="activity-list-top">
<el-input v-model="keyWord1" prefix-icon="el-icon-search" placeholder="请输入活动名搜索" style="width: 50%"></el-input>
</div>
<el-divider content-position="left">所有活动</el-divider> <el-divider content-position="left">所有活动</el-divider>
<div style="text-align: center">
<el-pagination
background
layout="total, sizes ,prev, pager, next, jumper"
:total="allActivitiesResult.length"
:page-sizes="[5, 10, 20, 40]"
v-model:page-size="pageSize"
v-model:current-page="currentPage">
</el-pagination>
</div>
<div class="activity-list-card" v-for="(item,index) in currentPageAllActivities"> <div class="activity-list-card" v-for="(item,index) in currentPageAllActivities">
<el-card class="box-card" shadow="hover"> <el-card class="box-card" shadow="hover">
<template #header> <template #header>
@ -121,16 +134,6 @@
</div> </div>
</el-card> </el-card>
</div> </div>
<div style="text-align: center">
<el-pagination
background
layout="total, sizes ,prev, pager, next, jumper"
:total="allActivitiesResult.length"
:page-sizes="[5, 10, 20, 40]"
v-model:page-size="pageSize"
v-model:current-page="currentPage">
</el-pagination>
</div>
</div> </div>
</div> </div>
</el-main> </el-main>
@ -147,6 +150,7 @@
return{ return{
title:'社会实践活动列表', title:'社会实践活动列表',
keyWord:'', keyWord:'',
keyWord1: '',
showFinished:true, showFinished:true,
user:{ user:{
username:'', username:'',
@ -233,14 +237,14 @@
}, },
allActivitiesResult:function (){ allActivitiesResult:function (){
let result=[]; let result=[];
if(this.keyWord==='') if(this.keyWord1==='')
{ {
return this.allActivities; return this.allActivities;
} }
for(let i=0;i<this.allActivities.length;i++) for(let i=0;i<this.allActivities.length;i++)
{ {
let str=this.allActivities[i].activityName; let str=this.allActivities[i].activityName;
if(str.search(this.keyWord)!==-1) if(str.search(this.keyWord1)!==-1)
{ {
result.push(this.allActivities[i]); result.push(this.allActivities[i]);
} }

@ -52,8 +52,17 @@
sub-title="恭喜你完成了社会实践活动!" sub-title="恭喜你完成了社会实践活动!"
> >
<template #extra> <template #extra>
小组评分:<br/> <div v-for="item in score">
个人评分: {{item.key}}
<el-rate
v-model="item.value"
disabled
show-score
text-color="#ff9900"
score-template="{value} 分"
>
</el-rate>
</div>
</template> </template>
</el-result> </el-result>
</div> </div>
@ -158,6 +167,14 @@
avatarSrc: '', avatarSrc: '',
userId:'' userId:''
}, },
score:[
<c:forEach items="${score}" var="item">
{
key:'${item.key}',
value:${item.value},
},
</c:forEach>
],
form:{ form:{
participationId:'${participationId}', participationId:'${participationId}',
recordTitle:'', recordTitle:'',

@ -121,7 +121,8 @@
<el-input v-model="keyWord" size="mini" placeholder="搜索姓名/组名"></el-input> <el-input v-model="keyWord" size="mini" placeholder="搜索姓名/组名"></el-input>
</template> </template>
<template #default="scope"> <template #default="scope">
<el-button size="mini" @click="joinGroup(scope.row.groupId)">加入</el-button> <el-button size="mini" @click="joinGroup(scope.row.groupId)" v-if="!scope.row.isFinished">加入</el-button>
<el-tag type="success" v-if="scope.row.isFinished" size="small">该小组已完成</el-tag>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -181,6 +182,7 @@
groupName:'${group.getGroupName()}', groupName:'${group.getGroupName()}',
leaderId:'${group.getLeaderId()}', leaderId:'${group.getLeaderId()}',
leaderName:'${group.getLeaderName()}', leaderName:'${group.getLeaderName()}',
isFinished:${group.getFinished()},
gmtCreate:'${group.getFormattedCreateDate()}' gmtCreate:'${group.getFormattedCreateDate()}'
}, },
</c:forEach> </c:forEach>

@ -52,6 +52,7 @@
border border
> >
<template #extra> <template #extra>
<el-link type="primary" @click="deleteParticipate">退出小组</el-link>&emsp;
<el-link href="#record" type="primary">日志管理<i class="el-icon-arrow-down"></i></el-link>&emsp; <el-link href="#record" type="primary">日志管理<i class="el-icon-arrow-down"></i></el-link>&emsp;
<el-link href="#groupMember" type="primary">小组成员管理<i class="el-icon-arrow-down"></i></el-link> <el-link href="#groupMember" type="primary">小组成员管理<i class="el-icon-arrow-down"></i></el-link>
</template> </template>
@ -112,7 +113,7 @@
<el-timeline> <el-timeline>
<el-timeline-item :timestamp="item.gmtCreate" placement="top" v-for="item in recordList"> <el-timeline-item :timestamp="item.gmtCreate" placement="top" v-for="item in recordList">
<el-card> <el-card>
<h4>{{item.recordTitle}}</h4> <h4>{{item.recordTitle}}<el-tag type="warning" v-if="!item.isRead">未读</el-tag></h4>
<p>{{item.recordContent}}</p> <p>{{item.recordContent}}</p>
</el-card> </el-card>
</el-timeline-item> </el-timeline-item>
@ -168,7 +169,8 @@
{ {
recordTitle:'${record.getRecordTitle()}', recordTitle:'${record.getRecordTitle()}',
recordContent:'${record.getRecordContent()}', recordContent:'${record.getRecordContent()}',
gmtCreate:'${record.getFormattedCreateDate()}' gmtCreate:'${record.getFormattedCreateDate()}',
isRead:${record.getRead()},
}, },
</c:forEach> </c:forEach>
], ],
@ -319,6 +321,36 @@
this.$message.error("出现异常,提交失败") this.$message.error("出现异常,提交失败")
}) })
}) })
},
deleteParticipate(){
this.$messageBox.confirm(
'确认退出吗?你填写的活动记录将消失!',
'警告',
{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
axios({
method: "get",
url: "/student/deleteParticipate?participationId="+this.form.participationId,
})
.then(res => {
if(res.data==="success")
{
location.href="/student/activities"
}
else
{
this.$message.error("组长在组员没有退出时,不能退出社会实践活动!")
}
})
.catch(res=>{
this.$message.error("出现异常,提交失败")
})
})
} }
} }
}; };

@ -51,6 +51,9 @@
:column="1" :column="1"
border border
> >
<template #extra>
<el-link type="primary" @click="deleteParticipate">退出小组</el-link>&emsp;
</template>
<el-descriptions-item> <el-descriptions-item>
<template #label> <template #label>
活动名称 活动名称
@ -138,6 +141,7 @@
avatarSrc: '', avatarSrc: '',
userId:'' userId:''
}, },
participationId:'${participationId}',
currentStatus:'${currentStatus}', currentStatus:'${currentStatus}',
activity:{ activity:{
activityId: '${activity.getActivityId()}', activityId: '${activity.getActivityId()}',
@ -249,6 +253,36 @@
this.$message.error("出现异常,拒绝失败") this.$message.error("出现异常,拒绝失败")
}) })
}) })
},
deleteParticipate(){
this.$messageBox.confirm(
'确认退出吗?你填写的活动记录将消失!',
'警告',
{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
axios({
method: "get",
url: "/student/deleteParticipate?participationId="+this.participationId,
})
.then(res => {
if(res.data==="success")
{
location.href="/student/activities";
}
else
{
this.$message.error("组长在组员没有退出时,不能退出社会实践活动!")
}
})
.catch(res=>{
this.$message.error("出现异常,提交失败")
})
})
} }
} }
}; };

@ -0,0 +1,340 @@
<%--
Created by IntelliJ IDEA.
User: peteralbus
Date: 2021/12/21
Time: 12:14
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<title>社会实践小组完成情况管理</title>
<!-- 导入 Vue 3 -->
<script src="${pageContext.request.contextPath}/vue/vue@next/vue.global.js"></script>
<!-- 导入组件库 -->
<script src="${pageContext.request.contextPath}/vue/element/index.full.js"></script>
<script src="${pageContext.request.contextPath}/vue/axios/axios.js"></script>
<script src="${pageContext.request.contextPath}/vue/qs.min.js"></script>
<!-- 引入样式 -->
<link rel="stylesheet" href="${pageContext.request.contextPath}/vue/font-awesome/css/font-awesome.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/main.css">
<link rel="stylesheet" href="//unpkg.com/element-plus@1.1.0-beta.9/dist/index.css" />
</head>
<body>
<div id="app">
<el-dialog
v-model="dialogVisible"
title="评分"
width="30%"
>
<div class="drawer-box">
<div>小组评分:<el-rate v-model="scoreGroup.scoreValue" allow-half></el-rate></div>
<div v-for="item in scoreStu">{{item.realName}}<el-rate v-model="item.scoreValue" allow-half></el-rate></div>
<br/>
<el-button type="primary" @click="rateScore" size="small">提交</el-button>
</div>
</el-dialog>
<header>
<%@ include file="/jsp/header.html" %>
</header>
<div class="main">
<div class="container">
<el-container>
<el-aside width="80px">
<%@ include file="/jsp/aside.html" %>
</el-aside>
<el-main>
<el-page-header icon="el-icon-arrow-left" :content="title" @back="goBack"></el-page-header>
<br/>
<div class="container">
<el-divider content-position="left">社会实践活动信息</el-divider>
<div class="activity-info">
<el-descriptions
title="活动情况"
:column="1"
border
>
<template #extra>
<el-button type="success" size="mini" @click="dialogVisible=true" v-if="!isScored">评分</el-button>
<el-tag type="success" v-if="isFinished">该小组已完成社会实践</el-tag>
<el-tag type="danger" v-if="activity.minPeople>group.memberCount">该小组人数尚未达标</el-tag>
<el-link href="#record" type="primary">日志管理<i class="el-icon-arrow-down"></i></el-link>&emsp;
<el-link href="#groupMember" type="primary">小组成员<i class="el-icon-arrow-down"></i></el-link>
</template>
<el-descriptions-item>
<template #label>
活动名称
</template>
{{activity.activityName}}
</el-descriptions-item>
<el-descriptions-item>
<template #label>
活动类别
</template>
{{activity.activityType}}
</el-descriptions-item>
<el-descriptions-item>
<template #label>
活动人数
</template>
{{activity.minPeople}}-{{activity.maxPeople}}人
</el-descriptions-item>
<el-descriptions-item>
<template #label>
负责老师
</template>
<span v-for="i in activity.teachers">{{i.realName}}&emsp;</span>
</el-descriptions-item>
<el-descriptions-item>
<template #label>
创建日期
</template>
{{activity.gmtCreate}}
</el-descriptions-item>
</el-descriptions>
<el-descriptions :column="1" border direction="vertical">
<el-descriptions-item>
<template #label>
简介
</template>
{{activity.activityIntroduction}}
</el-descriptions-item>
</el-descriptions>
</div>
<el-divider content-position="left" id="score" v-if="isScored">分数</el-divider>
<div v-for="item in score" class="drawer-box" v-if="isScored">
{{item.key}}
<el-rate
v-model="item.value"
disabled
show-score
text-color="#ff9900"
score-template="{value} 分"
>
</el-rate>
</div>
<el-divider content-position="left" id="record">日志查看</el-divider>
<el-timeline>
<el-timeline-item :timestamp="item.gmtCreate" placement="top" v-for="item in recordList">
<el-badge value="new" style="width: 100%" :hidden="item.isRead">
<el-card>
<h4>{{item.recordTitle}}-{{item.authorName}}</h4>
<p>{{item.recordContent}}</p>
<el-link v-if="!item.isRead" type="primary" @click="setRead(item.recordId)">设为已读</el-link>
</el-card>
</el-badge>
</el-timeline-item>
</el-timeline>
<el-divider content-position="left" id="groupMember">小组</el-divider>
<div>
<el-descriptions title="小组信息" border>
<el-descriptions-item label="小组名">{{group.groupName}}</el-descriptions-item>
<el-descriptions-item label="组长姓名">{{group.leaderName}}</el-descriptions-item>
<el-descriptions-item label="已加入组员数">{{group.memberCount}}</el-descriptions-item>
</el-descriptions>
<h4>成员信息</h4>
<el-table :data="memberList" style="width: 100%" stripe>
<el-table-column prop="username" label="用户名"></el-table-column>
<el-table-column prop="realName" label="姓名"></el-table-column>
<el-table-column align="right" label="加入状态">
<template #default="scope">
<el-tag type="success" v-if="scope.row.isAccept">已通过</el-tag>
<el-tag type="info" v-if="!scope.row.isAccept">审核中</el-tag>
</template>
</el-table-column>
</el-table>
</div>
</div>
</el-main>
</el-container>
</div>
</div>
<footer>
<%@ include file="/jsp/foot.html" %>
</footer>
</div>
<script>
const App = {
data() {
return{
title:'社会实践小组',
dialogVisible:false,
user:{
username:'',
realName:'',
avatarSrc: '',
userId:''
},
scoreGroup:{
groupId:'${group.getGroupId()}',
teacherId:'${userId}',
scoreValue:5
},
scoreStu:[
<c:forEach items="${memberList}" var="member">
{
participationId:'${member.getParticipationId()}',
realName:'${member.getRealName()}',
teacherId: '${userId}',
scoreValue: 5
},
</c:forEach>
],
score:[
<c:forEach items="${score}" var="item">
{
key:'${item.key}',
value:${item.value},
},
</c:forEach>
],
recordList:[
<c:forEach items="${recordList}" var="record">
{
recordId:'${record.getRecordId()}',
recordTitle:'${record.getRecordTitle()}',
recordContent:'${record.getRecordContent()}',
isRead:${record.getRead()},
authorName:'${record.getAuthorName()}',
gmtCreate:'${record.getFormattedCreateDate()}'
},
</c:forEach>
],
activity:{
activityId: '${activity.getActivityId()}',
activityName: '${activity.getActivityName()}',
activityType:'${activity.getActivityType()}',
activityIntroduction:'${activity.getActivityIntroduction()}',
minPeople:'${activity.getMinPeople()}',
maxPeople:'${activity.getMaxPeople()}',
gmtCreate:'${activity.getFormattedCreateDate()}',
teachers:[
<c:forEach items="${activity.getTeacherList()}" var="teacher">
{
userId:'${teacher.getUserId()}',
username:'${teacher.getUsername()}',
realName:'${teacher.getRealName()}',
userPhone:'${teacher.getUserPhone()}',
avatarSrc:'${teacher.getAvatarSrc()}'
},
</c:forEach>
]
},
group:{
groupId:'${group.getGroupId()}',
groupName:'${group.getGroupName()}',
leaderId:'${group.getLeaderId()}',
leaderName: '${group.getLeaderName()}',
memberCount: '${group.getMemberCount()}'
},
isFinished: ${isFinished},
isScored:${isScored},
memberList:[
<c:forEach items="${memberList}" var="member">
{
participateId:'${member.getParticipationId()}',
userId:'${member.getUserId()}',
username:'${member.getUsername()}',
realName:'${member.getRealName()}',
isAccept:${member.getAccept()}
},
</c:forEach>
],
activeIndex:'2'
}
},
mounted(){
this.user.realName='${realName}'
this.user.username='${username}'
this.user.avatarSrc='${avatarSrc}'
this.user.userId='${userId}'
},
methods: {
goBack(){
window.history.go(-1);
},
setRead(id){
axios({
method: "get",
url: "/teacher/setRead?recordId="+id,
}).then(res=>{
if(res.data==="error")
{
this.$message.error('设置失败!')
}
else
{
location.reload()
}
})
},
rateScore(){
let count=0
let that=this
this.$messageBox.confirm(
'确认提交评分?学生的社会实践活动将结束,评分不可修改',
'信息',
{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'info',
}
)
.then(() => {
axios({
method: "post",
url: "/teacher/scoreGroup",
data: this.scoreGroup,
transformRequest: [ function(data){
return Qs.stringify(data) //使用Qs将请求参数序列化
}],
headers: {
'Content-Type': 'application/x-www-form-urlencoded' //必须设置传输方式
}
})
.then(res => {
if(res.data==="success")
{
for(let i of that.scoreStu)
{
axios({
method: "post",
url: "/teacher/scoreStu",
data: i,
transformRequest: [ function(data){
return Qs.stringify(data) //使用Qs将请求参数序列化
}],
headers: {
'Content-Type': 'application/x-www-form-urlencoded' //必须设置传输方式
}
})
.then(res=>{
count++
if(count>=this.scoreStu.length)
{
location.reload();
}
})
}
}
else
{
this.$message.error("已经进行过评分")
}
})
.catch(res=>{
this.$message.error("出现异常,提交失败")
})
})
}
}
};
const app = Vue.createApp(App);
app.use(ElementPlus);
app.mount("#app");
</script>
</body>
</html>

@ -90,7 +90,7 @@
</el-form-item> </el-form-item>
<div class="button-group"> <div class="button-group">
<el-button type="primary" @click="submit('form')" :loading="loading">更改</el-button> <el-button type="primary" @click="submit('form')" :loading="loading">更改</el-button>
<el-button type="danger">删除</el-button> <el-button type="danger" @click="deleteActivity">删除</el-button>
</div> </div>
</el-form> </el-form>
</div> </div>
@ -101,10 +101,10 @@
<template #title> <template #title>
<div class="group-list-top"> <div class="group-list-top">
<div> <div>
{{item.groupName}}-组长:{{item.leaderName}}, 组员数量:{{item.memberCount}} {{item.groupName}}-组长:{{item.leaderName}}, 组员数量:{{item.memberCount}}<el-tag type="success" v-if="item.isFinished" size="small">已完成</el-tag>
</div> </div>
<div> <div>
<el-button type="primary" size="mini">管理该小组</el-button> <el-button type="primary" size="mini" @click="manageGroup(item.groupId)">管理该小组</el-button>
</div> </div>
</div> </div>
</template> </template>
@ -172,6 +172,7 @@
groupName:'${group.getGroupName()}', groupName:'${group.getGroupName()}',
leaderName:'${group.getLeaderName()}', leaderName:'${group.getLeaderName()}',
memberCount:'${group.getMemberCount()}', memberCount:'${group.getMemberCount()}',
isFinished:${group.getFinished()},
memberList:[ memberList:[
<c:forEach items="${group.getMemberList()}" var="member"> <c:forEach items="${group.getMemberList()}" var="member">
{ {
@ -267,6 +268,9 @@
} }
}) })
}, },
manageGroup(id){
location.href="/teacher/manageGroup?groupId="+id
},
addTeacher(id){ addTeacher(id){
this.$messageBox.confirm( this.$messageBox.confirm(
'确认要添加改老师为负责老师吗,该老师将拥有与你相同的权限?', '确认要添加改老师为负责老师吗,该老师将拥有与你相同的权限?',
@ -297,6 +301,33 @@
} }
}) })
}) })
},
deleteActivity(){
this.$messageBox.confirm(
'确认要删除该活动吗,其下属的所有小组也将丢失!',
'警告',
{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
axios({
method: "get",
url: "/teacher/deleteActivity?activityId="+this.activity.activityId,
}).then(res=>{
this.loading=false
if(res.data==="error")
{
this.$message.error('删除失败!')
}
else
{
location.href="/teacher/activities"
}
})
})
} }
} }
}; };

Loading…
Cancel
Save