forked from Gitlink/forgeplus-react
113 lines
3.3 KiB
JavaScript
113 lines
3.3 KiB
JavaScript
import React, { useCallback, useEffect, useState, useMemo } from 'react';
|
|
import { Tabs, Input, Table, Pagination, Modal, Button } from 'antd';
|
|
import { Link } from "react-router-dom";
|
|
import ChooseNav from '../../components/chooseNav';
|
|
import ItemListMyTask from '../components/itemListMyTask';
|
|
import AgreementModal from '../components/agreementModal';
|
|
import ComplainModal from '../components/complainModal';
|
|
import { applyStatusAllArr, paperCheckStatusArr, applyStatusArr, publishModeArr, taskStatusAllArr,} from '../static';
|
|
import { getJoinTaskList, followTaskList, confirmReceipt } from '../api';
|
|
import './index.scss';
|
|
const Search = Input.Search;
|
|
|
|
const publishStatusArr = taskStatusAllArr.slice(3, 9);
|
|
|
|
const statusArr = [];
|
|
for (const item of applyStatusAllArr) {
|
|
statusArr[item.dicItemCode] = item.dicItemName;
|
|
}
|
|
|
|
const paperCheckStatus = [];
|
|
for (const item of paperCheckStatusArr) {
|
|
paperCheckStatus[item.dicItemCode] = item.dicItemName;
|
|
}
|
|
|
|
export default ({ taskCategoryValueArr, showNotification,current_user }) => {
|
|
|
|
const [paperStatusString, setPaperStatusString] = useState('0,1,2,3,4');
|
|
const [taskStatusString, setTaskStatusString] = useState('3,4,5,6,7,8');
|
|
|
|
const [requirePaper, setRequirePaper] = useState('1');
|
|
const [searchInput, setSearchInput] = useState('');
|
|
const [curPage, setCurPage] = useState(1);
|
|
const [total, setTotal] = useState(0);
|
|
const [taskList, setTaskList] = useState([]);
|
|
const [loading, setLoading] = useState(false);
|
|
|
|
const [curPagePaper, setCurPagePaper] = useState(1);
|
|
const [totalPaper, setTotalPaper] = useState(0);
|
|
const [paperList, setPaperList] = useState([]);
|
|
|
|
const [checkedItem, setCheckedItem] = useState({});
|
|
const [complainVisible, setComplainVisible] = useState(false);
|
|
const [agreeVisible, setAgreeVisible] = useState(false);
|
|
|
|
const [reload, setReload] = useState(0);
|
|
|
|
useEffect(() => {
|
|
const params = {
|
|
searchInput,
|
|
curPage,
|
|
pageSize: 10,
|
|
};
|
|
setLoading(true);
|
|
followTaskList(params).then(res => {
|
|
if (res.message=="success") {
|
|
setTaskList(res.data.rows);
|
|
setTotal(res.data.total);
|
|
}
|
|
setLoading(false);
|
|
});
|
|
}, [ reload, searchInput, curPage]);
|
|
|
|
|
|
|
|
function confirmReceiptModal(paperId) {
|
|
Modal.confirm({
|
|
title: '确认收款',
|
|
content: '确认已经收到任务报酬',
|
|
onOk: () => {
|
|
confirmReceipt(paperId).then(res => {
|
|
if (res && res.message === "success") {
|
|
showNotification("您已确认收款!");
|
|
reloadList();
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
const reloadList = useCallback(() => {
|
|
setReload(Math.random());
|
|
}, [])
|
|
|
|
return (
|
|
|
|
<div className='follow-task'>
|
|
|
|
<div className='follow-task-head'>
|
|
<div >我关注的任务</div>
|
|
<Search
|
|
maxLength={20}
|
|
style={{ width: "300px" }}
|
|
placeholder="请输入任务名称关键字"
|
|
onSearch={(value) => { setSearchInput(value); setCurPage(1); }}
|
|
/>
|
|
</div>
|
|
|
|
|
|
<ItemListMyTask
|
|
list={taskList}
|
|
curPage={curPage}
|
|
total={total}
|
|
taskCategoryValueArr={taskCategoryValueArr}
|
|
changePage={(page) => { setCurPage(page) }}
|
|
loading={loading}
|
|
joinTask={true}
|
|
reloadList={reloadList}
|
|
current_user={current_user}
|
|
/>
|
|
</div>
|
|
|
|
)
|
|
} |