Commit 5551b755 authored by 杨思琦's avatar 杨思琦

fix: 消息通知修改

parent a62802ee
Pipeline #62234 passed with stages
...@@ -3,81 +3,65 @@ import React, { Component, useMemo, useState } from 'react'; ...@@ -3,81 +3,65 @@ import React, { Component, useMemo, useState } from 'react';
import { Button, Form, Input, Modal, notification, Pagination } from 'antd'; import { Button, Form, Input, Modal, notification, Pagination } from 'antd';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { FormattedMessage } from '@wisdom-utils/components'; import { FormattedMessage } from '@wisdom-utils/components';
import { history } from '@wisdom-utils/runtime';
import { findPathByWidget, isJSON } from '@wisdom-utils/components/lib/AppLayout/helpers';
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 { findPathByWidget, isJSON } from '@wisdom-utils/components/lib/AppLayout/helpers';
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 NoticeIcon from '../NoticeIcon'; // import NoticeIcon from '../NoticeIcon';
import styles from './index.less'; import styles from './index.less';
import { history } from '@wisdom-utils/runtime';
const { TextArea } = Input; 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(() => { const message = useMemo(() => messages[pageIndex - 1], [messages, pageIndex]);
return messages[pageIndex-1];
}, [messages, pageIndex]);
return ( return (
<Modal <Modal
title={<FormattedMessage id='component.noticeIcon.modal.alarm.title'/>} title={<FormattedMessage id="component.noticeIcon.modal.alarm.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={styles.platformModal}
footer={<Pagination footer={
simple <Pagination
total={messages.length} simple
pageSize={1} total={messages.length}
pageIndex={pageIndex} pageSize={1}
showSizeChanger={false} pageIndex={pageIndex}
onChange={(page, pageSize) => setPageIndex(page)} showSizeChanger={false}
/>} onChange={(page, pageSize) => setPageIndex(page)}
/>
}
onCancel={() => handleClosePlatform()} onCancel={() => handleClosePlatform()}
centered centered
> >
<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 <img src="https://panda-water.com/web4/assets/images/message/报警图标.svg" alt="" />
src="https://panda-water.com/web4/assets/images/message/报警图标.svg"
alt=""
/>
<div className={styles.content}> <div className={styles.content}>
<div className={styles['content-top']}> <div className={styles['content-top']}>
<a <a onClick={event => handlerMointer(event, message, true)}>
onClick={event =>
handlerMointer(event, message, true,)
}
>
{message && message.infoContent && message.infoContent.title} {message && message.infoContent && message.infoContent.title}
</a> </a>
<span <span title="点击标为已读" onClick={event => handlerMointer(event, message, false)} />
title={<FormattedMessage id='component.noticeIcon.messsage.statused'/>}
onClick={event =>
handlerMointer(event, message, false,)
}
/>
</div> </div>
<div className={styles['content-mid']}> <div className={styles['content-mid']}>
<b> <b>{message && message.infoContent && message.infoContent.alarmType}</b>
{message && message.infoContent && message.infoContent.alarmType}
</b>
{`|${message && message.infoContent && message.infoContent.alarmContent}`} {`|${message && message.infoContent && message.infoContent.alarmContent}`}
</div> </div>
<div className={styles['content-bottom']}> <div className={styles['content-bottom']}>
<p> <p>
报警值: 报警值:
<b> <b>{message && message.infoContent && message.infoContent.alarmValue}</b>
{message && message.infoContent && message.infoContent.alarmValue}
</b>
{' / '} {' / '}
预设值: 预设值:
{message && message.infoContent && message.infoContent.alarmThreshold} {message && message.infoContent && message.infoContent.alarmThreshold}
...@@ -87,9 +71,8 @@ const PlatformModal = ({ platformVisible, handleClosePlatform, handlerMointer, m ...@@ -87,9 +71,8 @@ const PlatformModal = ({ platformVisible, handleClosePlatform, handlerMointer, m
</div> </div>
</div> </div>
</Modal> </Modal>
) );
} };
/* eslint-disable */ /* eslint-disable */
class NoticeIconView extends Component { class NoticeIconView extends Component {
...@@ -389,7 +372,7 @@ class NoticeIconView extends Component { ...@@ -389,7 +372,7 @@ class NoticeIconView extends Component {
/> />
</NoticeIcon> </NoticeIcon>
{ {
this.state.platformVisible && ( this.state.platformVisible && this.platformMessages.length > 0 && (
<PlatformModal <PlatformModal
platformVisible={this.state.platformVisible} platformVisible={this.state.platformVisible}
handleClosePlatform={this.handleClosePlatform} handleClosePlatform={this.handleClosePlatform}
......
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