diff --git a/src/pages/share/Detail.less b/src/pages/share/Detail.less new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/share/Detail.tsx b/src/pages/share/Detail.tsx new file mode 100644 index 0000000..66f3578 --- /dev/null +++ b/src/pages/share/Detail.tsx @@ -0,0 +1,13 @@ +import React, {Component} from 'react'; +import './Detail.less'; + +export class Detail extends Component { + + render() { + return ( +
+ +
+ ) + } +} diff --git a/src/pages/share/List.less b/src/pages/share/List.less new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/share/List.tsx b/src/pages/share/List.tsx new file mode 100644 index 0000000..26b71ba --- /dev/null +++ b/src/pages/share/List.tsx @@ -0,0 +1,57 @@ +import React from "react"; +import { RouteComponentProps } from "react-router-dom"; +import { Pagination } from "antd"; +import TankComponent from "../../common/component/TankComponent"; +import Pager from "../../common/model/base/Pager"; +import Share from "../../common/model/share/Share"; +import ShareBar from "./widget/ShareBar"; + +import "./List.less"; + +interface IProps extends RouteComponentProps {} + +interface IState {} + +export class List extends TankComponent { + pager = new Pager(this, Share, Pager.MAX_PAGE_SIZE); + + constructor(props: IProps) { + super(props); + } + + componentDidMount() { + this.pager.enableHistory(); + this.refresh(); + } + + refresh = () => { + this.pager.httpList(); + }; + + changePage = (page: number) => { + this.pager.page = page - 1; // page的页数0基 + this.pager.httpList(); + this.updateUI(); + }; + + render() { + const { pager } = this; + + return ( +
+ {pager.data.map((share) => ( + + ))} + + +
+ ); + } +} diff --git a/src/pages/share/widget/ShareBar.less b/src/pages/share/widget/ShareBar.less new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/share/widget/ShareBar.tsx b/src/pages/share/widget/ShareBar.tsx new file mode 100644 index 0000000..b49960d --- /dev/null +++ b/src/pages/share/widget/ShareBar.tsx @@ -0,0 +1,146 @@ +import React from "react"; +import { RouteComponentProps } from "react-router-dom"; +import { + InfoCircleOutlined, + DeleteOutlined, + SmallDashOutlined, +} from "@ant-design/icons"; +import TankComponent from "../../../common/component/TankComponent"; +import SafeUtil from "../../../common/util/SafeUtil"; +import DateUtil from "../../../common/util/DateUtil"; +import Expanding from "../../widget/Expanding"; + +interface IProps extends RouteComponentProps { + share: any; + onDeleteSuccess: () => any; +} + +interface IState {} + +export default class ShareBar extends TankComponent { + // 小屏幕下操作栏 + showMore = false; + + constructor(props: IProps) { + super(props); + } + + showShare = () => {}; + + delShare = () => {}; + + toggleHandles = () => { + this.showMore = !this.showMore; + this.updateUI(); + }; + + render() { + const { history, share } = this.props; + const { showMore } = this; + return ( +
+
history.push(`/share/detail/${share.uuid}`)}> +
+
+
+ + + +
+
+ + {/*在大屏下的操作栏*/} +
+
+ + SafeUtil.stopPropagationWrap(e)(this.showShare()) + } + > + + + + SafeUtil.stopPropagationWrap(e)(this.delShare()) + } + > + + + + + {DateUtil.simpleDateHourMinute(share.updateTime)} + + + + {share.expireInfinity + ? "永久有效" + : DateUtil.simpleDateHourMinute(share.expireTime)} + +
+
+ + {/*在小屏幕下的操作栏*/} +
+ + SafeUtil.stopPropagationWrap(e)(this.toggleHandles()) + } + > + + +
+ +
+
+ + {share.name} + {share.hasExpired() ? ( + 已过期 + ) : null} + +
+
+
+
+ + + {showMore ? ( +
+
+ + 分享时间: {DateUtil.simpleDateHourMinute(share.createTime)} + + + {share.expireInfinity + ? "永久有效" + : DateUtil.simpleDateHourMinute(share.expireTime)} + +
+ +
+ SafeUtil.stopPropagationWrap(e)(this.showShare()) + } + > + +
+ +
+ SafeUtil.stopPropagationWrap(e)(this.delShare()) + } + > + +
+
+ ) : null} +
+
+ ); + } +} diff --git a/src/pages/share/widget/ShareDialogModal.less b/src/pages/share/widget/ShareDialogModal.less new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/share/widget/ShareDialogModal.tsx b/src/pages/share/widget/ShareDialogModal.tsx new file mode 100644 index 0000000..7baeb2f --- /dev/null +++ b/src/pages/share/widget/ShareDialogModal.tsx @@ -0,0 +1,56 @@ +import React, { Component } from "react"; +import TankComponent from "../../../common/component/TankComponent"; +import Share from "../../../common/model/share/Share"; +import {Modal} from "antd"; + +interface IProps { + share: Share, + showSuccessHint?: boolean, + onSuccess: () => any, + onClose: () => any +} + +interface IState {} + +export class ShareDialogModal extends TankComponent { + + constructor(props: IProps) { + super(props); + } + + static open = (share: Share) => { + let modal = Modal.confirm({ + title: "分享详情", + width: "50vw", + okCancel: false, + okButtonProps: { + className: "display-none" + }, + content: ( + { + modal.destroy(); + }} + onClose={() => { + modal.destroy(); + }} + /> + ), + }) + }; + + render() { + const { share } = this.props; + + return
+
+
+ + {share.name} +
+
+ +
; + } +}