From 12d561aea1143eae863d80edebf8b4cbe3cc85df Mon Sep 17 00:00:00 2001
From: liuwh <hugeinfo123>
Date: Mon, 06 Apr 2020 19:05:16 +0800
Subject: [PATCH] 1
---
src/components/common/NotifyList/index.jsx | 38 +++++++++++++++++++++++++++++---------
1 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/src/components/common/NotifyList/index.jsx b/src/components/common/NotifyList/index.jsx
index 4c7b328..665d4d0 100644
--- a/src/components/common/NotifyList/index.jsx
+++ b/src/components/common/NotifyList/index.jsx
@@ -7,6 +7,7 @@
/** 通知列表 */
import React, { ReactNode, ReactEventHandler, Component } from 'react';
import { Alert } from 'antd';
+import fetch from '../../../api/request';
import './index.scss';
@@ -16,30 +17,49 @@
this.config = {
};
this.state = {
+ content: ''
};
}
- componentWillMount() { }
+ componentWillMount() {
+ fetch({
+ url: `api/document/getNewNotice`
+ }).then(res => {
+ console.log('res', res);
+ this.setState({
+ content: res.documentContent || ''
+ })
+ })
+ }
componentDidMount() { }
+ onClick = () => {
+ this.props.history.push({ pathname: "/index/workbench/announcement" });
+ }
+
renderDom = () => {
+ let { content } = this.state;
return <div className="notify-list-main-dom">
<span className="notify-list-main-dom-msg">最新通知:公司本部从XX时间开始,调整省略很长很长的内容调整省略很长很长的内容公司本部从XX时间开始,调整省略很长很长的内容调整省略很长很长的内容公司本部从XX时间开始,调整省略很长很长的内容调整省略很长很长的内容</span>
- <span className="notify-list-main-dom-fuc">[查看全部]</span>
+ <span className="notify-list-main-dom-fuc" onClick={this.onClick}>[查看全部]</span>
</div>
}
render() {
+ let { content } = this.state;
+
return (
<div className="notify-list-main">
- <Alert
- // message="Warning Text Warning Text Warning TextW arning Text Warning Text Warning TextWarning Text"
- message={this.renderDom()}
- type="warning"
- closable={false}
- // onClose={onClose}
- />
+ {
+ content &&
+ <Alert
+ // message="Warning Text Warning Text Warning TextW arning Text Warning Text Warning TextWarning Text"
+ message={this.renderDom()}
+ type="warning"
+ closable={false}
+ />
+ }
</div>
)
}
--
Gitblit v1.8.0