diff --git a/cms.nginx - 副本.conf b/cms.nginx - 副本.conf index 9238fc2..964b8bd 100644 --- a/cms.nginx - 副本.conf +++ b/cms.nginx - 副本.conf @@ -35,9 +35,10 @@ server cms.fjy8018.xin:8085; #我工程的context-path=mytest location /cms { proxy_pass http://cms.fjy8018.xin:8085; + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Port $server_port; # root html; # index index.html index.htm; } diff --git a/src/main/java/com/fjy/spring/controller/UpLoadController.java b/src/main/java/com/fjy/spring/controller/UpLoadController.java index dd04599..bc83b1b 100644 --- a/src/main/java/com/fjy/spring/controller/UpLoadController.java +++ b/src/main/java/com/fjy/spring/controller/UpLoadController.java @@ -8,6 +8,7 @@ import com.fjy.spring.properties.ServerProperties; import com.fjy.spring.service.FileService; import com.fjy.spring.service.LogService; import com.fjy.spring.untils.FormatFileSizeUtil; +import com.fjy.spring.untils.GetIPAddrUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FileUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -212,7 +213,7 @@ public class UpLoadController { TbLog logs = new TbLog(); logs.setUserid(user.getColuserid()); logs.setColtime(dateNowStr); - logs.setColip(httpServletRequest.getRemoteAddr()); + logs.setColip(GetIPAddrUtil.getIpAddr(httpServletRequest)); logs.setColheader(user.getColname() + "上传了'" + filename + "'文件"); logService.addLogRec(logs); diff --git a/src/main/resources/static/js/common.js b/src/main/resources/static/js/common.js index 440d04a..1b15f85 100644 --- a/src/main/resources/static/js/common.js +++ b/src/main/resources/static/js/common.js @@ -10,3 +10,22 @@ function getRootPath_web() { var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1); return (localhostPaht + projectName); } +function compareTime(startTime,endTime) { + var startTimes = startTime.substring(0, 10).split('-'); + var endTimes = endTime.substring(0, 10).split('-'); + startTime = startTimes[1] + '-' + startTimes[2] + '-' + startTimes[0] + ' ' + startTime.substring(10, 19); + endTime = endTimes[1] + '-' + endTimes[2] + '-' + endTimes[0] + ' ' + endTime.substring(10, 19); + var thisResult = (Date.parse(endTime) - Date.parse(startTime)) / 3600 / 1000; + if (thisResult < 0) { + console.log("endTime小于tartTime!"); + return false; + } else if (thisResult > 0) { + console.log("endTime大于tartTime!"); + return true; + } else if (thisResult == 0) { + console.log("endTime等于tartTime!"); + return false; + } else { + return '异常'; + } +} diff --git a/src/main/resources/static/js/home.js b/src/main/resources/static/js/home.js index 6888970..c713ba0 100644 --- a/src/main/resources/static/js/home.js +++ b/src/main/resources/static/js/home.js @@ -328,8 +328,14 @@ var Main = { }); }, uploadURL(row) { - return "http://localhost:8080/cms/moreUpload?courseName=" + row.coursename + "&folder=" + row.workfolder; - }, + console.log(row.worktime); + if (compareTime(cur,row.worktime)){ + document.getElementById("btn-group").style.display=""; + return "http://localhost:8080/cms/moreUpload?courseName=" + row.coursename + "&folder=" + row.workfolder; + }else{ + document.getElementById("btn-show").style.display=""; + } + }, limitTime(row) { return DateDiff(row.worktime.replace(/([^\s]+)\s.*/, "$1"), cur); }, diff --git a/src/main/resources/static/js/homepage.js b/src/main/resources/static/js/homepage.js index 0566ed8..c5abbd8 100644 --- a/src/main/resources/static/js/homepage.js +++ b/src/main/resources/static/js/homepage.js @@ -3,7 +3,6 @@ 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("-") @@ -13,7 +12,9 @@ function DateDiff(sDate1, sDate2) { //sDate1和sDate2是2002-12-18格式 iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24) //把相差的毫秒数转换为天数 return iDays } - +function displayStyle(id,type) { + document.getElementById(id).style.display=type; +} var Main = { data() { var checkName = (rule, value, callback) => { @@ -65,6 +66,7 @@ var Main = { colrealname: '', colemail: '' }, + isShow:true, rules2: { colpassword: [ {required: true, validator: validatePass, trigger: 'blur'} @@ -230,7 +232,27 @@ var Main = { }); }, uploadURL(row) { - return getRootPath_web()+"/home/moreUpload?courseName=" + row.coursename + "&folder=" + row.workfolder+"&rename=true"; + let that = this; + console.log(row.worktime+"||"+row.workid); + if (compareTime(cur,row.worktime)){ + that.isShow = true; + console.log("Show"+that.isShow); + //提交时间合法 + //document.getElementById("btn-group").style.display=""; + //displayStyle("btn-show"+row.workid,"none"); + //displayStyle("btn-group"+row.workid,""); + return getRootPath_web()+"/home/moreUpload?courseName=" + row.coursename + "&folder=" + row.workfolder+"&rename=true"; + }else{ + that.isShow = false; + console.log("EShow"+that.isShow); + //提交时间不合法 + //displayStyle("btn-show"+row.workid,""); + //displayStyle("btn-group"+row.workid,"none"); + //displayStyle("btn-show"); + //document.getElementById("btn-show").style.display=""; + return 0; + + } }, limitTime(row) { return DateDiff(row.worktime.replace(/([^\s]+)\s.*/, "$1"), cur); diff --git a/src/main/resources/static/js/managecourse.js b/src/main/resources/static/js/managecourse.js index be07062..e2d6eb3 100644 --- a/src/main/resources/static/js/managecourse.js +++ b/src/main/resources/static/js/managecourse.js @@ -18,7 +18,12 @@ var Main = { teacherrealname: "root" } ], - multipleSelection: [] + multipleSelection: [], + courseList:[ + {courseName:"root"}, + {courseName:"root2"}, + ], + teacherList:[], } }, mounted() { diff --git a/src/main/resources/templates/dist/thymeleaf/common_head.html b/src/main/resources/templates/dist/thymeleaf/common_head.html index 76892a2..c3b3360 100644 --- a/src/main/resources/templates/dist/thymeleaf/common_head.html +++ b/src/main/resources/templates/dist/thymeleaf/common_head.html @@ -12,7 +12,7 @@ - + diff --git a/src/main/resources/templates/home/home.html b/src/main/resources/templates/home/home.html index d1d1f1c..99235a7 100644 --- a/src/main/resources/templates/home/home.html +++ b/src/main/resources/templates/home/home.html @@ -125,27 +125,42 @@ - - 选取文件 - - 上传到服务器 - -
上传文件大小不能超过100Mb
-
+ +
+ + 选取文件 + + + 上传到服务器 + +
上传文件大小不能超过100Mb +
+
+
+ + +
+
- + - + +