Merge remote-tracking branch 'origin/master'

dev_forum
杨树明 5 years ago
commit 1b1aee1041

@ -9,7 +9,6 @@ const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin'); const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
const eslintFormatter = require('react-dev-utils/eslintFormatter'); const eslintFormatter = require('react-dev-utils/eslintFormatter');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin');
// const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); // const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const getClientEnvironment = require('./env'); const getClientEnvironment = require('./env');
const paths = require('./paths'); const paths = require('./paths');
@ -250,46 +249,6 @@ module.exports = {
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
// You can remove this if you don't use Moment.js: // You can remove this if you don't use Moment.js:
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), 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. // 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. // Tell Webpack to provide empty mocks for them so importing them works.

@ -231,7 +231,7 @@ class CommonWorkSetting extends Component{
end_time: endTime.format(dateFormat) end_time: endTime.format(dateFormat)
}) })
} }
if (!this.state.late_time && endTime) { if (this.state.allow_late && !this.state.late_time && endTime) {
this.setState({ this.setState({
late_time: endTime.add(1, 'months').format(dateFormat) late_time: endTime.add(1, 'months').format(dateFormat)
}) })
@ -265,9 +265,12 @@ class CommonWorkSetting extends Component{
const currentEndTime = this._getCurrentEndTime() const currentEndTime = this._getCurrentEndTime()
let evaluation_start, evaluation_end, evaluation_num = 0, absence_penalty = 0; let evaluation_start, evaluation_end, evaluation_num = 0, absence_penalty = 0;
if (checked) { if (checked) {
if (currentEndTime) { if (this.state.allow_late && this.state.late_time) {
evaluation_start = moment(currentEndTime).add(7, 'days').format(dateFormat) evaluation_start = moment(this.state.late_time).add(14, 'days').format(dateFormat)
evaluation_end = moment(currentEndTime).add(21, '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) { if (!this.state.evaluation_num) {
evaluation_num = 3 evaluation_num = 3
@ -320,11 +323,15 @@ class CommonWorkSetting extends Component{
const { evaluation_end } = this.state; const { evaluation_end } = this.state;
const anonymous_appeal = e.target.checked const anonymous_appeal = e.target.checked
let appeal_time, appeal_penalty = this.state.appeal_penalty let appeal_time, appeal_penalty = this.state.appeal_penalty
const currentEndTime = this._getCurrentEndTime()
if (anonymous_appeal) { if (anonymous_appeal) {
appeal_penalty = 2 appeal_penalty = 2
if (evaluation_end) { if (this.state.allow_late && this.state.late_time) {
appeal_time = moment(evaluation_end).add(7, 'days').format(dateFormat) 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 { } else {
appeal_time = null; appeal_time = null;
} }
@ -386,7 +393,7 @@ class CommonWorkSetting extends Component{
answer_public: e.target.checked answer_public: e.target.checked
}) })
} }
// 补交设置 允许补交
allow_late_change=(e)=>{ allow_late_change=(e)=>{
this.setState({ this.setState({
allow_late: e.target.value allow_late: e.target.value
@ -401,6 +408,10 @@ class CommonWorkSetting extends Component{
late_time: moment(handleDateString(currentEndTime)).add(1, 'months').format(dateFormat) late_time: moment(handleDateString(currentEndTime)).add(1, 'months').format(dateFormat)
}) })
} }
} else {
this.setState({
late_time: null
})
} }
} }

@ -1350,21 +1350,10 @@ class Listofworks extends Component {
},{responseType: 'blob'}).then((response) => { },{responseType: 'blob'}).then((response) => {
console.log("1342"); console.log("1342");
console.log(response); console.log(response);
if (response.status == 200) { if(response.status === 200){
window.open(url, '_blank');
var blob = new Blob([response.data]) }else{
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对象
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -1384,21 +1373,11 @@ class Listofworks extends Component {
},{responseType: 'blob'}).then((response) => { },{responseType: 'blob'}).then((response) => {
console.log("1306"); console.log("1306");
console.log(response); console.log(response);
if (response.status == 200) { if(response.status === 200){
var blob = new Blob([response.data]) window.open(url, '_blank');
var downloadElement = document.createElement('a'); }else{
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对象
}
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });

@ -1619,19 +1619,11 @@ class Trainingjobsetting extends Component {
},{responseType: 'blob'}).then((response) => { },{responseType: 'blob'}).then((response) => {
console.log("326"); console.log("326");
console.log(response); console.log(response);
var blob = new Blob([response.data]) if(response.status === 200){
var downloadElement = document.createElement('a'); window.open(url, '_blank');
var href = window.URL.createObjectURL(blob); //创建下载的链接 }else{
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对象
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -1646,19 +1638,11 @@ class Trainingjobsetting extends Component {
axios.get((url),{responseType: 'blob'}).then((response) => { axios.get((url),{responseType: 'blob'}).then((response) => {
console.log("339"); console.log("339");
console.log(response); console.log(response);
var blob = new Blob([response.data]) if(response.status === 200){
var downloadElement = document.createElement('a'); window.open(url, '_blank');
var href = window.URL.createObjectURL(blob); //创建下载的链接 }else{
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对象
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)

@ -330,19 +330,11 @@ class Workquestionandanswer extends Component {
},{responseType: 'blob'}).then((response) => { },{responseType: 'blob'}).then((response) => {
console.log("326"); console.log("326");
console.log(response); console.log(response);
var blob = new Blob([response.data]) if(response.status === 200){
var downloadElement = document.createElement('a'); window.open(url, '_blank');
var href = window.URL.createObjectURL(blob); //创建下载的链接 }else{
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对象
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -357,19 +349,11 @@ class Workquestionandanswer extends Component {
axios.get((url),{responseType: 'blob'}).then((response) => { axios.get((url),{responseType: 'blob'}).then((response) => {
console.log("339"); console.log("339");
console.log(response); console.log(response);
var blob = new Blob([response.data]) if(response.status === 200){
var downloadElement = document.createElement('a'); window.open(url, '_blank');
var href = window.URL.createObjectURL(blob); //创建下载的链接 }else{
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对象
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)

Loading…
Cancel
Save