admin page and log update

This commit is contained in:
czm 2020-12-30 14:41:49 +08:00
parent 78435af514
commit fa0eb26d9a
7 changed files with 91 additions and 58 deletions

View File

@ -86,7 +86,8 @@ const constantRoutes = [
path: 'paper/list', path: 'paper/list',
component: () => import('@/views/exam/paper/list'), component: () => import('@/views/exam/paper/list'),
name: 'ExamPaperPageList', name: 'ExamPaperPageList',
meta: { title: '试卷列表', noCache: true } meta: { title: '试卷列表', noCache: true },
hidden: true
}, },
{ {
path: 'paper/edit', path: 'paper/edit',
@ -138,30 +139,30 @@ const constantRoutes = [
} }
] ]
}, },
{ // {
path: '/task', // path: '/task',
component: Layout, // component: Layout,
name: 'TaskPage', // name: 'TaskPage',
meta: { // meta: {
title: '任务管理', // title: '任务管理',
icon: 'task' // icon: 'task'
}, // },
alwaysShow: true, // alwaysShow: true,
children: [ // children: [
{ // {
path: 'list', // path: 'list',
component: () => import('@/views/task/list'), // component: () => import('@/views/task/list'),
name: 'TaskListPage', // name: 'TaskListPage',
meta: { title: '任务列表', noCache: true } // meta: { title: '任务列表', noCache: true }
}, // },
{ // {
path: 'edit', // path: 'edit',
component: () => import('@/views/task/edit'), // component: () => import('@/views/task/edit'),
name: 'TaskEditPage', // name: 'TaskEditPage',
meta: { title: '任务创建', noCache: true } // meta: { title: '任务创建', noCache: true }
} // }
] // ]
}, // },
{ {
path: '/education', path: '/education',
component: Layout, component: Layout,
@ -200,30 +201,30 @@ const constantRoutes = [
} }
] ]
}, },
{ // {
path: '/message', // path: '/message',
component: Layout, // component: Layout,
name: 'MessagePage', // name: 'MessagePage',
meta: { // meta: {
title: '消息中心', // title: '消息中心',
icon: 'message' // icon: 'message'
}, // },
alwaysShow: true, // alwaysShow: true,
children: [ // children: [
{ // {
path: 'list', // path: 'list',
component: () => import('@/views/message/list'), // component: () => import('@/views/message/list'),
name: 'MessageListPage', // name: 'MessageListPage',
meta: { title: '消息列表', noCache: true } // meta: { title: '消息列表', noCache: true }
}, // },
{ // {
path: 'send', // path: 'send',
component: () => import('@/views/message/send'), // component: () => import('@/views/message/send'),
name: 'MessageSendPage', // name: 'MessageSendPage',
meta: { title: '消息发送', noCache: true } // meta: { title: '消息发送', noCache: true }
} // }
] // ]
}, // },
{ {
path: '/log', path: '/log',
component: Layout, component: Layout,

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="dashboard-container"> <div class="dashboard-container">
<el-row :gutter="40" class="panel-group"> <el-row :gutter="40" class="panel-group">
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> <!--<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel"> <div class="card-panel">
<div class="card-panel-icon-wrapper icon-people"> <div class="card-panel-icon-wrapper icon-people">
<svg-icon icon-class="exam" class-name="card-panel-icon"/> <svg-icon icon-class="exam" class-name="card-panel-icon"/>
@ -13,7 +13,7 @@
<count-to :start-val="0" :end-val="examPaperCount" :duration="2600" class="card-panel-num" v-loading="loading"/> <count-to :start-val="0" :end-val="examPaperCount" :duration="2600" class="card-panel-num" v-loading="loading"/>
</div> </div>
</div> </div>
</el-col> </el-col>-->
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel" > <div class="card-panel" >
<div class="card-panel-icon-wrapper icon-message"> <div class="card-panel-icon-wrapper icon-message">
@ -27,6 +27,7 @@
</div> </div>
</div> </div>
</el-col> </el-col>
<!--
<el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col">
<div class="card-panel"> <div class="card-panel">
<div class="card-panel-icon-wrapper icon-shopping"> <div class="card-panel-icon-wrapper icon-shopping">
@ -53,6 +54,7 @@
</div> </div>
</div> </div>
</el-col> </el-col>
-->
</el-row> </el-row>
<el-row class="echarts-line"> <el-row class="echarts-line">
<div id="echarts-moth-user" style="width: 100%;height:400px;" v-loading="loading"/> <div id="echarts-moth-user" style="width: 100%;height:400px;" v-loading="loading"/>

View File

@ -19,7 +19,7 @@
<el-table-column prop="name" label="industry"/> <el-table-column prop="name" label="industry"/>
<el-table-column width="220px" label="操作" align="center"> <el-table-column width="220px" label="操作" align="center">
<template slot-scope="{row}"> <template slot-scope="{row}">
<router-link :to="{path:'/education/subject/edit', query:{id:row.id}}" class="link-left"> <router-link :to="{path:'/education/industry/edit', query:{id:row.id}}" class="link-left">
<el-button size="mini">编辑</el-button> <el-button size="mini">编辑</el-button>
</router-link> </router-link>
<el-button size="mini" type="danger" @click="delSubject(row)" class="link-left">删除</el-button> <el-button size="mini" type="danger" @click="delSubject(row)" class="link-left">删除</el-button>

View File

@ -25,11 +25,11 @@
<el-form-item label="手机:"> <el-form-item label="手机:">
<el-input v-model="form.phone"></el-input> <el-input v-model="form.phone"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="年级:" prop="userLevel" required> <!--<el-form-item label="年级:" prop="userLevel" required>
<el-select v-model="form.userLevel" placeholder="年级"> <el-select v-model="form.userLevel" placeholder="年级">
<el-option v-for="item in levelEnum" :key="item.key" :value="item.key" :label="item.value"></el-option> <el-option v-for="item in levelEnum" :key="item.key" :value="item.key" :label="item.value"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>-->
<el-form-item label="状态:" required> <el-form-item label="状态:" required>
<el-select v-model="form.status" placeholder="状态"> <el-select v-model="form.status" placeholder="状态">
<el-option v-for="item in statusEnum" :key="item.key" :value="item.key" :label="item.value"></el-option> <el-option v-for="item in statusEnum" :key="item.key" :value="item.key" :label="item.value"></el-option>
@ -61,7 +61,7 @@ export default {
sex: '', sex: '',
birthDay: null, birthDay: null,
phone: null, phone: null,
userLevel: null userLevel: '1'
}, },
formLoading: false, formLoading: false,
rules: { rules: {
@ -125,7 +125,7 @@ export default {
sex: '', sex: '',
birthDay: null, birthDay: null,
phone: null, phone: null,
userLevel: null userLevel: '1'
} }
}, },
...mapActions('tagsView', { delCurrentView: 'delCurrentView' }) ...mapActions('tagsView', { delCurrentView: 'delCurrentView' })

View File

@ -16,7 +16,7 @@
<el-table-column prop="id" label="Id" /> <el-table-column prop="id" label="Id" />
<el-table-column prop="userName" label="用户名"/> <el-table-column prop="userName" label="用户名"/>
<el-table-column prop="realName" label="真实姓名" /> <el-table-column prop="realName" label="真实姓名" />
<el-table-column prop="userLevel" label="学级" :formatter="levelFormatter"/> <!--<el-table-column prop="userLevel" label="学级" :formatter="levelFormatter"/>-->
<el-table-column prop="sex" label="性别" width="60px;" :formatter="sexFormatter"/> <el-table-column prop="sex" label="性别" width="60px;" :formatter="sexFormatter"/>
<el-table-column prop="phone" label="手机号"/> <el-table-column prop="phone" label="手机号"/>
<el-table-column prop="createTime" label="创建时间" width="160px"/> <el-table-column prop="createTime" label="创建时间" width="160px"/>

View File

@ -5,9 +5,14 @@ import com.mindskip.xzs.base.RestResponse;
import com.mindskip.xzs.base.SystemCode; import com.mindskip.xzs.base.SystemCode;
import com.mindskip.xzs.domain.Question; import com.mindskip.xzs.domain.Question;
import com.mindskip.xzs.domain.TextContent; import com.mindskip.xzs.domain.TextContent;
import com.mindskip.xzs.domain.User;
import com.mindskip.xzs.domain.UserEventLog;
import com.mindskip.xzs.domain.enums.QuestionTypeEnum; import com.mindskip.xzs.domain.enums.QuestionTypeEnum;
import com.mindskip.xzs.domain.question.QuestionObject; import com.mindskip.xzs.domain.question.QuestionObject;
import com.mindskip.xzs.event.UserEvent;
import com.mindskip.xzs.service.IndustryService;
import com.mindskip.xzs.service.QuestionService; import com.mindskip.xzs.service.QuestionService;
import com.mindskip.xzs.service.SkillService;
import com.mindskip.xzs.service.TextContentService; import com.mindskip.xzs.service.TextContentService;
import com.mindskip.xzs.utility.*; import com.mindskip.xzs.utility.*;
import com.mindskip.xzs.viewmodel.admin.question.QuestionEditRequestVM; import com.mindskip.xzs.viewmodel.admin.question.QuestionEditRequestVM;
@ -17,9 +22,11 @@ import com.github.pagehelper.PageInfo;
import com.mindskip.xzs.utility.*; import com.mindskip.xzs.utility.*;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.Date;
@RestController("AdminQuestionController") @RestController("AdminQuestionController")
@RequestMapping(value = "/api/admin/question") @RequestMapping(value = "/api/admin/question")
@ -28,6 +35,9 @@ public class QuestionController extends BaseApiController {
private final QuestionService questionService; private final QuestionService questionService;
private final TextContentService textContentService; private final TextContentService textContentService;
private final ApplicationEventPublisher eventPublisher;
private final IndustryService industryService;
private final SkillService skillService;
@RequestMapping(value = "/page", method = RequestMethod.POST) @RequestMapping(value = "/page", method = RequestMethod.POST)
public RestResponse<PageInfo<QuestionResponseVM>> pageList(@RequestBody QuestionPageRequestVM model) { public RestResponse<PageInfo<QuestionResponseVM>> pageList(@RequestBody QuestionPageRequestVM model) {
@ -51,13 +61,24 @@ public class QuestionController extends BaseApiController {
if (validQuestionEditRequestResult.getCode() != SystemCode.OK.getCode()) { if (validQuestionEditRequestResult.getCode() != SystemCode.OK.getCode()) {
return validQuestionEditRequestResult; return validQuestionEditRequestResult;
} }
User user = getCurrentUser();
UserEventLog userEventLog = new UserEventLog(user.getId(), user.getUserName(), user.getRealName(), new Date());
String content = "";
if (null == model.getId()) { if (null == model.getId()) {
questionService.insertFullQuestion(model, getCurrentUser().getId()); Question question = questionService.insertFullQuestion(model, getCurrentUser().getId());
content = user.getUserName() + "增加 [题号——>"+question.getId()+"] " +
"[industry——>"+industryService.selectById(model.getIndustryId()).getName()+"] " +
"[skill——>"+skillService.selectById(model.getSkillId()).getName()+"]";
} else { } else {
questionService.updateFullQuestion(model); questionService.updateFullQuestion(model);
content = user.getUserName() + "更新 [题号——>"+model.getId()+"] " +
"[industry——>"+industryService.selectById(model.getIndustryId()).getName()+"] " +
"[skill——>"+skillService.selectById(model.getSkillId()).getName()+"]";
} }
userEventLog.setContent(content);
eventPublisher.publishEvent(new UserEvent(userEventLog));
return RestResponse.ok(); return RestResponse.ok();
} }
@ -73,6 +94,13 @@ public class QuestionController extends BaseApiController {
Question question = questionService.selectById(id); Question question = questionService.selectById(id);
question.setDeleted(true); question.setDeleted(true);
questionService.updateByIdFilter(question); questionService.updateByIdFilter(question);
User user = getCurrentUser();
UserEventLog userEventLog = new UserEventLog(user.getId(), user.getUserName(), user.getRealName(), new Date());
String content = user.getUserName() + "删除 [题号——>"+question.getId()+"] " +
"[industry——>"+industryService.selectById(question.getIndustryId()).getName()+"] " +
"[skill——>"+skillService.selectById(question.getSkillId()).getName()+"]";
userEventLog.setContent(content);
eventPublisher.publishEvent(new UserEvent(userEventLog));
return RestResponse.ok(); return RestResponse.ok();
} }

View File

@ -372,3 +372,5 @@ CREATE TABLE `t_user_token` (
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Compact; ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Compact;
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;
(SELECT * FROM t_question WHERE skill_id = 1 LIMIT 2) UNION (SELECT * FROM t_question WHERE skill_id = 11 LIMIT 2) ;