实现用户信息修改页面session传值
This commit is contained in:
@@ -6,6 +6,7 @@ import com.fjy.spring.exception.UserException;
|
|||||||
import com.fjy.spring.service.*;
|
import com.fjy.spring.service.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -31,6 +32,12 @@ public class DataController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private HomeworkService homeworkService;
|
private HomeworkService homeworkService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FileService fileService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VUserfileService vUserfileService;
|
||||||
|
|
||||||
@GetMapping("/home/findAllHomework")
|
@GetMapping("/home/findAllHomework")
|
||||||
public List<VWorkDetail> findAllHomework(){
|
public List<VWorkDetail> findAllHomework(){
|
||||||
List<VWorkDetail> homeworks = workDetailService.findAll();
|
List<VWorkDetail> homeworks = workDetailService.findAll();
|
||||||
@@ -90,4 +97,15 @@ public class DataController {
|
|||||||
new UserException(ResultEnum.EMPTY_DATA);
|
new UserException(ResultEnum.EMPTY_DATA);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/home/findStudentInCourseFile")
|
||||||
|
public List<VUserfile> findStudentInCourseFile(
|
||||||
|
@RequestParam(value = "Folder") String Folder,@RequestParam(value = "CourseName") String CourseName){
|
||||||
|
List<VUserfile> files = vUserfileService.findByWorkFolderAndCourseName(Folder,CourseName);
|
||||||
|
if (files!=null){
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
new UserException(ResultEnum.EMPTY_DATA);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ package com.fjy.spring.controller;
|
|||||||
|
|
||||||
import com.fjy.spring.constant.GlobalConstant;
|
import com.fjy.spring.constant.GlobalConstant;
|
||||||
import com.fjy.spring.domain.TbFile;
|
import com.fjy.spring.domain.TbFile;
|
||||||
|
import com.fjy.spring.domain.TbLog;
|
||||||
import com.fjy.spring.domain.TbUser;
|
import com.fjy.spring.domain.TbUser;
|
||||||
import com.fjy.spring.properties.ServerProperties;
|
import com.fjy.spring.properties.ServerProperties;
|
||||||
import com.fjy.spring.service.FileService;
|
import com.fjy.spring.service.FileService;
|
||||||
|
import com.fjy.spring.service.LogService;
|
||||||
import com.fjy.spring.untils.FormatFileSizeUtil;
|
import com.fjy.spring.untils.FormatFileSizeUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@@ -12,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -30,6 +33,12 @@ public class UpLoadController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private FileService fileService;//文件相关数据库操作
|
private FileService fileService;//文件相关数据库操作
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LogService logService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
HttpServletRequest httpServletRequest;
|
||||||
|
|
||||||
@GetMapping("/toOneUpload")
|
@GetMapping("/toOneUpload")
|
||||||
public String toOneUpload() {
|
public String toOneUpload() {
|
||||||
return "oneUpload";
|
return "oneUpload";
|
||||||
@@ -145,7 +154,9 @@ public class UpLoadController {
|
|||||||
|
|
||||||
for (MultipartFile file : files.values()) {
|
for (MultipartFile file : files.values()) {
|
||||||
String filename = file.getOriginalFilename();
|
String filename = file.getOriginalFilename();
|
||||||
File targetFile = new File(uploadUrl + filename);
|
String suffix = "."+filename.substring(filename.lastIndexOf(".") + 1);//获取文件后缀
|
||||||
|
|
||||||
|
File targetFile = new File(uploadUrl + user.getColstudentno()+user.getColrealname()+suffix);
|
||||||
|
|
||||||
System.out.println("文件上传到: " + uploadUrl + filename);
|
System.out.println("文件上传到: " + uploadUrl + filename);
|
||||||
System.out.println("文件大小: " + new FormatFileSizeUtil().GetFileSize(file.getSize()));
|
System.out.println("文件大小: " + new FormatFileSizeUtil().GetFileSize(file.getSize()));
|
||||||
@@ -153,11 +164,21 @@ public class UpLoadController {
|
|||||||
|
|
||||||
TbFile tbFile = new TbFile();
|
TbFile tbFile = new TbFile();
|
||||||
tbFile.setColfilesize(new FormatFileSizeUtil().GetFileSize(file.getSize()));
|
tbFile.setColfilesize(new FormatFileSizeUtil().GetFileSize(file.getSize()));
|
||||||
tbFile.setColfilename(filename);
|
tbFile.setColfilename(user.getColstudentno()+user.getColrealname()+suffix);
|
||||||
tbFile.setColtime(dateNowStr);
|
tbFile.setColtime(dateNowStr);
|
||||||
tbFile.setColfilepath(uploadUrl + filename);
|
tbFile.setColrealname(filename);
|
||||||
|
tbFile.setColfilepath(uploadUrl + user.getColstudentno()+user.getColrealname()+suffix);//文件自动学号+姓名命名
|
||||||
tbFile.setColip(request.getRemoteAddr());
|
tbFile.setColip(request.getRemoteAddr());
|
||||||
tbFile.setColuserid(user.getColuserid());
|
tbFile.setColuserid(user.getColuserid());
|
||||||
|
tbFile.setCourseName(courseName);
|
||||||
|
tbFile.setWorkFolder(folder);
|
||||||
|
|
||||||
|
TbLog log = new TbLog();
|
||||||
|
log.setUserid(user.getColuserid());
|
||||||
|
log.setColtime(dateNowStr);
|
||||||
|
log.setColip(httpServletRequest.getRemoteAddr());
|
||||||
|
log.setColheader(user.getColname()+"上传了"+filename+"文件");
|
||||||
|
logService.addLogRec(log);
|
||||||
|
|
||||||
if (fileService.addFile(tbFile))
|
if (fileService.addFile(tbFile))
|
||||||
System.out.println("记录写入数据库成功");
|
System.out.println("记录写入数据库成功");
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.fjy.spring.domain;
|
package com.fjy.spring.domain;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
@@ -23,6 +24,10 @@ public class TbFile {
|
|||||||
private String colfilesize;
|
private String colfilesize;
|
||||||
|
|
||||||
private String colfilepath;
|
private String colfilepath;
|
||||||
|
@Column(name = "coursename")
|
||||||
|
private String courseName;
|
||||||
|
@Column(name = "workfolder")
|
||||||
|
private String workFolder;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
@@ -35,6 +40,22 @@ public class TbFile {
|
|||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCourseName() {
|
||||||
|
return courseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCourseName(String courseName) {
|
||||||
|
this.courseName = courseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWorkFolder() {
|
||||||
|
return workFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWorkFolder(String workFolder) {
|
||||||
|
this.workFolder = workFolder;
|
||||||
|
}
|
||||||
|
|
||||||
public String getColtime() {
|
public String getColtime() {
|
||||||
return coltime;
|
return coltime;
|
||||||
}
|
}
|
||||||
|
|||||||
126
src/main/java/com/fjy/spring/domain/VUserfile.java
Normal file
126
src/main/java/com/fjy/spring/domain/VUserfile.java
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
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.Id;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Immutable
|
||||||
|
@Subselect("SELECT * FROM v_userfile")
|
||||||
|
public class VUserfile {
|
||||||
|
@Id
|
||||||
|
private int colfileid;
|
||||||
|
|
||||||
|
private String colstudentno;
|
||||||
|
|
||||||
|
private String coltime;
|
||||||
|
|
||||||
|
private String colip;
|
||||||
|
|
||||||
|
private String colrealname;
|
||||||
|
|
||||||
|
private String colfilename;
|
||||||
|
|
||||||
|
private String colfilesize;
|
||||||
|
|
||||||
|
private String colfilepath;
|
||||||
|
@Column(name = "coursename")
|
||||||
|
private String courseName;
|
||||||
|
@Column(name = "workfolder")
|
||||||
|
private String workFolder;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "TbFile{" +
|
||||||
|
"colip='" + colip + '\'' +
|
||||||
|
", colrealname='" + colrealname + '\'' +
|
||||||
|
", colfilename='" + colfilename + '\'' +
|
||||||
|
", colfilesize='" + colfilesize + '\'' +
|
||||||
|
", colfilepath='" + colfilepath + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCourseName() {
|
||||||
|
return courseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCourseName(String courseName) {
|
||||||
|
this.courseName = courseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWorkFolder() {
|
||||||
|
return workFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWorkFolder(String workFolder) {
|
||||||
|
this.workFolder = workFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getColtime() {
|
||||||
|
return coltime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColtime(String coltime) {
|
||||||
|
this.coltime = coltime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getColfileid() {
|
||||||
|
return colfileid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColfileid(int colfileid) {
|
||||||
|
this.colfileid = colfileid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getColstudentno() {
|
||||||
|
return colstudentno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColstudentno(String colstudentno) {
|
||||||
|
this.colstudentno = colstudentno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getColip() {
|
||||||
|
return colip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColip(String colip) {
|
||||||
|
this.colip = colip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getColrealname() {
|
||||||
|
return colrealname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColrealname(String colrealname) {
|
||||||
|
this.colrealname = colrealname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getColfilename() {
|
||||||
|
return colfilename;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColfilename(String colfilename) {
|
||||||
|
this.colfilename = colfilename;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getColfilesize() {
|
||||||
|
return colfilesize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColfilesize(String colfilesize) {
|
||||||
|
this.colfilesize = colfilesize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getColfilepath() {
|
||||||
|
return colfilepath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColfilepath(String colfilepath) {
|
||||||
|
this.colfilepath = colfilepath;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
|
|||||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
/*@Configuration*/
|
@Configuration
|
||||||
public class WebAppConfig implements WebMvcConfigurer {
|
public class WebAppConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,4 +8,6 @@ import java.util.Optional;
|
|||||||
|
|
||||||
public interface TbFileRepository extends JpaRepository<TbFile,Integer>{
|
public interface TbFileRepository extends JpaRepository<TbFile,Integer>{
|
||||||
public List<TbFile> findByColfilename(String name);
|
public List<TbFile> findByColfilename(String name);
|
||||||
|
|
||||||
|
public List<TbFile> findByWorkFolderAndCourseName(String workFolder,String courseName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.fjy.spring.repository;
|
package com.fjy.spring.repository;
|
||||||
|
|
||||||
import com.fjy.spring.domain.TbStudent;
|
import com.fjy.spring.domain.TbStudent;
|
||||||
|
import com.fjy.spring.domain.VUserfile;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
public interface TbStudentRepository extends JpaRepository<TbStudent,Integer> {
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface TbStudentRepository extends JpaRepository<TbStudent,Integer> {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.fjy.spring.repository;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fjy.spring.domain.VUserfile;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface VUserfileRepository extends JpaRepository<VUserfile,Integer> {
|
||||||
|
|
||||||
|
public List<VUserfile> findByWorkFolderAndCourseName(String workFolder,String courseName);
|
||||||
|
}
|
||||||
@@ -43,4 +43,8 @@ public class FileService {
|
|||||||
tbFileRepository.deleteById(file.getColfileid());
|
tbFileRepository.deleteById(file.getColfileid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<TbFile> findByWorkFolderAndCourseName(String workFolder,String courseName){
|
||||||
|
return tbFileRepository.findByWorkFolderAndCourseName(workFolder,courseName);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
16
src/main/java/com/fjy/spring/service/StudentService.java
Normal file
16
src/main/java/com/fjy/spring/service/StudentService.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package com.fjy.spring.service;
|
||||||
|
|
||||||
|
import com.fjy.spring.domain.TbStudent;
|
||||||
|
import com.fjy.spring.domain.TbUser;
|
||||||
|
import com.fjy.spring.repository.TbStudentRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class StudentService {
|
||||||
|
@Autowired
|
||||||
|
private TbStudentRepository tbStudentRepository;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -43,4 +43,5 @@ public class UserService {
|
|||||||
public List<TbUser> findAllUser(){
|
public List<TbUser> findAllUser(){
|
||||||
return tbUserRepository.findAll();
|
return tbUserRepository.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
18
src/main/java/com/fjy/spring/service/VUserfileService.java
Normal file
18
src/main/java/com/fjy/spring/service/VUserfileService.java
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package com.fjy.spring.service;
|
||||||
|
|
||||||
|
import com.fjy.spring.domain.VUserfile;
|
||||||
|
import com.fjy.spring.repository.VUserfileRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class VUserfileService {
|
||||||
|
@Autowired
|
||||||
|
private VUserfileRepository vUserfileRepository;
|
||||||
|
|
||||||
|
public List<VUserfile> findByWorkFolderAndCourseName(String workFolder, String courseName) {
|
||||||
|
return vUserfileRepository.findByWorkFolderAndCourseName(workFolder, courseName);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -228,6 +228,27 @@ var Main = {
|
|||||||
/*var url = window.location.protocol+"://"+window.location.host+":"+window.location.port+"/"*/
|
/*var url = window.location.protocol+"://"+window.location.host+":"+window.location.port+"/"*/
|
||||||
window.open("http://localhost:8080/cms/download/dodownload?fileId=" + row.colfileid);
|
window.open("http://localhost:8080/cms/download/dodownload?fileId=" + row.colfileid);
|
||||||
},
|
},
|
||||||
|
handleDelete(row) {
|
||||||
|
axios({
|
||||||
|
url: 'http://localhost:8080/cms/home/filedelete',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
fileid: row.colfileid
|
||||||
|
},
|
||||||
|
transformRequest: [function (data) {
|
||||||
|
// Do whatever you want to transform the data
|
||||||
|
let ret = ''
|
||||||
|
for (let it in data) {
|
||||||
|
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
}],
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.openNotiSuccess("成功","删除成功!");
|
||||||
|
},
|
||||||
handlePreview(file) {
|
handlePreview(file) {
|
||||||
console.log(file);
|
console.log(file);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ var Main = {
|
|||||||
return {
|
return {
|
||||||
activeIndex: '1',
|
activeIndex: '1',
|
||||||
formInline: {
|
formInline: {
|
||||||
user: '',
|
name:'',
|
||||||
region: ''
|
name2:'',
|
||||||
|
content: '',
|
||||||
|
folder: ''
|
||||||
},
|
},
|
||||||
homeworkData: [
|
homeworkData: [
|
||||||
{
|
{
|
||||||
@@ -17,6 +19,15 @@ var Main = {
|
|||||||
folder: "第一次作业"
|
folder: "第一次作业"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
homeworkFormData:[
|
||||||
|
{
|
||||||
|
courseNo: 1,
|
||||||
|
courseName: "信息安全",
|
||||||
|
courseTime: "2018-02-06 20:42:28.0",
|
||||||
|
teacherusername: "FJY",
|
||||||
|
teacherrealname: "root"
|
||||||
|
}
|
||||||
|
],
|
||||||
multipleSelection: []
|
multipleSelection: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -31,6 +42,14 @@ var Main = {
|
|||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
|
axios.get('http://localhost:8080/cms/home/findallvhomework')
|
||||||
|
.then(function (response) {
|
||||||
|
console.log(response.data);
|
||||||
|
that.homeworkData = response.data;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -1,3 +1,17 @@
|
|||||||
|
var dt = new Date();
|
||||||
|
var month = dt.getMonth()+1;
|
||||||
|
var day = dt.getDate();
|
||||||
|
var year = dt.getFullYear();
|
||||||
|
var cur = year + '-' + month + '-' + day;
|
||||||
|
function DateDiff(sDate1, sDate2){ //sDate1和sDate2是2002-12-18格式
|
||||||
|
var aDate, oDate1, oDate2, iDays
|
||||||
|
aDate = sDate1.split("-")
|
||||||
|
oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]) //转换为12-18-2002格式
|
||||||
|
aDate = sDate2.split("-")
|
||||||
|
oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0])
|
||||||
|
iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 /24) //把相差的毫秒数转换为天数
|
||||||
|
return iDays
|
||||||
|
}
|
||||||
var Main = {
|
var Main = {
|
||||||
data() {
|
data() {
|
||||||
var checkName = (rule, value, callback) => {
|
var checkName = (rule, value, callback) => {
|
||||||
@@ -37,12 +51,8 @@ var Main = {
|
|||||||
return {
|
return {
|
||||||
activeIndex: '1',
|
activeIndex: '1',
|
||||||
ruleForm2: {
|
ruleForm2: {
|
||||||
colname: '',
|
|
||||||
colpassword: '',
|
colpassword: '',
|
||||||
checkPass: '',
|
checkPass: '',
|
||||||
colstudentno: '',
|
|
||||||
colrealname: '',
|
|
||||||
colemail: ''
|
|
||||||
},
|
},
|
||||||
rules2: {
|
rules2: {
|
||||||
colpassword: [
|
colpassword: [
|
||||||
@@ -94,10 +104,41 @@ var Main = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
submitForm(formName) {
|
openNotiSuccess(title, content) {
|
||||||
|
this.$notify({
|
||||||
|
title: title,
|
||||||
|
message: content,
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
limitTime(row){
|
||||||
|
return DateDiff(row.worktime.replace(/([^\s]+)\s.*/, "$1"), cur);
|
||||||
|
},
|
||||||
|
submitForm(formName, url) {
|
||||||
this.$refs[formName].validate((valid) => {
|
this.$refs[formName].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
alert('submit!');
|
axios({
|
||||||
|
url: 'http://localhost:8080/cms/' + url,
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
content: this.$refs.content.value
|
||||||
|
},
|
||||||
|
transformRequest: [function (data) {
|
||||||
|
// Do whatever you want to transform the data
|
||||||
|
let ret = ''
|
||||||
|
for (let it in data) {
|
||||||
|
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
}],
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log(this.$refs.content.value)
|
||||||
|
this.openNotiSuccess("成功", "修改成功!")
|
||||||
|
//this.$options.methods.openNotiSuccess.bind(this)();
|
||||||
|
//alert('submit!');
|
||||||
} else {
|
} else {
|
||||||
console.log('error submit!!');
|
console.log('error submit!!');
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -240,11 +240,11 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column fixed="right" label="操作" width="150">
|
<el-table-column fixed="right" label="操作" width="150">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button @click="handleClick(scope.row)" type="success" plain
|
<el-button @click="handleDownload(scope.row)" type="success" plain
|
||||||
size="small">
|
size="small">
|
||||||
下载
|
下载
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="danger" plain size="small">删除</el-button>
|
<el-button type="danger" plain size="small" @click="handleDelete(scope.row)">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|||||||
@@ -1,19 +1,50 @@
|
|||||||
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
<html lang="en">
|
||||||
xmlns:th="http://www.thymeleaf.org">
|
<head>
|
||||||
<head th:include="dist/thymeleaf/common_head :: header('课程管理')">
|
<meta charset="UTF-8">
|
||||||
|
<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>
|
||||||
<div th:insert="~{dist/thymeleaf/common_head :: #body_js}"></div>
|
<!-- 先引入 Vue -->
|
||||||
|
<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 th:include="dist/thymeleaf/layout :: header"></el-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-row><el-card class="box-card">
|
||||||
<el-card th:include="dist/thymeleaf/layout :: userbox"></el-card>
|
<div slot="header" class="clearfix">
|
||||||
|
<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 th:include="dist/thymeleaf/layout :: adminbox"></el-card>
|
<el-card th:include="dist/thymeleaf/layout :: adminbox"></el-card>
|
||||||
@@ -47,25 +78,24 @@
|
|||||||
<h4>添加作业</h4>
|
<h4>添加作业</h4>
|
||||||
<el-form :inline="true" :model="formInline" class="demo-form-inline">
|
<el-form :inline="true" :model="formInline" class="demo-form-inline">
|
||||||
<el-form-item label="作业名称">
|
<el-form-item label="作业名称">
|
||||||
<el-input v-model="formInline.user" placeholder="作业名称"></el-input>
|
<el-input v-model="formInline.name" placeholder="作业名称"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="模板文件名称">
|
<el-form-item label="模板文件名称">
|
||||||
<el-select v-model="formInline.region" placeholder="模板文件名称">
|
<el-select v-model="formInline.name" placeholder="模板文件名称">
|
||||||
<el-option label="区域一" value="shanghai"></el-option>
|
<el-option label="区域一" value="shanghai"></el-option>
|
||||||
<el-option label="区域二" value="beijing"></el-option>
|
<el-option label="区域二" value="beijing"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="课程名称">
|
<el-form-item label="课程名称" :model="homeworkFormData">
|
||||||
<el-select v-model="formInline.region" placeholder="课程名称">
|
<el-select v-model="homeworkFormData.courseName" placeholder="课程名称">
|
||||||
<el-option label="区域一" value="shanghai"></el-option>
|
<el-option label="homeworkFormData.courseName" value="homeworkFormData.courseName"></el-option>
|
||||||
<el-option label="区域二" value="beijing"></el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="存储文件夹">
|
<el-form-item label="存储文件夹">
|
||||||
<el-input v-model="formInline.user" placeholder="存储文件夹"></el-input>
|
<el-input v-model="formInline.folder" placeholder="存储文件夹"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="作业内容">
|
<el-form-item label="作业内容">
|
||||||
<el-input v-model="formInline.user" placeholder="作业内容" type="textarea"></el-input>
|
<el-input v-model="formInline.content" placeholder="作业内容" type="textarea"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="onSubmit">添加</el-button>
|
<el-button type="primary" @click="onSubmit">添加</el-button>
|
||||||
@@ -84,7 +114,7 @@
|
|||||||
</el-container>
|
</el-container>
|
||||||
</el-container>
|
</el-container>
|
||||||
</div>
|
</div>
|
||||||
<script th:src="@{/js/homework.js}"></script>
|
<script src="../../static/js/homework.js"></script>
|
||||||
<script th:src="@{/js/common.js}"></script>
|
<script src="../../static/js/common.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,58 +1,17 @@
|
|||||||
<!DOCTYPE HTML>
|
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
|
||||||
<html>
|
<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" type="text/css" href="styles.css">
|
|
||||||
-->
|
|
||||||
<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 th:include="dist/thymeleaf/layout :: userbox"></el-card>
|
||||||
<el-card class="box-card">
|
|
||||||
<div slot="header" class="clearfix">
|
|
||||||
<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-col>
|
</el-col>
|
||||||
<el-col :md="13" :lg="13" :xl="13" :sm="18" :xs="23" :offset="1">
|
<el-col :md="13" :lg="13" :xl="13" :sm="18" :xs="23" :offset="1">
|
||||||
<el-row>
|
<el-row>
|
||||||
@@ -65,7 +24,7 @@
|
|||||||
<el-form-item label="用户名"
|
<el-form-item label="用户名"
|
||||||
prop="colname">
|
prop="colname">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="ruleForm2.colname" name="colname"></el-input>
|
th:value="${#httpServletRequest.getSession().getAttribute('USER_SESSION').colname}" name="colname"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
label="密码" prop="colpassword">
|
label="密码" prop="colpassword">
|
||||||
@@ -82,21 +41,21 @@
|
|||||||
{ required: true, message: '请输入邮箱地址', trigger: 'blur' },
|
{ required: true, message: '请输入邮箱地址', trigger: 'blur' },
|
||||||
{ type: 'email', message: '请输入正确的邮箱地址', trigger: 'blur,change' }
|
{ type: 'email', message: '请输入正确的邮箱地址', trigger: 'blur,change' }
|
||||||
]">
|
]">
|
||||||
<el-input v-model="ruleForm2.colemail" name="colemail"></el-input>
|
<el-input th:value="${#httpServletRequest.getSession().getAttribute('USER_SESSION').colemail}" name="colemail"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="学号"
|
<el-form-item label="学号"
|
||||||
prop="colstudentno">
|
prop="colstudentno">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="ruleForm2.colstudentno" name="colstudentno"></el-input>
|
th:value="${#httpServletRequest.getSession().getAttribute('USER_SESSION').colstudentno}" name="colstudentno"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="真实姓名"
|
<el-form-item label="真实姓名"
|
||||||
prop="colrealname">
|
prop="colrealname">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="ruleForm2.colrealname" name="colrealname"></el-input>
|
th:value="${#httpServletRequest.getSession().getAttribute('USER_SESSION').colrealname}" name="colrealname"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary"
|
<el-button type="primary"
|
||||||
native-type="submit">提交
|
@click="submitForm('feedbackForm','register/doregister')">提交
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button @click="resetForm('ruleForm2')">重置</el-button>
|
<el-button @click="resetForm('ruleForm2')">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -140,15 +99,11 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
</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/user.js"></script>
|
<script th:src="@{/js/user.js}"></script>
|
||||||
<script src="../../static/js/common.js"></script>
|
<script th:src="@{/js/common.js}"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user