上传公告修改

This commit is contained in:
何童崇 2021-09-17 14:13:59 +08:00
parent 4cf8357463
commit 15b63be594
3 changed files with 23 additions and 18 deletions

View File

@ -6,10 +6,10 @@ import cookie from 'react-cookies';
let actionUrl = '';
if (window.location.href.indexOf('localhost') > -1) {
// actionUrl='https://taskapi.osredm.com';
actionUrl='http://192.168.31.47:8081';
actionUrl='https://taskapi.osredm.com';
// actionUrl='http://192.168.31.47:8081';
}else if(window.location.href.indexOf('192.168.31.48') > -1){
actionUrl="http://117.50.100.12:8008";
actionUrl='https://taskapi.osredm.com';
}else if(window.location.href.indexOf('noticeweb.osredm') > -1){
actionUrl="https://taskapi.osredm.com";
}else if(window.location.href.indexOf('https://osredm.com')>-1){

View File

@ -11,12 +11,14 @@ for (const item of noticeType) {
}
export default Form.create()(({ match, history, showNotification, form }) => {
const { getFieldDecorator, validateFields, setFieldsValue, } = form;
const { getFieldDecorator, validateFields, setFieldsValue } = form;
const [reload, setReload] = useState(0);
const [noticeData, setNoticeData] = useState({});
const [visible, setVisible] = useState(false);
const [readerName,setReaderName]=useState('');
const id = match.params.noticeId;
useEffect(() => {
@ -34,7 +36,7 @@ export default Form.create()(({ match, history, showNotification, form }) => {
const helper = useCallback(
(label, name, rules, widget) => (
<Form.Item label={label}>
{getFieldDecorator(name, { rules, validateFirst: true })(widget)}
{getFieldDecorator(name, { rules, validateFirst: true ,getValueFromEvent: e=>e.target.value.replace(/(^\s*)|(\s*$)/g, "") })(widget)}
</Form.Item>
),
[]
@ -51,13 +53,14 @@ export default Form.create()(({ match, history, showNotification, form }) => {
setVisible(false);
setReload(Math.random());
} else {
res && Modal.error({content:res.message});
res && Modal.error({ content: res.message });
}
})
}
});
}
return (
<div className="centerbox notice-detail">
<div className="head-navigation">
@ -85,6 +88,17 @@ export default Form.create()(({ match, history, showNotification, form }) => {
</div>
</div>
{
noticeData.contactInfo ? <React.Fragment>
<div className="notice-content-title"><Icon type="caret-right" />联系方式</div>
<div className="content-secret" dangerouslySetInnerHTML={{ __html: noticeData.contactInfo && noticeData.contactInfo.replace(/\n/g, '</br>') }}>
</div>
{
noticeData.blockedView && <Button type="primary" onClick={() => { setVisible(true) }}>申请查看加密内容</Button>
}
</React.Fragment> : ''
}
{
noticeData.fileDownloadPath &&
@ -98,16 +112,7 @@ export default Form.create()(({ match, history, showNotification, form }) => {
</p>
</React.Fragment>
}
{
noticeData.isSecret && <React.Fragment>
<div className="notice-content-title"><Icon type="caret-right" />加密内容</div>
<div className="content-secret" dangerouslySetInnerHTML={{ __html: noticeData.contactInfo && noticeData.contactInfo.replace(/\n/g, '</br>') }}>
</div>
{
noticeData.blockedView && <Button type="primary" onClick={() => { setVisible(true) }}>申请查看加密内容</Button>
}
</React.Fragment>
}
</div>
</div>

View File

@ -57,8 +57,7 @@
}
.content-secret{
margin: 1.25rem 0;
min-height: 2em;
min-height: 2em;
}
.notice-content-title {
@ -71,6 +70,7 @@
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2rem !important;
padding: 0 1rem;
background: #f9f9f9;
span:hover{