完成课程管理数据读取,修复页面加载css,js错误
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
package com.fjy.spring.controller;
|
package com.fjy.spring.controller;
|
||||||
|
|
||||||
|
import com.fjy.spring.domain.VCourse;
|
||||||
import com.fjy.spring.domain.VFeedBack;
|
import com.fjy.spring.domain.VFeedBack;
|
||||||
import com.fjy.spring.domain.VLog;
|
import com.fjy.spring.domain.VLog;
|
||||||
import com.fjy.spring.domain.VWorkDetail;
|
import com.fjy.spring.domain.VWorkDetail;
|
||||||
import com.fjy.spring.enums.ResultEnum;
|
import com.fjy.spring.enums.ResultEnum;
|
||||||
import com.fjy.spring.exception.UserException;
|
import com.fjy.spring.exception.UserException;
|
||||||
|
import com.fjy.spring.service.CourseService;
|
||||||
import com.fjy.spring.service.FeedBackService;
|
import com.fjy.spring.service.FeedBackService;
|
||||||
import com.fjy.spring.service.LogService;
|
import com.fjy.spring.service.LogService;
|
||||||
import com.fjy.spring.service.WorkDetailService;
|
import com.fjy.spring.service.WorkDetailService;
|
||||||
@@ -26,6 +28,9 @@ public class DataController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private FeedBackService feedBackService;
|
private FeedBackService feedBackService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CourseService courseService;
|
||||||
|
|
||||||
@GetMapping("/home/findAllHomework")
|
@GetMapping("/home/findAllHomework")
|
||||||
public List<VWorkDetail> findAllHomework(){
|
public List<VWorkDetail> findAllHomework(){
|
||||||
List<VWorkDetail> homeworks = workDetailService.findAll();
|
List<VWorkDetail> homeworks = workDetailService.findAll();
|
||||||
@@ -55,4 +60,14 @@ public class DataController {
|
|||||||
new UserException(ResultEnum.EMPTY_DATA);
|
new UserException(ResultEnum.EMPTY_DATA);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/home/findvcourse")
|
||||||
|
public List<VCourse> findVCourse(){
|
||||||
|
List<VCourse> vCourses = courseService.findAllVCourse();
|
||||||
|
if (vCourses!=null){
|
||||||
|
return vCourses;
|
||||||
|
}
|
||||||
|
new UserException(ResultEnum.EMPTY_DATA);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,11 +35,27 @@ public class NavController {
|
|||||||
return "/home/about";
|
return "/home/about";
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = {"/admin"})
|
@GetMapping(value = {"/home/admin"})
|
||||||
public String toAdminPage(){
|
public String toAdminPage(){
|
||||||
return "/home/admin";
|
return "/home/admin";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = {"/home/managecourse"})
|
||||||
|
public String toManageCoursePage(){
|
||||||
|
return "/home/managecourse";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = {"/home/manageuser"})
|
||||||
|
public String toManageUserPage(){
|
||||||
|
return "/home/manageuser";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = {"/home/homework"})
|
||||||
|
public String toHomeworkPage(){
|
||||||
|
return "/home/homework";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = {"/home/user"})
|
@GetMapping(value = {"/home/user"})
|
||||||
public String toUserPage(){
|
public String toUserPage(){
|
||||||
return "/home/user";
|
return "/home/user";
|
||||||
|
|||||||
71
src/main/java/com/fjy/spring/domain/VCourse.java
Normal file
71
src/main/java/com/fjy/spring/domain/VCourse.java
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
package com.fjy.spring.domain;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.Immutable;
|
||||||
|
import org.hibernate.annotations.Subselect;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Immutable
|
||||||
|
@Subselect("SELECT * FROM v_course")
|
||||||
|
public class VCourse {
|
||||||
|
@Id
|
||||||
|
@Column(name = "courseno")
|
||||||
|
private Integer courseNo;
|
||||||
|
|
||||||
|
@Column(name = "coursename")
|
||||||
|
private String courseName;
|
||||||
|
|
||||||
|
@Column(name = "coursetime")
|
||||||
|
private String courseTime;
|
||||||
|
|
||||||
|
@Column(name = "colrealname")
|
||||||
|
private String teacherusername;
|
||||||
|
|
||||||
|
@Column(name = "colname")
|
||||||
|
private String teacherrealname;
|
||||||
|
|
||||||
|
public Integer getCourseNo() {
|
||||||
|
return courseNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCourseNo(Integer courseNo) {
|
||||||
|
this.courseNo = courseNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCourseName() {
|
||||||
|
return courseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCourseName(String courseName) {
|
||||||
|
this.courseName = courseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCourseTime() {
|
||||||
|
return courseTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCourseTime(String courseTime) {
|
||||||
|
this.courseTime = courseTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTeacherusername() {
|
||||||
|
return teacherusername;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTeacherusername(String teacherusername) {
|
||||||
|
this.teacherusername = teacherusername;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTeacherrealname() {
|
||||||
|
return teacherrealname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTeacherrealname(String teacherrealname) {
|
||||||
|
this.teacherrealname = teacherrealname;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.fjy.spring.repository;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fjy.spring.domain.VCourse;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface VCourseRepository extends JpaRepository<VCourse,Integer> {
|
||||||
|
|
||||||
|
}
|
||||||
18
src/main/java/com/fjy/spring/service/CourseService.java
Normal file
18
src/main/java/com/fjy/spring/service/CourseService.java
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package com.fjy.spring.service;
|
||||||
|
|
||||||
|
import com.fjy.spring.domain.VCourse;
|
||||||
|
import com.fjy.spring.repository.VCourseRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CourseService {
|
||||||
|
@Autowired
|
||||||
|
private VCourseRepository vcourseRepository;
|
||||||
|
|
||||||
|
public List<VCourse> findAllVCourse(){
|
||||||
|
return vcourseRepository.findAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,18 +17,6 @@ var Main = {
|
|||||||
username: "root",
|
username: "root",
|
||||||
content: "1234214",
|
content: "1234214",
|
||||||
time: "2018-02-08 10:30:38"
|
time: "2018-02-08 10:30:38"
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 72,
|
|
||||||
username: "root",
|
|
||||||
content: "afsdas",
|
|
||||||
time: "2018-02-08 10:31:22"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 73,
|
|
||||||
username: "root",
|
|
||||||
content: "反馈",
|
|
||||||
time: "2018-02-08 10:35:18"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
logData:[
|
logData:[
|
||||||
|
|||||||
@@ -157,7 +157,6 @@ var Main = {
|
|||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openNotiSuccess(title,content) {
|
openNotiSuccess(title,content) {
|
||||||
|
|||||||
@@ -6,45 +6,40 @@ var Main = {
|
|||||||
user: '',
|
user: '',
|
||||||
region: ''
|
region: ''
|
||||||
},
|
},
|
||||||
tableData3: [{
|
tableData3: [
|
||||||
id:'1',
|
{
|
||||||
date: '2016-05-03',
|
courseNo: 1,
|
||||||
name: '王小虎',
|
courseName: "信息安全",
|
||||||
address: '上海市普陀区金沙江路 1518 弄'
|
courseTime: "2018-02-06 20:42:28.0",
|
||||||
}, {
|
teacherusername: "FJY",
|
||||||
id:'2',
|
teacherrealname: "root"
|
||||||
date: '2016-05-02',
|
}
|
||||||
name: '王小虎',
|
],
|
||||||
address: '上海市普陀区金沙江路 1518 弄'
|
|
||||||
}, {
|
|
||||||
id:'3',
|
|
||||||
date: '2016-05-04',
|
|
||||||
name: '王小虎',
|
|
||||||
address: '上海市普陀区金沙江路 1518 弄'
|
|
||||||
}, {
|
|
||||||
id:'4',
|
|
||||||
date: '2016-05-01',
|
|
||||||
name: '王小虎',
|
|
||||||
address: '上海市普陀区金沙江路 1518 弄'
|
|
||||||
}, {
|
|
||||||
id:'5',
|
|
||||||
date: '2016-05-08',
|
|
||||||
name: '王小虎',
|
|
||||||
address: '上海市普陀区金沙江路 1518 弄'
|
|
||||||
}, {
|
|
||||||
id:'6',
|
|
||||||
date: '2016-05-06',
|
|
||||||
name: '王小虎',
|
|
||||||
address: '上海市普陀区金沙江路 1518 弄'
|
|
||||||
}, {
|
|
||||||
id:'7',
|
|
||||||
date: '2016-05-07',
|
|
||||||
name: '王小虎',
|
|
||||||
address: '上海市普陀区金沙江路 1518 弄'
|
|
||||||
}],
|
|
||||||
multipleSelection: []
|
multipleSelection: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
var that = this;
|
||||||
|
axios.get('http://localhost:8080/cms/home/findvcourse')
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response.data);
|
||||||
|
that.tableData3 = response.data;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
/*axios.get('http://localhost:8080/cms/home/findAllHomework')
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response.data);
|
||||||
|
that.tableHomeworkData = response.data;
|
||||||
|
//that.limitTime = response.data;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});*/
|
||||||
|
})
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
togglePost(url){
|
togglePost(url){
|
||||||
axios({
|
axios({
|
||||||
@@ -70,7 +65,7 @@ var Main = {
|
|||||||
console.log(key, keyPath);
|
console.log(key, keyPath);
|
||||||
},
|
},
|
||||||
ClickToJump(targe){
|
ClickToJump(targe){
|
||||||
window.location.href="http://localhost:8080/cms/" + targe;
|
window.location.href="http://localhost:8080/cms/home/" + targe;
|
||||||
},
|
},
|
||||||
toggleSelection(rows) {
|
toggleSelection(rows) {
|
||||||
if (rows) {
|
if (rows) {
|
||||||
|
|||||||
@@ -22,13 +22,13 @@
|
|||||||
<span>管理员号</span>
|
<span>管理员号</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<el-button type="text" @click="ClickToJump('home')">用户管理</el-button>
|
<el-button type="text" @click="ClickToJump('admin')">后台主页</el-button>
|
||||||
<br>
|
<br>
|
||||||
<el-button type="text" @click="ClickToJump('user')">课程/老师管理</el-button>
|
<el-button type="text" @click="ClickToJump('managecourse')">课程管理</el-button>
|
||||||
<br>
|
<br>
|
||||||
<el-button type="text" @click="ClickToJump('about')">作业管理</el-button>
|
<el-button type="text" @click="ClickToJump('homework')">作业管理</el-button>
|
||||||
<br>
|
<br>
|
||||||
<el-button type="text" @click="ClickToJump('feedback')">公告/日志</el-button>
|
<el-button type="text" @click="ClickToJump('manageuser')">用户管理</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
</el-container>
|
</el-container>
|
||||||
</el-container>
|
</el-container>
|
||||||
</div>
|
</div>
|
||||||
<script th:src="@{js/admin.js}"></script>
|
<script th:src="@{../js/admin.js}"></script>
|
||||||
<script th:src="@{js/msg.js}"></script>
|
<script th:src="@{../js/msg.js}"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,51 +1,19 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
|
||||||
<html lang="en">
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
<head>
|
xmlns:th="http://www.thymeleaf.org">
|
||||||
<meta charset="UTF-8">
|
<head th:include="dist/thymeleaf/common_head :: header('课程管理')">
|
||||||
<title>课程|老师 管理</title>
|
|
||||||
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
|
|
||||||
<!--<link rel="stylesheet" href="https://unpkg.com/element-ui@2.1.0/lib/theme-chalk/display.css">-->
|
|
||||||
<link rel="stylesheet" href="../../static/css/style.css">
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<!-- 先引入 Vue -->
|
<div th:insert="~{dist/thymeleaf/common_head :: #body_js}"></div>
|
||||||
<script src="https://unpkg.com/vue/dist/vue.js"></script>
|
|
||||||
<!-- 引入组件库 -->
|
|
||||||
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
|
|
||||||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-header>
|
<el-header th:include="dist/thymeleaf/layout :: header"></el-header>
|
||||||
<el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
|
|
||||||
<el-menu-item index="1">首页</el-menu-item>
|
|
||||||
<el-submenu index="2">
|
|
||||||
<template slot="title">个人中心</template>
|
|
||||||
<el-menu-item index="2-1">选项1</el-menu-item>
|
|
||||||
<el-menu-item index="2-2">选项2</el-menu-item>
|
|
||||||
<el-menu-item index="2-3">选项3</el-menu-item>
|
|
||||||
</el-submenu>
|
|
||||||
<el-menu-item index="3" @click="ClickToJump('about')">关于</el-menu-item>
|
|
||||||
<el-menu-item index="4" @click="ClickToJump('feedback')">意见反馈</el-menu-item>
|
|
||||||
<el-menu-item index="5"><a href="login.jsp">登出</a></el-menu-item>
|
|
||||||
</el-menu>
|
|
||||||
</el-header>
|
|
||||||
<el-main>
|
<el-main>
|
||||||
|
|
||||||
<el-col :md="4" :lg="4" :xl="4" class="hidden-sm-and-down">
|
<el-col :md="4" :lg="4" :xl="4" class="hidden-sm-and-down">
|
||||||
<el-row><el-card class="box-card">
|
<el-row>
|
||||||
<div slot="header" class="clearfix">
|
<el-card th:include="dist/thymeleaf/layout :: userbox"></el-card>
|
||||||
<span>用户名</span><br>
|
|
||||||
<span>学号</span>
|
|
||||||
</div>
|
|
||||||
<div class="item">
|
|
||||||
<el-button type="text" @click="ClickToJump('home')">首页</el-button><br>
|
|
||||||
<el-button type="text" @click="ClickToJump('user')">个人中心</el-button><br>
|
|
||||||
<el-button type="text" @click="ClickToJump('about')">关于</el-button><br>
|
|
||||||
<el-button type="text" @click="ClickToJump('feedback')">意见反馈</el-button>
|
|
||||||
</div>
|
|
||||||
</el-card>
|
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-card class="box-card">
|
<el-card class="box-card">
|
||||||
@@ -71,14 +39,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<el-table ref="multipleTable" :data="tableData3"
|
<el-table ref="multipleTable" :data="tableData3"
|
||||||
tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
|
tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" prop='id' width="55">
|
<el-table-column type="selection" prop='courseNo' width="55">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="courseName" label="课程名">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="日期" width="120">
|
<el-table-column label="日期" width="120">
|
||||||
<template slot-scope="scope">{{ scope.row.date }}</template>
|
<template slot-scope="scope">{{ scope.row.courseTime }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="name" label="姓名" width="120">
|
<el-table-column prop="teacherrealname" label="老师姓名" width="120">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="address" label="地址" show-overflow-tooltip>
|
<el-table-column prop="teacherusername" label="老师用户名" width="120">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</template>
|
</template>
|
||||||
@@ -98,7 +68,7 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="onSubmit">添加</el-button>
|
<el-button type="primary" @click="onSubmit">添加</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form></el-row>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -106,14 +76,11 @@
|
|||||||
|
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-main>
|
</el-main>
|
||||||
<el-footer>
|
<el-footer th:include="dist/thymeleaf/layout :: footer"></el-footer>
|
||||||
<div class="footer">
|
|
||||||
© 2018 作业提交系统
|
|
||||||
</div></el-footer>
|
|
||||||
</el-container>
|
</el-container>
|
||||||
</el-container>
|
</el-container>
|
||||||
</div>
|
</div>
|
||||||
<script src="../../static/js/managecourse.js"></script>
|
<script th:src="@{/js/managecourse.js}"></script>
|
||||||
<script src="../../static/js/msg.js"></script>
|
<script th:src="@{/js/msg.js}"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user