+ {diliverIcon(card, viewMethod, classes)}
+
+ ))}
>
- }
+ )}
>
);
};
diff --git a/src/component/FileManager/Explorer.js b/src/component/FileManager/Explorer.js
index 5d6a950..c28ce63 100644
--- a/src/component/FileManager/Explorer.js
+++ b/src/component/FileManager/Explorer.js
@@ -1,4 +1,15 @@
-import { CircularProgress, Grid, Paper, Table, TableBody, TableCell, TableHead, TableRow, Typography, withStyles } from "@material-ui/core";
+import {
+ CircularProgress,
+ Grid,
+ Paper,
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableRow,
+ Typography,
+ withStyles
+} from "@material-ui/core";
import TableSortLabel from "@material-ui/core/TableSortLabel";
import SadIcon from "@material-ui/icons/SentimentVeryDissatisfied";
import EmptyIcon from "@material-ui/icons/Unarchive";
@@ -8,8 +19,14 @@ import React, { Component } from "react";
import { configure, GlobalHotKeys } from "react-hotkeys";
import { connect } from "react-redux";
import { withRouter } from "react-router-dom";
-import { changeContextMenu, navigateTo, navigateUp, openRemoveDialog, setSelectedTarget } from "../../actions/index";
-import explorer from "../../redux/explorer"
+import {
+ changeContextMenu,
+ navigateTo,
+ navigateUp,
+ openRemoveDialog,
+ setSelectedTarget
+} from "../../actions/index";
+import explorer from "../../redux/explorer";
import { isMac } from "../../utils";
import pathHelper from "../../utils/page";
import ContextMenu from "./ContextMenu";
@@ -161,7 +178,7 @@ class ExplorerCompoment extends Component {
super();
this.keyMap = {
DELETE_FILE: "del",
- SELECT_ALL: `${isMac() ? 'command' : 'ctrl'}+a`
+ SELECT_ALL: `${isMac() ? "command" : "ctrl"}+a`
};
this.handlers = {
@@ -187,8 +204,8 @@ class ExplorerCompoment extends Component {
};
configure({
- ignoreTags: ['input', 'select', 'textarea'],
- })
+ ignoreTags: ["input", "select", "textarea"]
+ });
}
contextMenu = e => {
@@ -218,236 +235,198 @@ class ExplorerCompoment extends Component {
const { classes } = this.props;
const isHomePage = pathHelper.isHomePage(this.props.location.pathname);
- const showView = !this.props.loading && (this.props.dirList.length !== 0 ||
- this.props.fileList.length !== 0)
+ const showView =
+ !this.props.loading &&
+ (this.props.dirList.length !== 0 ||
+ this.props.fileList.length !== 0);
const listView = (
-
- {this.props.dirList.length !== 0 &&
- (
- <>
-
- 文件夹
-
-
- {this.props.dirList.map(
- (value, index) => (
-
-
-
- )
- )}
-
- >
- )}
- {this.props.fileList.length !== 0 &&
- (
- <>
-
- 文件
-
-
- {this.props.fileList.map(
- (value, index) => (
-
-
-
- )
- )}
-
- >
- )}
-
- )
- const view = this.props.viewMethod === "list" ? listView : normalView
+
+ {this.props.dirList.length !== 0 && (
+ <>
+
+ 文件夹
+
+
+ {this.props.dirList.map((value, index) => (
+
+
+
+ ))}
+
+ >
+ )}
+ {this.props.fileList.length !== 0 && (
+ <>
+
+ 文件
+
+
+ {this.props.fileList.map((value, index) => (
+
+
+
+ ))}
+
+ >
+ )}
+
+ );
+ const view = this.props.viewMethod === "list" ? listView : normalView;
return (
({
backgroundColor: theme.palette.background.paper,
borderRadius: "90%",
paddingTop: "2px",
- color: theme.palette.text.secondary,
+ color: theme.palette.text.secondary
},
hide: {
display: "none"
diff --git a/src/component/FileManager/FileManager.js b/src/component/FileManager/FileManager.js
index 762f2b6..6434d64 100644
--- a/src/component/FileManager/FileManager.js
+++ b/src/component/FileManager/FileManager.js
@@ -1,17 +1,22 @@
-import React, { Component } from 'react'
-import { DndProvider } from 'react-dnd'
-import HTML5Backend from 'react-dnd-html5-backend'
-import { connect } from "react-redux"
-import { withRouter } from "react-router-dom"
-import { closeAllModals, navigateTo, setSelectedTarget, toggleSnackbar } from "../../actions"
+import React, { Component } from "react";
+import { DndProvider } from "react-dnd";
+import HTML5Backend from "react-dnd-html5-backend";
+import { connect } from "react-redux";
+import { withRouter } from "react-router-dom";
+import {
+ closeAllModals,
+ navigateTo,
+ setSelectedTarget,
+ toggleSnackbar
+} from "../../actions";
import { changeSubTitle } from "../../redux/viewUpdate/action";
-import pathHelper from "../../utils/page"
-import DragLayer from "./DnD/DragLayer"
-import Explorer from "./Explorer"
-import Modals from "./Modals"
-import Navigator from "./Navigator/Navigator"
+import pathHelper from "../../utils/page";
+import DragLayer from "./DnD/DragLayer";
+import Explorer from "./Explorer";
+import Modals from "./Modals";
+import Navigator from "./Navigator/Navigator";
-const mapStateToProps = ()=>({});
+const mapStateToProps = () => ({});
const mapDispatchToProps = dispatch => {
return {
@@ -27,14 +32,14 @@ const mapDispatchToProps = dispatch => {
closeAllModals: () => {
dispatch(closeAllModals());
},
- navigateTo:path=>{
+ navigateTo: path => {
dispatch(navigateTo(path));
- },
+ }
};
};
class FileManager extends Component {
- constructor(props){
+ constructor(props) {
super(props);
this.image = React.createRef();
}
@@ -45,28 +50,28 @@ class FileManager extends Component {
}
componentDidMount() {
- if (pathHelper.isHomePage(this.props.location.pathname)){
+ if (pathHelper.isHomePage(this.props.location.pathname)) {
this.props.changeSubTitle(null);
}
-
}
render() {
return (
-
-
-
-
-
+
+
+
+
+
);
}
-
}
-FileManager.propTypes = {
-};
+FileManager.propTypes = {};
export default connect(
mapStateToProps,
mapDispatchToProps
-)((withRouter(FileManager)));
\ No newline at end of file
+)(withRouter(FileManager));
diff --git a/src/component/FileManager/Folder.js b/src/component/FileManager/Folder.js
index fe53e96..ab5bfdc 100644
--- a/src/component/FileManager/Folder.js
+++ b/src/component/FileManager/Folder.js
@@ -1,9 +1,9 @@
-import React from "react";
+import React from "react";
import FolderIcon from "@material-ui/icons/Folder";
import classNames from "classnames";
import { ButtonBase, Typography, Tooltip, makeStyles } from "@material-ui/core";
import { useSelector } from "react-redux";
-import {lighten} from "@material-ui/core/styles";
+import { lighten } from "@material-ui/core/styles";
const useStyles = makeStyles(theme => ({
container: {
padding: "7px"
@@ -46,7 +46,7 @@ const useStyles = makeStyles(theme => ({
backgroundColor: theme.palette.background.paper,
borderRadius: "90%",
paddingTop: "2px",
- color: theme.palette.text.secondary,
+ color: theme.palette.text.secondary
},
folderNameSelected: {
color:
@@ -65,12 +65,12 @@ const useStyles = makeStyles(theme => ({
overflow: "hidden",
marginRight: "20px"
},
- active:{
- border: "2px solid " + theme.palette.primary.light,
- },
+ active: {
+ border: "2px solid " + theme.palette.primary.light
+ }
}));
-export default function Folder({ folder,isActive }) {
+export default function Folder({ folder, isActive }) {
const selected = useSelector(state => state.explorer.selected);
const classes = useStyles();
@@ -87,9 +87,9 @@ export default function Folder({ folder,isActive }) {
{
[classes.selected]: isSelected,
[classes.notSelected]: !isSelected,
- [classes.active]: isActive,
+ [classes.active]: isActive
},
- classes.button,
+ classes.button
)}
>
({});
@@ -39,21 +39,22 @@ class ImagPreviewComponent extends Component {
const items = [];
let firstOne = 0;
if (nextProps.first.id !== "") {
- if (pathHelper.isSharePage(this.props.location.pathname) && !nextProps.first.path){
+ if (
+ pathHelper.isSharePage(this.props.location.pathname) &&
+ !nextProps.first.path
+ ) {
const newImg = {
intro: nextProps.first.name,
- src:
- baseURL +
- "/share/preview/" +nextProps.first.key
+ src: baseURL + "/share/preview/" + nextProps.first.key
};
firstOne = 0;
items.push(newImg);
this.setState({
- photoIndex:firstOne,
+ photoIndex: firstOne,
items: items,
isOpen: true
});
- return
+ return;
}
// eslint-disable-next-line
nextProps.other.map(value => {
@@ -63,21 +64,22 @@ class ImagPreviewComponent extends Component {
.toLowerCase();
if (imgPreviewSuffix.indexOf(fileType) !== -1) {
let src = "";
- if (pathHelper.isSharePage(this.props.location.pathname)){
- src = baseURL +
- "/share/preview/" + value.key
- src = src + "?path=" + encodeURIComponent( (value.path === "/"
- ? value.path + value.name
- : value.path + "/" + value.name))
-
- }else{
- src = baseURL +
- "/file/preview/" +
- value.id
+ if (pathHelper.isSharePage(this.props.location.pathname)) {
+ src = baseURL + "/share/preview/" + value.key;
+ src =
+ src +
+ "?path=" +
+ encodeURIComponent(
+ value.path === "/"
+ ? value.path + value.name
+ : value.path + "/" + value.name
+ );
+ } else {
+ src = baseURL + "/file/preview/" + value.id;
}
const newImg = {
intro: value.name,
- src:src,
+ src: src
};
if (
value.path === nextProps.first.path &&
@@ -89,7 +91,7 @@ class ImagPreviewComponent extends Component {
}
});
this.setState({
- photoIndex:firstOne,
+ photoIndex: firstOne,
items: items,
isOpen: true
});
@@ -104,22 +106,23 @@ class ImagPreviewComponent extends Component {
};
render() {
- const { photoIndex, isOpen,items } = this.state;
+ const { photoIndex, isOpen, items } = this.state;
return (
- {isOpen && (
this.handleClose()}
- index={photoIndex}
- onIndexChange={(n) =>
- this.setState({
- photoIndex: n,
- })
- }
-
- />)}
+ {isOpen && (
+ this.handleClose()}
+ index={photoIndex}
+ onIndexChange={n =>
+ this.setState({
+ photoIndex: n
+ })
+ }
+ />
+ )}
);
}
diff --git a/src/component/FileManager/ImgPreview_old.js b/src/component/FileManager/ImgPreview_old.js
index 21d7a13..5489b11 100644
--- a/src/component/FileManager/ImgPreview_old.js
+++ b/src/component/FileManager/ImgPreview_old.js
@@ -8,7 +8,7 @@ import { withStyles } from "@material-ui/core";
import Lightbox from "react-image-lightbox";
import "react-image-lightbox/style.css";
import pathHelper from "../../utils/page";
-import {withRouter} from "react-router";
+import { withRouter } from "react-router";
const styles = () => ({});
@@ -38,21 +38,22 @@ class ImgPreviewCompoment extends Component {
const items = [];
let firstOne = 0;
if (nextProps.first !== null) {
- if (pathHelper.isSharePage(this.props.location.pathname) && !nextProps.first.path){
+ if (
+ pathHelper.isSharePage(this.props.location.pathname) &&
+ !nextProps.first.path
+ ) {
const newImg = {
title: nextProps.first.name,
- src:
- baseURL +
- "/share/preview/" +nextProps.first.key
+ src: baseURL + "/share/preview/" + nextProps.first.key
};
firstOne = 0;
items.push(newImg);
this.setState({
- photoIndex:firstOne,
+ photoIndex: firstOne,
items: items,
isOpen: true
});
- return
+ return;
}
// eslint-disable-next-line
nextProps.other.map(value => {
@@ -62,21 +63,22 @@ class ImgPreviewCompoment extends Component {
.toLowerCase();
if (imgPreviewSuffix.indexOf(fileType) !== -1) {
let src = "";
- if (pathHelper.isSharePage(this.props.location.pathname)){
- src = baseURL +
- "/share/preview/" + value.key
- src = src + "?path=" + encodeURIComponent( (value.path === "/"
- ? value.path + value.name
- : value.path + "/" + value.name))
-
- }else{
- src = baseURL +
- "/file/preview/" +
- value.id
+ if (pathHelper.isSharePage(this.props.location.pathname)) {
+ src = baseURL + "/share/preview/" + value.key;
+ src =
+ src +
+ "?path=" +
+ encodeURIComponent(
+ value.path === "/"
+ ? value.path + value.name
+ : value.path + "/" + value.name
+ );
+ } else {
+ src = baseURL + "/file/preview/" + value.id;
}
const newImg = {
title: value.name,
- src:src,
+ src: src
};
if (
value.path === nextProps.first.path &&
@@ -88,7 +90,7 @@ class ImgPreviewCompoment extends Component {
}
});
this.setState({
- photoIndex:firstOne,
+ photoIndex: firstOne,
items: items,
isOpen: true
});
@@ -103,34 +105,42 @@ class ImgPreviewCompoment extends Component {
};
render() {
- const { photoIndex, isOpen,items } = this.state;
+ const { photoIndex, isOpen, items } = this.state;
return (
- {isOpen && ( this.handleClose()}
- imageLoadErrorMessage = "无法加载此图像"
- imageCrossOrigin = "anonymous"
- imageTitle = {items[photoIndex].title}
- onMovePrevRequest={() =>
- this.setState({
- photoIndex: (photoIndex + items.length - 1) % items.length,
- })
- }
- reactModalStyle={{
- overlay:{
- zIndex:10000
- },
- }}
- onMoveNextRequest={() =>
- this.setState({
- photoIndex: (photoIndex + 1) % items.length,
- })
- }
- />)}
+ {isOpen && (
+ this.handleClose()}
+ imageLoadErrorMessage="无法加载此图像"
+ imageCrossOrigin="anonymous"
+ imageTitle={items[photoIndex].title}
+ onMovePrevRequest={() =>
+ this.setState({
+ photoIndex:
+ (photoIndex + items.length - 1) %
+ items.length
+ })
+ }
+ reactModalStyle={{
+ overlay: {
+ zIndex: 10000
+ }
+ }}
+ onMoveNextRequest={() =>
+ this.setState({
+ photoIndex: (photoIndex + 1) % items.length
+ })
+ }
+ />
+ )}
);
}
diff --git a/src/component/FileManager/Modals.js b/src/component/FileManager/Modals.js
index f1e620d..3e190ac 100644
--- a/src/component/FileManager/Modals.js
+++ b/src/component/FileManager/Modals.js
@@ -20,7 +20,7 @@ import {
DialogContent,
DialogTitle,
DialogContentText,
- CircularProgress,
+ CircularProgress
} from "@material-ui/core";
import Loading from "../Modals/Loading";
import CopyDialog from "../Modals/Copy";
@@ -100,7 +100,7 @@ class ModalsCompoment extends Component {
downloadURL: "",
remoteDownloadPathSelect: false,
source: "",
- purchaseCallback:null,
+ purchaseCallback: null
};
handleInputChange = e => {
@@ -121,17 +121,25 @@ class ModalsCompoment extends Component {
// 打包下载
if (nextProps.loading === true) {
if (nextProps.loadingText === "打包中...") {
- if (pathHelper.isSharePage(this.props.location.pathname) && this.props.share && this.props.share.score > 0){
+ if (
+ pathHelper.isSharePage(this.props.location.pathname) &&
+ this.props.share &&
+ this.props.share.score > 0
+ ) {
this.scoreHandler(this.archiveDownload);
- return
+ return;
}
this.archiveDownload();
} else if (nextProps.loadingText === "获取下载地址...") {
- if (pathHelper.isSharePage(this.props.location.pathname) && this.props.share && this.props.share.score > 0){
+ if (
+ pathHelper.isSharePage(this.props.location.pathname) &&
+ this.props.share &&
+ this.props.share.score > 0
+ ) {
this.scoreHandler(this.Download);
- return
+ return;
}
- this.Download();
+ this.Download();
}
}
return;
@@ -165,9 +173,9 @@ class ModalsCompoment extends Component {
}
};
- scoreHandler = callback =>{
- callback();
- }
+ scoreHandler = callback => {
+ callback();
+ };
Download = () => {
let reqURL = "";
@@ -176,8 +184,8 @@ class ModalsCompoment extends Component {
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;
+ "/" +
+ this.props.selected[0].name;
reqURL =
"/share/download/" +
this.props.selected[0].key +
@@ -213,7 +221,7 @@ class ModalsCompoment extends Component {
} else {
items.push(value.id);
}
- return null
+ return null;
});
let reqURL = "/file/archive";
@@ -221,13 +229,9 @@ class ModalsCompoment extends Component {
items: items,
dirs: dirs
};
- if (pathHelper.isSharePage(
- this.props.location.pathname
- )) {
- reqURL =
- "/share/archive/" +
- window.shareInfo.key;
- postBody["path"] = this.props.selected[0].path
+ if (pathHelper.isSharePage(this.props.location.pathname)) {
+ reqURL = "/share/archive/" + window.shareInfo.key;
+ postBody["path"] = this.props.selected[0].path;
}
API.post(reqURL, postBody)
@@ -279,7 +283,7 @@ class ModalsCompoment extends Component {
.then(response => {
if (response.rawData.code === 0) {
this.onClose();
- setTimeout(this.props.refreshFileList,500);
+ setTimeout(this.props.refreshFileList, 500);
} else {
this.props.toggleSnackbar(
"top",
@@ -401,10 +405,10 @@ class ModalsCompoment extends Component {
// 检查重名
if (
- this.props.dirList.findIndex((value) => {
+ this.props.dirList.findIndex(value => {
return value.name === newName;
}) !== -1 ||
- this.props.fileList.findIndex((value) => {
+ this.props.fileList.findIndex(value => {
return value.name === newName;
}) !== -1
) {
@@ -442,7 +446,7 @@ class ModalsCompoment extends Component {
e.preventDefault();
this.props.setModalsLoading(true);
if (
- this.props.dirList.findIndex((value) => {
+ this.props.dirList.findIndex(value => {
return value.name === this.state.newFolderName;
}) !== -1
) {
@@ -483,7 +487,7 @@ class ModalsCompoment extends Component {
e.preventDefault();
this.props.setModalsLoading(true);
if (
- this.props.dirList.findIndex((value) => {
+ this.props.dirList.findIndex(value => {
return value.name === this.state.newFileName;
}) !== -1
) {
@@ -523,18 +527,18 @@ class ModalsCompoment extends Component {
submitTorrentDownload = e => {
e.preventDefault();
this.props.setModalsLoading(true);
- API
- .post("/aria2/torrent/" + this.props.selected[0].id, {
- dst: this.state.selectedPath === "//" ? "/" : this.state.selectedPath
- })
+ API.post("/aria2/torrent/" + this.props.selected[0].id, {
+ dst:
+ this.state.selectedPath === "//" ? "/" : this.state.selectedPath
+ })
.then(() => {
- this.props.toggleSnackbar(
- "top",
- "right",
- "任务已创建",
- "success"
- );
- this.onClose();
+ this.props.toggleSnackbar(
+ "top",
+ "right",
+ "任务已创建",
+ "success"
+ );
+ this.onClose();
this.props.setModalsLoading(false);
})
.catch(error => {
@@ -551,19 +555,19 @@ class ModalsCompoment extends Component {
submitDownload = e => {
e.preventDefault();
this.props.setModalsLoading(true);
- API
- .post("/aria2/url", {
- url: this.state.downloadURL,
- dst: this.state.selectedPath === "//" ? "/" : this.state.selectedPath
- })
+ API.post("/aria2/url", {
+ url: this.state.downloadURL,
+ dst:
+ this.state.selectedPath === "//" ? "/" : this.state.selectedPath
+ })
.then(() => {
- this.props.toggleSnackbar(
- "top",
- "right",
- "任务已创建",
- "success"
- );
- this.onClose();
+ this.props.toggleSnackbar(
+ "top",
+ "right",
+ "任务已创建",
+ "success"
+ );
+ this.onClose();
this.props.setModalsLoading(false);
})
.catch(error => {
@@ -607,7 +611,7 @@ class ModalsCompoment extends Component {
downloadURL: "",
shareUrl: "",
remoteDownloadPathSelect: false,
- source: "",
+ source: ""
});
this.newNameSuffix = "";
this.props.closeAllModals();
@@ -930,7 +934,7 @@ class ModalsCompoment extends Component {
: "")
: baseURL +
"/file/preview/" +
- this.props.selected[0].id
+ this.props.selected[0].id
}
/>
)}
diff --git a/src/component/FileManager/Navigator/DropDown.js b/src/component/FileManager/Navigator/DropDown.js
index 053aeef..b6cb08f 100644
--- a/src/component/FileManager/Navigator/DropDown.js
+++ b/src/component/FileManager/Navigator/DropDown.js
@@ -1,41 +1,37 @@
import React from "react";
import DropDownItem from "./DropDownItem";
-
export default function DropDown(props) {
-
let timer;
let first = props.folders.length;
const status = [];
for (let index = 0; index < props.folders.length; index++) {
status[index] = false;
-
}
- const setActiveStatus = (id,value)=>{
+ const setActiveStatus = (id, value) => {
status[id] = value;
- if (value){
+ if (value) {
clearTimeout(timer);
- }else{
+ } else {
let shouldClose = true;
status.forEach(element => {
- if (element){
+ if (element) {
shouldClose = false;
}
});
- if (shouldClose){
- if (first<=0){
- timer = setTimeout(()=>{
+ if (shouldClose) {
+ if (first <= 0) {
+ timer = setTimeout(() => {
props.onClose();
- },100)
- }else{
+ }, 100);
+ } else {
first--;
}
-
}
}
console.log(status);
- }
+ };
return (
<>
@@ -45,7 +41,7 @@ export default function DropDown(props) {
path={"/" + props.folders.slice(0, id).join("/")}
navigateTo={props.navigateTo}
id={id}
- setActiveStatus = {setActiveStatus}
+ setActiveStatus={setActiveStatus}
folder={folder}
/>
))}
diff --git a/src/component/FileManager/Navigator/DropDownItem.js b/src/component/FileManager/Navigator/DropDownItem.js
index 5cb506b..bb0b949 100644
--- a/src/component/FileManager/Navigator/DropDownItem.js
+++ b/src/component/FileManager/Navigator/DropDownItem.js
@@ -1,11 +1,7 @@
import React, { useEffect } from "react";
import { makeStyles } from "@material-ui/core";
import FolderIcon from "@material-ui/icons/Folder";
-import {
- MenuItem,
- ListItemIcon,
- ListItemText
-} from "@material-ui/core";
+import { MenuItem, ListItemIcon, ListItemText } from "@material-ui/core";
import { useDrop } from "react-dnd";
import classNames from "classnames";
@@ -36,9 +32,9 @@ export default function DropDownItem(props) {
const isActive = canDrop && isOver;
useEffect(() => {
- props.setActiveStatus(props.id,isActive);
+ props.setActiveStatus(props.id, isActive);
// eslint-disable-next-line
- }, [isActive])
+ }, [isActive]);
const classes = useStyles();
return (
diff --git a/src/component/FileManager/Navigator/Navigator.js b/src/component/FileManager/Navigator/Navigator.js
index b2ecd43..a491991 100644
--- a/src/component/FileManager/Navigator/Navigator.js
+++ b/src/component/FileManager/Navigator/Navigator.js
@@ -21,9 +21,11 @@ import {
openCreateFolderDialog,
openShareDialog,
drawerToggleAction,
- setShareUserPopover, openResaveDialog, openCompressDialog
+ setShareUserPopover,
+ openResaveDialog,
+ openCompressDialog
} from "../../../actions/index";
-import explorer from "../../../redux/explorer"
+import explorer from "../../../redux/explorer";
import API from "../../../middleware/Api";
import { setCookie, setGetParameter, fixUrlHash } from "../../../utils/index";
import {
@@ -40,11 +42,10 @@ import pathHelper from "../../../utils/page";
import classNames from "classnames";
import Auth from "../../../middleware/Auth";
import Avatar from "@material-ui/core/Avatar";
-import {Archive} from "@material-ui/icons";
+import { Archive } from "@material-ui/icons";
import { FilePlus } from "mdi-material-ui";
import { openCreateFileDialog } from "../../../actions";
-
const mapStateToProps = state => {
return {
path: state.navigator.path,
@@ -100,12 +101,12 @@ const mapDispatchToProps = dispatch => {
setShareUserPopover: e => {
dispatch(setShareUserPopover(e));
},
- openResave: (key) => {
+ openResave: key => {
dispatch(openResaveDialog(key));
},
- openCompressDialog: ()=>{
- dispatch(openCompressDialog())
- },
+ openCompressDialog: () => {
+ dispatch(openCompressDialog());
+ }
};
};
@@ -182,7 +183,7 @@ class NavigatorComponent extends Component {
componentDidMount = () => {
const url = new URL(fixUrlHash(window.location.href));
const c = url.searchParams.get("path");
- this.renderPath(c === null ? "/":c);
+ this.renderPath(c === null ? "/" : c);
if (!this.props.isShare) {
// 如果是在个人文件管理页,首次加载时打开侧边栏
@@ -330,7 +331,7 @@ class NavigatorComponent extends Component {
const presentPath = this.props.path.split("/");
const newTarget = [
{
- id:this.currentID,
+ id: this.currentID,
type: "dir",
name: presentPath.pop(),
path: presentPath.length === 1 ? "/" : presentPath.join("/")
@@ -384,7 +385,7 @@ class NavigatorComponent extends Component {
render() {
const { classes } = this.props;
- const isHomePage = pathHelper.isHomePage(this.props.location.pathname);
+ const isHomePage = pathHelper.isHomePage(this.props.location.pathname);
const user = Auth.GetUser();
const presentFolderMenu = (
@@ -401,45 +402,42 @@ class NavigatorComponent extends Component {
刷新
- {this.props.keywords === "" &&
- isHomePage && (
-
-
+ {this.props.keywords === "" && isHomePage && (
+
+
+
+ {user.group.compress && (
- {user.group.compress &&
}
-
-
-
-
- )}
+ )}
+
+
+
+
+ )}
);
@@ -614,7 +612,11 @@ class NavigatorComponent extends Component {
>
)}
diff --git a/src/component/FileManager/Navigator/PathButton.js b/src/component/FileManager/Navigator/PathButton.js
index fb6ef13..e8346f4 100644
--- a/src/component/FileManager/Navigator/PathButton.js
+++ b/src/component/FileManager/Navigator/PathButton.js
@@ -1,4 +1,4 @@
-import React,{useEffect} from "react";
+import React, { useEffect } from "react";
import ExpandMore from "@material-ui/icons/ExpandMore";
import { Button } from "@material-ui/core";
import { makeStyles } from "@material-ui/core";
@@ -13,14 +13,14 @@ const useStyles = makeStyles(theme => ({
active: {
border: "2px solid " + theme.palette.primary.light
},
- button:{
- textTransform: "none",
+ button: {
+ textTransform: "none"
}
}));
export default function PathButton(props) {
- const inputRef = React.useRef(null)
-
+ const inputRef = React.useRef(null);
+
const [{ canDrop, isOver }, drop] = useDrop({
accept: "object",
drop: () => {
@@ -45,35 +45,36 @@ export default function PathButton(props) {
const isActive = canDrop && isOver;
useEffect(() => {
- if(props.more && isActive){
+ if (props.more && isActive) {
inputRef.current.click();
}
// eslint-disable-next-line
- }, [isActive])
+ }, [isActive]);
const classes = useStyles();
return (
-
-
-
+
+
-
);
}
diff --git a/src/component/FileManager/ObjectIcon.js b/src/component/FileManager/ObjectIcon.js
index bc45c71..9ad4a7e 100644
--- a/src/component/FileManager/ObjectIcon.js
+++ b/src/component/FileManager/ObjectIcon.js
@@ -99,12 +99,12 @@ export default function ObjectIcon(props) {
};
const selectFile = e => {
- dispatch(selectFileAction(props.file, e, props.index))
+ dispatch(selectFileAction(props.file, e, props.index));
};
const enterFolder = () => {
- NavitateTo(
- path === "/" ? path + props.file.name : path + "/" + props.file.name
- );
+ NavitateTo(
+ path === "/" ? path + props.file.name : path + "/" + props.file.name
+ );
};
const handleClick = e => {
if (props.file.type === "up") {
@@ -156,18 +156,18 @@ export default function ObjectIcon(props) {
if (isShare) {
history.push(
selected[0].key +
- "/doc?name=" +
- encodeURIComponent(selected[0].name) +
- "&share_path=" +
- encodeURIComponent(previewPath)
+ "/doc?name=" +
+ encodeURIComponent(selected[0].name) +
+ "&share_path=" +
+ encodeURIComponent(previewPath)
);
return;
}
history.push(
"/doc?p=" +
- encodeURIComponent(previewPath) +
- "&id=" +
- selected[0].id
+ encodeURIComponent(previewPath) +
+ "&id=" +
+ selected[0].id
);
return;
case "audio":
@@ -177,58 +177,73 @@ export default function ObjectIcon(props) {
if (isShare) {
history.push(
selected[0].key +
- "/video?name=" +
- encodeURIComponent(selected[0].name) +
- "&share_path=" +
- encodeURIComponent(previewPath)
+ "/video?name=" +
+ encodeURIComponent(selected[0].name) +
+ "&share_path=" +
+ encodeURIComponent(previewPath)
);
return;
}
history.push(
"/video?p=" +
- encodeURIComponent(previewPath) +
- "&id=" +
- selected[0].id
+ encodeURIComponent(previewPath) +
+ "&id=" +
+ selected[0].id
);
return;
case "edit":
if (isShare) {
history.push(
selected[0].key +
- "/text?name=" +
- encodeURIComponent(selected[0].name) +
- "&share_path=" +
- encodeURIComponent(previewPath)
+ "/text?name=" +
+ encodeURIComponent(selected[0].name) +
+ "&share_path=" +
+ encodeURIComponent(previewPath)
);
return;
}
- history.push("/text?p=" + encodeURIComponent(previewPath) + "&id=" + selected[0].id);
+ history.push(
+ "/text?p=" +
+ encodeURIComponent(previewPath) +
+ "&id=" +
+ selected[0].id
+ );
return;
case "pdf":
if (isShare) {
history.push(
selected[0].key +
- "/pdf?name=" +
- encodeURIComponent(selected[0].name) +
- "&share_path=" +
- encodeURIComponent(previewPath)
+ "/pdf?name=" +
+ encodeURIComponent(selected[0].name) +
+ "&share_path=" +
+ encodeURIComponent(previewPath)
);
return;
}
- history.push("/pdf?p=" + encodeURIComponent(previewPath) + "&id=" + selected[0].id);
+ history.push(
+ "/pdf?p=" +
+ encodeURIComponent(previewPath) +
+ "&id=" +
+ selected[0].id
+ );
return;
case "code":
if (isShare) {
history.push(
selected[0].key +
- "/code?name=" +
- encodeURIComponent(selected[0].name) +
- "&share_path=" +
- encodeURIComponent(previewPath)
+ "/code?name=" +
+ encodeURIComponent(selected[0].name) +
+ "&share_path=" +
+ encodeURIComponent(previewPath)
);
return;
}
- history.push("/code?p=" + encodeURIComponent(previewPath) + "&id=" + selected[0].id);
+ history.push(
+ "/code?p=" +
+ encodeURIComponent(previewPath) +
+ "&id=" +
+ selected[0].id
+ );
return;
default:
OpenLoadingDialog("获取下载地址...");
diff --git a/src/component/FileManager/PathSelector.js b/src/component/FileManager/PathSelector.js
index f94e9bc..225e38f 100644
--- a/src/component/FileManager/PathSelector.js
+++ b/src/component/FileManager/PathSelector.js
@@ -1,13 +1,11 @@
-import React, { Component } from 'react'
-import PropTypes from 'prop-types';
-import FolderIcon from '@material-ui/icons/Folder'
-import RightIcon from "@material-ui/icons/KeyboardArrowRight"
-import UpIcon from "@material-ui/icons/ArrowUpward"
-import { connect } from 'react-redux'
-import classNames from 'classnames';
-import {
- toggleSnackbar,
-} from "../../actions/index"
+import React, { Component } from "react";
+import PropTypes from "prop-types";
+import FolderIcon from "@material-ui/icons/Folder";
+import RightIcon from "@material-ui/icons/KeyboardArrowRight";
+import UpIcon from "@material-ui/icons/ArrowUpward";
+import { connect } from "react-redux";
+import classNames from "classnames";
+import { toggleSnackbar } from "../../actions/index";
import {
MenuList,
@@ -16,130 +14,162 @@ import {
ListItemIcon,
ListItemText,
withStyles,
- ListItemSecondaryAction,
-} from '@material-ui/core';
-import API from '../../middleware/Api'
+ ListItemSecondaryAction
+} from "@material-ui/core";
+import API from "../../middleware/Api";
const mapStateToProps = state => {
return {
- keywords: state.explorer.keywords,
- }
-}
+ keywords: state.explorer.keywords
+ };
+};
const mapDispatchToProps = dispatch => {
return {
- toggleSnackbar:(vertical,horizontal,msg,color)=>{
- dispatch(toggleSnackbar(vertical,horizontal,msg,color))
- },
- }
-}
-
+ toggleSnackbar: (vertical, horizontal, msg, color) => {
+ dispatch(toggleSnackbar(vertical, horizontal, msg, color));
+ }
+ };
+};
const styles = theme => ({
- iconWhite:{
- color: theme.palette.common.white,
+ iconWhite: {
+ color: theme.palette.common.white
},
selected: {
- backgroundColor: theme.palette.primary.main+"!important",
- '& $primary, & $icon': {
- color: theme.palette.common.white,
- },
- },
+ backgroundColor: theme.palette.primary.main + "!important",
+ "& $primary, & $icon": {
+ color: theme.palette.common.white
+ }
+ },
primary: {},
icon: {},
- buttonIcon:{},
- selector:{
- minWidth: "300px",
+ buttonIcon: {},
+ selector: {
+ minWidth: "300px"
},
- container:{
+ container: {
maxHeight: "330px",
- overflowY:" auto",
+ overflowY: " auto"
}
-})
-
+});
class PathSelectorCompoment extends Component {
-
state = {
- presentPath:"/",
- dirList:[],
- selectedTarget:null,
- }
+ presentPath: "/",
+ dirList: [],
+ selectedTarget: null
+ };
- componentDidMount= ()=>{
+ componentDidMount = () => {
const toBeLoad = this.props.presentPath;
this.enterFolder(this.props.keywords === "" ? toBeLoad : "/");
- }
+ };
- back = ()=>{
+ back = () => {
const paths = this.state.presentPath.split("/");
paths.pop();
const toBeLoad = paths.join("/");
- this.enterFolder(toBeLoad===""?"/":toBeLoad);
- }
+ this.enterFolder(toBeLoad === "" ? "/" : toBeLoad);
+ };
- enterFolder = (toBeLoad)=>{
- API.get((this.props.api ? this.props.api : '/directory')+encodeURIComponent(toBeLoad),)
- .then( (response)=> {
- const dirList = response.data.objects.filter( (x)=> {
- return (x.type === "dir" && (this.props.selected.findIndex((value)=>{
- return (value.name === x.name )&&(value.path === x.path);
- }))===-1);
- });
- if(toBeLoad ==="/"){
- dirList.unshift({name:"/",path:""})
- }
- this.setState({
- presentPath:toBeLoad,
- dirList:dirList,
- selectedTarget:null,
+ enterFolder = toBeLoad => {
+ API.get(
+ (this.props.api ? this.props.api : "/directory") +
+ encodeURIComponent(toBeLoad)
+ )
+ .then(response => {
+ const dirList = response.data.objects.filter(x => {
+ return (
+ x.type === "dir" &&
+ this.props.selected.findIndex(value => {
+ return (
+ value.name === x.name && value.path === x.path
+ );
+ }) === -1
+ );
+ });
+ if (toBeLoad === "/") {
+ dirList.unshift({ name: "/", path: "" });
+ }
+ this.setState({
+ presentPath: toBeLoad,
+ dirList: dirList,
+ selectedTarget: null
+ });
})
- })
- .catch((error) =>{
- this.props.toggleSnackbar("top","right",error.message,"warning");
- });
- }
+ .catch(error => {
+ this.props.toggleSnackbar(
+ "top",
+ "right",
+ error.message,
+ "warning"
+ );
+ });
+ };
- handleSelect = (index) =>{
- this.setState({selectedTarget:index});
+ handleSelect = index => {
+ this.setState({ selectedTarget: index });
this.props.onSelect(this.state.dirList[index]);
- }
+ };
render() {
-
- const { classes} = this.props;
+ const { classes } = this.props;
return (
-
- {this.state.presentPath!=="/"&&
-
- }
- {this.state.dirList.map((value,index)=>(
-
- ))}
-
-
-
+
+ {this.state.presentPath !== "/" && (
+
+ )}
+ {this.state.dirList.map((value, index) => (
+
+ ))}
+
);
}
@@ -147,12 +177,11 @@ class PathSelectorCompoment extends Component {
PathSelectorCompoment.propTypes = {
classes: PropTypes.object.isRequired,
- presentPath:PropTypes.string.isRequired,
- selected:PropTypes.array.isRequired,
+ presentPath: PropTypes.string.isRequired,
+ selected: PropTypes.array.isRequired
};
export default connect(
mapStateToProps,
mapDispatchToProps
-
-)(withStyles(styles)(PathSelectorCompoment))
\ No newline at end of file
+)(withStyles(styles)(PathSelectorCompoment));
diff --git a/src/component/FileManager/SmallIcon.js b/src/component/FileManager/SmallIcon.js
index fafe1ec..ad5bf5e 100644
--- a/src/component/FileManager/SmallIcon.js
+++ b/src/component/FileManager/SmallIcon.js
@@ -1,43 +1,44 @@
-import React, { Component } from 'react'
-import PropTypes from 'prop-types';
-import { connect } from 'react-redux'
-import classNames from 'classnames';
-import { withStyles, ButtonBase, Typography, Tooltip } from '@material-ui/core';
+import React, { Component } from "react";
+import PropTypes from "prop-types";
+import { connect } from "react-redux";
+import classNames from "classnames";
+import { withStyles, ButtonBase, Typography, Tooltip } from "@material-ui/core";
import TypeIcon from "./TypeIcon";
-import {lighten} from "@material-ui/core/styles";
+import { lighten } from "@material-ui/core/styles";
const styles = theme => ({
container: {
- padding: "7px",
+ padding: "7px"
},
selected: {
"&:hover": {
- border: "1px solid #d0d0d0",
+ border: "1px solid #d0d0d0"
},
backgroundColor:
theme.palette.type === "dark"
? "#fff"
- : lighten(theme.palette.primary.main,0.8),
+ : lighten(theme.palette.primary.main, 0.8)
},
notSelected: {
"&:hover": {
backgroundColor: theme.palette.background.default,
- border: "1px solid #d0d0d0",
+ border: "1px solid #d0d0d0"
},
- backgroundColor: theme.palette.background.paper,
+ backgroundColor: theme.palette.background.paper
},
button: {
height: "50px",
- border: "1px solid "+theme.palette.divider,
+ border: "1px solid " + theme.palette.divider,
width: "100%",
borderRadius: "6px",
boxSizing: "border-box",
- transition: "background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
+ transition:
+ "background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,border 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
display: "flex",
justifyContent: "left",
- alignItems: "initial",
+ alignItems: "initial"
},
icon: {
margin: "10px 10px 10px 16px",
@@ -46,83 +47,94 @@ const styles = theme => ({
backgroundColor: theme.palette.background.paper,
borderRadius: "90%",
paddingTop: "2px",
- color: theme.palette.text.secondary,
+ color: theme.palette.text.secondary
},
folderNameSelected: {
- color: theme.palette.type === "dark" ? theme.palette.background.paper : theme.palette.primary.dark,
- fontWeight: "500",
+ color:
+ theme.palette.type === "dark"
+ ? theme.palette.background.paper
+ : theme.palette.primary.dark,
+ fontWeight: "500"
},
folderNameNotSelected: {
- color: theme.palette.text.secondary,
+ color: theme.palette.text.secondary
},
folderName: {
marginTop: "15px",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
overflow: "hidden",
- marginRight: "20px",
- },
-})
+ marginRight: "20px"
+ }
+});
const mapStateToProps = state => {
return {
- selected: state.explorer.selected,
- }
-}
+ selected: state.explorer.selected
+ };
+};
const mapDispatchToProps = () => {
- return {
- }
-}
+ return {};
+};
class SmallIconCompoment extends Component {
-
- state = {
- }
-
+ state = {};
render() {
-
const { classes } = this.props;
- const isSelected = (this.props.selected.findIndex((value) => {
- return value === this.props.file;
- })) !== -1;
+ const isSelected =
+ this.props.selected.findIndex(value => {
+ return value === this.props.file;
+ }) !== -1;
return (
-
-
+
+ {this.props.file.name}
-
-
+ >
+ {this.props.file.name}
+
+
+
);
}
}
SmallIconCompoment.propTypes = {
classes: PropTypes.object.isRequired,
- file: PropTypes.object.isRequired,
+ file: PropTypes.object.isRequired
};
-
const SmallIcon = connect(
mapStateToProps,
mapDispatchToProps
-)(withStyles(styles)(SmallIconCompoment))
+)(withStyles(styles)(SmallIconCompoment));
-export default SmallIcon
\ No newline at end of file
+export default SmallIcon;
diff --git a/src/component/FileManager/TableRow.js b/src/component/FileManager/TableRow.js
index 5e52eb1..258ab53 100644
--- a/src/component/FileManager/TableRow.js
+++ b/src/component/FileManager/TableRow.js
@@ -7,10 +7,10 @@ import classNames from "classnames";
import { sizeToString } from "../../utils/index";
import { withStyles, TableCell, TableRow, Typography } from "@material-ui/core";
import TypeIcon from "./TypeIcon";
-import {lighten} from "@material-ui/core/styles";
+import { lighten } from "@material-ui/core/styles";
import pathHelper from "../../utils/page";
-import {withRouter} from "react-router";
-import KeyboardReturnIcon from '@material-ui/icons/KeyboardReturn';
+import { withRouter } from "react-router";
+import KeyboardReturnIcon from "@material-ui/icons/KeyboardReturn";
const styles = theme => ({
selected: {
@@ -18,20 +18,20 @@ const styles = theme => ({
backgroundColor:
theme.palette.type === "dark"
? theme.palette.background.paper
- : lighten(theme.palette.primary.main,0.8),
+ : lighten(theme.palette.primary.main, 0.8)
},
selectedShared: {
"&:hover": {},
backgroundColor:
theme.palette.type === "dark"
- ? lighten(theme.palette.background.paper,0.15)
- : lighten(theme.palette.primary.main,0.8),
+ ? lighten(theme.palette.background.paper, 0.15)
+ : lighten(theme.palette.primary.main, 0.8)
},
notSelected: {
"&:hover": {
- backgroundColor: theme.palette.background.default,
+ backgroundColor: theme.palette.background.default
}
},
icon: {
@@ -39,12 +39,13 @@ const styles = theme => ({
marginRight: "20px",
color: theme.palette.text.secondary
},
- tableIcon:{
+ tableIcon: {
marginRight: "20px",
- verticalAlign: "middle",
+ verticalAlign: "middle"
},
folderNameSelected: {
- color: theme.palette.type === "dark" ? "#fff" : theme.palette.primary.dark,
+ color:
+ theme.palette.type === "dark" ? "#fff" : theme.palette.primary.dark,
fontWeight: "500",
userSelect: "none"
},
@@ -54,7 +55,7 @@ const styles = theme => ({
},
folderName: {
marginRight: "20px",
- display: "flex",
+ display: "flex"
},
hideAuto: {
[theme.breakpoints.down("sm")]: {
@@ -86,10 +87,15 @@ class TableRowCompoment extends Component {
let icon;
if (this.props.file.type === "dir") {
icon = ;
- }else if (this.props.file.type === "up"){
- icon =
+ } else if (this.props.file.type === "up") {
+ icon = ;
} else {
- icon =
+ icon = (
+
+ );
}
const isSelected =
@@ -102,15 +108,17 @@ class TableRowCompoment extends Component {
onContextMenu={this.props.contextMenu}
onClick={this.props.handleClick}
onDoubleClick={this.props.handleDoubleClick.bind(this)}
- className={classNames(
- {
- [classes.selected]: isSelected&&!isShare,
- [classes.selectedShared]: isSelected&&isShare,
- [classes.notSelected]: !isSelected
- }
- )}
+ className={classNames({
+ [classes.selected]: isSelected && !isShare,
+ [classes.selectedShared]: isSelected && isShare,
+ [classes.notSelected]: !isSelected
+ })}
>
-
+
-
+
{" "}
- {this.props.file.type !== "dir" &&this.props.file.type !== "up"&&
+ {this.props.file.type !== "dir" &&
+ this.props.file.type !== "up" &&
sizeToString(this.props.file.size)}
-
+
@@ -133,7 +139,7 @@ const TypeIcon = props => {
>
diff --git a/src/component/Login/Activication.js b/src/component/Login/Activication.js
index cd5f5f8..9d319a5 100644
--- a/src/component/Login/Activication.js
+++ b/src/component/Login/Activication.js
@@ -1,19 +1,12 @@
import React, { useCallback, useState, useEffect } from "react";
import { useDispatch } from "react-redux";
import { makeStyles } from "@material-ui/core";
-import {
- toggleSnackbar,
-} from "../../actions/index";
+import { toggleSnackbar } from "../../actions/index";
import { useHistory } from "react-router-dom";
import API from "../../middleware/Api";
-import {
- Button,
- Paper,
- Avatar,
- Typography
-} from "@material-ui/core";
+import { Button, Paper, Avatar, Typography } from "@material-ui/core";
import EmailIcon from "@material-ui/icons/EmailOutlined";
-import {useLocation} from "react-router";
+import { useLocation } from "react-router";
const useStyles = makeStyles(theme => ({
layout: {
width: "auto",
@@ -42,7 +35,7 @@ const useStyles = makeStyles(theme => ({
},
submit: {
marginTop: theme.spacing(3)
- },
+ }
}));
function useQuery() {
@@ -53,8 +46,8 @@ function Activation() {
const query = useQuery();
const location = useLocation();
- const [success,setSuccess] = useState(false);
- const [email,setEmail] = useState("");
+ const [success, setSuccess] = useState(false);
+ const [email, setEmail] = useState("");
const dispatch = useDispatch();
const ToggleSnackbar = useCallback(
@@ -66,10 +59,10 @@ function Activation() {
const classes = useStyles();
-
-
useEffect(() => {
- API.get("/user/activate/" + query.get("id") + "?sign=" + query.get("sign"))
+ API.get(
+ "/user/activate/" + query.get("id") + "?sign=" + query.get("sign")
+ )
.then(response => {
setEmail(response.data);
setSuccess(true);
@@ -83,28 +76,29 @@ function Activation() {
return (
- {success &&
-
-
-
-
- 激活成功
-
- 您的账号已被成功激活。
-
-
- }
-
-
+ {success && (
+
+
+
+
+
+ 激活成功
+
+
+ 您的账号已被成功激活。
+
+
+
+ )}
);
}
diff --git a/src/component/Login/ReCaptcha.js b/src/component/Login/ReCaptcha.js
index e07f2c4..678ebc1 100644
--- a/src/component/Login/ReCaptcha.js
+++ b/src/component/Login/ReCaptcha.js
@@ -11,5 +11,5 @@ function getURL() {
export default makeAsyncScriptLoader(getURL, {
callbackName,
- globalName,
-})(ReCAPTCHA);
\ No newline at end of file
+ globalName
+})(ReCAPTCHA);
diff --git a/src/component/Login/ReCaptchaWrapper.js b/src/component/Login/ReCaptchaWrapper.js
index 7a8d21b..56c6623 100644
--- a/src/component/Login/ReCaptchaWrapper.js
+++ b/src/component/Login/ReCaptchaWrapper.js
@@ -57,7 +57,11 @@ export default class ReCAPTCHA extends React.Component {
}
explicitRender() {
- if (this.props.grecaptcha && this.props.grecaptcha.render && this._widgetId === undefined) {
+ if (
+ this.props.grecaptcha &&
+ this.props.grecaptcha.render &&
+ this._widgetId === undefined
+ ) {
const wrapper = document.createElement("div");
this._widgetId = this.props.grecaptcha.render(wrapper, {
sitekey: this.props.sitekey,
@@ -70,11 +74,15 @@ export default class ReCAPTCHA extends React.Component {
size: this.props.size,
stoken: this.props.stoken,
hl: this.props.hl,
- badge: this.props.badge,
+ badge: this.props.badge
});
this.captcha.appendChild(wrapper);
}
- if (this._executeRequested && this.props.grecaptcha && this._widgetId !== undefined) {
+ if (
+ this._executeRequested &&
+ this.props.grecaptcha &&
+ this._widgetId !== undefined
+ ) {
this._executeRequested = false;
this.execute();
}
@@ -152,7 +160,7 @@ ReCAPTCHA.propTypes = {
size: PropTypes.oneOf(["compact", "normal", "invisible"]),
stoken: PropTypes.string,
hl: PropTypes.string,
- badge: PropTypes.oneOf(["bottomright", "bottomleft", "inline"]),
+ badge: PropTypes.oneOf(["bottomright", "bottomleft", "inline"])
};
ReCAPTCHA.defaultProps = {
// eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -161,5 +169,5 @@ ReCAPTCHA.defaultProps = {
type: "image",
tabindex: 0,
size: "normal",
- badge: "bottomright",
-};
\ No newline at end of file
+ badge: "bottomright"
+};
diff --git a/src/component/Login/ResetForm.js b/src/component/Login/ResetForm.js
index 9f3bb3f..9b5a562 100644
--- a/src/component/Login/ResetForm.js
+++ b/src/component/Login/ResetForm.js
@@ -51,7 +51,7 @@ const useStyles = makeStyles(theme => ({
display: "flex",
width: "100%",
justifyContent: "space-between"
- },
+ }
}));
function useQuery() {
@@ -68,9 +68,9 @@ function ResetForm() {
const handleInputChange = name => e => {
setInput({
...input,
- [name]:e.target.value
- })
- }
+ [name]: e.target.value
+ });
+ };
const dispatch = useDispatch();
const ToggleSnackbar = useCallback(
(vertical, horizontal, msg, color) =>
@@ -81,15 +81,15 @@ function ResetForm() {
const submit = e => {
e.preventDefault();
- if (input.password !== input.password_repeat){
+ if (input.password !== input.password_repeat) {
ToggleSnackbar("top", "right", "两次密码输入不一致", "warning");
- return
+ return;
}
setLoading(true);
API.patch("/user/reset", {
secret: query.get("sign"),
id: query.get("id"),
- Password: input.password,
+ Password: input.password
})
.then(() => {
setLoading(false);
@@ -100,7 +100,7 @@ function ResetForm() {
setLoading(false);
ToggleSnackbar("top", "right", error.message, "warning");
});
- }
+ };
const classes = useStyles();
diff --git a/src/component/Login/ResetPwdForm.js b/src/component/Login/ResetPwdForm.js
index 23e3335..dab0e1c 100644
--- a/src/component/Login/ResetPwdForm.js
+++ b/src/component/Login/ResetPwdForm.js
@@ -1,8 +1,8 @@
-import React, { Component } from 'react'
-import { connect } from 'react-redux'
-import KeyIcon from '@material-ui/icons/VpnKeyOutlined';
-import { toggleSnackbar, } from "../../actions/index"
-import axios from 'axios'
+import React, { Component } from "react";
+import { connect } from "react-redux";
+import KeyIcon from "@material-ui/icons/VpnKeyOutlined";
+import { toggleSnackbar } from "../../actions/index";
+import axios from "axios";
import {
withStyles,
@@ -14,120 +14,138 @@ import {
InputLabel,
Paper,
Avatar,
- Typography,
-} from '@material-ui/core';
+ Typography
+} from "@material-ui/core";
const styles = theme => ({
layout: {
- width: 'auto',
- marginTop: '110px',
+ width: "auto",
+ marginTop: "110px",
marginLeft: theme.spacing(3),
marginRight: theme.spacing(3),
[theme.breakpoints.up(1100 + theme.spacing(3) * 2)]: {
width: 400,
- marginLeft: 'auto',
- marginRight: 'auto',
- },
+ marginLeft: "auto",
+ marginRight: "auto"
+ }
},
paper: {
marginTop: theme.spacing(8),
- display: 'flex',
- flexDirection: 'column',
- alignItems: 'center',
- padding: `${theme.spacing(2)}px ${theme.spacing(3)}px ${theme.spacing(3)}px`,
+ display: "flex",
+ flexDirection: "column",
+ alignItems: "center",
+ padding: `${theme.spacing(2)}px ${theme.spacing(3)}px ${theme.spacing(
+ 3
+ )}px`
},
avatar: {
margin: theme.spacing(1),
- backgroundColor: theme.palette.secondary.main,
+ backgroundColor: theme.palette.secondary.main
},
form: {
- width: '100%', // Fix IE 11 issue.
- marginTop: theme.spacing(1),
+ width: "100%", // Fix IE 11 issue.
+ marginTop: theme.spacing(1)
},
submit: {
- marginTop: theme.spacing(3),
+ marginTop: theme.spacing(3)
},
link: {
marginTop: "10px",
- display:"flex",
+ display: "flex",
width: "100%",
- justifyContent: "space-between",
+ justifyContent: "space-between"
},
- captchaContainer:{
- display:"flex",
+ captchaContainer: {
+ display: "flex",
marginTop: "10px",
[theme.breakpoints.down("sm")]: {
- display: "block",
- },
+ display: "block"
+ }
}
-})
+});
const mapStateToProps = () => {
- return {
- }
-}
+ return {};
+};
const mapDispatchToProps = dispatch => {
return {
toggleSnackbar: (vertical, horizontal, msg, color) => {
- dispatch(toggleSnackbar(vertical, horizontal, msg, color))
- },
- }
-}
+ dispatch(toggleSnackbar(vertical, horizontal, msg, color));
+ }
+ };
+};
class ResetPwdFormCompoment extends Component {
+ state = {
+ pwd: "",
+ pwdRepeat: "",
+ loading: false
+ };
- state={
- pwd:"",
- pwdRepeat:"",
- loading:false,
- }
-
- login = e=>{
+ login = e => {
e.preventDefault();
- if(this.state.pwdRepeat !== this.state.pwd){
- this.props.toggleSnackbar("top","right","两次密码输入不一致","warning");
+ if (this.state.pwdRepeat !== this.state.pwd) {
+ this.props.toggleSnackbar(
+ "top",
+ "right",
+ "两次密码输入不一致",
+ "warning"
+ );
return;
}
this.setState({
- loading:true,
+ loading: true
});
- axios.post('/Member/Reset',{
- pwd:this.state.pwd,
- key:window.resetKey,
- }).then( (response)=> {
- if(response.data.code!=="200"){
+ axios
+ .post("/Member/Reset", {
+ pwd: this.state.pwd,
+ key: window.resetKey
+ })
+ .then(response => {
+ if (response.data.code !== "200") {
+ this.setState({
+ loading: false
+ });
+ this.props.toggleSnackbar(
+ "top",
+ "right",
+ response.data.message,
+ "warning"
+ );
+ } else {
+ this.setState({
+ loading: false,
+ pwd: "",
+ pwdRepeat: ""
+ });
+ this.props.toggleSnackbar(
+ "top",
+ "right",
+ "密码重设成功",
+ "success"
+ );
+ }
+ })
+ .catch(error => {
this.setState({
- loading:false,
+ loading: false
});
- this.props.toggleSnackbar("top","right",response.data.message,"warning");
- }else{
- this.setState({
- loading:false,
- pwd:"",
- pwdRepeat:"",
- });
- this.props.toggleSnackbar("top","right","密码重设成功","success");
- }
- })
- .catch((error) =>{
- this.setState({
- loading:false,
+ this.props.toggleSnackbar(
+ "top",
+ "right",
+ error.message,
+ "error"
+ );
});
- this.props.toggleSnackbar("top","right",error.message,"error");
-
-
- });
- }
+ };
handleChange = name => event => {
this.setState({ [name]: event.target.value });
};
-
render() {
const { classes } = this.props;
-
return (
@@ -140,25 +158,27 @@ class ResetPwdFormCompoment extends Component {
-
-
-
- 返回登录
-
-
-
-
- 注册账号
-
-
+ {" "}
+ {" "}
+
+
);
}
-
}
const ResetPwdForm = connect(
mapStateToProps,
mapDispatchToProps
-)(withStyles(styles)(ResetPwdFormCompoment))
+)(withStyles(styles)(ResetPwdFormCompoment));
-export default ResetPwdForm
+export default ResetPwdForm;
diff --git a/src/component/Modals/AddTag.js b/src/component/Modals/AddTag.js
index 171c67b..6b5a400 100644
--- a/src/component/Modals/AddTag.js
+++ b/src/component/Modals/AddTag.js
@@ -8,9 +8,7 @@ import {
DialogTitle,
CircularProgress
} from "@material-ui/core";
-import {
- toggleSnackbar,
-} from "../../actions/index";
+import { toggleSnackbar } from "../../actions/index";
import PathSelector from "../FileManager/PathSelector";
import { useDispatch } from "react-redux";
import API from "../../middleware/Api";
@@ -35,7 +33,7 @@ import {
RhombusOutline,
Square,
SquareOutline,
- Triangle,
+ Triangle
} from "mdi-material-ui";
const useStyles = makeStyles(theme => ({
@@ -148,12 +146,12 @@ export default function AddTag(props) {
[dispatch]
);
- const submitNewLink = ()=>{
+ const submitNewLink = () => {
setLoading(true);
API.post("/tag/link", {
path: input.path,
- name:input.tagName
+ name: input.tagName
})
.then(response => {
setLoading(false);
@@ -161,7 +159,7 @@ export default function AddTag(props) {
props.onSuccess({
type: 1,
name: input.tagName,
- expression:input.path,
+ expression: input.path,
color: theme.palette.text.secondary,
icon: "FolderHeartOutline",
id: response.data
@@ -173,7 +171,7 @@ export default function AddTag(props) {
.then(() => {
setLoading(false);
});
- }
+ };
const submitNewTag = () => {
setLoading(true);
@@ -203,19 +201,19 @@ export default function AddTag(props) {
});
};
const submit = () => {
- if (value === 0) {
- submitNewTag();
- }else{
- submitNewLink();
- }
+ if (value === 0) {
+ submitNewTag();
+ } else {
+ submitNewLink();
+ }
};
- const selectPath = ()=>{
+ const selectPath = () => {
setInput({
...input,
path: selectedPath === "//" ? "/" : selectedPath
});
setPathSelectDialog(false);
- }
+ };
const classes = useStyles();
@@ -232,13 +230,21 @@ export default function AddTag(props) {
aria-labelledby="form-dialog-title"
>
选择目录
-
+
-
@@ -355,7 +361,7 @@ export default function AddTag(props) {
className={classes.textField}
/>
setPathSelectDialog(true)}
+ onClick={() => setPathSelectDialog(true)}
style={{
marginLeft: theme.spacing(1),
alignSelf: "flex-end"
@@ -379,8 +385,8 @@ export default function AddTag(props) {
(value === 0 &&
(input.filename === "" ||
input.tagName === "")) ||
- (value === 1 && (input.tagName === "" ||
- input.path === ""))
+ (value === 1 &&
+ (input.tagName === "" || input.path === ""))
}
>
确定
diff --git a/src/component/Modals/Compress.js b/src/component/Modals/Compress.js
index 2ee02af..d67881a 100644
--- a/src/component/Modals/Compress.js
+++ b/src/component/Modals/Compress.js
@@ -9,10 +9,7 @@ import {
DialogContentText,
CircularProgress
} from "@material-ui/core";
-import {
- toggleSnackbar,
- setModalsLoading,
-} from "../../actions/index";
+import { toggleSnackbar, setModalsLoading } from "../../actions/index";
import PathSelector from "../FileManager/PathSelector";
import { useDispatch } from "react-redux";
import API from "../../middleware/Api";
@@ -21,7 +18,7 @@ import TextField from "@material-ui/core/TextField";
const useStyles = makeStyles(theme => ({
contentFix: {
padding: "10px 24px 0px 24px",
- backgroundColor:theme.palette.background.default,
+ backgroundColor: theme.palette.background.default
},
wrapper: {
margin: theme.spacing(1),
@@ -85,11 +82,11 @@ export default function CompressDialog(props) {
});
API.post("/file/compress", {
- src:{
- dirs:dirs,
- items:items,
+ src: {
+ dirs: dirs,
+ items: items
},
- name:fileName,
+ name: fileName,
dst: selectedPath === "//" ? "/" : selectedPath
})
.then(() => {
@@ -121,7 +118,14 @@ export default function CompressDialog(props) {
{selectedPath !== "" && (
- setFileName(e.target.value)} value={fileName} fullWidth autoFocus id="standard-basic" label="压缩文件名" />
+ setFileName(e.target.value)}
+ value={fileName}
+ fullWidth
+ autoFocus
+ id="standard-basic"
+ label="压缩文件名"
+ />
)}
@@ -131,7 +135,11 @@ export default function CompressDialog(props) {
确定
{props.modalsLoading && (
diff --git a/src/component/Modals/Copy.js b/src/component/Modals/Copy.js
index 91bb987..d1202b6 100644
--- a/src/component/Modals/Copy.js
+++ b/src/component/Modals/Copy.js
@@ -12,7 +12,7 @@ import {
import {
toggleSnackbar,
setModalsLoading,
- refreshFileList,
+ refreshFileList
} from "../../actions/index";
import PathSelector from "../FileManager/PathSelector";
import { useDispatch } from "react-redux";
diff --git a/src/component/Modals/CreateShare.js b/src/component/Modals/CreateShare.js
index 454b7f9..f0b7158 100644
--- a/src/component/Modals/CreateShare.js
+++ b/src/component/Modals/CreateShare.js
@@ -120,12 +120,12 @@ export default function CreatShare(props) {
password: "",
downloads: 1,
expires: 24 * 3600,
- showPassword: false,
+ showPassword: false
});
const [shareOption, setShareOption] = React.useState({
password: false,
expire: false,
- preview:true,
+ preview: true
});
const handleChange = prop => event => {
@@ -180,10 +180,9 @@ export default function CreatShare(props) {
const onClose = () => {
props.onClose();
- setTimeout(()=>{
+ setTimeout(() => {
setShareURL("");
- },500)
-
+ }, 500);
};
const submitShare = e => {
@@ -195,7 +194,7 @@ export default function CreatShare(props) {
password: values.password,
downloads: shareOption.expire ? values.downloads : -1,
expire: values.expires,
- preview:shareOption.preview,
+ preview: shareOption.preview
};
API.post("/share", submitFormBody)
@@ -205,11 +204,11 @@ export default function CreatShare(props) {
password: "",
downloads: 1,
expires: 24 * 3600,
- showPassword: false,
+ showPassword: false
});
setShareOption({
password: false,
- expire: false,
+ expire: false
});
props.setModalsLoading(false);
})
@@ -412,7 +411,9 @@ export default function CreatShare(props) {
- 是否允许在分享页面预览文件内容
+
+ 是否允许在分享页面预览文件内容
+
diff --git a/src/component/Modals/CreateWebDAVAccount.js b/src/component/Modals/CreateWebDAVAccount.js
index d0239ce..d71dacd 100644
--- a/src/component/Modals/CreateWebDAVAccount.js
+++ b/src/component/Modals/CreateWebDAVAccount.js
@@ -1,4 +1,4 @@
-import React, {useState} from "react";
+import React, { useState } from "react";
import { makeStyles } from "@material-ui/core";
import { Dialog } from "@material-ui/core";
import DialogTitle from "@material-ui/core/DialogTitle";
@@ -15,7 +15,7 @@ const useStyles = makeStyles(theme => ({
formIcon: {
marginTop: 21,
marginRight: 19,
- color:theme.palette.text.secondary,
+ color: theme.palette.text.secondary
},
input: {
width: 250
@@ -54,17 +54,17 @@ export default function CreateWebDAVAccount(props) {
const handleInputChange = name => e => {
setValue({
...value,
- [name]: e.target.value,
+ [name]: e.target.value
});
};
- const selectPath = ()=>{
+ const selectPath = () => {
setValue({
...value,
path: selectedPath === "//" ? "/" : selectedPath
});
setPathSelectDialog(false);
- }
+ };
return (
@@ -124,7 +136,11 @@ export default function CreateWebDAVAccount(props) {
取消
- props.callback(value)}>
+ props.callback(value)}
+ >
确定
diff --git a/src/component/Modals/Decompress.js b/src/component/Modals/Decompress.js
index bf780be..35947d5 100644
--- a/src/component/Modals/Decompress.js
+++ b/src/component/Modals/Decompress.js
@@ -9,14 +9,11 @@ import {
DialogContentText,
CircularProgress
} from "@material-ui/core";
-import {
- toggleSnackbar,
- setModalsLoading,
-} from "../../actions/index";
+import { toggleSnackbar, setModalsLoading } from "../../actions/index";
import PathSelector from "../FileManager/PathSelector";
import { useDispatch } from "react-redux";
import API from "../../middleware/Api";
-import {filePath} from "../../utils";
+import { filePath } from "../../utils";
const useStyles = makeStyles(theme => ({
contentFix: {
@@ -68,7 +65,7 @@ export default function DecompressDialog(props) {
}
SetModalsLoading(true);
API.post("/file/decompress", {
- src:filePath(props.selected[0]),
+ src: filePath(props.selected[0]),
dst: selectedPath === "//" ? "/" : selectedPath
})
.then(() => {
diff --git a/src/component/Modals/Loading.js b/src/component/Modals/Loading.js
index 0a2c027..a434eb2 100644
--- a/src/component/Modals/Loading.js
+++ b/src/component/Modals/Loading.js
@@ -5,7 +5,7 @@ import DialogContent from "@material-ui/core/DialogContent";
import Dialog from "@material-ui/core/Dialog";
import DialogContentText from "@material-ui/core/DialogContentText";
import { blue } from "@material-ui/core/colors";
-import {useSelector} from "react-redux";
+import { useSelector } from "react-redux";
const useStyles = makeStyles({
avatar: {
@@ -23,24 +23,17 @@ const useStyles = makeStyles({
export default function LoadingDialog() {
const classes = useStyles();
- const open = useSelector(
- state => state.viewUpdate.modals.loading,
- );
- const text = useSelector(
- state => state.viewUpdate.modals.loadingText,
- );
-
+ const open = useSelector(state => state.viewUpdate.modals.loading);
+ const text = useSelector(state => state.viewUpdate.modals.loadingText);
return (
);
-}
\ No newline at end of file
+}
diff --git a/src/component/Modals/SelectFile.js b/src/component/Modals/SelectFile.js
index 2216454..1be8709 100644
--- a/src/component/Modals/SelectFile.js
+++ b/src/component/Modals/SelectFile.js
@@ -1,4 +1,4 @@
-import React, {useState, useEffect} from "react";
+import React, { useState, useEffect } from "react";
import { makeStyles } from "@material-ui/core";
import {
Button,
@@ -29,35 +29,37 @@ const useStyles = makeStyles(theme => ({
marginTop: -12,
marginLeft: -12
},
- content:{
- padding:0,
+ content: {
+ padding: 0
}
}));
export default function SelectFileDialog(props) {
- const [files,setFiles] = useState(props.files);
+ const [files, setFiles] = useState(props.files);
- useEffect(()=>{
+ useEffect(() => {
setFiles(props.files);
- },[props.files]);
+ }, [props.files]);
-
- const handleChange = index => event =>{
+ const handleChange = index => event => {
const filesCopy = [...files];
// eslint-disable-next-line
- filesCopy.map((v,k)=>{
- if (v.index === index){
- filesCopy[k] = {...filesCopy[k],selected:event.target.checked ? "true" : "false"};
+ filesCopy.map((v, k) => {
+ if (v.index === index) {
+ filesCopy[k] = {
+ ...filesCopy[k],
+ selected: event.target.checked ? "true" : "false"
+ };
}
});
setFiles(filesCopy);
};
- const submit = () =>{
+ const submit = () => {
const index = [];
// eslint-disable-next-line
- files.map(v=>{
- if(v.selected === "true"){
+ files.map(v => {
+ if (v.selected === "true") {
index.push(parseInt(v.index));
}
});
@@ -77,25 +79,30 @@ export default function SelectFileDialog(props) {
{files.map((v, k) => {
return (
+
+
+ }
+ label={v.path}
+ />
+
+
);
})}
取消
-
+
确定
{props.modalsLoading && (
({
icon: {
- color: 'rgb(255, 255, 255)',
- opacity: "0.54",
- },
+ color: "rgb(255, 255, 255)",
+ opacity: "0.54"
+ }
}));
const DarkModeSwitcher = ({ position }) => {
@@ -24,8 +24,8 @@ const DarkModeSwitcher = ({ position }) => {
const isDayLight = (ThemeType && ThemeType === "light") || !ThemeType;
const isDark = ThemeType && ThemeType === "dark";
const toggleMode = () => {
- Auth.SetPreference("theme_mode",isDayLight?"dark":"light");
- ToggleThemeMode();
+ Auth.SetPreference("theme_mode", isDayLight ? "dark" : "light");
+ ToggleThemeMode();
};
const classes = useStyles();
return (
@@ -35,9 +35,11 @@ const DarkModeSwitcher = ({ position }) => {
>
+ onClick={toggleMode}
+ color="inherit"
+ >
{isDayLight && }
{isDark && }
diff --git a/src/component/Navbar/FileTags.js b/src/component/Navbar/FileTags.js
index 17a0a37..2e501f8 100644
--- a/src/component/Navbar/FileTags.js
+++ b/src/component/Navbar/FileTags.js
@@ -1,4 +1,4 @@
-import React, {useCallback, useState, Suspense} from "react";
+import React, { useCallback, useState, Suspense } from "react";
import {
Divider,
List,
@@ -8,7 +8,7 @@ import {
makeStyles,
withStyles
} from "@material-ui/core";
-import { Clear, KeyboardArrowRight} from "@material-ui/icons";
+import { Clear, KeyboardArrowRight } from "@material-ui/icons";
import classNames from "classnames";
import FolderShared from "@material-ui/icons/FolderShared";
import UploadIcon from "@material-ui/icons/CloudUpload";
@@ -106,12 +106,11 @@ const useStyles = makeStyles(theme => ({
subMenu: {
marginLeft: theme.spacing(2)
},
- overFlow:{
+ overFlow: {
whiteSpace: "nowrap",
overflow: "hidden",
- textOverflow: "ellipsis",
+ textOverflow: "ellipsis"
}
-
}));
const icons = {
@@ -132,7 +131,7 @@ const icons = {
FolderHeartOutline: FolderHeartOutline
};
-const AddTag = React.lazy(() => import ("../Modals/AddTag" ));
+const AddTag = React.lazy(() => import("../Modals/AddTag"));
export default function FileTag() {
const classes = useStyles();
@@ -143,9 +142,11 @@ export default function FileTag() {
const isHomePage = pathHelper.isHomePage(location.pathname);
const [tagOpen, setTagOpen] = useState(true);
- const [addTagModal,setAddTagModal] = useState(false);
- const [tagHover,setTagHover] = useState(null);
- const [tags,setTags] = useState(Auth.GetUser().tags?Auth.GetUser().tags:[]);
+ const [addTagModal, setAddTagModal] = useState(false);
+ const [tagHover, setTagHover] = useState(null);
+ const [tags, setTags] = useState(
+ Auth.GetUser().tags ? Auth.GetUser().tags : []
+ );
const dispatch = useDispatch();
const SearchMyFile = useCallback(k => dispatch(searchMyFile(k)), [
@@ -159,7 +160,6 @@ export default function FileTag() {
[dispatch]
);
-
const getIcon = (icon, color) => {
if (icons[icon]) {
const IconComponent = icons[icon];
@@ -179,19 +179,21 @@ export default function FileTag() {
return ;
};
- const submitSuccess = tag =>{
- const newTags = [...tags,tag];
+ const submitSuccess = tag => {
+ const newTags = [...tags, tag];
setTags(newTags);
const user = Auth.GetUser();
user.tags = newTags;
Auth.SetUser(user);
};
- const submitDelete = id =>{
- API.delete("/tag/"+id)
+ const submitDelete = id => {
+ API.delete("/tag/" + id)
.then(() => {
- const newTags = tags.filter((v)=>{return v.id !== id});
- setTags(newTags)
+ const newTags = tags.filter(v => {
+ return v.id !== id;
+ });
+ setTags(newTags);
const user = Auth.GetUser();
user.tags = newTags;
Auth.SetUser(user);
@@ -204,131 +206,136 @@ export default function FileTag() {
return (
<>
- setAddTagModal(false)}/>
+ setAddTagModal(false)}
+ />
- isHomePage && setTagOpen(!tagOpen)}
- >
-
-
-
- setTagHover(null)}>
-
-
-
-
-
-
-
-
-
-
-
- {[
- {
- key: "视频",
- id: "video",
- icon: (
-
- )
- },
- {
- key: "图片",
- id: "image",
- icon: (
-
- )
- },
- {
- key: "音频",
- id: "audio",
- icon: (
-
- )
- },
- {
- key: "文档",
- id: "doc",
- icon: (
-
- )
+ key="我的文件"
+ onClick={() =>
+ !isHomePage && history.push("/home?path=%2F")
}
- ].map(v => (
+ >
+
+
+ {!(tagOpen && isHomePage) && (
+
+ )}
+
+
+
+
+
+
+
+ setTagHover(null)}>
SearchMyFile(v.id + "/internal")}
+ id="pickfiles"
+ className={classes.hiddenButton}
>
-
- {v.icon}
+
+
-
+
- ))}
- {tags.map(v => (
+
+
+
+
+
+
+ {[
+ {
+ key: "视频",
+ id: "video",
+ icon: (
+
+ )
+ },
+ {
+ key: "图片",
+ id: "image",
+ icon: (
+
+ )
+ },
+ {
+ key: "音频",
+ id: "audio",
+ icon: (
+
+ )
+ },
+ {
+ key: "文档",
+ id: "doc",
+ icon: (
+
+ )
+ }
+ ].map(v => (
+ SearchMyFile(v.id + "/internal")}
+ >
+
+ {v.icon}
+
+
+
+ ))}
+ {tags.map(v => (
setTagHover(v.id)}
+ onMouseEnter={() => setTagHover(v.id)}
onClick={() => {
if (v.type === 0) {
SearchMyFile("tag/" + v.id);
@@ -345,26 +352,37 @@ export default function FileTag() {
v.type === 0 ? v.color : null
)}
-
+
- {tagHover === v.id && submitDelete(v.id)}>
-
+ {tagHover === v.id && (
+ submitDelete(v.id)}
+ >
+
- }
+
+ )}
))}
- setAddTagModal(true)}>
-
-
-
-
-
-
{" "}
-
-
-
- >
+ setAddTagModal(true)}>
+
+
+
+
+
+ {" "}
+
+
+
+ >
);
}
diff --git a/src/component/Navbar/Navbar.js b/src/component/Navbar/Navbar.js
index 1dcb970..f1ee1f7 100644
--- a/src/component/Navbar/Navbar.js
+++ b/src/component/Navbar/Navbar.js
@@ -68,7 +68,7 @@ import FileTag from "./FileTags";
import { Assignment, Devices, Settings } from "@material-ui/icons";
import Divider from "@material-ui/core/Divider";
-vhCheck()
+vhCheck();
const drawerWidth = 240;
const drawerWidthMobile = 270;
@@ -365,15 +365,18 @@ class NavbarCompoment extends Component {
if (isShare) {
this.props.history.push(
this.props.selected[0].key +
- "/doc?name=" +
- encodeURIComponent(this.props.selected[0].name) +
- "&share_path=" +
- encodeURIComponent(previewPath)
+ "/doc?name=" +
+ encodeURIComponent(this.props.selected[0].name) +
+ "&share_path=" +
+ encodeURIComponent(previewPath)
);
return;
}
this.props.history.push(
- "/doc?p=" + encodeURIComponent(previewPath) + "&id=" + this.props.selected[0].id
+ "/doc?p=" +
+ encodeURIComponent(previewPath) +
+ "&id=" +
+ this.props.selected[0].id
);
return;
case "audio":
@@ -383,60 +386,72 @@ class NavbarCompoment extends Component {
if (isShare) {
this.props.history.push(
this.props.selected[0].key +
- "/video?name=" +
- encodeURIComponent(this.props.selected[0].name) +
- "&share_path=" +
- encodeURIComponent(previewPath)
+ "/video?name=" +
+ encodeURIComponent(this.props.selected[0].name) +
+ "&share_path=" +
+ encodeURIComponent(previewPath)
);
return;
}
this.props.history.push(
- "/video?p=" +encodeURIComponent(previewPath) + "&id=" + this.props.selected[0].id
+ "/video?p=" +
+ encodeURIComponent(previewPath) +
+ "&id=" +
+ this.props.selected[0].id
);
return;
case "edit":
if (isShare) {
this.props.history.push(
this.props.selected[0].key +
- "/text?name=" +
- encodeURIComponent(this.props.selected[0].name) +
- "&share_path=" +
- encodeURIComponent(previewPath)
+ "/text?name=" +
+ encodeURIComponent(this.props.selected[0].name) +
+ "&share_path=" +
+ encodeURIComponent(previewPath)
);
return;
}
this.props.history.push(
- "/text?p=" + encodeURIComponent(previewPath) + "&id=" + this.props.selected[0].id
+ "/text?p=" +
+ encodeURIComponent(previewPath) +
+ "&id=" +
+ this.props.selected[0].id
);
return;
case "pdf":
if (isShare) {
this.props.history.push(
this.props.selected[0].key +
- "/pdf?name=" +
- encodeURIComponent(this.props.selected[0].name) +
- "&share_path=" +
- encodeURIComponent(previewPath)
+ "/pdf?name=" +
+ encodeURIComponent(this.props.selected[0].name) +
+ "&share_path=" +
+ encodeURIComponent(previewPath)
);
return;
}
this.props.history.push(
- "/pdf?p=" + encodeURIComponent(previewPath) + "&id=" + this.props.selected[0].id
+ "/pdf?p=" +
+ encodeURIComponent(previewPath) +
+ "&id=" +
+ this.props.selected[0].id
);
return;
case "code":
if (isShare) {
this.props.history.push(
this.props.selected[0].key +
- "/code?name=" +
- encodeURIComponent(this.props.selected[0].name) +
- "&share_path=" +
- encodeURIComponent(previewPath)
+ "/code?name=" +
+ encodeURIComponent(this.props.selected[0].name) +
+ "&share_path=" +
+ encodeURIComponent(previewPath)
);
return;
}
this.props.history.push(
- "/code?p=" + encodeURIComponent(previewPath) + "&id=" + this.props.selected[0].id
+ "/code?p=" +
+ encodeURIComponent(previewPath) +
+ "&id=" +
+ this.props.selected[0].id
);
return;
default:
@@ -568,7 +583,7 @@ class NavbarCompoment extends Component {
{pathHelper.isMobile() && (
<>
-
+
-
+
@@ -736,8 +753,13 @@ class NavbarCompoment extends Component {
!(
!this.props.isMultiple && this.props.withFile
) && (
- {this.props.history.push("/")}}
+ {
+ this.props.history.push("/");
+ }}
>
{this.props.subTitle
? this.props.subTitle
@@ -799,8 +821,7 @@ class NavbarCompoment extends Component {
(isHomePage || isSharePage) && (
{!this.props.isMultiple &&
- this.props.withFile
- &&
+ this.props.withFile &&
isPreviewable(
this.props.selected[0].name
) && (
diff --git a/src/component/Navbar/SearchBar.js b/src/component/Navbar/SearchBar.js
index c201b59..3c2379a 100644
--- a/src/component/Navbar/SearchBar.js
+++ b/src/component/Navbar/SearchBar.js
@@ -18,12 +18,12 @@ import {
ListItemText,
Typography
} from "@material-ui/core";
-import {withRouter} from "react-router";
+import { withRouter } from "react-router";
import pathHelper from "../../utils/page";
-import {HotKeys,configure} from "react-hotkeys";
+import { HotKeys, configure } from "react-hotkeys";
configure({
- ignoreTags:[],
+ ignoreTags: []
});
const mapStateToProps = () => {
@@ -91,11 +91,10 @@ const styles = theme => ({
});
const keyMap = {
- SEARCH: "enter",
+ SEARCH: "enter"
};
class SearchBarCompoment extends Component {
-
constructor(props) {
super(props);
this.state = {
@@ -104,15 +103,15 @@ class SearchBarCompoment extends Component {
};
}
- handlers={
- SEARCH:(e)=>{
- if(pathHelper.isHomePage(this.props.location.pathname)){
+ handlers = {
+ SEARCH: e => {
+ if (pathHelper.isHomePage(this.props.location.pathname)) {
this.searchMyFile();
- }else{
+ } else {
this.searchShare();
}
e.target.blur();
- },
+ }
};
handleChange = event => {
@@ -131,14 +130,15 @@ class SearchBarCompoment extends Component {
};
searchMyFile = () => {
- this.props.searchMyFile("keywords/"+this.input);
+ this.props.searchMyFile("keywords/" + this.input);
};
searchShare = () => {
- this.props.history.push("/search?keywords="+encodeURIComponent(this.input));
+ this.props.history.push(
+ "/search?keywords=" + encodeURIComponent(this.input)
+ );
};
-
render() {
const { classes } = this.props;
const { anchorEl } = this.state;
@@ -146,22 +146,22 @@ class SearchBarCompoment extends Component {
const isHomePage = pathHelper.isHomePage(this.props.location.pathname);
return (
-
+
-
-
-
+
+
+
({
diff --git a/src/component/Navbar/UserAvatarPopover.js b/src/component/Navbar/UserAvatarPopover.js
index 1afb773..47e0068 100644
--- a/src/component/Navbar/UserAvatarPopover.js
+++ b/src/component/Navbar/UserAvatarPopover.js
@@ -8,7 +8,11 @@ import {
AccountArrowRight,
AccountPlus
} from "mdi-material-ui";
-import {setSessionStatus, setUserPopover, toggleSnackbar} from "../../actions";
+import {
+ setSessionStatus,
+ setUserPopover,
+ toggleSnackbar
+} from "../../actions";
import { withRouter } from "react-router-dom";
import Auth from "../../middleware/Auth";
import {
@@ -38,9 +42,9 @@ const mapDispatchToProps = dispatch => {
toggleSnackbar: (vertical, horizontal, msg, color) => {
dispatch(toggleSnackbar(vertical, horizontal, msg, color));
},
- setSessionStatus:status=>{
+ setSessionStatus: status => {
dispatch(setSessionStatus(status));
- },
+ }
};
};
const styles = () => ({
@@ -106,7 +110,9 @@ class UserAvatarPopoverCompoment extends Component {
render() {
const { classes } = this.props;
const user = Auth.GetUser();
- const isAdminPage = pathHelper.isAdminPage(this.props.location.pathname);
+ const isAdminPage = pathHelper.isAdminPage(
+ this.props.location.pathname
+ );
return (
-