dev_forum
杨树明 6 years ago
parent ecfe2af710
commit 4693d4023c

@ -113,21 +113,21 @@ module.exports = {
// First, run the linter. // First, run the linter.
// It's important to do this before Babel processes the JS. // It's important to do this before Babel processes the JS.
// { {
// test: /\.(js|jsx|mjs)$/, test: /\.(js|jsx|mjs)$/,
// enforce: 'pre', enforce: 'pre',
// use: [ use: [
// { {
// options: { options: {
// formatter: eslintFormatter, formatter: eslintFormatter,
// eslintPath: require.resolve('eslint'), eslintPath: require.resolve('eslint'),
//
// }, },
// loader: require.resolve('eslint-loader'), loader: require.resolve('eslint-loader'),
// }, },
// ], ],
// include: paths.appSrc, include: paths.appSrc,
// }, },
{ {
// "oneOf" will traverse all following loaders until one will // "oneOf" will traverse all following loaders until one will
// match the requirements. When no loader matches it will fall // match the requirements. When no loader matches it will fall

@ -1,6 +1,6 @@
export function bytesToSize(bytes) { export function bytesToSize(bytes) {
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
if (bytes == 0) return '0 Byte'; if (bytes == 0) return '0 Byte';
var i = Math.floor(Math.log(bytes) / Math.log(1024)); var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i]; return parseFloat(bytes / Math.pow(1024, i), 2).toFixed(1) + ' ' + sizes[i];
} }

@ -33,14 +33,14 @@ class Fileslistitem extends Component{
axios.get(url,{ axios.get(url,{
params:{ params:{
course_id:coursesId course_id:coursesId
} },
}).then((result)=>{ }).then((result)=>{
if(result.data.attachment_histories.length===0){ if(result.data.attachment_histories.length===0){
let link = document.createElement('a'); let link = document.createElement('a');
// link.href = window.URL.createObjectURL(new Blob([result.data.url])); // link.href = window.URL.createObjectURL(new Blob([result.data.url]));
link.href = result.data.url; link.href = result.data.url;
link.download = result.data.title; link.download = encodeURI(result.data.title);
//兼容火狐浏览器 //兼容火狐浏览器
document.body.appendChild(link); document.body.appendChild(link);
let evt = document.createEvent("MouseEvents"); let evt = document.createEvent("MouseEvents");
@ -201,13 +201,13 @@ class Fileslistitem extends Component{
<span className="fl mr12 mt3"> <span className="fl mr12 mt3">
{checkBox} {checkBox}
</span> </span>
{ {
this.props.isAdmin ? <a this.props.isAdmin ? <a
// href={"/courses/" + coursesId + "/graduation/graduation_tasks/" + categoryid + "/" + taskid + "/list"} // href={"/courses/" + coursesId + "/graduation/graduation_tasks/" + categoryid + "/" + taskid + "/list"}
onClick={this.showfiles} onClick={this.showfiles}
title={discussMessage.title} title={discussMessage.title}
className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</a> : "" className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.title}</a> : ""
} }
{ {
this.props.isStudent? <a this.props.isStudent? <a
onClick={this.showfiles} onClick={this.showfiles}

@ -50,6 +50,7 @@ class Fileslists extends Component{
} }
this.updadatalist(); this.updadatalist();
on('updateNavSuccess', this.updateNavSuccess) on('updateNavSuccess', this.updateNavSuccess)
on('updateNavSuccess',this.updadatalist)
} }
updateNavSuccess=()=>{ updateNavSuccess=()=>{
@ -118,7 +119,6 @@ class Fileslists extends Component{
}) })
} }
updatafiled=()=>{ updatafiled=()=>{
debugger
if(this.props.match.params.main_id){ if(this.props.match.params.main_id){
this.seactall(); this.seactall();
}else if(this.props.match.params.Id){ }else if(this.props.match.params.Id){
@ -526,8 +526,6 @@ class Fileslists extends Component{
}) })
.then((response) => { .then((response) => {
if (response.data.status == 0) { if (response.data.status == 0) {
this.seactall();
this.setState({ this.setState({
// Modalstype:true, // Modalstype:true,
// Modalstopval:response.data.message, // Modalstopval:response.data.message,
@ -537,9 +535,10 @@ class Fileslists extends Component{
checkBoxValues:[], checkBoxValues:[],
// checkAllValue:false // checkAllValue:false
}) })
this.updatafiled()
this.props.showNotification('资源移动成功') this.props.showNotification('资源移动成功')
this.props.updataleftNavfun() this.props.updataleftNavfun()
this.updatafiled()
} }
}) })
} }

Loading…
Cancel
Save