Feat: 缩略图

This commit is contained in:
HFO4 2019-12-08 16:01:38 +08:00
parent f3b31afabd
commit 393cbfd0f0
4 changed files with 12 additions and 7 deletions

View File

@ -132,7 +132,7 @@ class ContextMenuCompoment extends Component {
}
this.props.changeContextMenu("file",false);
let downloadPath = this.props.selected[0].path === "/" ? this.props.selected[0].path+this.props.selected[0].name:this.props.selected[0].path+"/"+this.props.selected[0].name;
window.open(baseURL+"/file"+(downloadPath));
window.open(baseURL+"/file/download"+(downloadPath));
}

View File

@ -12,7 +12,7 @@ import {FileWordBox,FilePowerpointBox,FileExcelBox,ScriptText,MagnetOn,ZipBox,Wi
import { LazyLoadImage } from 'react-lazy-load-image-component';
import ContentLoader from 'react-content-loader'
import {mediaType} from "../../config"
import {baseURL} from "../../middleware/Api"
import { withStyles, ButtonBase, Typography, Divider, Tooltip } from '@material-ui/core';
const styles = theme => ({
@ -64,6 +64,7 @@ const styles = theme => ({
height:"150px",
width:"100%",
borderRadius: "6px 6px 0 0",
backgroundColor: theme.palette.background.default,
},
previewIcon:{
overflow: "hidden",
@ -74,8 +75,9 @@ const styles = theme => ({
paddingTop:"50px",
},
picPreview:{
"height": "auto",
"width": "100%",
"height": "100%",
"width": "auto",
flex: "none",
},
fileInfo:{
height:"50px",
@ -186,6 +188,8 @@ const styles = theme => ({
},
loadingAnimation:{
borderRadius: "6px 6px 0 0",
height: "100%",
width: "100%",
},
shareFix:{
marginLeft: "20px",
@ -283,7 +287,7 @@ class FileIconCompoment extends Component {
[classes.hide]:this.state.loading,
[classes.picPreview]:!this.state.loading,
})}
src={window.apiURL.imgThumb+"?isImg=true&path="+encodeURIComponent(this.props.file.path==="/"?this.props.file.path+this.props.file.name:this.props.file.path+"/"+this.props.file.name)}
src={baseURL+"/file/thumb/"+this.props.file.id}
afterLoad = {()=>this.setState({loading:false})}
beforeLoad = {()=>this.setState({loading:true})}
onError={()=>this.setState({showPicIcon:true})}

View File

@ -48,7 +48,7 @@ class ImgPreviewCompoment extends Component {
title: value.name,
src:
baseURL +
"/file" +
"/file/download" +
(value.path === "/"
? value.path + value.name
: value.path + "/" + value.name)

View File

@ -72,6 +72,7 @@ import {
Tooltip,
} from '@material-ui/core';
import Auth from "../middleware/Auth"
import {baseURL} from "../middleware/Api"
const drawerWidth = 240;
const drawerWidthMobile = 270;
@ -353,7 +354,7 @@ class NavbarCompoment extends Component {
return;
}
let downloadPath = this.props.selected[0].path === "/" ? this.props.selected[0].path+this.props.selected[0].name:this.props.selected[0].path+"/"+this.props.selected[0].name;
window.open(window.apiURL.download+"?action=download&path="+encodeURIComponent(downloadPath));
window.open(baseURL+"/file/download"+downloadPath);
}
render() {