|
@@ -4,7 +4,9 @@ import React from "react";
|
|
|
import { IconButton } from "./button";
|
|
import { IconButton } from "./button";
|
|
|
import ResetIcon from "../icons/reload.svg";
|
|
import ResetIcon from "../icons/reload.svg";
|
|
|
import Locale from "../locales";
|
|
import Locale from "../locales";
|
|
|
-
|
|
|
|
|
|
|
+import './error.scss';
|
|
|
|
|
+import { Button} from 'antd';
|
|
|
|
|
+import { Color } from "antd/es/color-picker";
|
|
|
|
|
|
|
|
interface IErrorBoundaryState {
|
|
interface IErrorBoundaryState {
|
|
|
hasError: boolean;
|
|
hasError: boolean;
|
|
@@ -34,21 +36,41 @@ export class ErrorBoundary extends React.Component<any, IErrorBoundaryState> {
|
|
|
// Render error message
|
|
// Render error message
|
|
|
return (
|
|
return (
|
|
|
<div className="error">
|
|
<div className="error">
|
|
|
- <h2>Oops, something went wrong!</h2>
|
|
|
|
|
- <pre>
|
|
|
|
|
|
|
+ <div className="error-icon">❌</div>
|
|
|
|
|
+ <h2 className="error-title">哎呀,出了点小问题!</h2>
|
|
|
|
|
+ <p className="error-desc">系统遇到了意外状况,别担心,我们的技术团队已经收到通知。您可以尝试刷新页面或清除数据来解决问题。</p>
|
|
|
|
|
+ <div className="error-actions">
|
|
|
|
|
+ {/* <IconButton
|
|
|
|
|
+ icon={<ResetIcon />}
|
|
|
|
|
+ text="Clear All Data"
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ this.clearAndSaveData();
|
|
|
|
|
+ }}
|
|
|
|
|
+ bordered
|
|
|
|
|
+ /> */}
|
|
|
|
|
+ <Button className="btn" type="primary" onClick={()=>{
|
|
|
|
|
+ location.reload();
|
|
|
|
|
+ }}> 刷新页面</Button>
|
|
|
|
|
+ <Button className="btn btn-outline" onClick={() => {
|
|
|
|
|
+ this.clearAndSaveData();
|
|
|
|
|
+ }}>清除所有数据</Button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ {/* 注释掉错误信息 */}
|
|
|
|
|
+ {/* <pre>
|
|
|
<code>{this.state.error?.toString()}</code>
|
|
<code>{this.state.error?.toString()}</code>
|
|
|
<code>{this.state.info?.componentStack}</code>
|
|
<code>{this.state.info?.componentStack}</code>
|
|
|
- </pre>
|
|
|
|
|
|
|
+ </pre> */}
|
|
|
|
|
|
|
|
<div style={{ display: "flex", justifyContent: "center" }}>
|
|
<div style={{ display: "flex", justifyContent: "center" }}>
|
|
|
- <IconButton
|
|
|
|
|
|
|
+ {/* <IconButton
|
|
|
icon={<ResetIcon />}
|
|
icon={<ResetIcon />}
|
|
|
text="Clear All Data"
|
|
text="Clear All Data"
|
|
|
onClick={() => {
|
|
onClick={() => {
|
|
|
this.clearAndSaveData();
|
|
this.clearAndSaveData();
|
|
|
}}
|
|
}}
|
|
|
bordered
|
|
bordered
|
|
|
- />
|
|
|
|
|
|
|
+ /> */}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
);
|
|
);
|