diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js index a203e798d..2fc1bbe64 100644 --- a/public/react/config/webpack.config.dev.js +++ b/public/react/config/webpack.config.dev.js @@ -9,7 +9,6 @@ const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin'); const eslintFormatter = require('react-dev-utils/eslintFormatter'); const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); -const ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin'); // const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); const getClientEnvironment = require('./env'); const paths = require('./paths'); @@ -250,46 +249,6 @@ module.exports = { // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack // You can remove this if you don't use Moment.js: new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), - new ParallelUglifyPlugin({ - // 传递给 UglifyJS的参数如下: - uglifyJS: { - output: { - /* - 是否输出可读性较强的代码,即会保留空格和制表符,默认为输出,为了达到更好的压缩效果, - 可以设置为false - */ - beautify: false, - /* - 是否保留代码中的注释,默认为保留,为了达到更好的压缩效果,可以设置为false - */ - comments: false - }, - compress: { - /* - 是否在UglifyJS删除没有用到的代码时输出警告信息,默认为输出,可以设置为false关闭这些作用 - 不大的警告 - */ - warnings: false, - - /* - 是否删除代码中所有的console语句,默认为不删除,开启后,会删除所有的console语句 - */ - drop_console: false, - - /* - 是否内嵌虽然已经定义了,但是只用到一次的变量,比如将 var x = 1; y = x, 转换成 y = 5, 默认为不 - 转换,为了达到更好的压缩效果,可以设置为false - */ - collapse_vars: false, - - /* - 是否提取出现了多次但是没有定义成变量去引用的静态值,比如将 x = 'xxx'; y = 'xxx' 转换成 - var a = 'xxxx'; x = a; y = a; 默认为不转换,为了达到更好的压缩效果,可以设置为false - */ - reduce_vars: false - } - } - }), ], // Some libraries import Node modules but don't use them in the browser. // Tell Webpack to provide empty mocks for them so importing them works. diff --git a/public/react/src/modules/courses/busyWork/CommonWorkSetting.js b/public/react/src/modules/courses/busyWork/CommonWorkSetting.js index 3f7e5f3ad..72987d2ca 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkSetting.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkSetting.js @@ -231,7 +231,7 @@ class CommonWorkSetting extends Component{ end_time: endTime.format(dateFormat) }) } - if (!this.state.late_time && endTime) { + if (this.state.allow_late && !this.state.late_time && endTime) { this.setState({ late_time: endTime.add(1, 'months').format(dateFormat) }) @@ -265,9 +265,12 @@ class CommonWorkSetting extends Component{ const currentEndTime = this._getCurrentEndTime() let evaluation_start, evaluation_end, evaluation_num = 0, absence_penalty = 0; if (checked) { - if (currentEndTime) { - evaluation_start = moment(currentEndTime).add(7, 'days').format(dateFormat) - evaluation_end = moment(currentEndTime).add(21, 'days').format(dateFormat) + if (this.state.allow_late && this.state.late_time) { + evaluation_start = moment(this.state.late_time).add(14, 'days').format(dateFormat) + evaluation_end = moment(this.state.late_time).add(28, 'days').format(dateFormat) + } else if (currentEndTime) { + evaluation_start = moment(currentEndTime).add(14, 'days').format(dateFormat) + evaluation_end = moment(currentEndTime).add(28, 'days').format(dateFormat) } if (!this.state.evaluation_num) { evaluation_num = 3 @@ -320,11 +323,15 @@ class CommonWorkSetting extends Component{ const { evaluation_end } = this.state; const anonymous_appeal = e.target.checked let appeal_time, appeal_penalty = this.state.appeal_penalty + const currentEndTime = this._getCurrentEndTime() + if (anonymous_appeal) { appeal_penalty = 2 - if (evaluation_end) { - appeal_time = moment(evaluation_end).add(7, 'days').format(dateFormat) - } + if (this.state.allow_late && this.state.late_time) { + appeal_time = moment(this.state.late_time).add(5 * 7, 'days').format(dateFormat) + } else if (currentEndTime) { + appeal_time = moment(currentEndTime).add(5 * 7, 'days').format(dateFormat) + } } else { appeal_time = null; } @@ -386,7 +393,7 @@ class CommonWorkSetting extends Component{ answer_public: e.target.checked }) } - + // 补交设置 允许补交 allow_late_change=(e)=>{ this.setState({ allow_late: e.target.value @@ -401,6 +408,10 @@ class CommonWorkSetting extends Component{ late_time: moment(handleDateString(currentEndTime)).add(1, 'months').format(dateFormat) }) } + } else { + this.setState({ + late_time: null + }) } } diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index 9606740dc..a720cffd4 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1350,21 +1350,10 @@ class Listofworks extends Component { },{responseType: 'blob'}).then((response) => { console.log("1342"); console.log(response); - if (response.status == 200) { - - var blob = new Blob([response.data]) - var downloadElement = document.createElement('a'); - var href = window.URL.createObjectURL(blob); //创建下载的链接 - let filename = response.headers.get('Content-Disposition'); - if (filename) { - filename = filename.match(/\"(.*)\"/)[1]; //提取文件名 - downloadElement.href = href; - downloadElement.download = filename; //下载后文件名 - document.body.appendChild(downloadElement); - downloadElement.click(); //点击下载 - document.body.removeChild(downloadElement); //下载完成移除元素 - } - window.URL.revokeObjectURL(href); //释放掉blob对象 + if(response.status === 200){ + window.open(url, '_blank'); + }else{ + } }).catch((error) => { console.log(error) @@ -1384,21 +1373,11 @@ class Listofworks extends Component { },{responseType: 'blob'}).then((response) => { console.log("1306"); console.log(response); - if (response.status == 200) { - var blob = new Blob([response.data]) - var downloadElement = document.createElement('a'); - var href = window.URL.createObjectURL(blob); //创建下载的链接 - let filename = response.headers.get('Content-Disposition'); - if (filename) { - filename = filename.match(/\"(.*)\"/)[1]; //提取文件名 - downloadElement.href = href; - downloadElement.download = filename; //下载后文件名 - document.body.appendChild(downloadElement); - downloadElement.click(); //点击下载 - document.body.removeChild(downloadElement); //下载完成移除元素 - } - window.URL.revokeObjectURL(href); //释放掉blob对象 - } + if(response.status === 200){ + window.open(url, '_blank'); + }else{ + + } }).catch((error) => { console.log(error) }); diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js index 19343ad79..f67eca6ab 100644 --- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js +++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js @@ -1619,19 +1619,11 @@ class Trainingjobsetting extends Component { },{responseType: 'blob'}).then((response) => { console.log("326"); console.log(response); - var blob = new Blob([response.data]) - var downloadElement = document.createElement('a'); - var href = window.URL.createObjectURL(blob); //创建下载的链接 - let filename = response.headers.get('Content-Disposition'); - if (filename) { - filename = filename.match(/\"(.*)\"/)[1]; //提取文件名 - downloadElement.href = href; - downloadElement.download = filename; //下载后文件名 - document.body.appendChild(downloadElement); - downloadElement.click(); //点击下载 - document.body.removeChild(downloadElement); //下载完成移除元素 + if(response.status === 200){ + window.open(url, '_blank'); + }else{ + } - window.URL.revokeObjectURL(href); //释放掉blob对象 }).catch((error) => { console.log(error) @@ -1646,19 +1638,11 @@ class Trainingjobsetting extends Component { axios.get((url),{responseType: 'blob'}).then((response) => { console.log("339"); console.log(response); - var blob = new Blob([response.data]) - var downloadElement = document.createElement('a'); - var href = window.URL.createObjectURL(blob); //创建下载的链接 - let filename = response.headers.get('Content-Disposition'); - if (filename) { - filename = filename.match(/\"(.*)\"/)[1]; //提取文件名 - downloadElement.href = href; - downloadElement.download = filename; //下载后文件名 - document.body.appendChild(downloadElement); - downloadElement.click(); //点击下载 - document.body.removeChild(downloadElement); //下载完成移除元素 + if(response.status === 200){ + window.open(url, '_blank'); + }else{ + } - window.URL.revokeObjectURL(href); //释放掉blob对象 }).catch((error) => { console.log(error) diff --git a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js index d341aab6b..ab650aae2 100644 --- a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js +++ b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js @@ -330,19 +330,11 @@ class Workquestionandanswer extends Component { },{responseType: 'blob'}).then((response) => { console.log("326"); console.log(response); - var blob = new Blob([response.data]) - var downloadElement = document.createElement('a'); - var href = window.URL.createObjectURL(blob); //创建下载的链接 - let filename = response.headers.get('Content-Disposition'); - if (filename) { - filename = filename.match(/\"(.*)\"/)[1]; //提取文件名 - downloadElement.href = href; - downloadElement.download = filename; //下载后文件名 - document.body.appendChild(downloadElement); - downloadElement.click(); //点击下载 - document.body.removeChild(downloadElement); //下载完成移除元素 + if(response.status === 200){ + window.open(url, '_blank'); + }else{ + } - window.URL.revokeObjectURL(href); //释放掉blob对象 }).catch((error) => { console.log(error) @@ -357,19 +349,11 @@ class Workquestionandanswer extends Component { axios.get((url),{responseType: 'blob'}).then((response) => { console.log("339"); console.log(response); - var blob = new Blob([response.data]) - var downloadElement = document.createElement('a'); - var href = window.URL.createObjectURL(blob); //创建下载的链接 - let filename = response.headers.get('Content-Disposition'); - if (filename) { - filename = filename.match(/\"(.*)\"/)[1]; //提取文件名 - downloadElement.href = href; - downloadElement.download = filename; //下载后文件名 - document.body.appendChild(downloadElement); - downloadElement.click(); //点击下载 - document.body.removeChild(downloadElement); //下载完成移除元素 + if(response.status === 200){ + window.open(url, '_blank'); + }else{ + } - window.URL.revokeObjectURL(href); //释放掉blob对象 }).catch((error) => { console.log(error)