From 6c95ff98f49d33fcbe7344a35d4122841f3c2502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <792998983@qq.com> Date: Mon, 26 Jul 2021 16:15:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug,=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/military/fetch.js | 4 +- src/military/task/agreementManage/index.js | 44 +++++++++-- src/military/task/api.js | 9 +++ .../task/components/adminRouter/index.jsx | 14 ++-- .../task/components/agreementModal/index.jsx | 10 +-- .../task/components/complainModal/index.jsx | 6 +- .../components/itemAgreementManage/index.jsx | 2 +- .../task/components/itemListMyTask/index.jsx | 79 +++++++++++++++++-- .../task/components/itemListMyTask/index.scss | 3 + .../task/components/itemListPaper/index.jsx | 15 ++-- .../task/components/itemListTask/index.jsx | 9 +-- .../task/components/itemPayProof/index.jsx | 4 +- .../itemPublicityComplain/index.jsx | 23 ++---- .../task/components/itemTaskManage/index.jsx | 11 ++- .../task/components/proofModal/index.jsx | 3 - src/military/task/myTask/index.jsx | 49 ++++++------ src/military/task/myTask/joinTask.jsx | 69 +++++++++------- src/military/task/paperComplain/index.js | 40 +++++----- src/military/task/paperManage/index.jsx | 48 ++++++----- src/military/task/payProof/index.js | 8 +- src/military/task/proofManage/index.js | 2 +- src/military/task/publicityComplain/index.js | 2 +- src/military/task/static.js | 9 ++- src/military/task/taskAdmin/index.jsx | 66 +++++++++++++--- src/military/task/taskAdmin/index.scss | 25 +++++- src/military/task/taskDetail/index.jsx | 72 +++++++++-------- src/military/task/taskDetail/index.scss | 1 - src/military/task/taskEdit/index.jsx | 4 +- src/military/task/taskList/index.jsx | 34 +++++++- src/military/task/taskManage/index.js | 6 +- 30 files changed, 448 insertions(+), 223 deletions(-) diff --git a/src/military/fetch.js b/src/military/fetch.js index 45a48ed7..2ea879b5 100644 --- a/src/military/fetch.js +++ b/src/military/fetch.js @@ -5,8 +5,8 @@ import cookie from 'react-cookies'; let actionUrl = ''; if (window.location.href.indexOf('localhost') > -1) { - // actionUrl = 'http://117.50.100.12:8008'; - actionUrl='http://192.168.31.72:8081'; + actionUrl = 'http://117.50.100.12:8008'; + // actionUrl='http://192.168.31.73:8081'; } else if (window.location.href.indexOf('117.50.100.12') > -1) { actionUrl = "http://117.50.100.12:8008"; axios.defaults.withCredentials = true; diff --git a/src/military/task/agreementManage/index.js b/src/military/task/agreementManage/index.js index 8fee7247..c7e5355d 100644 --- a/src/military/task/agreementManage/index.js +++ b/src/military/task/agreementManage/index.js @@ -1,4 +1,4 @@ -import React, { useCallback, forwardRef, useEffect, useState } from 'react'; +import React, { useCallback, useEffect, useState } from 'react'; import { Input, Button, Form, Select } from 'antd'; import AdminRouter from '../components/adminRouter'; import ItemAgreementManage from '../components/itemAgreementManage'; @@ -9,10 +9,10 @@ import '../index.scss'; const Option = Select.Option; const agreementOptionArr = agreementArr.slice(0, 2); -export default Form.create()(({ current_user, form, showNotification, match, history }) => { +export default Form.create()(({ form, showNotification, match, history }) => { - const { getFieldDecorator, validateFields, setFieldsValue, getFieldsValue } = form; + const { getFieldDecorator, validateFields, setFieldsValue, } = form; const [approve, setApprove] = useState(1); const [loading, setLoading] = useState(false); @@ -25,6 +25,9 @@ export default Form.create()(({ current_user, form, showNotification, match, his const [reload, setReload] = useState(0); + const [loadPaper, setLoadPaper] = useState(0); + + // 加载审核协议列表 useEffect(() => { const params = { ...searchObj, @@ -36,14 +39,41 @@ export default Form.create()(({ current_user, form, showNotification, match, his setLoading(true); agreementList(params).then(data => { if (data) { + if (loadPaper === 0 && data.rows.length === 0) { + setLoadPaper(1); + } else { + setLoadPaper(2); + } setTaskList(data.rows); setTotal(data.total); } setLoading(false); - }) + }); }, [reload, status, curPage, searchObj, type]); + // 如果第一次加载任务协议审核发现没有数据,那么切换成审核成果协议列表 + useEffect(() => { + if (loadPaper === 1) { + const params = { + status: '2', + type: '2', + currentPage: 1, + pageSize: 10, + }; + setLoading(true); + agreementList(params).then(data => { + if (data && data.rows.length > 0) { + setTaskList(data.rows); + setTotal(data.total); + setType('2'); + setLoadPaper(2); + } + setLoading(false); + }); + } + }, [loadPaper]); + // form表单公共处理函数 const helper = useCallback( (name, rules, widget, initialValue) => (