实现用户仅能查看自己提交的文件

This commit is contained in:
F嘉阳
2018-02-23 13:02:23 +08:00
parent c91ee252a3
commit a50c33375d
14 changed files with 783 additions and 106 deletions

View File

@@ -1,17 +1,19 @@
var dt = new Date();
var month = dt.getMonth()+1;
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
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 = {
data() {
var checkName = (rule, value, callback) => {
@@ -54,20 +56,21 @@ var Main = {
},
activeIndex: '1',
dialogVisible: false,
dialogTableVisible: false,
ruleForm2: {
colname: '',
colpassword: '',
checkPass:'',
checkPass: '',
colstudentno: '',
colrealname: '',
colemail: ''
},
rules2: {
colpassword: [
{required: true,validator: validatePass, trigger: 'blur'}
{required: true, validator: validatePass, trigger: 'blur'}
],
checkPass: [
{required: true,validator: validatePass2, trigger: 'blur'}
{required: true, validator: validatePass2, trigger: 'blur'}
],
colstudentno: [
{
@@ -84,12 +87,164 @@ var Main = {
}
],
colname: [
{required: true,validator: checkName, trigger: 'blur'}
{required: true, validator: checkName, trigger: 'blur'}
],
},
activeName:'login',
activeName: 'login',
fileList: [],
DownloadList: [],
VersionList:[
{
date:'2018-02-23',
content:'修复用户信息修改页面数据绑定方式改为使用axios进行数据获取和绑定',
version:'V1.5',
user:'F嘉阳'
},
{
date:'2018-02-22',
content:'实现后台对未交作业人员的查询',
version:'V1.4',
user:'F嘉阳'
},
{
date:'2018-02-22',
content:'实现用户信息修改',
version:'V1.3.1',
user:'F嘉阳'
},
{
date:'2018-02-21',
content:'实现用户信息修改页面session传值',
version:'V1.3',
user:'F嘉阳'
},
{
date:'2018-02-09',
content:'实现用户管理和作业管理数据读取',
version:'V1.2.1',
user:'F嘉阳'
},
{
date:'2018-02-09',
content:'实现单文件删除',
version:'V1.2',
user:'F嘉阳'
},
{
date:'2018-02-08',
content:'完成课程管理数据读取修复页面加载cssjs错误',
version:'V1.1.2',
user:'F嘉阳'
},
{
date:'2018-02-08',
content:'完成管理员主页的数据读取',
version:'V1.1.1',
user:'F嘉阳'
},
{
date:'2018-02-08',
content:'完成前端界面设计',
version:'V1.0',
user:'F嘉阳'
},
{
date:'2018-02-08',
content:'实现表单异步提交并显示消息',
version:'V0.15',
user:'F嘉阳'
},
{
date:'2018-02-07',
content:'实现作业上传自动创建文件夹',
version:'V0.14',
user:'F嘉阳'
},
{
date:'2018-02-07',
content:'实现作业获取和展示',
version:'V0.13',
user:'F嘉阳'
},
{
date:'2018-02-06',
content:'完成前端上传页面设计',
version:'V0.12',
user:'F嘉阳'
},
{
date:'2018-02-06',
content:'实现登录日志记录',
version:'V0.11',
user:'F嘉阳'
},
{
date:'2018-02-05',
content:'提高加密安全性',
version:'V0.10.1',
user:'F嘉阳'
},
{
date:'2018-02-05',
content:'实现用户密码SHA加密',
version:'V0.10',
user:'F嘉阳'
},
{
date:'2018-02-05',
content:'实现登录拦截器',
version:'V0.9',
user:'F嘉阳'
},
{
date:'2018-02-05',
content:'实现注册功能',
version:'V0.8',
user:'F嘉阳'
},
{
date:'2018-02-05',
content:'实现json数据绑定',
version:'V0.7',
user:'F嘉阳'
},
{
date:'2018-02-04',
content:'实现多文件上传按钮vue传值vue2.1特性)',
version:'V0.6',
user:'F嘉阳'
},
{
date:'2018-02-04',
content:'实现Element组件+单文件上传',
version:'V0.5',
user:'F嘉阳'
},
{
date:'2018-02-04',
content:'使用thymeleaf模板引擎引入frame框架和公用css和js文件',
version:'V0.4',
user:'F嘉阳'
},
{
date:'2018-02-03',
content:'实现文件上传和数据库记录、Element+vue登录注册UI',
version:'V0.3',
user:'F嘉阳'
},
{
date:'2018-01-30',
content:'实现登录编写错误码实现错误码返回json',
version:'V0.2',
user:'F嘉阳'
},
{
date:'2018-01-30',
content:'实现数据库查询用户,获取密码,编写了单元测试类',
version:'V0.1',
user:'F嘉阳'
}
],
tableHomeworkData: [
{
workid: 1,
@@ -139,7 +294,7 @@ var Main = {
mounted() {
this.$nextTick(() => {
var that = this;
axios.get('http://localhost:8080/cms/download/findall')
axios.get(getRootPath_web()+'/download/findone')
.then(function (response) {
console.log(response.data);
that.DownloadList = response.data;
@@ -147,7 +302,7 @@ var Main = {
.catch(function (error) {
console.log(error);
});
axios.get('http://localhost:8080/cms/home/findAllHomework')
axios.get(getRootPath_web()+'/home/findAllHomework')
.then(function (response) {
console.log(response.data);
that.tableHomeworkData = response.data;
@@ -159,7 +314,8 @@ var Main = {
})
},
methods: {
openNotiSuccess(title,content) {
openNotiSuccess(title, content) {
this.$notify({
title: title,
message: content,
@@ -172,17 +328,17 @@ var Main = {
type: 'success'
});
},
uploadURL(row){
return "http://localhost:8080/cms/moreUpload?courseName="+row.coursename+"&folder="+row.workfolder;
uploadURL(row) {
return "http://localhost:8080/cms/moreUpload?courseName=" + row.coursename + "&folder=" + row.workfolder;
},
limitTime(row){
return DateDiff(row.worktime.replace(/([^\s]+)\s.*/, "$1"), cur);
limitTime(row) {
return DateDiff(row.worktime.replace(/([^\s]+)\s.*/, "$1"), cur);
},
submitForm(formName,url) {
submitForm(formName, url) {
this.$refs[formName].validate((valid) => {
if (valid) {
axios({
url: 'http://localhost:8080/cms/'+url,
url: 'http://localhost:8080/cms/' + url,
method: 'post',
data: {
content: this.$refs.content.value
@@ -200,7 +356,7 @@ var Main = {
}
})
console.log(this.$refs.content.value)
this.openNotiSuccess("成功","反馈成功!")
this.openNotiSuccess("成功", "反馈成功!")
//this.$options.methods.openNotiSuccess.bind(this)();
//alert('submit!');
} else {
@@ -212,23 +368,23 @@ var Main = {
resetForm(formName) {
this.$refs[formName].resetFields();
},
handleClick(row) {
console.log(row.colfileid);
},
submitUpload() {
this.$refs.upload.submit();
},
handleRemove(file, fileList) {
console.log(file, fileList);
},
ClickToJump(targe){
window.location.href="http://localhost:8080/cms/" + targe;
},
handleDownload(row) {
/*var url = window.location.protocol+"://"+window.location.host+":"+window.location.port+"/"*/
window.open("http://localhost:8080/cms/download/dodownload?fileId=" + row.colfileid);
},
handleDelete(row) {
handleClick(row) {
console.log(row.colfileid);
},
submitUpload() {
this.$refs.upload.submit();
},
handleRemove(file, fileList) {
console.log(file, fileList);
},
ClickToJump(targe) {
window.location.href = "http://localhost:8080/cms/" + targe;
},
handleDownload(row) {
/*var url = window.location.protocol+"://"+window.location.host+":"+window.location.port+"/"*/
window.open("http://localhost:8080/cms/download/dodownload?fileId=" + row.colfileid);
},
handleDelete(row) {
axios({
url: 'http://localhost:8080/cms/home/filedelete',
method: 'post',
@@ -247,69 +403,70 @@ var Main = {
'Content-Type': 'application/x-www-form-urlencoded'
}
});
this.openNotiSuccess("成功","删除成功!");
},
handlePreview(file) {
console.log(file);
},
handleExceed(files, fileList) {
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${ file.name }`);
},
handleSelect(key, keyPath) {
console.log(key, keyPath);
},
handleOpen(key, keyPath) {
console.log(key, keyPath);
},
handleClose(key, keyPath) {
console.log(key, keyPath);
},
dialogClose(done) {
this.openNotiSuccess("成功", "删除成功!");
},
handlePreview(file) {
console.log(file);
},
handleExceed(files, fileList) {
this.$message.warning(`当前限制选择 3 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${ file.name }`);
},
handleSelect(key, keyPath) {
console.log(key, keyPath);
},
handleOpen(key, keyPath) {
console.log(key, keyPath);
},
handleClose(key, keyPath) {
console.log(key, keyPath);
},
dialogClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
done();
})
.catch(_ => {});
.catch(_ => {
});
},
showMsg(msg) {
this.$message({
message: msg,
type: 'success'
});
},
notiSuccess(title, value) {
this.$notify({
title: title,
message: value,
type: 'success'
});
},
notiWarning(title, value) {
this.$notify({
title: title,
message: value,
type: 'warning'
});
},
showMsg(msg) {
this.$message({
message: msg,
type: 'success'
});
},
notiSuccess(title, value) {
this.$notify({
title: title,
message: value,
type: 'success'
});
},
notiWarning(title, value) {
this.$notify({
title: title,
message: value,
type: 'warning'
});
},
notiInfo(title, value) {
this.$notify.info({
title: title,
message: value
});
},
notiInfo(title, value) {
this.$notify.info({
title: title,
message: value
});
},
notiError(title, value) {
this.$notify.error({
title: title,
message: value
});
notiError(title, value) {
this.$notify.error({
title: title,
message: value
});
}
}
}
}
var Ctor = Vue.extend(Main)
var con = new Ctor().$mount('#app')
//con.showMsg('登录成功');