@dcp-designable/utils
Version:
工具类
50 lines • 2.28 kB
JavaScript
/*
* @Author: 焦质晔
* @Date: 2024-10-15 09:25:04
* @Last Modified by: lishuna
* @Last Modified time: 2025-03-24 13:17:13
*/
import React from 'react';
import './index.less';
import { QmButton, notification } from 'dcp-design-react';
import { CaretDownFilled, CaretUpFilled } from '@ant-design/icons';
export function FetchNotification(msg, props) {
notification[props.type]({
message: props.extraInfo?.title
? `${props.extraInfo.title}出现异常`
: '提示信息',
description: msg,
duration: 5,
className: `app-fetch-notification`,
});
}
const InfoTemplate = (props) => {
const { type = 'error', errType = 'system', message = '', detailMsg = '', errCode = '', extraInfo = {}, openRepair, } = props;
const [expand, setExpand] = React.useState(false);
const expandHandler = (ev) => {
ev.stopPropagation();
setExpand(!expand);
};
const repairHandler = () => {
// ...
};
if (!message) {
return null;
}
return (React.createElement("div", { className: "app-info-template" },
React.createElement("div", null,
errCode && `${errCode}:`,
React.createElement("span", { className: "message" }, message),
detailMsg && (React.createElement(React.Fragment, null,
React.createElement("button", { className: "fold-btn", onClick: expandHandler },
!expand ? '展开' : '收起',
!expand
? (React.createElement(CaretDownFilled, { className: "icon" }))
: (React.createElement(CaretUpFilled, { className: "icon" }))),
React.createElement("div", { className: "detail-msg", style: { display: expand ? '' : 'none' } }, detailMsg)))),
errType === 'system' && extraInfo.title && (React.createElement("div", null, `如有问题请联系:${extraInfo.leader}??'管理员'`)),
openRepair && (React.createElement("div", { className: "footer" },
React.createElement(QmButton, { size: "small", type: "primary", onClick: repairHandler }, "\u62A5\u4FEE")))));
};
export default InfoTemplate;
//# sourceMappingURL=index.js.map