mirror of
https://github.com/eyebluecn/tank-front
synced 2024-04-21 12:31:55 +00:00
Fix the svg image cannot show bug.
This commit is contained in:
@@ -3,7 +3,7 @@ import axios, { CancelTokenSource } from "axios";
|
||||
import BaseEntity from "../base/BaseEntity";
|
||||
import Filter from "../base/filter/Filter";
|
||||
import HttpUtil from "../../util/HttpUtil";
|
||||
import FileUtil from "../../util/FileHelper";
|
||||
import FileHelper from "../../util/FileHelper";
|
||||
import ImageUtil from "../../util/ImageUtil";
|
||||
import EnvUtil from "../../util/EnvUtil";
|
||||
import InputFilter from "../base/filter/InputFilter";
|
||||
@@ -133,46 +133,46 @@ export default class Matter extends BaseEntity {
|
||||
}
|
||||
|
||||
isImage() {
|
||||
return FileUtil.isImage(this.name);
|
||||
return FileHelper.isImage(this.name);
|
||||
}
|
||||
|
||||
isPdf() {
|
||||
return FileUtil.isPdf(this.name);
|
||||
return FileHelper.isPdf(this.name);
|
||||
}
|
||||
|
||||
isText() {
|
||||
return FileUtil.isText(this.name);
|
||||
return FileHelper.isText(this.name);
|
||||
}
|
||||
|
||||
isDoc() {
|
||||
return FileUtil.isDoc(this.name);
|
||||
return FileHelper.isDoc(this.name);
|
||||
}
|
||||
|
||||
isPpt() {
|
||||
return FileUtil.isPpt(this.name);
|
||||
return FileHelper.isPpt(this.name);
|
||||
}
|
||||
|
||||
isXls() {
|
||||
return FileUtil.isXls(this.name);
|
||||
return FileHelper.isXls(this.name);
|
||||
}
|
||||
|
||||
isAudio() {
|
||||
return FileUtil.isAudio(this.name);
|
||||
return FileHelper.isAudio(this.name);
|
||||
}
|
||||
|
||||
isVideo() {
|
||||
return FileUtil.isVideo(this.name);
|
||||
return FileHelper.isVideo(this.name);
|
||||
}
|
||||
|
||||
isPsd() {
|
||||
return FileUtil.isPsd(this.name);
|
||||
return FileHelper.isPsd(this.name);
|
||||
}
|
||||
|
||||
getIcon() {
|
||||
if (FileUtil.isImage(this.name)) {
|
||||
if (FileHelper.isImage(this.name)) {
|
||||
return ImageUtil.handleImageUrl(this.getPreviewUrl(), false, 100, 100);
|
||||
} else {
|
||||
return FileUtil.getIcon(this.name, this.dir);
|
||||
return FileHelper.getIcon(this.name, this.dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import BaseEntity from "../base/BaseEntity";
|
||||
import Matter from "../matter/Matter";
|
||||
import FileUtil from "../../util/FileHelper";
|
||||
import FileHelper from "../../util/FileHelper";
|
||||
import EnvUtil from "../../util/EnvUtil";
|
||||
import {ShareType} from "./ShareType";
|
||||
import {ShareExpireOption, ShareExpireOptionMap} from "./ShareExpireOption";
|
||||
@@ -62,12 +62,12 @@ export default class Share extends BaseEntity {
|
||||
|
||||
getIcon() {
|
||||
if (this.shareType === ShareType.MIX) {
|
||||
return FileUtil.getIcon(
|
||||
return FileHelper.getIcon(
|
||||
"zip",
|
||||
false
|
||||
);
|
||||
} else {
|
||||
return FileUtil.getIcon(
|
||||
return FileHelper.getIcon(
|
||||
this.name,
|
||||
this.shareType === ShareType.DIRECTORY
|
||||
);
|
||||
|
||||
@@ -15,7 +15,7 @@ import textSvg from "../../assets/image/file/text.svg";
|
||||
import videoSvg from "../../assets/image/file/video.svg";
|
||||
import xlsSvg from "../../assets/image/file/xls.svg";
|
||||
|
||||
export default class FileUtil {
|
||||
export default class FileHelper {
|
||||
static isImage(name: string | null): boolean {
|
||||
let mimeType = MimeUtil.getMimeType(name);
|
||||
return StringUtil.startWith(mimeType, "image");
|
||||
@@ -89,26 +89,26 @@ export default class FileUtil {
|
||||
return folderSvg;
|
||||
}
|
||||
|
||||
if (FileUtil.isPdf(name)) {
|
||||
if (FileHelper.isPdf(name)) {
|
||||
return pdfSvg;
|
||||
} else if (FileUtil.isDoc(name)) {
|
||||
} else if (FileHelper.isDoc(name)) {
|
||||
return docSvg;
|
||||
} else if (FileUtil.isPpt(name)) {
|
||||
} else if (FileHelper.isPpt(name)) {
|
||||
return pptSvg;
|
||||
} else if (FileUtil.isXls(name)) {
|
||||
} else if (FileHelper.isXls(name)) {
|
||||
return xlsSvg;
|
||||
} else if (FileUtil.isAudio(name)) {
|
||||
} else if (FileHelper.isAudio(name)) {
|
||||
return audioSvg;
|
||||
} else if (
|
||||
FileUtil.isVideo(name) ||
|
||||
FileHelper.isVideo(name) ||
|
||||
MimeUtil.getExtension(name) === ".mkv"
|
||||
) {
|
||||
return videoSvg;
|
||||
} else if (FileUtil.isText(name)) {
|
||||
} else if (FileHelper.isText(name)) {
|
||||
return textSvg;
|
||||
} else if (FileUtil.isPsd(name)) {
|
||||
} else if (FileHelper.isPsd(name)) {
|
||||
return psdSvg;
|
||||
} else if (FileUtil.isImage(name)) {
|
||||
} else if (FileHelper.isImage(name)) {
|
||||
return imageSvg;
|
||||
} else if (
|
||||
StringUtil.endWith(name, "zip") ||
|
||||
|
||||
@@ -12,7 +12,7 @@ import Pager from "../../common/model/base/Pager";
|
||||
import Dashboard from '../../common/model/dashboard/Dashboard';
|
||||
import DateUtil from '../../common/util/DateUtil';
|
||||
import SortDirection from "../../common/model/base/SortDirection";
|
||||
import FileUtil from "../../common/util/FileHelper";
|
||||
import FileHelper from "../../common/util/FileHelper";
|
||||
import Matter from '../../common/model/matter/Matter';
|
||||
import Lang from "../../common/model/global/Lang";
|
||||
import MessageBoxUtil from "../../common/util/MessageBoxUtil";
|
||||
@@ -346,7 +346,7 @@ export default class Index extends TankComponent<IProps, IState> {
|
||||
<div className="text-block">
|
||||
<div className="upper">
|
||||
<div className="indicator">{Lang.t("dashboard.totalFileSize")}</div>
|
||||
<div className="amount">{FileUtil.humanFileSize(dashboard.totalFileSize)}</div>
|
||||
<div className="amount">{FileHelper.humanFileSize(dashboard.totalFileSize)}</div>
|
||||
<div>
|
||||
<RatePanel name={Lang.t("dashboard.weekRate")} standardValue={this.standardWeekSize}
|
||||
compareValue={this.compareWeekSize}/>
|
||||
@@ -355,7 +355,7 @@ export default class Index extends TankComponent<IProps, IState> {
|
||||
</div>
|
||||
</div>
|
||||
<div className="lower">
|
||||
{Lang.t("dashboard.yesterdayMatterSize")}:{FileUtil.humanFileSize(yesterdayDashboard.fileSize)}
|
||||
{Lang.t("dashboard.yesterdayMatterSize")}:{FileHelper.humanFileSize(yesterdayDashboard.fileSize)}
|
||||
</div>
|
||||
</div>
|
||||
</Col>
|
||||
|
||||
@@ -45,7 +45,7 @@ import ShareDialogModal from "../share/widget/ShareDialogModal";
|
||||
import BreadcrumbModel from "../../common/model/base/option/BreadcrumbModel";
|
||||
import BreadcrumbPanel from "../widget/BreadcrumbPanel";
|
||||
import Lang from "../../common/model/global/Lang";
|
||||
import FileUtil from "../../common/util/FileHelper";
|
||||
import FileHelper from "../../common/util/FileHelper";
|
||||
import SafeUtil from "../../common/util/SafeUtil";
|
||||
import MatterSortPanel from "./widget/MatterSortPanel";
|
||||
import {
|
||||
@@ -293,7 +293,7 @@ export default class List extends TankComponent<IProps, IState> {
|
||||
MessageBoxUtil.success(Lang.t("matter.uploaded"));
|
||||
} else {
|
||||
// 上传错误弹出提示框
|
||||
const url = FileUtil.getErrorLogsToCSVUrl(this.uploadErrorLogs);
|
||||
const url = FileHelper.getErrorLogsToCSVUrl(this.uploadErrorLogs);
|
||||
Modal.confirm({
|
||||
title: Lang.t("matter.uploadInfo"),
|
||||
icon: <ExclamationCircleFilled twoToneColor="#FFDC00" />,
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
SmallDashOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import MessageBoxUtil from "../../../../common/util/MessageBoxUtil";
|
||||
import FileUtil from "../../../../common/util/FileHelper";
|
||||
import FileHelper from "../../../../common/util/FileHelper";
|
||||
import DateUtil from "../../../../common/util/DateUtil";
|
||||
import Expanding from "../../../widget/Expanding";
|
||||
import "./ImageCachePanel.less";
|
||||
@@ -103,7 +103,7 @@ export default class ImageCachePanel extends TankComponent<IProps, IState> {
|
||||
}
|
||||
/>
|
||||
<span className="image-cache-size">
|
||||
{FileUtil.humanFileSize(imageCache.size)}
|
||||
{FileHelper.humanFileSize(imageCache.size)}
|
||||
</span>
|
||||
<span className="image-cache-date">
|
||||
{DateUtil.simpleDateHourMinute(imageCache.updateTime)}
|
||||
|
||||
@@ -9,7 +9,7 @@ import {Button, Form, Input, InputNumber, Switch} from "antd";
|
||||
import {SaveOutlined} from "@ant-design/icons";
|
||||
import TankContentCard from "../widget/TankContentCard";
|
||||
import Preference from "../../common/model/preference/Preference";
|
||||
import FileUtil from "../../common/util/FileHelper";
|
||||
import FileHelper from "../../common/util/FileHelper";
|
||||
import {FormInstance} from "antd/lib/form";
|
||||
import MessageBoxUtil from "../../common/util/MessageBoxUtil";
|
||||
import Sun from "../../common/model/global/Sun";
|
||||
@@ -164,10 +164,10 @@ export default class Edit extends TankComponent<IProps, IState> {
|
||||
<span className="pl10">
|
||||
{Lang.t("preference.current")}:
|
||||
{this.formRef && this.formRef.current
|
||||
? FileUtil.humanFileSize(
|
||||
? FileHelper.humanFileSize(
|
||||
this.formRef.current.getFieldValue("downloadDirMaxSize")
|
||||
)
|
||||
: FileUtil.humanFileSize(preference.defaultTotalSizeLimit)}
|
||||
: FileHelper.humanFileSize(preference.defaultTotalSizeLimit)}
|
||||
</span>
|
||||
</Form.Item>
|
||||
|
||||
@@ -190,12 +190,12 @@ export default class Edit extends TankComponent<IProps, IState> {
|
||||
<span className="pl10">
|
||||
{Lang.t("preference.current")}:
|
||||
{this.formRef && this.formRef.current
|
||||
? FileUtil.humanFileSize(
|
||||
? FileHelper.humanFileSize(
|
||||
this.formRef.current.getFieldValue(
|
||||
"defaultTotalSizeLimit"
|
||||
)
|
||||
)
|
||||
: FileUtil.humanFileSize(preference.defaultTotalSizeLimit)}
|
||||
: FileHelper.humanFileSize(preference.defaultTotalSizeLimit)}
|
||||
</span>
|
||||
</Form.Item>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
import InfoCell from "../widget/InfoCell";
|
||||
import Preference from "../../common/model/preference/Preference";
|
||||
import TankContentCard from "../widget/TankContentCard";
|
||||
import FileUtil from "../../common/util/FileHelper";
|
||||
import FileHelper from "../../common/util/FileHelper";
|
||||
import ImagePreviewer from "../widget/previewer/ImagePreviewer";
|
||||
import Lang from "../../common/model/global/Lang";
|
||||
import SingleTextModal from "../widget/SingleTextModal";
|
||||
@@ -162,11 +162,11 @@ export default class Index extends TankComponent<IProps, IState> {
|
||||
</InfoCell>
|
||||
|
||||
<InfoCell name={Lang.t("preference.zipMaxSizeLimit")}>
|
||||
{FileUtil.humanFileSize(this.preference.downloadDirMaxSize)}
|
||||
{FileHelper.humanFileSize(this.preference.downloadDirMaxSize)}
|
||||
</InfoCell>
|
||||
|
||||
<InfoCell name={Lang.t("preference.userDefaultSizeLimit")}>
|
||||
{FileUtil.humanFileSize(this.preference.defaultTotalSizeLimit)}
|
||||
{FileHelper.humanFileSize(this.preference.defaultTotalSizeLimit)}
|
||||
</InfoCell>
|
||||
|
||||
<InfoCell name={Lang.t("preference.matterBinDefaultSaveDay")}>
|
||||
|
||||
@@ -11,7 +11,7 @@ import TankContentCard from "../widget/TankContentCard";
|
||||
import { Link, RouteComponentProps } from "react-router-dom";
|
||||
import ImagePreviewer from "../widget/previewer/ImagePreviewer";
|
||||
import { UserRole, UserRoleMap } from "../../common/model/user/UserRole";
|
||||
import FileUtil from "../../common/util/FileHelper";
|
||||
import FileHelper from "../../common/util/FileHelper";
|
||||
import { UserStatus, UserStatusMap } from "../../common/model/user/UserStatus";
|
||||
import BrowserUtil from "../../common/util/BrowserUtil";
|
||||
import SingleTextModal from "../widget/SingleTextModal";
|
||||
@@ -207,15 +207,15 @@ export default class Detail extends TankComponent<IProps, IState> {
|
||||
</InfoCell>
|
||||
|
||||
<InfoCell name={Lang.t("user.singleFileSizeLimit")}>
|
||||
{FileUtil.humanFileSize(currentUser.sizeLimit)}
|
||||
{FileHelper.humanFileSize(currentUser.sizeLimit)}
|
||||
</InfoCell>
|
||||
|
||||
<InfoCell name={Lang.t("user.totalFileSizeLimit")}>
|
||||
{FileUtil.humanFileSize(currentUser.totalSizeLimit)}
|
||||
{FileHelper.humanFileSize(currentUser.totalSizeLimit)}
|
||||
</InfoCell>
|
||||
|
||||
<InfoCell name={Lang.t("user.totalFileSize")}>
|
||||
{FileUtil.humanFileSize(currentUser.totalSize)}
|
||||
{FileHelper.humanFileSize(currentUser.totalSize)}
|
||||
</InfoCell>
|
||||
|
||||
<InfoCell name={Lang.t("user.status")}>
|
||||
|
||||
@@ -6,7 +6,7 @@ import {Button, Form, Input, InputNumber, Select} from 'antd';
|
||||
import User from "../../common/model/user/User";
|
||||
import Moon from "../../common/model/global/Moon";
|
||||
import TankTitle from "../widget/TankTitle";
|
||||
import FileUtil from "../../common/util/FileHelper";
|
||||
import FileHelper from "../../common/util/FileHelper";
|
||||
import TankContentCard from "../widget/TankContentCard";
|
||||
import {FormInstance} from "antd/lib/form";
|
||||
import {SaveOutlined} from "@ant-design/icons/lib";
|
||||
@@ -224,8 +224,8 @@ export default class Edit extends TankComponent<IProps, IState> {
|
||||
<span
|
||||
className="pl10"> {Lang.t("user.current")}:
|
||||
{(this.formRef && this.formRef.current) ?
|
||||
FileUtil.humanFileSize(this.formRef.current.getFieldValue("sizeLimit"))
|
||||
: FileUtil.humanFileSize(currentUser.sizeLimit)}
|
||||
FileHelper.humanFileSize(this.formRef.current.getFieldValue("sizeLimit"))
|
||||
: FileHelper.humanFileSize(currentUser.sizeLimit)}
|
||||
</span>
|
||||
</Form.Item>
|
||||
|
||||
@@ -244,8 +244,8 @@ export default class Edit extends TankComponent<IProps, IState> {
|
||||
<span
|
||||
className="pl10"> {Lang.t("user.current")}:
|
||||
{(this.formRef && this.formRef.current) ?
|
||||
FileUtil.humanFileSize(this.formRef.current.getFieldValue("totalSizeLimit"))
|
||||
: FileUtil.humanFileSize(currentUser.totalSizeLimit)}
|
||||
FileHelper.humanFileSize(this.formRef.current.getFieldValue("totalSizeLimit"))
|
||||
: FileHelper.humanFileSize(currentUser.totalSizeLimit)}
|
||||
</span>
|
||||
</Form.Item>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import "./List.less";
|
||||
import SortDirection from "../../common/model/base/SortDirection";
|
||||
import Pager from "../../common/model/base/Pager";
|
||||
import StringUtil from "../../common/util/StringUtil";
|
||||
import FileUtil from "../../common/util/FileHelper";
|
||||
import FileHelper from "../../common/util/FileHelper";
|
||||
import DateUtil from "../../common/util/DateUtil";
|
||||
import FilterPanel from "../widget/filter/FilterPanel";
|
||||
import TableEmpty from "../widget/TableEmpty";
|
||||
@@ -157,21 +157,21 @@ export default class List extends TankComponent<IProps, IState> {
|
||||
title: Lang.t("user.singleFileSizeLimit"),
|
||||
dataIndex: "sizeLimit",
|
||||
render: (text: any, record: User, index: number): React.ReactNode => (
|
||||
<span>{FileUtil.humanFileSize(record.sizeLimit)}</span>
|
||||
<span>{FileHelper.humanFileSize(record.sizeLimit)}</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: Lang.t("user.totalFileSize"),
|
||||
dataIndex: "totalSize",
|
||||
render: (text: any, record: User, index: number): React.ReactNode => (
|
||||
<span>{FileUtil.humanFileSize(record.totalSize)}</span>
|
||||
<span>{FileHelper.humanFileSize(record.totalSize)}</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: Lang.t("user.totalFileSizeLimit"),
|
||||
dataIndex: "totalSizeLimit",
|
||||
render: (text: any, record: User, index: number): React.ReactNode => (
|
||||
<span>{FileUtil.humanFileSize(record.totalSizeLimit)}</span>
|
||||
<span>{FileHelper.humanFileSize(record.totalSizeLimit)}</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ import User from "../../../common/model/user/User";
|
||||
import { Link } from "react-router-dom";
|
||||
import { UserRoleMap } from "../../../common/model/user/UserRole";
|
||||
import { Tag, Tooltip } from "antd";
|
||||
import FileUtil from "../../../common/util/FileHelper";
|
||||
import FileHelper from "../../../common/util/FileHelper";
|
||||
import {
|
||||
UserStatus,
|
||||
UserStatusMap,
|
||||
@@ -77,13 +77,13 @@ export default class MobileUserPanel extends TankComponent<IProps, IState> {
|
||||
{this.showMore ? (
|
||||
<div className="ml10 panel-detail">
|
||||
<InfoCell name={Lang.t("user.singleFileSizeLimit")}>
|
||||
<span>{FileUtil.humanFileSize(user.sizeLimit)}</span>
|
||||
<span>{FileHelper.humanFileSize(user.sizeLimit)}</span>
|
||||
</InfoCell>
|
||||
<InfoCell name={Lang.t("user.totalFileSize")}>
|
||||
<span>{FileUtil.humanFileSize(user.totalSize)}</span>
|
||||
<span>{FileHelper.humanFileSize(user.totalSize)}</span>
|
||||
</InfoCell>
|
||||
<InfoCell name={Lang.t("user.totalFileSizeLimit")}>
|
||||
<span>{FileUtil.humanFileSize(user.totalSizeLimit)}</span>
|
||||
<span>{FileHelper.humanFileSize(user.totalSizeLimit)}</span>
|
||||
</InfoCell>
|
||||
<InfoCell name={Lang.t("user.status")}>
|
||||
<Tag color={UserStatusMap[user.status].color}>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import "./BrowserPreviewer.less"
|
||||
import React from "react";
|
||||
import * as ReactDOM from 'react-dom';
|
||||
import FileUtil from "../../../common/util/FileHelper";
|
||||
import FileHelper from "../../../common/util/FileHelper";
|
||||
import {CloseOutlined} from "@ant-design/icons";
|
||||
|
||||
interface IProps {
|
||||
@@ -70,7 +70,7 @@ export default class BrowserPreviewer extends React.Component<IProps, IState> {
|
||||
</div>
|
||||
|
||||
<div className="middle-part">
|
||||
{this.props.name}({FileUtil.humanFileSize(this.props.size)})
|
||||
{this.props.name}({FileHelper.humanFileSize(this.props.size)})
|
||||
</div>
|
||||
|
||||
<div className="right-part">
|
||||
|
||||
Reference in New Issue
Block a user