import React from 'react';

import classNames from 'classnames';

import commonStyles from '../common.less';
import styles from './index.less';

export class NoticeContent {
  constructor({
    noticeTitle,
    noticeType,
    noticeContent,
    time
  } = content) {
    this.noticeTitle = noticeTitle;
    this.noticeType = noticeType;
    this.noticeContent = noticeContent;
    this.time = time;
  }
}

const Notice = ({ message, confirmRead }) => {
  let noticeContent = message.infoContent;
  const goPath = (item) => {
    debugger
    confirmRead(false,[message.id]);
    let webPath = item.webPath || "product/notification/HistoryNotice/HistoryNotice";
    window.share.event.emit("listenerMointer", {
      widgetId: widgetID,
      label: '系统公告',
      url: webPath,
    });
  }
  return (
    <div  className={classNames(styles.notice,commonStyles.messageContainer)} title="点击查看详情" onClick={()=> goPath(message)}>
      <div className={commonStyles.title}>
        <span>公告</span>
        <img
          className={commonStyles.confirm}
          title="点击标为已读"
          onClick={() => {
             confirmRead(false,[message.id]);
          }}
          src="https://panda-water.cn/Web4/assets/images/message/%E5%8B%BE%E6%B5%85.png"
        />
      </div>
      <div className={commonStyles.content}>
        <p>
          <i>{noticeContent.noticeType}</i>
          {noticeContent.noticeTitle}
        </p>
        <p>{noticeContent.noticeContent}</p>
        <p className={commonStyles.messageTime}>{message.time}</p>
      </div>
    </div>
  );
};

export default Notice;
