实现文件上传和删除后自动更新列表

This commit is contained in:
F嘉阳
2018-02-27 10:36:54 +08:00
parent a93f63280b
commit 90c9b2e332
5 changed files with 36 additions and 20 deletions

View File

@@ -9,7 +9,7 @@ serverproperties:
spring:
thymeleaf:
prefix: classpath:/templates/
cache: false
cache: true
check-template: true
datasource:

View File

@@ -1,4 +1,4 @@
#控制配置文件调用
spring:
profiles:
active: prod
active: dev

View File

@@ -25,13 +25,13 @@
<!--滚动策略-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--路径文件名,文件名包含时间-->
<!--<fileNamePattern>F:\JAVA Workspace\Temp\log\%d\info.%d.log</fileNamePattern>-->
<fileNamePattern>/www/cmsfile/%d/info.%d.log</fileNamePattern>
</rollingPolicy>
</appender>
<fileNamePattern>F:\JAVA Workspace\Temp\log\%d\info.%d.log</fileNamePattern>
<!--<fileNamePattern>/www/cmsfile/%d/info.%d.log</fileNamePattern>-->
</rollingPolicy>
</appender>
<appender name="fileErrorLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!--根据范围过滤ERROR等级以下的日志-->
<appender name="fileErrorLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!--根据范围过滤ERROR等级以下的日志-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
@@ -44,8 +44,8 @@
<!--滚动策略-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--路径文件名,文件名包含时间-->
<!--<fileNamePattern>F:\JAVA Workspace\Temp\log\error.%d.log</fileNamePattern>-->
<fileNamePattern>/www/cmsfile/%d/error.%d.log</fileNamePattern>
<fileNamePattern>F:\JAVA Workspace\Temp\log\error.%d.log</fileNamePattern>
<!--<fileNamePattern>/www/cmsfile/%d/error.%d.log</fileNamePattern>-->
</rollingPolicy>
</appender>

View File

@@ -163,15 +163,11 @@ var Main = {
},
mounted() {
this.$nextTick(() => {
var that = this;
axios.get(getRootPath_web()+'/download/findone')
.then(function (response) {
console.log(response.data);
that.DownloadList = response.data;
})
.catch(function (error) {
console.log(error);
});
let that = this;
/*setInterval(function(){
that.getFileList();
},1000);*/
this.getFileList();
axios.get(getRootPath_web()+'/home/findAllHomework')
.then(function (response) {
console.log(response.data);
@@ -202,6 +198,18 @@ var Main = {
})
},
methods: {
getFileList(){
let that = this;
axios.get(getRootPath_web()+'/download/findone')
.then(function (response) {
//console.log(response.data);
that.DownloadList = response.data;
})
.catch(function (error) {
console.log(error);
that.openNotiError("失败", "获取文件列表失败!");
});
},
openNotiSuccess(title, content) {
this.$notify({
title: title,
@@ -279,7 +287,10 @@ var Main = {
console.log(row.colfileid);
},
submitUpload() {
let that = this;
this.$refs.upload.submit();
this.openNotiSuccess("成功", "文件上传成功!");
setTimeout(function () {that.getFileList();},1000);
},
handleRemove(file, fileList) {
console.log(file, fileList);
@@ -315,7 +326,8 @@ var Main = {
if (response.data===true){
//that.$refs[formName].submit;
//return true;
that.openNotiSuccess("成功", "删除成功!")
that.openNotiSuccess("成功", "删除成功!");
that.getFileList();
}else if (response.data===false){
that.openNotiError("失败", "删除失败!");
}else {

View File

@@ -237,6 +237,10 @@
<el-table-column prop="colfilesize" label="大小" width="80">
</el-table-column>
<el-table-column prop="coltime" label="上传时间">
</el-table-column>
<el-table-column prop="courseName" label="课程名">
</el-table-column>
<el-table-column prop="workFolder" label="作业名">
</el-table-column>
<el-table-column fixed="right" label="操作" width="150">
<template slot-scope="scope">