mirror of
https://github.com/eyebluecn/tank-front
synced 2026-10-19 16:16:18 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21ffb2cf64 | ||
|
|
c7db00386c | ||
|
|
04c188dc3f |
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"printWidth": 100,
|
||||
"tabWidth": 4,
|
||||
"trailingComma": "all",
|
||||
"singleQuote": true
|
||||
}
|
||||
+2
-1
@@ -2,4 +2,5 @@
|
||||
1. 增加云盘剩余容量显示
|
||||
2. 优化拖拽文件夹进行上传的错误提示
|
||||
3. 优化超出限制大小的错误提示
|
||||
4. 修复一些已知问题
|
||||
4. 文件列表页右键展示操作目录
|
||||
5. 修复一些已知问题
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
RedoOutlined,
|
||||
CloseCircleOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import { Modal, Checkbox, Tooltip } from "antd";
|
||||
import { Modal, Checkbox, Tooltip, Dropdown, Menu } from "antd";
|
||||
import { CheckboxChangeEvent } from "antd/es/checkbox";
|
||||
import SafeUtil from "../../../common/util/SafeUtil";
|
||||
import ClipboardUtil from "../../../common/util/ClipboardUtil";
|
||||
@@ -84,14 +84,14 @@ export default class MatterPanel extends TankComponent<IProps, IState> {
|
||||
AnimateUtil.setInputSelection(this.inputRef.current, 0, dotIndex);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
clipboard() {
|
||||
let textToCopy = this.props.matter.getDownloadUrl();
|
||||
ClipboardUtil.copy(textToCopy, () => {
|
||||
MessageBoxUtil.success(Lang.t("operationSuccess"));
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
deleteMatter() {
|
||||
MatterDeleteModal.open(
|
||||
@@ -108,7 +108,7 @@ export default class MatterPanel extends TankComponent<IProps, IState> {
|
||||
});
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
hardDeleteMatter() {
|
||||
Modal.confirm({
|
||||
@@ -121,7 +121,7 @@ export default class MatterPanel extends TankComponent<IProps, IState> {
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
recoveryMatter() {
|
||||
Modal.confirm({
|
||||
@@ -134,12 +134,12 @@ export default class MatterPanel extends TankComponent<IProps, IState> {
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
changeMatterName(e: any) {
|
||||
this.renameMatterName = e.currentTarget.value;
|
||||
this.updateUI();
|
||||
};
|
||||
}
|
||||
|
||||
finishRename() {
|
||||
//有可能按enter的时候和blur同时了。
|
||||
@@ -167,7 +167,7 @@ export default class MatterPanel extends TankComponent<IProps, IState> {
|
||||
},
|
||||
() => this.updateUI()
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
finishCreateDirectory() {
|
||||
const { matter, director, onCreateDirectoryCallback } = this.props;
|
||||
@@ -185,7 +185,7 @@ export default class MatterPanel extends TankComponent<IProps, IState> {
|
||||
},
|
||||
() => onCreateDirectoryCallback!()
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
blurTrigger() {
|
||||
const { matter, director } = this.props;
|
||||
@@ -196,28 +196,28 @@ export default class MatterPanel extends TankComponent<IProps, IState> {
|
||||
this.finishRename();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
enterTrigger(e: any) {
|
||||
if (e.key.toLowerCase() === "enter") {
|
||||
this.inputRef.current!.blur();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
changePrivacy(privacy: boolean) {
|
||||
this.props.matter.httpChangePrivacy(privacy, () => {
|
||||
this.updateUI();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
checkToggle(e: CheckboxChangeEvent) {
|
||||
this.props.matter.check = e.target.checked;
|
||||
this.props.onCheckMatter!(this.props.matter);
|
||||
};
|
||||
}
|
||||
|
||||
highLight() {
|
||||
this.inputRef.current!.select();
|
||||
};
|
||||
}
|
||||
|
||||
clickRow() {
|
||||
const {
|
||||
@@ -243,12 +243,12 @@ export default class MatterPanel extends TankComponent<IProps, IState> {
|
||||
matter.preview();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
toggleHandles() {
|
||||
this.showMore = !this.showMore;
|
||||
this.updateUI();
|
||||
};
|
||||
}
|
||||
|
||||
renderPcOperation() {
|
||||
const { matter, recycleMode = false } = this.props;
|
||||
@@ -369,25 +369,25 @@ export default class MatterPanel extends TankComponent<IProps, IState> {
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
renderMobileOperation() {
|
||||
// 文件操作在正常模式 or 回收站模式下不同,其中回收站模式只保留查看信息与彻底删除操作
|
||||
getHandles() {
|
||||
const { matter, recycleMode = false } = this.props;
|
||||
|
||||
// 文件操作在正常模式 or 回收站模式下不同,其中回收站模式只保留查看信息与彻底删除操作
|
||||
const handles = recycleMode ? (
|
||||
<>
|
||||
// 回收站模式
|
||||
if (recycleMode)
|
||||
return [
|
||||
<div
|
||||
className="cell-btn navy"
|
||||
onClick={(e) =>
|
||||
SafeUtil.stopPropagationWrap(e)(
|
||||
Sun.navigateTo("/matter/detail/" + matter.uuid)
|
||||
Sun.navigateTo("/matter/detail/" + this.props.matter.uuid)
|
||||
)
|
||||
}
|
||||
>
|
||||
<InfoCircleOutlined className="btn-action mr5" />
|
||||
{Lang.t("matter.fileDetail")}
|
||||
</div>
|
||||
</div>,
|
||||
<div
|
||||
className="cell-btn navy"
|
||||
onClick={(e) =>
|
||||
@@ -396,7 +396,7 @@ export default class MatterPanel extends TankComponent<IProps, IState> {
|
||||
>
|
||||
<RedoOutlined className="btn-action mr5" />
|
||||
{Lang.t("matter.recovery")}
|
||||
</div>
|
||||
</div>,
|
||||
<div
|
||||
className="cell-btn text-danger"
|
||||
onClick={(e) =>
|
||||
@@ -405,11 +405,14 @@ export default class MatterPanel extends TankComponent<IProps, IState> {
|
||||
>
|
||||
<CloseCircleOutlined className="btn-action mr5" />
|
||||
{Lang.t("matter.hardDelete")}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{!matter.dir && matter.privacy && (
|
||||
</div>,
|
||||
];
|
||||
|
||||
// 普通模式
|
||||
const handles = [];
|
||||
if (!matter.dir) {
|
||||
handles.push(
|
||||
matter.privacy ? (
|
||||
<div
|
||||
className="cell-btn navy"
|
||||
onClick={(e) =>
|
||||
@@ -419,9 +422,7 @@ export default class MatterPanel extends TankComponent<IProps, IState> {
|
||||
<UnlockOutlined className="btn-action mr5" />
|
||||
{Lang.t("matter.setPublic")}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!matter.dir && !matter.privacy && (
|
||||
) : (
|
||||
<div
|
||||
className="cell-btn navy"
|
||||
onClick={(e) =>
|
||||
@@ -431,49 +432,55 @@ export default class MatterPanel extends TankComponent<IProps, IState> {
|
||||
<LockOutlined className="btn-action mr5" />
|
||||
{Lang.t("matter.setPrivate")}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div
|
||||
className="cell-btn navy"
|
||||
onClick={(e) =>
|
||||
SafeUtil.stopPropagationWrap(e)(
|
||||
Sun.navigateTo("/matter/detail/" + matter.uuid)
|
||||
)
|
||||
}
|
||||
>
|
||||
<InfoCircleOutlined className="btn-action mr5" />
|
||||
{Lang.t("matter.fileDetail")}
|
||||
</div>
|
||||
<div
|
||||
className="cell-btn navy"
|
||||
onClick={(e) => SafeUtil.stopPropagationWrap(e)(this.prepareRename())}
|
||||
>
|
||||
<EditOutlined className="btn-action mr5" />
|
||||
{Lang.t("matter.rename")}
|
||||
</div>
|
||||
<div
|
||||
className="cell-btn navy"
|
||||
onClick={(e) => SafeUtil.stopPropagationWrap(e)(this.clipboard())}
|
||||
>
|
||||
<LinkOutlined className="btn-action mr5" />
|
||||
{Lang.t("matter.copyLink")}
|
||||
</div>
|
||||
<div
|
||||
className="cell-btn navy"
|
||||
onClick={(e) => SafeUtil.stopPropagationWrap(e)(matter.download())}
|
||||
>
|
||||
<DownloadOutlined className="btn-action mr5" />
|
||||
{Lang.t("matter.download")}
|
||||
</div>
|
||||
<div
|
||||
className="cell-btn text-danger"
|
||||
onClick={(e) => SafeUtil.stopPropagationWrap(e)(this.deleteMatter())}
|
||||
>
|
||||
<DeleteOutlined className="btn-action mr5" />
|
||||
{Lang.t("matter.delete")}
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
);
|
||||
}
|
||||
handles.push(
|
||||
<div
|
||||
className="cell-btn navy"
|
||||
onClick={(e) =>
|
||||
SafeUtil.stopPropagationWrap(e)(
|
||||
Sun.navigateTo("/matter/detail/" + matter.uuid)
|
||||
)
|
||||
}
|
||||
>
|
||||
<InfoCircleOutlined className="btn-action mr5" />
|
||||
{Lang.t("matter.fileDetail")}
|
||||
</div>,
|
||||
<div
|
||||
className="cell-btn navy"
|
||||
onClick={(e) => SafeUtil.stopPropagationWrap(e)(this.prepareRename())}
|
||||
>
|
||||
<EditOutlined className="btn-action mr5" />
|
||||
{Lang.t("matter.rename")}
|
||||
</div>,
|
||||
<div
|
||||
className="cell-btn navy"
|
||||
onClick={(e) => SafeUtil.stopPropagationWrap(e)(this.clipboard())}
|
||||
>
|
||||
<LinkOutlined className="btn-action mr5" />
|
||||
{Lang.t("matter.copyLink")}
|
||||
</div>,
|
||||
<div
|
||||
className="cell-btn navy"
|
||||
onClick={(e) => SafeUtil.stopPropagationWrap(e)(matter.download())}
|
||||
>
|
||||
<DownloadOutlined className="btn-action mr5" />
|
||||
{Lang.t("matter.download")}
|
||||
</div>,
|
||||
<div
|
||||
className="cell-btn text-danger"
|
||||
onClick={(e) => SafeUtil.stopPropagationWrap(e)(this.deleteMatter())}
|
||||
>
|
||||
<DeleteOutlined className="btn-action mr5" />
|
||||
{Lang.t("matter.delete")}
|
||||
</div>
|
||||
);
|
||||
return handles;
|
||||
}
|
||||
|
||||
renderMobileOperation() {
|
||||
const { matter, recycleMode = false } = this.props;
|
||||
|
||||
return (
|
||||
<div className="more-panel">
|
||||
@@ -487,86 +494,98 @@ export default class MatterPanel extends TankComponent<IProps, IState> {
|
||||
{StringUtil.humanFileSize(matter.size)}
|
||||
</span>
|
||||
</div>
|
||||
{handles}
|
||||
{this.getHandles()}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
const { matter } = this.props;
|
||||
|
||||
const menu = (
|
||||
<Menu>
|
||||
{this.getHandles().map((item, i) => (
|
||||
<Menu.Item key={i}>{item}</Menu.Item>
|
||||
))}
|
||||
</Menu>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="widget-matter-panel">
|
||||
<div onClick={(e) => SafeUtil.stopPropagationWrap(e)(this.clickRow())}>
|
||||
<div className="media clearfix">
|
||||
<div className="pull-left">
|
||||
<div className="left-part">
|
||||
<span
|
||||
className="cell cell-hot"
|
||||
onClick={(e) => SafeUtil.stopPropagationWrap(e)}
|
||||
>
|
||||
<Checkbox
|
||||
checked={matter.check}
|
||||
onChange={e => this.checkToggle(e)}
|
||||
/>
|
||||
</span>
|
||||
<span className="cell">
|
||||
<img className="matter-icon" src={matter.getIcon()} />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/*在大屏幕下的操作栏*/}
|
||||
<div className="pull-right visible-pc">
|
||||
{matter.uuid && this.renderPcOperation()}
|
||||
</div>
|
||||
|
||||
<div className="pull-right visible-mobile">
|
||||
<span
|
||||
className="more-btn"
|
||||
onClick={(e) =>
|
||||
SafeUtil.stopPropagationWrap(e)(this.toggleHandles())
|
||||
}
|
||||
>
|
||||
<EllipsisOutlined className="btn-action navy f18" />
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="media-body">
|
||||
<div className="middle-part">
|
||||
{matter.editMode ? (
|
||||
<span className="matter-name-edit">
|
||||
<input
|
||||
ref={this.inputRef}
|
||||
className={matter.uuid!}
|
||||
value={this.renameMatterName}
|
||||
onChange={e => this.changeMatterName(e)}
|
||||
placeholder={Lang.t("matter.enterName")}
|
||||
onBlur={() => this.blurTrigger()}
|
||||
onKeyUp={e => this.enterTrigger(e)}
|
||||
<Dropdown overlay={menu} trigger={["contextMenu"]}>
|
||||
<div className="widget-matter-panel">
|
||||
<div
|
||||
onClick={(e) => SafeUtil.stopPropagationWrap(e)(this.clickRow())}
|
||||
>
|
||||
<div className="media clearfix">
|
||||
<div className="pull-left">
|
||||
<div className="left-part">
|
||||
<span
|
||||
className="cell cell-hot"
|
||||
onClick={(e) => SafeUtil.stopPropagationWrap(e)}
|
||||
>
|
||||
<Checkbox
|
||||
checked={matter.check}
|
||||
onChange={(e) => this.checkToggle(e)}
|
||||
/>
|
||||
</span>
|
||||
) : (
|
||||
<span className="matter-name">
|
||||
{matter.name}
|
||||
{!matter.dir && !matter.privacy && (
|
||||
<Tooltip
|
||||
title={Lang.t("matter.publicFileEveryoneCanVisit")}
|
||||
>
|
||||
<UnlockOutlined className="icon" />
|
||||
</Tooltip>
|
||||
)}
|
||||
<span className="cell">
|
||||
<img className="matter-icon" src={matter.getIcon()} />
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/*在大屏幕下的操作栏*/}
|
||||
<div className="pull-right visible-pc">
|
||||
{matter.uuid && this.renderPcOperation()}
|
||||
</div>
|
||||
|
||||
<div className="pull-right visible-mobile">
|
||||
<span
|
||||
className="more-btn"
|
||||
onClick={(e) =>
|
||||
SafeUtil.stopPropagationWrap(e)(this.toggleHandles())
|
||||
}
|
||||
>
|
||||
<EllipsisOutlined className="btn-action navy f18" />
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="media-body">
|
||||
<div className="middle-part">
|
||||
{matter.editMode ? (
|
||||
<span className="matter-name-edit">
|
||||
<input
|
||||
ref={this.inputRef}
|
||||
className={matter.uuid!}
|
||||
value={this.renameMatterName}
|
||||
onChange={(e) => this.changeMatterName(e)}
|
||||
placeholder={Lang.t("matter.enterName")}
|
||||
onBlur={() => this.blurTrigger()}
|
||||
onKeyUp={(e) => this.enterTrigger(e)}
|
||||
/>
|
||||
</span>
|
||||
) : (
|
||||
<span className="matter-name">
|
||||
{matter.name}
|
||||
{!matter.dir && !matter.privacy && (
|
||||
<Tooltip
|
||||
title={Lang.t("matter.publicFileEveryoneCanVisit")}
|
||||
>
|
||||
<UnlockOutlined className="icon" />
|
||||
</Tooltip>
|
||||
)}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Expanding>
|
||||
{this.showMore ? this.renderMobileOperation() : null}
|
||||
</Expanding>
|
||||
</div>
|
||||
<Expanding>
|
||||
{this.showMore ? this.renderMobileOperation() : null}
|
||||
</Expanding>
|
||||
</div>
|
||||
</Dropdown>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user