From c927a78e95ec0c054fa9473169b20233fc47a042 Mon Sep 17 00:00:00 2001 From: seaheart Date: Sun, 25 Jun 2023 23:33:30 +0800 Subject: [PATCH] upgrade matter detail --- src/common/model/matter/Matter.ts | 75 ++++++++++++++++------------ src/pages/matter/List.tsx | 1 + src/pages/space/List.tsx | 2 +- src/pages/widget/BreadcrumbPanel.tsx | 10 ---- 4 files changed, 45 insertions(+), 43 deletions(-) diff --git a/src/common/model/matter/Matter.ts b/src/common/model/matter/Matter.ts index f0706c5..f17d359 100644 --- a/src/common/model/matter/Matter.ts +++ b/src/common/model/matter/Matter.ts @@ -143,38 +143,6 @@ export default class Matter extends BaseEntity { return FileUtil.isImage(this.name); } - isPdf() { - return FileUtil.isPdf(this.name); - } - - isText() { - return FileUtil.isText(this.name); - } - - isDoc() { - return FileUtil.isDoc(this.name); - } - - isPpt() { - return FileUtil.isPpt(this.name); - } - - isXls() { - return FileUtil.isXls(this.name); - } - - isAudio() { - return FileUtil.isAudio(this.name); - } - - isVideo() { - return FileUtil.isVideo(this.name); - } - - isPsd() { - return FileUtil.isPsd(this.name); - } - getIcon() { if (FileUtil.isImage(this.name)) { return ImageUtil.handleImageUrl(this.getPreviewUrl(), false, 100, 100); @@ -314,6 +282,49 @@ export default class Matter extends BaseEntity { ); } + httpDetail( + successCallback?: any, + errorCallback?: any, + finallyCallback?: any + ) { + let that = this; + if (!this.uuid) { + this.errorMessage = 'uuid未指定,无法获取到详情!'; + + this.defaultErrorHandler(this.errorMessage, errorCallback); + + return; + } + + this.detailLoading = true; + + this.httpGet( + this.getUrlDetail(), + { + uuid: this.uuid, + spaceUuid: this.spaceUuid, + }, + function (response: any) { + that.detailLoading = false; + + that.assign(response.data.data); + + SafeUtil.safeCallback(successCallback)(response); + }, + function (response: any) { + that.detailLoading = false; + + if (typeof errorCallback === 'function') { + errorCallback(that.getErrorMessage(response), response); + } else { + //没有传入错误处理的方法就采用默认处理方法:toast弹出该错误信息。 + that.defaultErrorHandler(response); + } + }, + finallyCallback + ); + } + httpRename( name: string, successCallback?: any, diff --git a/src/pages/matter/List.tsx b/src/pages/matter/List.tsx index 065ff0e..26f648c 100644 --- a/src/pages/matter/List.tsx +++ b/src/pages/matter/List.tsx @@ -498,6 +498,7 @@ export default class List extends TankComponent { this.breadcrumbModels = [rootBreadcrumb]; if (!isRootDirectory) { + this.currentDirectory.spaceUuid = this.getSpaceUuid(); this.currentDirectory.httpDetail(() => { const arr = []; let cur: Matter | null = this.currentDirectory; diff --git a/src/pages/space/List.tsx b/src/pages/space/List.tsx index d6ad02b..99dfade 100644 --- a/src/pages/space/List.tsx +++ b/src/pages/space/List.tsx @@ -193,7 +193,7 @@ export default class List extends TankComponent { } > - + diff --git a/src/pages/widget/BreadcrumbPanel.tsx b/src/pages/widget/BreadcrumbPanel.tsx index ad7ce4d..1ce2dc8 100644 --- a/src/pages/widget/BreadcrumbPanel.tsx +++ b/src/pages/widget/BreadcrumbPanel.tsx @@ -4,7 +4,6 @@ import './TableEmpty.less'; import TankComponent from '../../common/component/TankComponent'; import BreadcrumbModel from '../../common/model/base/option/BreadcrumbModel'; import Sun from '../../common/model/global/Sun'; -import { HomeOutlined } from '@ant-design/icons/lib'; interface IProps { breadcrumbModels: BreadcrumbModel[]; @@ -22,15 +21,6 @@ export default class BreadcrumbPanel extends TankComponent { render() { return ( - {/* - { - Sun.navigateTo('/'); - }} - /> - */} - {this.props.breadcrumbModels.map( (item: BreadcrumbModel, index: number) => { if (item.displayDirect) {