dev_unstable
杨树明 6 years ago
parent 6944ec49cc
commit 8324d49a95

@ -38,19 +38,19 @@ class Fileslistitem extends Component{
}).then((result)=>{ }).then((result)=>{
if(result.data.attachment_histories.length===0){ if(result.data.attachment_histories.length===0){
if(result.data.is_pdf===true){ // if(result.data.is_pdf===true){
//预览pdf // //预览pdf
axios({ // axios({
method:'get', // method:'get',
url:result.data.url, // url:result.data.url,
responseType: 'arraybuffer', // responseType: 'arraybuffer',
}).then((result)=>{ // }).then((result)=>{
var binaryData = []; // var binaryData = [];
binaryData.push(result.data); // binaryData.push(result.data);
this.url =window.URL.createObjectURL(new Blob(binaryData, {type:"application/pdf"})); // this.url =window.URL.createObjectURL(new Blob(binaryData, {type:"application/pdf"}));
window.open(this.url); // window.open(this.url);
}) // })
}else{ // }else{ }
let link = document.createElement('a'); let link = document.createElement('a');
document.body.appendChild(link); document.body.appendChild(link);
link.href = "/api"+result.data.url; link.href = "/api"+result.data.url;
@ -60,7 +60,6 @@ class Fileslistitem extends Component{
evt.initEvent("click", false, false); evt.initEvent("click", false, false);
link.dispatchEvent(evt); link.dispatchEvent(evt);
document.body.removeChild(link); document.body.removeChild(link);
}
}else{ }else{
this.setState({ this.setState({
Showoldfiles:true, Showoldfiles:true,

@ -187,10 +187,11 @@ class Showoldfiles extends Component{
<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" id={allfiles.id}> <div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" id={allfiles.id}>
<li className="fl fontlefts"> <li className="fl fontlefts">
{allfiles.is_pdf===false? {/*{allfiles.is_pdf===false?*/}
<a className={"isabox"} href={"/api"+allfiles.url} >{allfiles.title}</a>: {/*<a className={"isabox"} href={"/api"+allfiles.url} >{allfiles.title}</a>:*/}
<a className={"isabox"} onClick={()=>this.showfiless(allfiles.url)} >{allfiles.title}</a> {/*<a className={"isabox"} onClick={()=>this.showfiless(allfiles.url)} >{allfiles.title}</a>*/}
} {/*}*/}
<a className={"isabox"} href={"/api"+allfiles.url} >{allfiles.title}</a>
<span className={"newcolor-orange fl"}>当前版本</span> <span className={"newcolor-orange fl"}>当前版本</span>
</li> </li>
@ -206,11 +207,11 @@ class Showoldfiles extends Component{
<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" id={item.id} key={key}> <div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" id={item.id} key={key}>
<li className="fl fontlefts"> <li className="fl fontlefts">
<a className={"isabox"} href={"/api"+item.url}>{item.title}</a>
{item.is_pdf===false? {/*{item.is_pdf===false?*/}
<a className={"isabox"} href={"/api"+item.url}>{item.title}</a>: {/*<a className={"isabox"} href={"/api"+item.url}>{item.title}</a>:*/}
<a className={"isabox"} onClick={()=>this.showfiless(item.url)} >{item.title}</a> {/*<a className={"isabox"} onClick={()=>this.showfiless(item.url)} >{item.title}</a>*/}
} {/*}*/}
</li> </li>
<li className="fl filesves "> <li className="fl filesves ">

Loading…
Cancel
Save