NoticeIconView.js 21.1 KB
Newer Older
1
import React, { Component, lazy, Suspense, useMemo, useState } from 'react';
邓晓峰's avatar
邓晓峰 committed
2

3
import { Button, Form, Input, Modal, notification, Pagination } from 'antd';
dengxiaofeng's avatar
dengxiaofeng committed
4
import { connect } from 'react-redux';
崔佳豪's avatar
崔佳豪 committed
5
import { FormattedMessage } from '@wisdom-utils/components';
杨思琦's avatar
杨思琦 committed
6 7
import { history } from '@wisdom-utils/runtime';
import { findPathByWidget, isJSON } from '@wisdom-utils/components/lib/AppLayout/helpers';
杨思琦's avatar
杨思琦 committed
8
import classNames from 'classnames';
9 10
import { appService } from '@/api';
import { getVideoUrl } from '@/utils/utils';
崔佳豪's avatar
崔佳豪 committed
11 12 13
import Notifier from '../../layouts/AppLayout/notifier/notice';
import NoticeIcon from '../../layouts/AppLayout/notifier';
import { ERR_OK, MESSAGE_TYPE, NEW_MESSAGE } from '../../layouts/AppLayout/notifier/constants';
14 15
import service from '../../api/service/notification';
import { actionCreators } from '../../containers/App/store';
邓晓峰's avatar
邓晓峰 committed
16
import isProd from '../../utils/env';
杨思琦's avatar
杨思琦 committed
17
import { getMessageTypeIcon } from '../../layouts/AppLayout/notifier/utils';
邓晓峰's avatar
邓晓峰 committed
18
// import NoticeIcon from '../NoticeIcon';
dengxiaofeng's avatar
dengxiaofeng committed
19
import styles from './index.less';
20
const VideoSliderModal = lazy(() => import('@wisdom-components/videoslidermodal'));
21
const { TextArea } = Input;
22

23 24 25 26 27
const jessibucaObj = {
  operateBtns: {
    screenshot: false,
  },
  loadingText: '视频加载中',
28
  decoder: '/civbase/JessibucaVideo/decoder.js',
29
};
杨思琦's avatar
杨思琦 committed
30
const PlatformModal = ({ platformVisible, handleClosePlatform, handlerMointer, messages = [], type }) => {
31
  const [pageIndex, setPageIndex] = useState(1);
杨思琦's avatar
杨思琦 committed
32
  const message = useMemo(() => messages[pageIndex - 1], [messages, pageIndex]);
杨思琦's avatar
杨思琦 committed
33
  const isAlarm = message.infoClasses === MESSAGE_TYPE.ALARM_TYPE;
杨思琦's avatar
杨思琦 committed
34 35 36 37 38 39
  const isRecover = type === 'recover';
  const defaultIcon =
    isAlarm && !isRecover
      ? 'https://panda-water.com/web4/assets/images/message/报警图标.svg'
      : getMessageTypeIcon(message);
  const icon = message.webIcon && !isRecover ? `${window.location.origin}/${message.webIcon}` : defaultIcon;
40 41
  return (
    <Modal
杨思琦's avatar
杨思琦 committed
42 43
      title={
        isAlarm ? (
杨思琦's avatar
杨思琦 committed
44 45 46 47 48
          isRecover ? (
            '报警恢复'
          ) : (
            <FormattedMessage id="component.noticeIcon.modal.alarm.title" />
          )
杨思琦's avatar
杨思琦 committed
49 50 51 52
        ) : (
          <FormattedMessage id="component.noticeIcon.model.system.title" />
        )
      }
53
      maskClosable={false}
崔佳豪's avatar
崔佳豪 committed
54
      mask={false}
杨思琦's avatar
杨思琦 committed
55
      maskStyle={{ pointerEvents: 'none' }}
56 57
      visible={platformVisible}
      zIndex={5000}
崔佳豪's avatar
崔佳豪 committed
58
      wrapClassName={styles.platformModalWrap}
杨思琦's avatar
杨思琦 committed
59 60 61 62 63
      className={classNames(
        styles.platformModal,
        !isAlarm && styles.platformModalDefault,
        isRecover && styles.platformModalRecover,
      )}
杨思琦's avatar
杨思琦 committed
64 65 66 67 68 69 70 71 72 73
      footer={
        <Pagination
          simple
          total={messages.length}
          pageSize={1}
          pageIndex={pageIndex}
          showSizeChanger={false}
          onChange={(page, pageSize) => setPageIndex(page)}
        />
      }
74 75 76 77 78
      onCancel={() => handleClosePlatform()}
      centered
    >
      <div className={styles.alarmContent}>
        {/* eslint-disable-next-line jsx-a11y/alt-text */}
杨思琦's avatar
杨思琦 committed
79
        <img src={icon} alt="" />
80 81
        <div className={styles.content}>
          <div className={styles['content-top']}>
杨思琦's avatar
杨思琦 committed
82 83 84 85 86 87 88 89
            <div className={styles['content-top-title']}>
              <a
                onClick={event => handlerMointer(event, message, true)}
                title={message && message.infoContent && message.infoContent.title}
              >
                {message && message.infoContent && `${message.infoContent.title}  ${message.infoContent.title}`}
              </a>
            </div>
杨思琦's avatar
杨思琦 committed
90
            <span title="点击标为已读" onClick={event => handlerMointer(event, message, false)} />
91
          </div>
杨思琦's avatar
杨思琦 committed
92 93 94
          {isAlarm ? (
            <>
              <div className={styles['content-mid']}>
杨思琦's avatar
杨思琦 committed
95 96 97
                <b className={classNames(isRecover && styles['content-mid-recover'])}>
                  {message && message.infoContent && message.infoContent.alarmType}
                </b>
杨思琦's avatar
杨思琦 committed
98 99 100 101 102
                {`|${message && message.infoContent && message.infoContent.alarmContent}`}
              </div>
              <div className={styles['content-bottom']}>
                <p>
                  报警值:
杨思琦's avatar
杨思琦 committed
103 104 105 106 107 108 109 110 111 112
                  <b className={classNames(isRecover && styles['content-bottom-recover'])}>
                    {message && message.infoContent && message.infoContent.alarmValue}
                  </b>
                  {!isRecover && (
                    <>
                      {' / '}
                      预设值:
                      {message && message.infoContent && message.infoContent.alarmThreshold}
                    </>
                  )}
杨思琦's avatar
杨思琦 committed
113 114 115 116 117 118 119 120
                </p>
              </div>
            </>
          ) : (
            <div className={styles['content-bottom']}>
              <p>{message && message.infoContent && message.infoContent.content}</p>
            </div>
          )}
崔佳豪's avatar
崔佳豪 committed
121
          <p className={styles['message-time']}>{message && message.time}</p>
122 123 124
        </div>
      </div>
    </Modal>
杨思琦's avatar
杨思琦 committed
125 126
  );
};
127

128
/* eslint-disable */
dengxiaofeng's avatar
dengxiaofeng committed
129
class NoticeIconView extends Component {
邓晓峰's avatar
邓晓峰 committed
130
  constructor(props) {
叶飞's avatar
叶飞 committed
131 132 133 134
    super(props);
    this.state = {
      count: 0,
      noticeData: [],
135
      platformVisible: false,
杨思琦's avatar
杨思琦 committed
136
      platformRecoverVisible: false,
邓晓峰's avatar
邓晓峰 committed
137
      videoVisible: false,
邓晓峰's avatar
邓晓峰 committed
138
      // eslint-disable-next-line react/no-unused-state
邓晓峰's avatar
邓晓峰 committed
139
      noticeVisible: false,
邓晓峰's avatar
邓晓峰 committed
140
      // eslint-disable-next-line react/no-unused-state
邓晓峰's avatar
邓晓峰 committed
141
      renderVideo: null,
邓晓峰's avatar
邓晓峰 committed
142 143
      // eslint-disable-next-line react/no-unused-state
      initVisible: false,
144
      sysTopVisible: false,
邓晓峰's avatar
邓晓峰 committed
145 146 147
      sysMessage: {},
      alarmMessage: {},
      videoMessage: {},
148
      popupVisible: false,
叶飞's avatar
叶飞 committed
149
    };
邓晓峰's avatar
邓晓峰 committed
150
    // this.renderPlatform
151 152 153 154
    try {
      window.share && window.share.event && window.share.event.removeAllListeners('reloadNotice');
    } catch (error) {
    }
邓晓峰's avatar
邓晓峰 committed
155 156 157 158
    this.notifier = new Notifier(
      this.props.global.userInfo,
      this.renderVideo,
      this.renderPlatform,
159
      this.renderSysPlatform,
邓晓峰's avatar
邓晓峰 committed
160
      this.props,
邓晓峰's avatar
邓晓峰 committed
161
    );
叶飞's avatar
叶飞 committed
162 163
  }

164
  get platformMessages() {
杨思琦's avatar
杨思琦 committed
165 166 167 168 169
    return this.state.noticeData.filter(item => item.infoLevel === '4' && !item?.infoContent?.alarmState);
  }

  get platformRecoverMessages() {
    return this.state.noticeData.filter(item => item.infoLevel === '4' && item?.infoContent?.alarmState === 1 );
170 171
  }

叶飞's avatar
叶飞 committed
172
  async componentDidMount() {
邓晓峰's avatar
邓晓峰 committed
173
    this.notifier.subscribe(NEW_MESSAGE, this.onNewMessage.bind(this));
叶飞's avatar
叶飞 committed
174
    this.notifier.start();
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
    window.share && window.share.event && window.share.event.on('reloadNotice', () => {
      try {
        // eslint-disable-next-line no-unused-expressions
        this.notifier && this.notifier.stop();
      } catch (error) {
        // eslint-disable-next-line no-empty
      } finally {
        this.notifier = new Notifier(
          this.props.global.userInfo,
          this.renderVideo,
          this.renderPlatform,
          this.renderSysPlatform,
          this.props,
        );
        this.notifier.subscribe(NEW_MESSAGE, this.onNewMessage.bind(this));
        this.notifier.start();
      }
    });
叶飞's avatar
叶飞 committed
193
  }
叶飞's avatar
叶飞 committed
194

邓晓峰's avatar
邓晓峰 committed
195
  componentWillUnmount() {
邓晓峰's avatar
邓晓峰 committed
196
    try {
邓晓峰's avatar
邓晓峰 committed
197
      // eslint-disable-next-line no-unused-expressions
邓晓峰's avatar
邓晓峰 committed
198
      this.notifier && this.notifier.stop();
邓晓峰's avatar
邓晓峰 committed
199 200 201
    } catch (error) {
      // eslint-disable-next-line no-empty
    } finally {
202
      window.share.event.removeAllListeners('reloadNotice');
邓晓峰's avatar
邓晓峰 committed
203
    }
邓晓峰's avatar
邓晓峰 committed
204
  }
dengxiaofeng's avatar
dengxiaofeng committed
205

206
  onPopupVisibleChange = value => {
杨思琦's avatar
杨思琦 committed
207 208 209 210 211
    if(value && this.notifier?.loadHisMessages) {
      this.notifier.loadHisMessages(this.notifier.currentPageIndex || 1, this.notifier.currentPageSize || 10).then(()=>{
        this.setState({
          popupVisible: value,
          platformVisible: this.platformMessages.length > 0 ? true : this.state.platformVisible,
杨思琦's avatar
杨思琦 committed
212
          platformRecoverVisible: this.platformRecoverMessages.length > 0 ? true : this.state.platformRecoverVisible,
杨思琦's avatar
杨思琦 committed
213 214 215 216 217 218 219 220
          sysTopVisible: false,
          videoVisible: false,
        });
      });
    } else {
      this.setState({
        popupVisible: value,
        platformVisible: this.platformMessages.length > 0 ? true : this.state.platformVisible,
杨思琦's avatar
杨思琦 committed
221
        platformRecoverVisible: this.platformRecoverMessages.length > 0 ? true : this.state.platformRecoverVisible,
杨思琦's avatar
杨思琦 committed
222 223 224 225
        sysTopVisible: false,
        videoVisible: false,
      });
    }
226 227
  };

叶飞's avatar
叶飞 committed
228 229
  onNewMessage = messages => {
    this.setState({
邓晓峰's avatar
邓晓峰 committed
230 231
      count: messages.totalCount,
      noticeData: messages.messages,
邓晓峰's avatar
邓晓峰 committed
232
    });
叶飞's avatar
叶飞 committed
233 234
  };

邓晓峰's avatar
邓晓峰 committed
235
  modalVisible = () => {
邓晓峰's avatar
邓晓峰 committed
236
    const data = this.state.noticeData.filter(item => item.infoLevel === '4');
邓晓峰's avatar
邓晓峰 committed
237

邓晓峰's avatar
邓晓峰 committed
238 239
    return data.length > 0;
  };
邓晓峰's avatar
邓晓峰 committed
240 241

  handleCloseVideo = () => {
邓晓峰's avatar
邓晓峰 committed
242 243 244
    this.setState({ videoVisible: false });
    this.notifier.destoryVideo();
  };
邓晓峰's avatar
邓晓峰 committed
245

邓晓峰's avatar
邓晓峰 committed
246
  handleClosePlatform = event => {
杨思琦's avatar
杨思琦 committed
247
    this.setState({ platformVisible: false, platformRecoverVisible: false, });
邓晓峰's avatar
邓晓峰 committed
248
  };
邓晓峰's avatar
邓晓峰 committed
249

崔佳豪's avatar
崔佳豪 committed
250
  // 显示报警弹窗
邓晓峰's avatar
邓晓峰 committed
251
  renderPlatform = message => {
杨思琦's avatar
杨思琦 committed
252 253 254
    const { infoContent = {} } = message;
    const { alarmState = 0 } = infoContent;
    if (!alarmState && !this.state.platformVisible) {
255 256
      this.setState({
        platformVisible: true,
杨思琦's avatar
杨思琦 committed
257 258 259 260 261 262
        platformRecoverVisible: false
      })
    } else if (alarmState && !this.state.platformRecoverVisible) {
      this.setState({
        platformVisible: false,
        platformRecoverVisible: true,
263 264
      })
    }
邓晓峰's avatar
邓晓峰 committed
265 266
  };

267
  renderVideo = async message => {
崔佳豪's avatar
崔佳豪 committed
268
    try {
269 270 271 272
      this.setState({
        videoVisible: true,
      });
      const { props } = this;
邓晓峰's avatar
邓晓峰 committed
273

274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
      if(!message.infoContent?.deviceCode&&!message.infoContent?.DeviceCode)return;
      const {data} = await appService.GetVideoPlayListByDeviceCode({
        UserID: 1,
        DeviceCode: message.infoContent?.deviceCode || message.infoContent?.DeviceCode,
        _site:props.global.userInfo.site || '',
      })
      const dataList = []
      if(Array.isArray(data)){
        data.forEach((list) => {
          dataList.push({
            id: list.vmS_DeviceID,
            name: list.channelName,
            protocol: list.protocol,
            username: list.username,
            password: list.password,
            dataRate: 'Sub',
            pandavmsHost: getVideoUrl(),
            gateway: true,
            address: list.address,
            channel: list.channelID * 1,
          });
        });
      }
邓晓峰's avatar
邓晓峰 committed
297

298 299 300
      this.setState({
        videoMessage: {
          list:dataList,
301
          title:message.infoContent?.messContent || ''
302 303 304 305 306 307
        },
      });
            
    } catch (error) {
        
    }
邓晓峰's avatar
邓晓峰 committed
308
  };
邓晓峰's avatar
邓晓峰 committed
309

310 311 312 313
  // 消息弹窗Footer
  renderNotifierFooter = () => {
    const toNotifications = e => {
      e.stopPropagation();
崔佳豪's avatar
崔佳豪 committed
314
      history.push && history.push('/civbase/system/notifications')
315 316 317
    }
    return (
      <div className={styles.notificationFoter}>
崔佳豪's avatar
崔佳豪 committed
318
        <Button type='link' onClick={toNotifications}>查看通知消息</Button>
319 320 321 322
      </div>
    )
  }

邓晓峰's avatar
邓晓峰 committed
323 324
  handlerOptions = value => {
    // eslint-disable-next-line no-undef
邓晓峰's avatar
邓晓峰 committed
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
    service
      .postAddOptions({
        UserName: this.props.global.userInfo.fullName,
        Type: '其他问题',
        System: '熊猫智联',
        Content: value.content,
        Phone: value.phone,
        UserID: this.props.global.userInfo.OID,
        Picture: '',
      })
      .then(res => {
        if (res.statusCode === ERR_OK) {
          this.setState({
            sysTopVisible: false,
          });
        }
      });
邓晓峰's avatar
邓晓峰 committed
342 343
  };

344
  renderSysPlatform = message => {
崔佳豪's avatar
崔佳豪 committed
345
    try {
346
    const noticeContent =
邓晓峰's avatar
邓晓峰 committed
347 348
      this.props.global.mqtt_mess.MessageLevel === '2.0' &&
      isJSON(message.infoContent)
349 350 351 352 353
        ? JSON.parse(message.infoContent)
        : message.infoContent;
    this.setState({
      sysTopVisible: true,
      platformVisible: false,
杨思琦's avatar
杨思琦 committed
354
      platformRecoverVisible: false,
邓晓峰's avatar
邓晓峰 committed
355 356 357 358 359
      videoVisible: false,
      sysMessage: {
        message,
        noticeContent,
      },
360
    });
崔佳豪's avatar
崔佳豪 committed
361
    } catch (error) {}
邓晓峰's avatar
邓晓峰 committed
362
  };
邓晓峰's avatar
邓晓峰 committed
363

邓晓峰's avatar
邓晓峰 committed
364 365
  handlerMointer = (event, item, detail) => {
    event.stopPropagation();
邓晓峰's avatar
邓晓峰 committed
366
    this.notifier.confirmRead(false, [item.id]);
邓晓峰's avatar
邓晓峰 committed
367 368
    if (detail) {
      const widgetID = 'widget_city_综合运营_管网监控_实时监控_报警监控';
邓晓峰's avatar
邓晓峰 committed
369
      const webPath = 'product/scada/AlertMonitoring/AlertMonitoring';
邓晓峰's avatar
邓晓峰 committed
370 371 372 373 374 375
      const widget = findPathByWidget(
        'productex/water/IOTMonitor/RealTimeAlarm/RealTimeAlarm',
        this.props.global.widgets,
        '',
        'url',
      );
邓晓峰's avatar
邓晓峰 committed
376
      window.share.event.emit('listenerMointer', {
邓晓峰's avatar
邓晓峰 committed
377
        widgetId: widgetID,
邓晓峰's avatar
邓晓峰 committed
378
        label: '实时报警',
邓晓峰's avatar
邓晓峰 committed
379
        url: widget.url || webPath,
邓晓峰's avatar
邓晓峰 committed
380 381
      });
    }
邓晓峰's avatar
邓晓峰 committed
382
    this.setState({
邓晓峰's avatar
邓晓峰 committed
383
      platformVisible: false,
杨思琦's avatar
杨思琦 committed
384
      platformRecoverVisible: false,
邓晓峰's avatar
邓晓峰 committed
385 386
    });
  };
邓晓峰's avatar
邓晓峰 committed
387

邓晓峰's avatar
邓晓峰 committed
388
  handlerSysDetail = message => {
邓晓峰's avatar
邓晓峰 committed
389
    this.setState({
邓晓峰's avatar
邓晓峰 committed
390
      sysTopVisible: true,
邓晓峰's avatar
邓晓峰 committed
391
    });
邓晓峰's avatar
邓晓峰 committed
392
    this.renderSysPlatform(message);
邓晓峰's avatar
邓晓峰 committed
393
  };
邓晓峰's avatar
邓晓峰 committed
394

杨思琦's avatar
杨思琦 committed
395
  handlerUnknowDetail = (message, product, type) => {
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423
    // 需要有跳转路径
    if (!message.webPath)
      return notification.info({ message: '提示', duration: 3, description: '未配置跳转路径' });

    const parsePath = url => {
      const [path, param = ''] = url.split('|');
      let params = param.split('&').reduce((pre, item) => {
        if(!item) return pre;
        const [key, value] = item.split('=');
        pre[key] = value;
        return pre;
      }, {});
      return [path, param, params];
    }
    const [path,,params] = parsePath(message.webPath);
    // 需要有widget参数
    if (!params.widget)
      return notification.info({ message: '提示', duration: 3, description: '未配置跳转路径' });
    // 根据widget匹配菜单
    const menu = (this.props.flatMenu || []).find(item => item.params && item.params.widget === params.widget);
    // const menu = (this.props.flatMenu || []).find(item => item.path.indexOf(path) > -1);
    let targetMenuPath = menu ? menu.path.replace(/^\//, '') : '';
    if (targetMenuPath == '') {
      notification.info({ message: '提示', duration: 3, description: '你没有跳转菜单权限,请联系管理员添加权限' });
      return;
    }
    params._source = '消息通知';
    params._target = message.webPath;
杨思琦's avatar
杨思琦 committed
424
    if (product) {
杨思琦's avatar
杨思琦 committed
425 426
      if (/civweb4/.test(targetMenuPath)) return true;
    }
427
    sessionStorage.setItem('routerParams', JSON.stringify(params));
杨思琦's avatar
杨思琦 committed
428
    window.history.pushState(params, '', `/civbase/${targetMenuPath}${type ? '' : `?v=${Date.now()}`}`);
429 430
  }

dengxiaofeng's avatar
dengxiaofeng committed
431 432
  render() {
    return (
邓晓峰's avatar
邓晓峰 committed
433 434 435 436
      <>
        <NoticeIcon
          className={styles.action}
          count={this.state.count}
叶飞's avatar
叶飞 committed
437
          confirmRead={this.notifier.confirmRead}
邓晓峰's avatar
邓晓峰 committed
438
          config={this.props.global}
邓晓峰's avatar
邓晓峰 committed
439
          bell={this.props.bell}
440
          renderFooter={this.renderNotifierFooter}
441 442
          popupVisible={this.state.popupVisible}
          onPopupVisibleChange={this.onPopupVisibleChange}
邓晓峰's avatar
邓晓峰 committed
443 444 445
        >
          <NoticeIcon.Tab
            list={this.state.noticeData}
446
            title={<FormattedMessage id='component.noticeIcon.title'/>}
邓晓峰's avatar
邓晓峰 committed
447
            emptyText={<FormattedMessage id='component.noticeIcon.allClear'/>}
邓晓峰's avatar
邓晓峰 committed
448
            confirmRead={this.notifier.confirmRead}
邓晓峰's avatar
邓晓峰 committed
449
            handlerSysDetail={this.handlerSysDetail}
450
            handlerUnknowDetail={this.handlerUnknowDetail.bind(this)}
邓晓峰's avatar
邓晓峰 committed
451
            loadMore={this.notifier.loadMore}
邓晓峰's avatar
邓晓峰 committed
452
            hasMore={this.notifier.hasMore}
邓晓峰's avatar
邓晓峰 committed
453 454
          />
        </NoticeIcon>
455
        {
杨思琦's avatar
杨思琦 committed
456
          this.state.platformVisible && this.platformMessages.length > 0 && (
457 458 459 460 461 462 463 464
            <PlatformModal
              platformVisible={this.state.platformVisible}
              handleClosePlatform={this.handleClosePlatform}
              messages={this.platformMessages}
              handlerMointer={this.handlerMointer}
            />
          )
        }
邓晓峰's avatar
邓晓峰 committed
465

杨思琦's avatar
杨思琦 committed
466 467 468 469 470 471 472 473 474 475 476 477
        {
          this.state.platformRecoverVisible && this.platformRecoverMessages.length > 0 && (
            <PlatformModal
              platformVisible={this.state.platformRecoverVisible}
              handleClosePlatform={this.handleClosePlatform}
              messages={this.platformRecoverMessages}
              handlerMointer={this.handlerMointer}
              type={'recover'}
            />
          )
        }

478
        {this.state.videoVisible && this.state.videoMessage?.list?.length && (
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493
          <Suspense fallback={<></>}>
            <VideoSliderModal
              modalInfo={{
                title: this.state.videoMessage.title,
                open: this.state.videoVisible,
                visible:this.state.videoVisible,
                className:'noticeVideoModal',
                onCancel: () => {
                  this.handleCloseVideo()
                },
              }}
              videoInfos={this.state.videoMessage.list}
              JessibucaObj={jessibucaObj}
            />
          </Suspense>
邓晓峰's avatar
邓晓峰 committed
494
        )}
495

496
        {this.state.sysTopVisible && this.state.sysMessage && !this.props.global.isNewYear && (
邓晓峰's avatar
邓晓峰 committed
497
          <Modal
498
            title={<FormattedMessage id='component.noticeIcon.model.system.title'/>}
邓晓峰's avatar
邓晓峰 committed
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541
            visible
            zIndex={8000}
            className={styles.noticeModal}
            onCancel={() => this.setState({ sysTopVisible: false })}
            footer={null}
            centered
          >
            <div className={styles.alarmContent}>
              <div className={styles.title}>
                {this.state.sysMessage.noticeContent.noticeTitle}
              </div>
              <div
                className={styles.content}
                dangerouslySetInnerHTML={{
                  __html: this.state.sysMessage.noticeContent.noticeContent,
                }}
              />
              <div className={styles.time}>
                {this.state.sysMessage.message.time}
              </div>
              <Form formLayout="vertical" onFinish={this.handlerOptions}>
                <div>1、您还有其他建议和反馈吗?</div>
                <Form.Item
                  name="content"
                  rules={[{ required: true, message: '请填写反馈内容' }]}
                >
                  <Input />
                </Form.Item>
                <div>
                  2、怎么联系您(您填写了建议和反馈,也请帮忙填写下您的联系方式,以便我们有不清楚的问题时,能与您联系沟通)
                </div>
                <Form.Item name="phone">
                  <Input />
                </Form.Item>
                <Form.Item>
                  <Button htmlType="submit" type="primary">
                    提交
                  </Button>
                </Form.Item>
              </Form>
            </div>
          </Modal>
        )}
542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598

        {this.state.sysTopVisible &&
          this.state.sysMessage &&
          this.props.global.isNewYear && (
            <Modal
              visible
              zIndex={9000}
              footer={null}
              centered
              className={styles.newYearMessage}
              width={876}
            >
            <div className={styles['topPopup-body']}>
              <div className={styles['topPopup-title']}>
                <img src="https://panda-water.com/web4/assets/images/message/%E5%85%B3%E9%97%AD%E6%8C%89%E9%92%AE.png" onClick={() => this.setState({ sysTopVisible: false })}/>
                <div className={styles['newYearTitle']}>
                  <img src="https://panda-water.com/web4/assets/images/message/%E7%83%9F%E8%8A%B1%E5%B7%A6.png"/>
                  <span title={this.state.sysMessage.noticeContent.noticeTitle}>{this.state.sysMessage.noticeContent.noticeTitle}</span>
                  <img src="https://panda-water.com/web4/assets/images/message/%E7%83%9F%E8%8A%B1%E5%8F%B3.png"/>
                </div>
              </div>
              <div className={styles['topPopup-content']}>
                <div className={styles['content']}>
                  <div className={styles['content-mid']}  dangerouslySetInnerHTML={{
                    __html: this.state.sysMessage.noticeContent.noticeContent,
                  }}></div>
                  <div className={styles['content-bottom']}>
                    <span className={styles['message-time']}>{this.state.sysMessage.message.time}</span>
                  </div>
                </div>
              </div>
              <div className={styles['feedbackBox']}>
                <Form layout="vertical" onFinish={this.handlerOptions}>
                  <div className={styles['question']}>您还有其他建议和反馈吗?</div>
                  <Form.Item
                    name="content"
                    rules={[{ required: true, message: '请填写反馈内容' }]}
                  >
                    <TextArea placeholder="请输入您的建议和反馈" rows={3}/>
                  </Form.Item>
                  <div className={styles['question']}>
                    请填写您的联系方式,以便我们及时与您沟通!
                  </div>
                  <div className={styles['horiztion']}>
                    <Form.Item name="phone">
                      <Input autoComplete='off' placeholder="请输入您的邮箱或者电话号码"/>
                    </Form.Item>
                    <Form.Item>
                      <Button htmlType="submit" type="primary"> </Button>
                    </Form.Item>
                  </div>

                </Form>
              </div>
            </div>
          </Modal>
        )}
邓晓峰's avatar
邓晓峰 committed
599
      </>
dengxiaofeng's avatar
dengxiaofeng committed
600 601 602 603
    );
  }
}

邓晓峰's avatar
邓晓峰 committed
604 605
const mapStateToProps = state => ({
  global: state.getIn(['global', 'globalConfig']),
606
  flatMenu: state.getIn(['global', 'flatMenu']),
邓晓峰's avatar
邓晓峰 committed
607
});
叶飞's avatar
叶飞 committed
608

邓晓峰's avatar
邓晓峰 committed
609 610 611 612 613
const mapDispatchToProps = dispatch => ({
  updateConfig(config) {
    dispatch(actionCreators.getConfig(config));
  },
});
邓晓峰's avatar
邓晓峰 committed
614

邓晓峰's avatar
邓晓峰 committed
615 616
export default connect(
  mapStateToProps,
邓晓峰's avatar
邓晓峰 committed
617
  mapDispatchToProps,
邓晓峰's avatar
邓晓峰 committed
618
)(NoticeIconView);