start coding of message module.

DEV
PeterAlbus 3 years ago
parent 7ac57ac0d9
commit da07813f0c

@ -1,7 +1,10 @@
package com.peteralbus.controller; package com.peteralbus.controller;
import com.peteralbus.entity.Activity; import com.peteralbus.entity.Activity;
import com.peteralbus.entity.User;
import com.peteralbus.service.ActivityService; import com.peteralbus.service.ActivityService;
import com.peteralbus.service.MessageService;
import com.peteralbus.service.UserService;
import com.peteralbus.util.PrincipalUtil; import com.peteralbus.util.PrincipalUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -20,17 +23,37 @@ import java.util.List;
@RequestMapping("/admin") @RequestMapping("/admin")
public class AdminController public class AdminController
{ {
@Autowired
MessageService messageService;
@Autowired @Autowired
ActivityService activityService; ActivityService activityService;
@Autowired
UserService userService;
private ModelAndView basicModelAndView()
{
ModelAndView modelAndView=PrincipalUtil.getBasicModelAndView();
modelAndView.addObject("messageCount",messageService.getNewMessageCount());
modelAndView.addObject("newMessageList",messageService.getNewMessage());
return modelAndView;
}
@RequestMapping("/activities") @RequestMapping("/activities")
public ModelAndView activities() public ModelAndView activities()
{ {
ModelAndView modelAndView=PrincipalUtil.getBasicModelAndView(); ModelAndView modelAndView=this.basicModelAndView();
List<Activity> activityList=activityService.adminActivityList(); List<Activity> activityList=activityService.adminActivityList();
modelAndView.addObject("activityList",activityList); modelAndView.addObject("activityList",activityList);
modelAndView.setViewName("/jsp/admin/activities.jsp"); modelAndView.setViewName("/jsp/admin/activities.jsp");
return modelAndView; return modelAndView;
} }
@RequestMapping("/users")
public ModelAndView users()
{
ModelAndView modelAndView=this.basicModelAndView();
List<User> userList=userService.getUserList();
modelAndView.addObject("userList",userList);
modelAndView.setViewName("/jsp/admin/users.jsp");
return modelAndView;
}
@ResponseBody @ResponseBody
@RequestMapping("/restoreActivity") @RequestMapping("/restoreActivity")
public String restoreActivity(Long activityId) public String restoreActivity(Long activityId)
@ -41,4 +64,16 @@ public class AdminController
} }
return "error"; return "error";
} }
@ResponseBody
@RequestMapping("/resetPassword")
public String resetPassword(Long userId)
{
User user=userService.queryById(userId);
user.setPassword("123456");
if(userService.updateUserPassword(user)>0)
{
return "success";
}
return "error";
}
} }

@ -1,9 +1,11 @@
package com.peteralbus.controller; package com.peteralbus.controller;
import com.peteralbus.entity.User; import com.peteralbus.entity.User;
import com.peteralbus.service.MessageService;
import com.peteralbus.util.PrincipalUtil; import com.peteralbus.util.PrincipalUtil;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject; import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -17,16 +19,39 @@ import org.springframework.web.servlet.ModelAndView;
@Controller @Controller
public class PageController public class PageController
{ {
@Autowired
MessageService messageService;
/** /**
* Home page model and view. * Home page model and view.
* *
* @return the model and view * @return the model and view
*/ */
private ModelAndView basicModelAndView()
{
ModelAndView modelAndView=PrincipalUtil.getBasicModelAndView();
modelAndView.addObject("messageCount",messageService.getNewMessageCount());
modelAndView.addObject("newMessageList",messageService.getNewMessage());
return modelAndView;
}
@RequestMapping("/index") @RequestMapping("/index")
public ModelAndView homePage() public ModelAndView homePage()
{ {
ModelAndView modelAndView= PrincipalUtil.getBasicModelAndView(); ModelAndView modelAndView=this.basicModelAndView();
modelAndView.setViewName("/jsp/home.jsp"); modelAndView.setViewName("/jsp/home.jsp");
return modelAndView; return modelAndView;
} }
@RequestMapping("/messageList")
public ModelAndView messageList()
{
ModelAndView modelAndView=this.basicModelAndView();
modelAndView.setViewName("/jsp/message/messageList.jsp");
return modelAndView;
}
@RequestMapping("/message")
public ModelAndView message(Long messageId)
{
ModelAndView modelAndView=this.basicModelAndView();
modelAndView.setViewName("/jsp/message/message.jsp");
return modelAndView;
}
} }

@ -1,10 +1,7 @@
package com.peteralbus.controller; package com.peteralbus.controller;
import com.peteralbus.entity.*; import com.peteralbus.entity.*;
import com.peteralbus.service.ActivityService; import com.peteralbus.service.*;
import com.peteralbus.service.GroupService;
import com.peteralbus.service.ParticipateService;
import com.peteralbus.service.RecordService;
import com.peteralbus.util.PrincipalUtil; import com.peteralbus.util.PrincipalUtil;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.UnauthorizedException; import org.apache.shiro.authz.UnauthorizedException;
@ -26,6 +23,8 @@ import java.util.Map;
@RequestMapping("/student") @RequestMapping("/student")
public class StudentController public class StudentController
{ {
@Autowired
MessageService messageService;
@Autowired @Autowired
ActivityService activityService; ActivityService activityService;
@Autowired @Autowired
@ -34,10 +33,17 @@ public class StudentController
ParticipateService participateService; ParticipateService participateService;
@Autowired @Autowired
RecordService recordService; RecordService recordService;
private ModelAndView basicModelAndView()
{
ModelAndView modelAndView=PrincipalUtil.getBasicModelAndView();
modelAndView.addObject("messageCount",messageService.getNewMessageCount());
modelAndView.addObject("newMessageList",messageService.getNewMessage());
return modelAndView;
}
@RequestMapping("/activities") @RequestMapping("/activities")
public ModelAndView activities() public ModelAndView activities()
{ {
ModelAndView modelAndView=PrincipalUtil.getBasicModelAndView(); ModelAndView modelAndView=this.basicModelAndView();
Subject subject = SecurityUtils.getSubject(); Subject subject = SecurityUtils.getSubject();
User user=(User)subject.getPrincipal(); User user=(User)subject.getPrincipal();
List<Activity> activityList=activityService.getActivityByStudent(user.getUserId()); List<Activity> activityList=activityService.getActivityByStudent(user.getUserId());
@ -50,7 +56,7 @@ public class StudentController
@RequestMapping("/applyActivity") @RequestMapping("/applyActivity")
public ModelAndView applyActivity(Long activityId) public ModelAndView applyActivity(Long activityId)
{ {
ModelAndView modelAndView=PrincipalUtil.getBasicModelAndView(); ModelAndView modelAndView=this.basicModelAndView();
Subject subject = SecurityUtils.getSubject(); Subject subject = SecurityUtils.getSubject();
User user=(User)subject.getPrincipal(); User user=(User)subject.getPrincipal();
Activity activity= activityService.getActivityById(activityId); Activity activity= activityService.getActivityById(activityId);
@ -68,7 +74,7 @@ public class StudentController
@RequestMapping("/manageActivity") @RequestMapping("/manageActivity")
public ModelAndView manageActivity(Long activityId) public ModelAndView manageActivity(Long activityId)
{ {
ModelAndView modelAndView=PrincipalUtil.getBasicModelAndView(); ModelAndView modelAndView=this.basicModelAndView();
Subject subject = SecurityUtils.getSubject(); Subject subject = SecurityUtils.getSubject();
User user=(User)subject.getPrincipal(); User user=(User)subject.getPrincipal();
Activity activity= activityService.getActivityById(activityId); Activity activity= activityService.getActivityById(activityId);

@ -38,11 +38,20 @@ public class TeacherController
ScoreGroupService scoreGroupService; ScoreGroupService scoreGroupService;
@Autowired @Autowired
ScoreStuService scoreStuService; ScoreStuService scoreStuService;
@Autowired
MessageService messageService;
private ModelAndView basicModelAndView()
{
ModelAndView modelAndView=PrincipalUtil.getBasicModelAndView();
modelAndView.addObject("messageCount",messageService.getNewMessageCount());
modelAndView.addObject("newMessageList",messageService.getNewMessage());
return modelAndView;
}
@RequiresRoles(value={"teacher"}, logical= Logical.OR) @RequiresRoles(value={"teacher"}, logical= Logical.OR)
@RequestMapping("/activities") @RequestMapping("/activities")
public ModelAndView activities() public ModelAndView activities()
{ {
ModelAndView modelAndView= PrincipalUtil.getBasicModelAndView(); ModelAndView modelAndView=this.basicModelAndView();
Subject subject = SecurityUtils.getSubject(); Subject subject = SecurityUtils.getSubject();
User user=(User)subject.getPrincipal(); User user=(User)subject.getPrincipal();
List<Activity> activityList=activityService.getActivityByTeacher(user.getUserId()); List<Activity> activityList=activityService.getActivityByTeacher(user.getUserId());
@ -56,7 +65,7 @@ public class TeacherController
@RequestMapping("/activityDetail") @RequestMapping("/activityDetail")
public ModelAndView activityDetail(Long activityId) public ModelAndView activityDetail(Long activityId)
{ {
ModelAndView modelAndView= PrincipalUtil.getBasicModelAndView(); ModelAndView modelAndView=this.basicModelAndView();
Activity activity=activityService.getActivityById(activityId); Activity activity=activityService.getActivityById(activityId);
modelAndView.addObject("activity",activity); modelAndView.addObject("activity",activity);
modelAndView.setViewName("/jsp/teacher/activityDetail.jsp"); modelAndView.setViewName("/jsp/teacher/activityDetail.jsp");
@ -65,7 +74,7 @@ public class TeacherController
@RequestMapping("/modifyActivity") @RequestMapping("/modifyActivity")
public ModelAndView modifyActivity(Long activityId) public ModelAndView modifyActivity(Long activityId)
{ {
ModelAndView modelAndView=PrincipalUtil.getBasicModelAndView(); ModelAndView modelAndView=this.basicModelAndView();
Subject subject = SecurityUtils.getSubject(); Subject subject = SecurityUtils.getSubject();
User user=(User)subject.getPrincipal(); User user=(User)subject.getPrincipal();
if(!activityService.checkIsManage(user.getUserId(), activityId)) if(!activityService.checkIsManage(user.getUserId(), activityId))
@ -84,7 +93,7 @@ public class TeacherController
@RequestMapping("/manageGroup") @RequestMapping("/manageGroup")
public ModelAndView manageGroup(Long groupId) public ModelAndView manageGroup(Long groupId)
{ {
ModelAndView modelAndView=PrincipalUtil.getBasicModelAndView(); ModelAndView modelAndView=this.basicModelAndView();
Subject subject = SecurityUtils.getSubject(); Subject subject = SecurityUtils.getSubject();
User user=(User)subject.getPrincipal(); User user=(User)subject.getPrincipal();
Group group=groupService.getById(groupId); Group group=groupService.getById(groupId);

@ -0,0 +1,14 @@
package com.peteralbus.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.peteralbus.entity.Message;
import org.apache.ibatis.annotations.Mapper;
/**
* The interface Message dao.
* @author peteralbus
*/
@Mapper
public interface MessageDao extends BaseMapper<Message>
{
}

@ -0,0 +1,152 @@
package com.peteralbus.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* The type Message.
* @author peteralbus
*/
public class Message implements Serializable
{
@TableId(type= IdType.ASSIGN_ID)
private Long messageId;
private String messageTitle;
private Long messageReceiver;
private String messageSender;
private String messageContent;
private Boolean isRead;
@Version
private Integer version;
@TableField(fill = FieldFill.INSERT)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime gmtCreate;
@TableField(fill = FieldFill.INSERT_UPDATE)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime gmtModified;
@TableLogic
private Integer isDelete;
public Long getMessageId()
{
return messageId;
}
public void setMessageId(Long messageId)
{
this.messageId = messageId;
}
public String getMessageTitle()
{
return messageTitle;
}
public void setMessageTitle(String messageTitle)
{
this.messageTitle = messageTitle;
}
public Long getMessageReceiver()
{
return messageReceiver;
}
public void setMessageReceiver(Long messageReceiver)
{
this.messageReceiver = messageReceiver;
}
public String getMessageSender()
{
return messageSender;
}
public void setMessageSender(String messageSender)
{
this.messageSender = messageSender;
}
public String getMessageContent()
{
return messageContent;
}
public void setMessageContent(String messageContent)
{
this.messageContent = messageContent;
}
public Boolean getRead()
{
return isRead;
}
public void setRead(Boolean read)
{
isRead = read;
}
public Integer getVersion()
{
return version;
}
public void setVersion(Integer version)
{
this.version = version;
}
public LocalDateTime getGmtCreate()
{
return gmtCreate;
}
public void setGmtCreate(LocalDateTime gmtCreate)
{
this.gmtCreate = gmtCreate;
}
public LocalDateTime getGmtModified()
{
return gmtModified;
}
public void setGmtModified(LocalDateTime gmtModified)
{
this.gmtModified = gmtModified;
}
public Integer getIsDelete()
{
return isDelete;
}
public void setIsDelete(Integer isDelete)
{
this.isDelete = isDelete;
}
@Override
public String toString()
{
return "Message{" +
"messageId=" + messageId +
", messageTitle='" + messageTitle + '\'' +
", messageReceiver=" + messageReceiver +
", messageSender='" + messageSender + '\'' +
", messageContent='" + messageContent + '\'' +
", isRead=" + isRead +
", version=" + version +
", gmtCreate=" + gmtCreate +
", gmtModified=" + gmtModified +
", isDelete=" + isDelete +
'}';
}
}

@ -0,0 +1,58 @@
package com.peteralbus.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.peteralbus.dao.MessageDao;
import com.peteralbus.entity.Message;
import com.peteralbus.entity.User;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* The type Message service.
* @author peteralbus
*/
@Service
public class MessageService
{
@Autowired
MessageDao messageDao;
public List<Message> getMessage()
{
Subject subject = SecurityUtils.getSubject();
User user=(User)subject.getPrincipal();
QueryWrapper<Message> queryWrapper=new QueryWrapper<>();
queryWrapper.eq("message_receiver",user.getUserId());
return messageDao.selectList(queryWrapper);
}
public List<Message> getNewMessage()
{
Subject subject = SecurityUtils.getSubject();
User user=(User)subject.getPrincipal();
QueryWrapper<Message> queryWrapper=new QueryWrapper<>();
queryWrapper.eq("message_receiver",user.getUserId());
queryWrapper.eq("is_read",false);
return messageDao.selectList(queryWrapper);
}
public Long getNewMessageCount()
{
Subject subject = SecurityUtils.getSubject();
User user=(User)subject.getPrincipal();
QueryWrapper<Message> queryWrapper=new QueryWrapper<>();
queryWrapper.eq("message_receiver",user.getUserId());
return messageDao.selectCount(queryWrapper);
}
public int sendMessage(Long targetId,String sender,String title,String content)
{
Message message=new Message();
message.setMessageSender(sender);
message.setMessageReceiver(targetId);
message.setMessageTitle(title);
message.setMessageContent(content);
message.setRead(false);
return messageDao.insert(message);
}
}

@ -79,4 +79,14 @@ public class UserService
queryWrapper.eq("user_class",2); queryWrapper.eq("user_class",2);
return userDao.selectList(queryWrapper); return userDao.selectList(queryWrapper);
} }
public List<User> getUserList()
{
return userDao.selectList(null);
}
public User queryById(Long userId)
{
return userDao.selectById(userId);
}
} }

@ -1,13 +1,22 @@
package com.peteralbus.util; package com.peteralbus.util;
import com.peteralbus.entity.Message;
import com.peteralbus.entity.User; import com.peteralbus.entity.User;
import com.peteralbus.service.MessageService;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject; import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.annotation.PostConstruct;
import java.util.List;
/** /**
* The type Principal util. * The type Principal util.
* @author peteralbus
*/ */
@Component
public class PrincipalUtil public class PrincipalUtil
{ {
/** /**

@ -11,7 +11,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>主页</title> <title>社会实践活动管理</title>
<!-- 导入 Vue 3 --> <!-- 导入 Vue 3 -->
<script src="${pageContext.request.contextPath}/vue/vue@next/vue.global.js"></script> <script src="${pageContext.request.contextPath}/vue/vue@next/vue.global.js"></script>
<!-- 导入组件库 --> <!-- 导入组件库 -->
@ -133,6 +133,13 @@
this.user.realName='${realName}' this.user.realName='${realName}'
this.user.username='${username}' this.user.username='${username}'
this.user.avatarSrc='${avatarSrc}' this.user.avatarSrc='${avatarSrc}'
<c:if test="${newMessageList.size()!=0}">
this.$notify.info({
title: '有新消息:${newMessageList.get(0).getMessageTitle()}',
message: '${newMessageList.get(0).getMessageContent()}',
offset: 100,
})
</c:if>
}, },
methods: { methods: {
goBack(){ goBack(){

@ -0,0 +1,199 @@
<%--
Created by IntelliJ IDEA.
User: peteralbus
Date: 2021/12/21
Time: 20:04
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">
<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 style="text-align: center">
<el-pagination
background
layout="total, sizes ,prev, pager, next, jumper"
:total="userListResult.length"
:page-sizes="[5, 10, 20, 40]"
v-model:page-size="pageSize"
v-model:current-page="currentPage">
</el-pagination>
</div>
<div>
<el-table
:data="currentPageUsers"
style="width: 100%"
>
<el-table-column prop="userId" label="用户ID" fixed width="250"></el-table-column>
<el-table-column prop="username" label="用户名" width="200"></el-table-column>
<el-table-column prop="realName" label="姓名" width="200"></el-table-column>
<el-table-column label="头像">
<template #default="scope">
<el-popover effect="light" trigger="hover" placement="top">
<template #default>
<img :src="scope.row.avatarSrc" alt="" style="width: 150px;height: 150px"/>
</template>
<template #reference>
<el-tag size="medium">悬浮查看</el-tag>
</template>
</el-popover>
</template>
</el-table-column>
<el-table-column prop="userPhone" label="手机号" width="200"></el-table-column>
<el-table-column prop="userClass" label="用户类别"></el-table-column>
<el-table-column prop="userSalt" label="加密盐值"></el-table-column>
<el-table-column prop="version" label="版本"></el-table-column>
<el-table-column prop="gmtCreate" label="创建时间" width="250"></el-table-column>
<el-table-column prop="gmtModified" label="上次更改" width="250"></el-table-column>
<el-table-column align="right" fixed="right" width="100">
<template #header>
<el-input v-model="keyWord" size="mini" placeholder="搜索用户"></el-input>
</template>
<template #default="scope">
<el-button size="mini" @click="resetPassword(scope.row.userId)" type="danger">重置密码</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-main>
</el-container>
</div>
</div>
<footer>
<%@ include file="/jsp/foot.html" %>
</footer>
</div>
<script>
const App = {
data() {
return{
title:'用户',
user:{
username:'',
realName:'',
avatarSrc: ''
},
keyWord:'',
currentPage:1,
pageSize:10,
userList:[
<c:forEach items="${userList}" var="user">
{
userId: '${user.getUserId()}',
username: '${user.getUsername()}',
password:'${user.getPassword()}',
realName:'${user.getRealName()}',
userPhone:'${user.getUserPhone()}',
avatarSrc:'${user.getAvatarSrc()}',
userClass: '${user.getUserClass()}',
userSalt:'${user.getUserSalt()}',
version:'${user.getVersion()}',
gmtCreate:'${user.getGmtCreate()}',
gmtModified:'${user.getGmtModified()}',
isDelete:'${user.getIsDelete()}'
},
</c:forEach>
],
activeIndex:'5'
}
},
mounted(){
this.user.realName='${realName}'
this.user.username='${username}'
this.user.avatarSrc='${avatarSrc}'
<c:if test="${newMessageList.size()!=0}">
this.$notify.info({
title: '有新消息:${newMessageList.get(0).getMessageTitle()}',
message: '${newMessageList.get(0).getMessageContent()}',
offset: 100,
})
</c:if>
},
methods: {
goBack(){
window.history.go(-1);
},
resetPassword(id){
this.$messageBox.confirm(
'确认要重置用户密码为123456吗',
'警告',
{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
axios({
method: "get",
url: "/admin/resetPassword?userId="+id,
}).then(res=>{
if(res.data==="error")
{
this.$message.error('重置失败!')
}
else
{
this.$message.success('重置成功!')
}
})
})
}
},
computed:{
userListResult:function (){
let result=[];
if(this.keyWord==='')
{
return this.userList;
}
for(let i=0;i<this.userList.length;i++)
{
let str=this.userList[i].realName;
let str_leader=this.userList[i].username;
if(str.search(this.keyWord)!==-1||str_leader.search(this.keyWord)!==-1)
{
result.push(this.userList[i]);
}
}
return result;
},
currentPageUsers:function (){
return this.userListResult.slice((this.currentPage-1)*this.pageSize,this.currentPage*this.pageSize)
}
}
};
const app = Vue.createApp(App);
app.use(ElementPlus);
app.mount("#app");
</script>
</body>
</html>

@ -27,6 +27,12 @@
<template #title>活动列表</template> <template #title>活动列表</template>
</el-menu-item> </el-menu-item>
</shiro:hasRole> </shiro:hasRole>
<shiro:hasRole name="admin">
<el-menu-item index="5" onclick="location.href='/admin/users'">
<i class="el-icon-user"></i>
<template #title>用户列表</template>
</el-menu-item>
</shiro:hasRole>
<el-menu-item index="9"> <el-menu-item index="9">
<i class="el-icon-document"></i> <i class="el-icon-document"></i>
<template #title>Navigator Three</template> <template #title>Navigator Three</template>

@ -9,7 +9,13 @@
<shiro:hasRole name="student">欢迎学生:{{user.realName}}!</shiro:hasRole> <shiro:hasRole name="student">欢迎学生:{{user.realName}}!</shiro:hasRole>
<shiro:hasRole name="teacher">欢迎老师:{{user.realName}}!</shiro:hasRole> <shiro:hasRole name="teacher">欢迎老师:{{user.realName}}!</shiro:hasRole>
<shiro:hasRole name="admin">欢迎管理员:{{user.realName}}!</shiro:hasRole> <shiro:hasRole name="admin">欢迎管理员:{{user.realName}}!</shiro:hasRole>
<shiro:authenticated>&emsp;<el-link href="${pageContext.request.contextPath}/logout">登出 <i class="fa fa-sign-out"></i></el-link></shiro:authenticated> <shiro:authenticated>
<el-badge :value="${messageCount}" class="item" :hidden="${messageCount}==0">
<el-button icon="el-icon-message" onclick="location.href='/message'" size="mini"></el-button>
</el-badge>
&emsp;
<el-link href="${pageContext.request.contextPath}/logout">登出 <i class="fa fa-sign-out"></i></el-link>
</shiro:authenticated>
</div> </div>
</div> </div>
</el-affix> </el-affix>

@ -6,6 +6,7 @@
--%> --%>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %> <%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
@ -66,6 +67,13 @@
this.user.realName='${realName}' this.user.realName='${realName}'
this.user.username='${username}' this.user.username='${username}'
this.user.avatarSrc='${avatarSrc}' this.user.avatarSrc='${avatarSrc}'
<c:if test="${newMessageList.size()!=0}">
this.$notify.info({
title: '有新消息:${newMessageList.get(0).getMessageTitle()}',
message: '${newMessageList.get(0).getMessageContent()}',
offset: 100,
})
</c:if>
}, },
methods: { methods: {
goBack(){ goBack(){

@ -0,0 +1,16 @@
<%--
Created by IntelliJ IDEA.
User: peteralbus
Date: 2021/12/21
Time: 21:39
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
</body>
</html>

@ -0,0 +1,16 @@
<%--
Created by IntelliJ IDEA.
User: peteralbus
Date: 2021/12/21
Time: 21:18
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
</body>
</html>

@ -175,6 +175,13 @@
this.user.realName='${realName}' this.user.realName='${realName}'
this.user.username='${username}' this.user.username='${username}'
this.user.avatarSrc='${avatarSrc}' this.user.avatarSrc='${avatarSrc}'
<c:if test="${newMessageList.size()!=0}">
this.$notify.info({
title: '有新消息:${newMessageList.get(0).getMessageTitle()}',
message: '${newMessageList.get(0).getMessageContent()}',
offset: 100,
})
</c:if>
let teachers let teachers
<c:forEach items="${activityList}" var="activity"> <c:forEach items="${activityList}" var="activity">
teachers=[] teachers=[]

@ -235,6 +235,13 @@
this.user.username='${username}' this.user.username='${username}'
this.user.avatarSrc='${avatarSrc}' this.user.avatarSrc='${avatarSrc}'
this.user.userId='${userId}' this.user.userId='${userId}'
<c:if test="${newMessageList.size()!=0}">
this.$notify.info({
title: '有新消息:${newMessageList.get(0).getMessageTitle()}',
message: '${newMessageList.get(0).getMessageContent()}',
offset: 100,
})
</c:if>
}, },
methods: { methods: {
goBack(){ goBack(){

@ -195,6 +195,13 @@
this.user.realName='${realName}' this.user.realName='${realName}'
this.user.username='${username}' this.user.username='${username}'
this.user.avatarSrc='${avatarSrc}' this.user.avatarSrc='${avatarSrc}'
<c:if test="${newMessageList.size()!=0}">
this.$notify.info({
title: '有新消息:${newMessageList.get(0).getMessageTitle()}',
message: '${newMessageList.get(0).getMessageContent()}',
offset: 100,
})
</c:if>
}, },
methods: { methods: {
goBack(){ goBack(){

@ -220,6 +220,13 @@
this.user.username='${username}' this.user.username='${username}'
this.user.avatarSrc='${avatarSrc}' this.user.avatarSrc='${avatarSrc}'
this.user.userId='${userId}' this.user.userId='${userId}'
<c:if test="${newMessageList.size()!=0}">
this.$notify.info({
title: '有新消息:${newMessageList.get(0).getMessageTitle()}',
message: '${newMessageList.get(0).getMessageContent()}',
offset: 100,
})
</c:if>
}, },
methods: { methods: {
goBack(){ goBack(){

@ -189,6 +189,13 @@
this.user.username='${username}' this.user.username='${username}'
this.user.avatarSrc='${avatarSrc}' this.user.avatarSrc='${avatarSrc}'
this.user.userId='${userId}' this.user.userId='${userId}'
<c:if test="${newMessageList.size()!=0}">
this.$notify.info({
title: '有新消息:${newMessageList.get(0).getMessageTitle()}',
message: '${newMessageList.get(0).getMessageContent()}',
offset: 100,
})
</c:if>
}, },
methods: { methods: {
goBack(){ goBack(){

@ -172,6 +172,13 @@
this.user.realName='${realName}' this.user.realName='${realName}'
this.user.username='${username}' this.user.username='${username}'
this.user.avatarSrc='${avatarSrc}' this.user.avatarSrc='${avatarSrc}'
<c:if test="${newMessageList.size()!=0}">
this.$notify.info({
title: '有新消息:${newMessageList.get(0).getMessageTitle()}',
message: '${newMessageList.get(0).getMessageContent()}',
offset: 100,
})
</c:if>
let teachers let teachers
<c:forEach items="${activityList}" var="activity"> <c:forEach items="${activityList}" var="activity">
teachers=[] teachers=[]

@ -136,6 +136,13 @@
this.user.realName='${realName}' this.user.realName='${realName}'
this.user.username='${username}' this.user.username='${username}'
this.user.avatarSrc='${avatarSrc}' this.user.avatarSrc='${avatarSrc}'
<c:if test="${newMessageList.size()!=0}">
this.$notify.info({
title: '有新消息:${newMessageList.get(0).getMessageTitle()}',
message: '${newMessageList.get(0).getMessageContent()}',
offset: 100,
})
</c:if>
}, },
methods: { methods: {
goBack(){ goBack(){

@ -251,6 +251,13 @@
this.user.username='${username}' this.user.username='${username}'
this.user.avatarSrc='${avatarSrc}' this.user.avatarSrc='${avatarSrc}'
this.user.userId='${userId}' this.user.userId='${userId}'
<c:if test="${newMessageList.size()!=0}">
this.$notify.info({
title: '有新消息:${newMessageList.get(0).getMessageTitle()}',
message: '${newMessageList.get(0).getMessageContent()}',
offset: 100,
})
</c:if>
}, },
methods: { methods: {
goBack(){ goBack(){

@ -214,6 +214,13 @@
this.user.realName='${realName}' this.user.realName='${realName}'
this.user.username='${username}' this.user.username='${username}'
this.user.avatarSrc='${avatarSrc}' this.user.avatarSrc='${avatarSrc}'
<c:if test="${newMessageList.size()!=0}">
this.$notify.info({
title: '有新消息:${newMessageList.get(0).getMessageTitle()}',
message: '${newMessageList.get(0).getMessageContent()}',
offset: 100,
})
</c:if>
}, },
computed:{ computed:{
teacherListResult:function (){ teacherListResult:function (){

Loading…
Cancel
Save