From e69130f25c0845d45b6ed77d52c17b7c568150d3 Mon Sep 17 00:00:00 2001 From: unknown <2569982966@qq.com> Date: Fri, 24 Nov 2023 19:41:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0luoji?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 24 ++++++++++++---------- src/AppConfig.js | 2 +- src/military/notice/api.js | 20 +++++++++++------- src/military/notice/noticeDetail/index.jsx | 22 ++++++++++++++------ src/military/notice/noticeList/index.jsx | 5 ++++- 5 files changed, 47 insertions(+), 26 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 21c5881bc..b06421b1b 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,8 +3,10 @@ - - + + + + - { + "keyToString": { + "WebServerToolWindowFactoryState": "false", + "last_opened_file_path": "E:/forgeplus-react/src/military/achievement/overview", + "node.js.detected.package.eslint": "true", + "node.js.selected.package.eslint": "(autodetect)", + "nodejs_package_manager_path": "npm", + "vue.rearranger.settings.migration": "true" } -}]]> +} diff --git a/src/AppConfig.js b/src/AppConfig.js index 7d0284c45..07b3cca57 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -25,7 +25,7 @@ if (isDev) { } debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' : window.location.search.indexOf('debug=s') !== -1 ? 'student' : - window.location.search.indexOf('debug=a') !== -1 ? 'a' : parsed.debug || 'admin' + window.location.search.indexOf('debug=a') !== -1 ? 'a' : parsed.debug } window._debugType = debugType; export function initAxiosInterceptors(props) { diff --git a/src/military/notice/api.js b/src/military/notice/api.js index d2d8962c4..e1016eec7 100644 --- a/src/military/notice/api.js +++ b/src/military/notice/api.js @@ -27,14 +27,20 @@ export async function getNoticeDetail(id) { method: 'get', params:{flag:1} }); - if (res.data) { - return res.data; - } else { - notification.open({ - message: "提示", - description: res.message || '请求错误', - }); + // 2023/11/24 因为根据登录状态来控制是否可以显示details页面 所以在这里加了个一个判断 + if (res.message === '403'){ + return '403' + }else { + if (res.data) { + return res.data; + } else { + notification.open({ + message: "提示", + description: res.message || '请求错误', + }); + } } + } //新增加密公告申请人 diff --git a/src/military/notice/noticeDetail/index.jsx b/src/military/notice/noticeDetail/index.jsx index eea007f70..0462b5342 100644 --- a/src/military/notice/noticeDetail/index.jsx +++ b/src/military/notice/noticeDetail/index.jsx @@ -10,7 +10,7 @@ for (const item of noticeType) { noticeTypeArr[item.code] = item.name; } -export default Form.create()(({ match, history, showNotification, form }) => { +export default Form.create()(({ match, history, showNotification, form,current_user,showLoginDialog}) => { const { getFieldDecorator, validateFields, setFieldsValue } = form; const [reload, setReload] = useState(0); @@ -21,13 +21,21 @@ export default Form.create()(({ match, history, showNotification, form }) => { const id = match.params.noticeId; - useEffect(() => { + + + + + useEffect(() => { id && getNoticeDetail(id).then(data => { - if (data) { + + if (data === '403'){ + showLoginDialog() + }else if (data){ data.publishDate = data.publishDate.split(' ')[0]; data.createdAt = data.createdAt.split(' ')[0]; data.closingDate = data.closingDate.split(' ')[0]; } + setNoticeData(data || {}); }) }, [id, reload]); @@ -49,10 +57,12 @@ export default Form.create()(({ match, history, showNotification, form }) => { ...values, annId: noticeData.id, }).then(res => { + if (res.message === "success") { setVisible(false); setReload(Math.random()); - } else { + }else { + res && Modal.error({ content: res.message }); } }) @@ -148,10 +158,10 @@ export default Form.create()(({ match, history, showNotification, form }) => { { helper('联系方式', 'contactInfo', - [{ required: true, message: "请输入联系方式" }, + [{ required: true, message: "请输入联系方式" }, { max: 100, message: '不能超过100字符' }, { validator: (rule,val,callback) =>{ - const pattern = /^((\+)?86|((\+)?86)?)0?1[3458]\d{9}$/; + const pattern = /^((\+)?86|((\+)?86)?)0?1[3458]\d{9}$/; if(pattern.test(val)){ callback(); }else { diff --git a/src/military/notice/noticeList/index.jsx b/src/military/notice/noticeList/index.jsx index 256353ba9..daf7d2d3e 100644 --- a/src/military/notice/noticeList/index.jsx +++ b/src/military/notice/noticeList/index.jsx @@ -29,7 +29,10 @@ export default (props) => { const [technologyList, setTechnologyList] = useState([]); const [dealList, setDealList] = useState([]); + + useEffect(() => { + setLoading(true); if (tab === '0' || tab === '7') { const params = { @@ -264,4 +267,4 @@ export default (props) => { ) -} \ No newline at end of file +}