Commit f8eec2ba authored by 杨思琦's avatar 杨思琦

fix: 修改消息弹框

parent 32add8f6
Pipeline #76227 passed with stages
...@@ -5,12 +5,14 @@ import { connect } from 'react-redux'; ...@@ -5,12 +5,14 @@ import { connect } from 'react-redux';
import { FormattedMessage } from '@wisdom-utils/components'; import { FormattedMessage } from '@wisdom-utils/components';
import { history } from '@wisdom-utils/runtime'; import { history } from '@wisdom-utils/runtime';
import { findPathByWidget, isJSON } from '@wisdom-utils/components/lib/AppLayout/helpers'; import { findPathByWidget, isJSON } from '@wisdom-utils/components/lib/AppLayout/helpers';
import classNames from 'classnames';
import Notifier from '../../layouts/AppLayout/notifier/notice'; import Notifier from '../../layouts/AppLayout/notifier/notice';
import NoticeIcon from '../../layouts/AppLayout/notifier'; import NoticeIcon from '../../layouts/AppLayout/notifier';
import { ERR_OK, MESSAGE_TYPE, NEW_MESSAGE } from '../../layouts/AppLayout/notifier/constants'; import { ERR_OK, MESSAGE_TYPE, NEW_MESSAGE } from '../../layouts/AppLayout/notifier/constants';
import service from '../../api/service/notification'; import service from '../../api/service/notification';
import { actionCreators } from '../../containers/App/store'; import { actionCreators } from '../../containers/App/store';
import isProd from '../../utils/env'; import isProd from '../../utils/env';
import { getMessageTypeIcon } from '../../layouts/AppLayout/notifier/utils';
// import NoticeIcon from '../NoticeIcon'; // import NoticeIcon from '../NoticeIcon';
import styles from './index.less'; import styles from './index.less';
...@@ -19,17 +21,27 @@ const { TextArea } = Input; ...@@ -19,17 +21,27 @@ const { TextArea } = Input;
const PlatformModal = ({ platformVisible, handleClosePlatform, handlerMointer, messages = [] }) => { const PlatformModal = ({ platformVisible, handleClosePlatform, handlerMointer, messages = [] }) => {
const [pageIndex, setPageIndex] = useState(1); const [pageIndex, setPageIndex] = useState(1);
const message = useMemo(() => messages[pageIndex - 1], [messages, pageIndex]); const message = useMemo(() => messages[pageIndex - 1], [messages, pageIndex]);
const isAlarm = message.infoClasses === MESSAGE_TYPE.ALARM_TYPE;
const defaultIcon = isAlarm
? 'https://panda-water.com/web4/assets/images/message/报警图标.svg'
: getMessageTypeIcon(message);
const icon = message.webIcon ? `${window.location.origin}/${message.webIcon}` : defaultIcon;
return ( return (
<Modal <Modal
title={<FormattedMessage id="component.noticeIcon.modal.alarm.title" />} title={
isAlarm ? (
<FormattedMessage id="component.noticeIcon.modal.alarm.title" />
) : (
<FormattedMessage id="component.noticeIcon.model.system.title" />
)
}
maskClosable={false} maskClosable={false}
mask={false} mask={false}
maskStyle={{ pointerEvents: 'none' }} maskStyle={{ pointerEvents: 'none' }}
visible={platformVisible} visible={platformVisible}
zIndex={5000} zIndex={5000}
wrapClassName={styles.platformModalWrap} wrapClassName={styles.platformModalWrap}
className={styles.platformModal} className={classNames(styles.platformModal, !isAlarm && styles.platformModalDefault)}
footer={ footer={
<Pagination <Pagination
simple simple
...@@ -45,7 +57,7 @@ const PlatformModal = ({ platformVisible, handleClosePlatform, handlerMointer, m ...@@ -45,7 +57,7 @@ const PlatformModal = ({ platformVisible, handleClosePlatform, handlerMointer, m
> >
<div className={styles.alarmContent}> <div className={styles.alarmContent}>
{/* eslint-disable-next-line jsx-a11y/alt-text */} {/* eslint-disable-next-line jsx-a11y/alt-text */}
<img src="https://panda-water.com/web4/assets/images/message/报警图标.svg" alt="" /> <img src={icon} alt="" />
<div className={styles.content}> <div className={styles.content}>
<div className={styles['content-top']}> <div className={styles['content-top']}>
<a onClick={event => handlerMointer(event, message, true)}> <a onClick={event => handlerMointer(event, message, true)}>
...@@ -53,20 +65,27 @@ const PlatformModal = ({ platformVisible, handleClosePlatform, handlerMointer, m ...@@ -53,20 +65,27 @@ const PlatformModal = ({ platformVisible, handleClosePlatform, handlerMointer, m
</a> </a>
<span title="点击标为已读" onClick={event => handlerMointer(event, message, false)} /> <span title="点击标为已读" onClick={event => handlerMointer(event, message, false)} />
</div> </div>
{isAlarm ? (
<div className={styles['content-mid']}> <>
<b>{message && message.infoContent && message.infoContent.alarmType}</b> <div className={styles['content-mid']}>
{`|${message && message.infoContent && message.infoContent.alarmContent}`} <b>{message && message.infoContent && message.infoContent.alarmType}</b>
</div> {`|${message && message.infoContent && message.infoContent.alarmContent}`}
<div className={styles['content-bottom']}> </div>
<p> <div className={styles['content-bottom']}>
报警值: <p>
<b>{message && message.infoContent && message.infoContent.alarmValue}</b> 报警值:
{' / '} <b>{message && message.infoContent && message.infoContent.alarmValue}</b>
预设值: {' / '}
{message && message.infoContent && message.infoContent.alarmThreshold} 预设值:
</p> {message && message.infoContent && message.infoContent.alarmThreshold}
</div> </p>
</div>
</>
) : (
<div className={styles['content-bottom']}>
<p>{message && message.infoContent && message.infoContent.content}</p>
</div>
)}
<p className={styles['message-time']}>{message && message.time}</p> <p className={styles['message-time']}>{message && message.time}</p>
</div> </div>
</div> </div>
...@@ -110,7 +129,7 @@ class NoticeIconView extends Component { ...@@ -110,7 +129,7 @@ class NoticeIconView extends Component {
} }
get platformMessages() { get platformMessages() {
return this.state.noticeData.filter(item => item.infoLevel === '4' && item.infoClasses === 'alarmType'); return this.state.noticeData.filter(item => item.infoLevel === '4');
} }
async componentDidMount() { async componentDidMount() {
......
...@@ -376,6 +376,13 @@ ...@@ -376,6 +376,13 @@
} }
} }
} }
.platformModalDefault {
:global {
.@{ant-prefix}-modal-header {
background: var(--panda-console-base-header-bg-color);
}
}
}
.videoPopup { .videoPopup {
:global(.@{ant-prefix}-modal-content) { :global(.@{ant-prefix}-modal-content) {
height: 520px; height: 520px;
......
...@@ -513,11 +513,7 @@ class Notifier { ...@@ -513,11 +513,7 @@ class Notifier {
this.renderPopVideo(message); // 显示视频弹窗 this.renderPopVideo(message); // 显示视频弹窗
return; return;
} }
if (message.infoLevel === PLATFORM_LEVEL && message.infoClasses === MESSAGE_TYPE.ALARM_TYPE) { if (message.infoLevel === PLATFORM_LEVEL) {
this.renderPopPlatform(message); // 显示报警弹窗
return;
}
if (message.version === '3.0' && message.infoLevel === PLATFORM_LEVEL) {
this.renderPopPlatform(message); // 显示报警弹窗 this.renderPopPlatform(message); // 显示报警弹窗
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment