From 507976bf10e6b31434102ca1763cbf192ca84024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <792998983@qq.com> Date: Tue, 13 Jul 2021 10:53:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/UrlTool.js | 1 + src/military/index.scss | 29 +++++++ .../task/components/agreementModal/index.jsx | 1 + .../components/itemAgreementManage/index.jsx | 5 +- .../task/components/itemListMyTask/index.jsx | 8 +- .../task/components/itemListMyTask/index.scss | 9 ++- .../task/components/itemListPaper/index.jsx | 10 +-- .../task/components/itemListTask/index.jsx | 7 +- .../task/components/itemListTask/index.scss | 4 + .../task/components/itemProofManage/index.jsx | 7 +- .../task/components/proofModal/index.jsx | 23 +++--- src/military/task/myTask/index.jsx | 1 + src/military/task/myTask/joinTask.jsx | 76 ++++++++++++++++--- src/military/task/paperComplain/index.js | 2 +- src/military/task/taskDetail/index.jsx | 13 ++-- 15 files changed, 150 insertions(+), 46 deletions(-) diff --git a/src/common/UrlTool.js b/src/common/UrlTool.js index 9b4d5191..f952f22c 100644 --- a/src/common/UrlTool.js +++ b/src/common/UrlTool.js @@ -12,6 +12,7 @@ export function getImageUrl(path) { // https://testbdweb.trustie.net // const local = 'http://localhost:3000' const local = 'http://39.105.176.215:49999'; + if (isDev) { return `${local}/${path}` } diff --git a/src/military/index.scss b/src/military/index.scss index 7964b096..3dae0f66 100644 --- a/src/military/index.scss +++ b/src/military/index.scss @@ -162,6 +162,35 @@ text-align: left; } + +.ant-modal-footer{ + text-align: center; + border: 0; +} + + +// 头像 +.head-log-big{ + width: 4rem; + height: 4rem; + margin-right: .5rem; + border-radius: 50%; +} + +.head-log-middle{ + width: 3rem; + height: 3rem; + margin-right: .35rem; + border-radius: 50%; +} + +.head-log-small{ + width: 1.25rem; + height: 1.25rem; + margin-right: .35rem; + border-radius: 50%; +} + // 富文本样式 .w-e-text table td, .w-e-text table th{ height: 30px; diff --git a/src/military/task/components/agreementModal/index.jsx b/src/military/task/components/agreementModal/index.jsx index aa59e86f..99c08c24 100644 --- a/src/military/task/components/agreementModal/index.jsx +++ b/src/military/task/components/agreementModal/index.jsx @@ -54,6 +54,7 @@ export default Form.create()(props => { className="form-edit-modal" >
+ 协议样板 { @@ -102,7 +101,7 @@ export default Form.create()((props) => { return (
- 头像加载失败 +
  • { goUser(item.user.login) }}>{item.user && (item.user.nickname || item.user.login)} diff --git a/src/military/task/components/itemListMyTask/index.jsx b/src/military/task/components/itemListMyTask/index.jsx index dcaeb544..184698cf 100644 --- a/src/military/task/components/itemListMyTask/index.jsx +++ b/src/military/task/components/itemListMyTask/index.jsx @@ -21,6 +21,7 @@ export default Form.create()((props) => { const [page, setPage] = useState(1); const [visibleProofs, setVisibleProofs] = useState(false); const [taskId, setTaskId] = useState(); + const [taskModeId, setTaskModeId] = useState(''); const pageSize = props.pageSize || 10; const [visibleMethod, setVisibleMethod] = useState(false); @@ -35,6 +36,7 @@ export default Form.create()((props) => { function uploadProofs(item) { setVisibleProofs(true); setTaskId(item.id); + setTaskModeId(item.taskModeId); } function adviceModal(advice) { @@ -138,7 +140,8 @@ export default Form.create()((props) => {
    • {item.name} - {item.status == 4 && 待确认} + {item.status === 4 && 待确认} + {item.status === 6 && 待签订协议}
    • {taskCategoryValueArr[item.categoryId]} @@ -161,7 +164,7 @@ export default Form.create()((props) => { } { - (item.status === 3 || item.status === 4) && item.papersCount > 0 && (!item.isProofBoolean) && + item.status === 4 && item.papersCount > 0 && (!item.isProofBoolean) && { uploadProofs(item) }} className="line_1 color-blue">上传佐证材料 } @@ -200,6 +203,7 @@ export default Form.create()((props) => { {visibleProofs && { const [commentId, setCommentId] = useState(undefined); const [complainVisible, setComplainVisible] = useState(false); + const [agreeVisible, setAgreeVisible] = useState(false); + const [loadingChild, setLoadingChild] = useState(false); - const [agreeVisible, setAgreeVisible] = useState(false); useEffect(() => { changePage(page); @@ -146,7 +146,7 @@ export default Form.create()((props) => { return (
      - 头像加载失败 + 头像加载失败
      • @@ -154,7 +154,7 @@ export default Form.create()((props) => { {item.user.nickname || item.user.login} {timeAgo(item.createdAt)} - {item.status === 2 ? 胜出 : {item.checkStatus !== 1 ? paperCheckStatus[item.checkStatus] : applyStatusAllNameArr[item.status]}} + {item.status === 2 ? 胜出 : {item.checkStatus != 1 ? paperCheckStatus[item.checkStatus] : applyStatusAllNameArr[item.status]}}
      • {(item.needComplain || detailStatus === 5) && (current_user.login === item.user.login) && diff --git a/src/military/task/components/itemListTask/index.jsx b/src/military/task/components/itemListTask/index.jsx index e7577471..1615ba40 100644 --- a/src/military/task/components/itemListTask/index.jsx +++ b/src/military/task/components/itemListTask/index.jsx @@ -1,10 +1,9 @@ import React, { useEffect, useState } from 'react'; import { Icon, Pagination } from 'antd'; -import { formatDuring } from 'educoder'; +import { formatDuring, getImageUrl } from 'educoder'; import Nodata from 'forge/Nodata'; import { taskStatusAllArr } from '../../static'; import Loading from "src/Loading"; -import winpng from '../../image/win.png'; import './index.scss'; const statusArr = []; @@ -46,8 +45,8 @@ export default (props) => {
      { goUser(item.user.login) }}> - 头像加载失败 - {item.user.nickname || item.user.login} + + {item.user.nickname || item.user.login} {item.visits || 0} {item.papersCount || 0}人参与 diff --git a/src/military/task/components/itemListTask/index.scss b/src/military/task/components/itemListTask/index.scss index c39cbaa5..bb7ad61d 100644 --- a/src/military/task/components/itemListTask/index.scss +++ b/src/military/task/components/itemListTask/index.scss @@ -12,6 +12,10 @@ &:hover{ color: #409eff; } + .head-log-small{ + position: relative; + top:-2px; + } } .price { font-weight: 500; diff --git a/src/military/task/components/itemProofManage/index.jsx b/src/military/task/components/itemProofManage/index.jsx index 6bc8b65a..578d5535 100644 --- a/src/military/task/components/itemProofManage/index.jsx +++ b/src/military/task/components/itemProofManage/index.jsx @@ -3,11 +3,10 @@ import { Pagination, Modal, Input } from 'antd'; import { Link } from "react-router-dom"; import Nodata from 'forge/Nodata'; import Loading from "src/Loading"; -import { timeAgo } from 'educoder'; +import { timeAgo, getImageUrl } from 'educoder'; import { checkProof } from '../../api'; import { httpUrl } from 'military/fetch'; import './index.scss'; -import winpng from '../../image/win.png'; const { TextArea } = Input; export default (props) => { @@ -80,7 +79,7 @@ export default (props) => { window.open(url); } - + return ( loading ? : @@ -90,7 +89,7 @@ export default (props) => { return (
      - 头像加载失败 +
    • { goUser(item.user.login) }}>{item.user.nickname || item.user.login} diff --git a/src/military/task/components/proofModal/index.jsx b/src/military/task/components/proofModal/index.jsx index a37fefc4..515667bd 100644 --- a/src/military/task/components/proofModal/index.jsx +++ b/src/military/task/components/proofModal/index.jsx @@ -9,7 +9,7 @@ import './index.scss'; export default Form.create()(props => { - const { changeVisible, taskId, visible, form, showNotification, reloadList } = props; + const { changeVisible, taskId, taskModeId, visible, form, showNotification, reloadList } = props; const { getFieldDecorator, validateFields, setFieldsValue, getFieldsValue } = form; const pageSize = props.pageSize || 10; @@ -97,16 +97,20 @@ export default Form.create()(props => { title: '操作', dataIndex: 'action', render: (text, record) => { - return 查看详情 + return 查看详情 } }]; }, [taskId]); - const rowSelection = { - onChange: (selectedRowKeys, selectedRows) => { - setSelectedRows(selectedRows); - }, - }; + const rowSelection = useMemo(() => { + return { + type: taskModeId === 1 ? 'radio' : 'checkbox', + onChange: (selectedRowKeys, selectedRows) => { + setSelectedRows(selectedRows); + }, + } + }, [taskModeId]); + const handleRow = record => { return { @@ -188,10 +192,7 @@ export default Form.create()(props => { dataSource={dataList} columns={columns} pagination={false} - rowSelection={{ - type: 'checkbox', - ...rowSelection, - }} + rowSelection={rowSelection} onRow={handleRow} /> {total > 10 && diff --git a/src/military/task/myTask/index.jsx b/src/military/task/myTask/index.jsx index 43f5ee01..b10e2542 100644 --- a/src/military/task/myTask/index.jsx +++ b/src/military/task/myTask/index.jsx @@ -177,6 +177,7 @@ export default ({ location, history, current_user,showNotification }) => { diff --git a/src/military/task/myTask/joinTask.jsx b/src/military/task/myTask/joinTask.jsx index ecfaafdb..cc010cae 100644 --- a/src/military/task/myTask/joinTask.jsx +++ b/src/military/task/myTask/joinTask.jsx @@ -1,22 +1,29 @@ import React, { useCallback, useEffect, useState, useMemo } from 'react'; -import { Tabs, Input, Table, Pagination } from 'antd'; +import { Tabs, Input, Table, Pagination, Modal } from 'antd'; import { Link } from "react-router-dom"; import ChooseNav from '../../components/chooseNav'; import ItemListMyTask from '../components/itemListMyTask'; -import { applyStatusAllArr, applyStatusArr, publishModeArr } from '../static'; -import { getJoinTaskList, myPapers } from '../api'; +import AgreementModal from '../components/agreementModal'; +import ComplainModal from '../components/complainModal'; +import { applyStatusAllArr, paperCheckStatusArr, applyStatusArr, publishModeArr, taskStatusAllArr } from '../static'; +import { getJoinTaskList, myPapers, confirmReceipt } from '../api'; import './index.scss'; const Search = Input.Search; const { TabPane } = Tabs; -const publishStatusArr = applyStatusAllArr.slice(3, 9); +const publishStatusArr = taskStatusAllArr.slice(3, 9); const statusArr = []; for (const item of applyStatusAllArr) { statusArr[item.dicItemCode] = item.dicItemName; } -export default ({ taskCategoryValueArr }) => { +const paperCheckStatus = []; +for (const item of paperCheckStatusArr) { + paperCheckStatus[item.dicItemCode] = item.dicItemName; +} + +export default ({ taskCategoryValueArr, showNotification }) => { const [paperStatusString, setPaperStatusString] = useState('0,1,2,3,4'); const [taskStatusString, setTaskStatusString] = useState('3,4,5,6,7,8'); @@ -32,6 +39,12 @@ export default ({ taskCategoryValueArr }) => { 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(() => { if (requirePaper === '1') { const params = { @@ -69,7 +82,7 @@ export default ({ taskCategoryValueArr }) => { setLoading(false); }) } - }, [requirePaper, paperStatusString, searchInput, curPagePaper]); + }, [requirePaper, paperStatusString, searchInput, curPagePaper, reload]); const columns = useMemo(() => { @@ -77,8 +90,9 @@ export default ({ taskCategoryValueArr }) => { { title: '任务/编号名称', dataIndex: 'name', + width: '30%', render: (text, record) => { - return {record.task.number +" "+ record.task.name} + return {record.task.number + " " + record.task.name} } }, { @@ -100,7 +114,7 @@ export default ({ taskCategoryValueArr }) => { title: '应征状态', dataIndex: 'status', render: (text, record) => { - return statusArr[text] + return record.checkStatus != 1 ? paperCheckStatus[record.checkStatus] : statusArr[text] } }, { @@ -108,7 +122,15 @@ export default ({ taskCategoryValueArr }) => { key: 'action', render: (text, record) => ( - 查看详情 + 查看详情 + {(record.needComplain || record.task.status === 5) && + { setComplainVisible(true); setCheckedItem(record) }}>申诉} + + {record.status === 2 && record.task.status === 6 && + { setAgreeVisible(true); setCheckedItem(record) }}>签订协议} + + {record.status === 2 && record.task.status === 7 && + { confirmReceiptModal(record.id) }}>确认收款} ), }, @@ -116,6 +138,21 @@ export default ({ taskCategoryValueArr }) => { }, [taskCategoryValueArr, publishModeArr, statusArr]); + function confirmReceiptModal(paperId) { + Modal.confirm({ + title: '确认收款', + content: '确认已经收到任务报酬', + onOk: () => { + confirmReceipt(paperId).then(res => { + if (res && res.message === "success") { + showNotification("您已确认收款!"); + } + }) + } + }) + } + + const changeOptionId = useCallback((option, type) => { if (type === 'taskStatus') { setTaskStatusString(option.dicItemCode.toString() || '3,4,5,6,7,8'); @@ -136,6 +173,10 @@ export default ({ taskCategoryValueArr }) => { setRequirePaper(key); } + const reloadList = useCallback(() => { + setReload(reload + 1); + }, []) + return ( { current={curPage} total={totalPaper} />} + + + + {agreeVisible && } + diff --git a/src/military/task/paperComplain/index.js b/src/military/task/paperComplain/index.js index c0f9a58f..0703bc6a 100644 --- a/src/military/task/paperComplain/index.js +++ b/src/military/task/paperComplain/index.js @@ -112,7 +112,7 @@ export default Form.create()(({ current_user, form, showNotification, match, }) render: (text, record) => { return
      { - record.materials && record.materials.map(item => { + Array.isArray(record.materials) && record.materials.map(item => { return
      { downFile(item) }}> {item.fileName} diff --git a/src/military/task/taskDetail/index.jsx b/src/military/task/taskDetail/index.jsx index efb1a403..04a851ce 100644 --- a/src/military/task/taskDetail/index.jsx +++ b/src/military/task/taskDetail/index.jsx @@ -2,7 +2,7 @@ import React, { forwardRef, useEffect, useState, useCallback, useMemo } from 're import { Form, Input, Button, Modal, Table, Pagination, Checkbox, Tooltip } from 'antd'; import classNames from 'classnames'; import { Link } from "react-router-dom"; -import { formatDuring } from 'educoder'; +import { formatDuring, getImageUrl } from 'educoder'; import Upload from '../../components/Upload'; import StatusNav from '../../components/statusNav'; import ItemListPaper from '../components/itemListPaper'; @@ -11,7 +11,6 @@ import { getTaskDetail, getTaskCategory, getTaskPaper, updateTask, addPaper, get import { taskModeIdArr, applyStatusArr, applyStatusAllArr, agreementContent } from '../static'; import { httpUrl } from '../../fetch'; import winpng from '../image/win.png'; -import headpng from '../image/head.png'; import './index.scss'; const { TextArea } = Input; @@ -137,7 +136,7 @@ export default Form.create()( }, [id, status, curPage, reload, relaodChildList]); - // 流程步骤显示 + // 流程步骤显示,返回剩余时间 const process = useCallback((title, status, days) => { let surplusTimetext = ''; if (detailData.status === status) { @@ -163,7 +162,8 @@ export default Form.create()( {detailData.status === status && detailData.delayTime &&

      {detailData.delayTime}

      } - {detailData.status === status && (!detailData.delayTime) &&

      剩余{surplusTimetext}

      } + {/* 因为有时只延期几秒或者几分钟时后端没有返回延期,所以这里加一个判断 */} + {detailData.status === status && (!detailData.delayTime) &&

      {surplusTimetext.indexOf('-') > 0 ? ('延期' + surplusTimetext.replaceAll('-', '')) : ('剩余' + surplusTimetext)}

      }
    • ) }, [detailData]); @@ -364,7 +364,7 @@ export default Form.create()(
      { goUser(detailData.user.login) }} alt="用户头像"> - 头像加载失败 + 头像加载失败

      {detailData && detailData.user && (detailData.user.nickname || detailData.user.login)}

      @@ -451,7 +451,7 @@ export default Form.create()( {!detailData.showUserStatus && } - {(detailData.status === 3 || detailData.status === 4) && dataList.length && (!detailData.isProofBoolean) && detailData.user && (current_user.admin || current_user.login === detailData.user.login) ? + {detailData.status === 4 && dataList.length && (!detailData.isProofBoolean) && detailData.user && (current_user.admin || current_user.login === detailData.user.login) ? { setVisibleProofs(true) }}>上传佐证材料 : ''} {/* 一键导出成果物 */} {dataList.length > 0 && taskLimit && 一键导出成果物 >>} @@ -515,6 +515,7 @@ export default Form.create()( { visibleProofs &&