mirror of
https://github.com/eyebluecn/tank-front
synced 2024-04-21 12:31:55 +00:00
matter list share
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
"antd": "^4.3.1",
|
||||
"axios": "^0.19.2",
|
||||
"camelcase": "^5.3.1",
|
||||
"copy-to-clipboard": "^3.3.1",
|
||||
"dotenv": "8.2.0",
|
||||
"dotenv-expand": "5.1.0",
|
||||
"echarts": "^4.8.0",
|
||||
|
||||
@@ -118,7 +118,7 @@ export default class Share extends BaseEntity {
|
||||
let that = this;
|
||||
|
||||
const form = {
|
||||
matterUuids: matterUuids.toString(),
|
||||
matterUuids: matterUuids,
|
||||
expireInfinity: this.expireOption === ShareExpireOption.INFINITY,
|
||||
expireTime: DateUtil.simpleDateTime(this.getExpireTime()),
|
||||
};
|
||||
|
||||
@@ -4,13 +4,13 @@ import "./Detail.less";
|
||||
import TankComponent from "../../common/component/TankComponent";
|
||||
import Matter from "../../common/model/matter/Matter";
|
||||
import { Spin, Space } from "antd";
|
||||
import copy from "copy-to-clipboard";
|
||||
import StringUtil from "../../common/util/StringUtil";
|
||||
import TankTitle from "../widget/TankTitle";
|
||||
import DownloadToken from "../../common/model/download/token/DownloadToken";
|
||||
import DateUtil from "../../common/util/DateUtil";
|
||||
import MessageBoxUtil from "../../common/util/MessageBoxUtil";
|
||||
import ImageCacheList from "./widget/imageCache/ImageCacheList";
|
||||
import ClipboardUtil from "../../common/util/ClipboardUtil";
|
||||
|
||||
interface RouteParam {
|
||||
uuid: string;
|
||||
@@ -46,8 +46,9 @@ export default class Detail extends TankComponent<IProps, IState> {
|
||||
const textToCopy = this.matter.getDownloadUrl(
|
||||
privacy ? this.downloadToken.uuid! : undefined
|
||||
);
|
||||
copy(textToCopy);
|
||||
MessageBoxUtil.success("操作成功");
|
||||
ClipboardUtil.copy(textToCopy, () => {
|
||||
MessageBoxUtil.success("操作成功");
|
||||
})
|
||||
};
|
||||
|
||||
render() {
|
||||
|
||||
@@ -29,6 +29,7 @@ import StringUtil from "../../common/util/StringUtil";
|
||||
import MoveBatchModal from "./widget/MoveBatchModal";
|
||||
import ShareOperationModal from "./widget/ShareOperationModal";
|
||||
import Share from "../../common/model/share/Share";
|
||||
import ShareDialogModal from "../share/widget/ShareDialogModal";
|
||||
|
||||
interface IProps extends RouteComponentProps {}
|
||||
|
||||
@@ -203,8 +204,11 @@ export default class List extends TankComponent<IProps, IState> {
|
||||
};
|
||||
|
||||
shareBatch = () => {
|
||||
ShareOperationModal.open(() => {
|
||||
|
||||
const uuids = this.selectedMatters.map((i) => i.uuid).join(",");
|
||||
ShareOperationModal.open((share: Share) => {
|
||||
share.httpCreate(uuids, () => {
|
||||
ShareDialogModal.open(share)
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import React from "react";
|
||||
import copy from "copy-to-clipboard";
|
||||
import Matter from "../../../common/model/matter/Matter";
|
||||
import TankComponent from "../../../common/component/TankComponent";
|
||||
import Director from "./Director";
|
||||
@@ -25,6 +24,7 @@ import {
|
||||
import { Modal, Checkbox } from "antd";
|
||||
import { CheckboxChangeEvent } from "antd/es/checkbox";
|
||||
import SafeUtil from "../../../common/util/SafeUtil";
|
||||
import ClipboardUtil from "../../../common/util/ClipboardUtil";
|
||||
|
||||
interface IProps {
|
||||
matter: Matter;
|
||||
@@ -83,8 +83,9 @@ export default class MatterPanel extends TankComponent<IProps, IState> {
|
||||
|
||||
clipboard = () => {
|
||||
let textToCopy = this.props.matter.getDownloadUrl();
|
||||
copy(textToCopy);
|
||||
MessageBoxUtil.success("操作成功");
|
||||
ClipboardUtil.copy(textToCopy, () => {
|
||||
MessageBoxUtil.success("操作成功");
|
||||
})
|
||||
};
|
||||
|
||||
deleteMatter = () => {
|
||||
|
||||
@@ -3,10 +3,10 @@ import TankComponent from "../../../common/component/TankComponent";
|
||||
import { Modal, Button, Col, Row, Select } from "antd";
|
||||
import "./ShareOperationModal.less";
|
||||
import Share from "../../../common/model/share/Share";
|
||||
import { ShareExpireOptionList } from "../../../common/model/share/ShareExpireOption";
|
||||
import { ShareExpireOptionList, ShareExpireOption } from "../../../common/model/share/ShareExpireOption";
|
||||
|
||||
interface IProps {
|
||||
onSuccess: () => any;
|
||||
onSuccess: (share: Share) => any;
|
||||
onClose: () => any;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export default class ShareOperationModal extends TankComponent<IProps, IState> {
|
||||
super(props);
|
||||
}
|
||||
|
||||
static open = (confirmCallback: () => any) => {
|
||||
static open = (confirmCallback: (share: Share) => any) => {
|
||||
const modal = Modal.confirm({
|
||||
className: "share-modal",
|
||||
title: "分享",
|
||||
@@ -30,8 +30,8 @@ export default class ShareOperationModal extends TankComponent<IProps, IState> {
|
||||
},
|
||||
content: (
|
||||
<ShareOperationModal
|
||||
onSuccess={() => {
|
||||
confirmCallback();
|
||||
onSuccess={(share: Share) => {
|
||||
confirmCallback(share);
|
||||
modal.destroy();
|
||||
}}
|
||||
onClose={() => {
|
||||
@@ -42,21 +42,31 @@ export default class ShareOperationModal extends TankComponent<IProps, IState> {
|
||||
});
|
||||
};
|
||||
|
||||
selectChange = (value: ShareExpireOption) => {
|
||||
this.share.expireOption = value;
|
||||
this.updateUI();
|
||||
};
|
||||
|
||||
render() {
|
||||
const { share } = this;
|
||||
return (
|
||||
<div className="widget-share-modal">
|
||||
<Row>
|
||||
<Col span={8}>有效期</Col>
|
||||
<Col span={16}>
|
||||
<Select>
|
||||
<Select className="wp100" value={share.expireOption} onChange={this.selectChange}>
|
||||
{ShareExpireOptionList.map((option) => (
|
||||
<Select.Option value={option.value} onChange={() => {}}>
|
||||
<Select.Option key={option.value} value={option.value}>
|
||||
{option.name}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Col>
|
||||
</Row>
|
||||
<div className="mt10 text-right">
|
||||
<Button type="primary" className="mr10" onClick={() => this.props.onSuccess(share)}>分享</Button>
|
||||
<Button onClick={this.props.onClose}>关闭</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
import React from "react";
|
||||
import copy from "copy-to-clipboard";
|
||||
import TankComponent from "../../../common/component/TankComponent";
|
||||
import Share from "../../../common/model/share/Share";
|
||||
import {Button, Modal} from "antd";
|
||||
import { CheckOutlined, CopyOutlined } from "@ant-design/icons";
|
||||
import { CopyOutlined } from "@ant-design/icons";
|
||||
import DateUtil from "../../../common/util/DateUtil";
|
||||
import MessageBoxUtil from "../../../common/util/MessageBoxUtil";
|
||||
import './ShareDialogModal.less';
|
||||
import ClipboardUtil from "../../../common/util/ClipboardUtil";
|
||||
|
||||
interface IProps {
|
||||
share: Share;
|
||||
showSuccessHint?: boolean;
|
||||
onSuccess: () => any;
|
||||
onClose: () => any;
|
||||
}
|
||||
@@ -23,8 +22,9 @@ export default class ShareDialogModal extends TankComponent<IProps, IState> {
|
||||
}
|
||||
|
||||
clipboard = (text: string) => {
|
||||
copy(text);
|
||||
MessageBoxUtil.success("复制成功");
|
||||
ClipboardUtil.copy(text, () => {
|
||||
MessageBoxUtil.success("复制成功");
|
||||
})
|
||||
};
|
||||
|
||||
copyAll = () => {
|
||||
@@ -59,7 +59,7 @@ export default class ShareDialogModal extends TankComponent<IProps, IState> {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { share, showSuccessHint } = this.props;
|
||||
const { share } = this.props;
|
||||
|
||||
return (
|
||||
<div className="widget-share-dialog-panel">
|
||||
@@ -67,12 +67,6 @@ export default class ShareDialogModal extends TankComponent<IProps, IState> {
|
||||
<div>
|
||||
<img className="share-icon" src={share.getIcon()} />
|
||||
<span className="name">{share.name}</span>
|
||||
{showSuccessHint ? (
|
||||
<span className="italic">
|
||||
分享成功
|
||||
<CheckOutlined className="text-success" />
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="mt15">
|
||||
<span className="inline-block mr10">分享者:{share.username}</span>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import React, { Component } from "react";
|
||||
import VelocityReact from "velocity-react";
|
||||
import SafeUtil from "../../common/util/SafeUtil";
|
||||
|
||||
interface IProps {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user