diff --git a/src/common/DateUtil.js b/src/common/DateUtil.js index 5869a1a2..93e5dbd3 100644 --- a/src/common/DateUtil.js +++ b/src/common/DateUtil.js @@ -72,14 +72,8 @@ export function formatDuring(mss) { var days = parseInt(mss / (1000 * 60 * 60 * 24)); var hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = parseInt((mss % (1000 * 60 * 60)) / (1000 * 60)); - // console.log("formatDuringformatDuring"); - // console.log(days); - // console.log(hours); - // console.log(minutes); - // console.log(Math.abs(days)); - // console.log(Math.abs(hours)); - // console.log(Math.abs(minutes)); - + var second = parseInt(mss / 1000 % 60); + try { days = Math.abs(days); } catch (e) { @@ -95,11 +89,22 @@ export function formatDuring(mss) { } catch (e) { } - return days + "天" + hours + "小时" + minutes + "分"; + + if (days) { + return days + "天" + hours + "小时" + minutes + "分"; + } + if (hours) { + return hours + "小时" + minutes + "分"; + } + if (minutes) { + return minutes + "分"; + } + return second + "秒"; + // return days + "天" + hours + "小时" + minutes + "分"; } /* - 返回多久以前 + 返回:多久以前 backDate:以前的某个日期 */ export function timeAgo(backDate) { @@ -114,15 +119,15 @@ export function timeAgo(backDate) { var minutes = Math.floor((time % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((time % (1000 * 60 * 60)) / 1000); if (days) { - return days + "天前"; + return days + "天前"; } if (hours) { return hours + "小时前"; } if (minutes) { - return minutes + "分前"; + return minutes + "分前"; } if (seconds) { - return seconds + "秒前"; + return seconds + "秒前"; } } \ No newline at end of file diff --git a/src/military/components/Upload.jsx b/src/military/components/Upload.jsx index 1bcf218d..acd5c1d6 100644 --- a/src/military/components/Upload.jsx +++ b/src/military/components/Upload.jsx @@ -1,8 +1,6 @@ import React, { useEffect, useState } from "react"; import { Upload, Button } from 'antd'; -import axios from 'axios'; import { appendFileSizeToUploadFileAll } from 'educoder'; -axios.defaults.withCredentials = true; function Uploads({ className, size, actionUrl, fileList, showNotification, load }) { const [files, setFiles] = useState(undefined); @@ -32,24 +30,7 @@ function Uploads({ className, size, actionUrl, fileList, showNotification, load return itemId !== id; }); setFiles(nf); - // fileIdList(nf); load && load(nf); - - // 发送服务到后台删除文件,同步更新数据 - // const url = actionUrl + `/busiAttachments/${id}`; - // axios.delete(url).then((response) => { - // if (response.data) { - // if (response.data.code === "1") { - // let nf = files.filter(item => (item.response.data.id !== id) && (item.id !== id)); - // setFiles(nf); - // fileIdList(nf); - // } else { - // showNotification(response.data.message); - // } - // } - // }).catch(function (error) { - // console.log(error); - // }); } @@ -61,16 +42,6 @@ function Uploads({ className, size, actionUrl, fileList, showNotification, load } } - // function fileIdList(fileList) { - // let id = []; - // let fileType = []; - // for (const item of fileList) { - // id.push(item.id || item.response.data.id); - // fileType.push(item.fileType || item.response.data.fileType); - // } - // load && load(id.join(), fileType.join()); - // } - function beforeUpload(file) { const isLt100M = file.size / 1024 / 1024 < size; if (!isLt100M) { diff --git a/src/military/components/config.js b/src/military/components/config.js new file mode 100644 index 00000000..996a2528 --- /dev/null +++ b/src/military/components/config.js @@ -0,0 +1,25 @@ +import { httpUrl } from '../fetch'; + +export const editorConfig = { + placeholder: '请输入', + uploadImgServer: httpUrl + '/busiAttachments/upload', + uploadFileName: 'file', + uploadImgHeaders: { + 'X-Requested-With': 'XMLHttpRequest' + }, + excludeMenus: [ + 'list', + 'todo', + 'emoticon', + 'video' + ], + uploadImgHooks: { + // 图片上传并返回了结果,想要自己把图片插入到编辑器中 + customInsert: function (insertImgFn, result) { + // insertImgFn 可把图片插入到编辑器,传入图片 src ,执行函数即可 + if (result && result.data && result.data.id) { + insertImgFn(`${httpUrl}/busiAttachments/view/${result.data.id}`); + } + } + }, +} \ No newline at end of file diff --git a/src/military/fetch.js b/src/military/fetch.js index 074b5f47..de7a7484 100644 --- a/src/military/fetch.js +++ b/src/military/fetch.js @@ -5,15 +5,21 @@ import cookie from 'react-cookies'; <<<<<<< HEAD ======= // export const httpUrl='http://117.50.100.12:8001'; -// export const httpUrl='http://192.168.31.72:8081'; +export const httpUrl='http://192.168.31.72:8081'; // export const httpUrl = 'http://106.75.31.211:58088'; // export const httpUrl = 'http://192.168.31.72:8089'; <<<<<<< HEAD +<<<<<<< HEAD // export const httpUrl = 'http://192.168.31.104:8081'; >>>>>>> 09e81b9... 添加成果内容 ======= export const httpUrl = 'http://192.168.31.104:8081'; >>>>>>> 6b63cd2... 上传成果修改 +======= +// export const httpUrl = 'http://192.168.31.104:8081'; + +// export const httpUrl = 'http://192.168.31.168:8081'; +>>>>>>> 5131dac... 修复成果提交时的bug,联调我是创客 let actionUrl = ''; diff --git a/src/military/index.scss b/src/military/index.scss index f8be6f73..fc49071c 100644 --- a/src/military/index.scss +++ b/src/military/index.scss @@ -257,6 +257,12 @@ font-size: 100%; background-color: #f1f1f1; } +.user-box{ + cursor: pointer; + &:hover{ + color: #409eff; + } +} @media screen and (max-width: 1200px){ diff --git a/src/military/task.js b/src/military/task.js index d5475db0..f0955be0 100644 --- a/src/military/task.js +++ b/src/military/task.js @@ -30,6 +30,11 @@ const MyTask = Loadable({ loading: Loading, }); +const TaskManage = Loadable({ + loader: () => import("./task/taskManage"), + loading: Loading, +}); + class Index extends Component { render() { return ( @@ -64,6 +69,13 @@ class Index extends Component { )} > + ( + + )} + > + ( diff --git a/src/military/task/api.js b/src/military/task/api.js index d0b9c544..4678faeb 100644 --- a/src/military/task/api.js +++ b/src/military/task/api.js @@ -25,7 +25,7 @@ export async function getTaskCategory() { } } -// 列表查询 +// 任务列表查询 export async function getTaskList(params) { let res = await fetch({ url: '/api/tasks/', @@ -77,6 +77,7 @@ export async function getJoinTaskList(params) { } + // 详情查询 export async function getTaskDetail(id) { let res = await fetch({ @@ -102,6 +103,15 @@ export function addTask(data) { }); } +//更新任务 +export function updateTask(data) { + return fetch({ + url: '/api/tasks/', + method: 'PUT', + data: data + }); +} + //删除 export function deleteTask(id) { return fetch({ @@ -110,14 +120,6 @@ export function deleteTask(id) { }); } -//更新任务 -export function updateTask(data) { - return fetch({ - url: '/api/tasks/', - method: 'put', - data: data - }); -} //新增成果 export function addAchieve(data) { @@ -180,6 +182,17 @@ export function checkAgreement(taskId) { }); } +// 检查用户是否提交了成果 +export function checkAchieve(taskId){ + return fetch({ + url: `/api/paper/${taskId}/check`, + method: 'get' + }); +} + + + + // 获取协议 export function getAgreement() { return fetch({ @@ -204,4 +217,32 @@ export function commentAdd(data) { method: 'post', data, }); -} \ No newline at end of file +} + + +// 审核任务列表查询 +export async function manageTaskList(params) { + let res = await fetch({ + url: '/api/tasks/backend/list', + method: 'get', + params, + }); + if (res.data) { + return res.data; + } else { + notification.open({ + message: "提示", + description: res.message || '请求错误', + }); + } +} + +//管理员审核任务 +export function checkTask(data) { + return fetch({ + url: `/api/tasks/backend/adminCheck`, + method: 'post', + data: data + }); +} + diff --git a/src/military/task/components/itemListAchieve/index.jsx b/src/military/task/components/itemListAchieve/index.jsx index 692ea10b..266b02a6 100644 --- a/src/military/task/components/itemListAchieve/index.jsx +++ b/src/military/task/components/itemListAchieve/index.jsx @@ -4,15 +4,17 @@ import ReactWEditor from 'wangeditor-for-react'; import { getImageUrl, timeAgo } from 'educoder'; import Nodata from 'forge/Nodata'; import Loading from "src/Loading"; +import { editorConfig } from 'military/components/config'; import { reportAchieve, thumbUpAchieve, commentAdd } from '../../api'; import { httpUrl } from '../../../fetch'; +import winpng from '../../image/win.png'; import './index.scss'; const { TextArea } = Input; export default (props) => { - const { list, curPage, total, changePage, loading, applyStatusAllNameArr, relaodList, showNotification } = props; + const { list, curPage, total, changePage, loading, applyStatusAllNameArr, reloadList, showNotification } = props; const [page, setPage] = useState(1); const [pageSize, setPageSize] = useState(() => { return props.pageSize || 10; @@ -51,7 +53,7 @@ export default (props) => { function thumbUp(id) { thumbUpAchieve(id).then(res => { - relaodList(); + reloadList(); }); } @@ -60,12 +62,19 @@ export default (props) => { showNotification("请输入评价"); return; } + if (commentHtml.length > 10000) { + showNotification("评论过长,请减少评论内容或者简化评论格式"); + return; + } commentAdd({ content: commentHtml, paperId: item.id, taskId: item.taskId }).then(res => { - if (res.message === 'success') closeComment(); + if (res.message === 'success') { + closeComment(); + reloadList(); + } }); } @@ -79,7 +88,10 @@ export default (props) => { setCommentHtml(''); } - + function goUser(login) { + window.location.href = `/users/${login}`; + } + return ( {loading ? : @@ -93,20 +105,24 @@ export default (props) => {
  • - - {item.user.nickName || item.user.login} + { goUser(item.user.login) }}> + 头像加载失败 + {item.user.nickname || item.user.login} {timeAgo(item.createdAt)} {!item.verifyStatus && "待审核"}
  • - + {applyStatusAllNameArr[item.status]}
+
+
+
{ item.paperDetail.busiAttachments && item.paperDetail.busiAttachments.map(fileItem => { @@ -120,21 +136,20 @@ export default (props) => {
-
- {item.comments.length > 0 && - item.comments.map(commentsItem => { - return
-
- {commentsItem.user.nickname || commentsItem.user.login} - {timeAgo(commentsItem.createdAt)} -
-
-
+ {item.comments.length > 0 &&
+ {item.comments.map(commentsItem => { + return
+
+ {commentsItem.user.nickname || commentsItem.user.login} + {timeAgo(commentsItem.createdAt)}
- }) +
+
+
+ }) } - {/* */} -
+ {/* */} +
}
  • @@ -150,39 +165,14 @@ export default (props) => { {commentId === item.id && { - setCommentHtml(html); + config={{ + ...editorConfig, + placeholder: "请输入评论", }} + onChange={(html) => { setCommentHtml(html) }} /> - }
  • @@ -223,6 +213,7 @@ export default (props) => { autoSize={{ minRows: 6 }} className="applyText" onChange={(e) => { setReportValue(e.target.value) }} + maxLength={100} />
    diff --git a/src/military/task/components/itemListMyTask/index.jsx b/src/military/task/components/itemListMyTask/index.jsx index 791dea24..e0466394 100644 --- a/src/military/task/components/itemListMyTask/index.jsx +++ b/src/military/task/components/itemListMyTask/index.jsx @@ -1,25 +1,22 @@ import React, { useEffect, useState } from 'react'; -import { Modal, Pagination } from 'antd'; +import { Modal, Pagination } from 'antd'; import { Link } from "react-router-dom"; import Nodata from 'forge/Nodata'; import Loading from "src/Loading"; -import { publishModeArr ,taskStatusAllArr} from '../../static'; +import { publishModeArr, taskStatusAllArr } from '../../static'; import './index.scss'; const statusArr = []; -for (const item of taskStatusAllArr){ - statusArr[item.dicItemCode]=item.dicItemName; +for (const item of taskStatusAllArr) { + statusArr[item.dicItemCode] = item.dicItemName; } export default (props) => { - const { list, curPage, total, changePage, taskCategoryValueArr, loading } = props; + const { list, curPage, total, changePage, taskCategoryValueArr, loading, publish } = props; const [page, setPage] = useState(1); const [visibleProofs, setVisibleProofs] = useState(false); - const [activeItem,setActiveItem]=useState({}); - - const [pageSize, setPageSize] = useState(() => { - return props.pageSize || 10; - }); + const [activeItem, setActiveItem] = useState({}); + const pageSize = props.pageSize || 10; useEffect(() => { changePage(page); @@ -30,12 +27,19 @@ export default (props) => { setActiveItem(item); } + function repairAdvice(repairAdvice){ + Modal.info({ + title: '审核意见', + content:repairAdvice + }) + } + return (
    • 任务
    • 类型
    • -
    • 应征投稿
    • + {publish &&
    • 应征投稿
    • }
    • 金额
    • 任务状态
    • 操作
    • @@ -61,7 +65,7 @@ export default (props) => { {publishModeArr[item.publishMode]} -
    • {item.papersCount||0}
    • + {publish &&
    • {item.papersCount || 0}
    • }
    • ¥{item.bounty}
    • @@ -71,13 +75,15 @@ export default (props) => {
    • { - item.status == 0 ||item.status == 2 ? + item.status === 0 || item.status === 9 ? 编辑草稿 : 查看详情 } - {item.status == 4 && 成果评选} - {item.status == 4 && item.papersCount && (!item.isProofBoolean) && { uploadProofs(item) }} className="line_1 color-blue">上传佐证材料} + {item.status === 4 && 成果评选} + {item.status === 4 && item.papersCount && (!item.isProofBoolean) && { uploadProofs(item) }} className="line_1 color-blue">上传佐证材料} + + {(item.status === 9 || item.status === 2) && { repairAdvice(item.repairAdvice) }} className="line_1 color-blue">审核意见} {/* 支付登记 */} {/* 上传支付凭证 */} diff --git a/src/military/task/components/itemListTask/index.jsx b/src/military/task/components/itemListTask/index.jsx index 21ad3a02..36402d63 100644 --- a/src/military/task/components/itemListTask/index.jsx +++ b/src/military/task/components/itemListTask/index.jsx @@ -1,23 +1,36 @@ import React, { useEffect, useState } from 'react'; import { Icon, Pagination } from 'antd'; +import { formatDuring } 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 = ["草稿", "待审核", "已拒绝", "成果征集中", "成果评选中", "公示中", "协议签订中", "支付中", "已完成"]; +const statusArr = []; +for (const item of taskStatusAllArr) { + statusArr[item.dicItemCode] = item.dicItemName; +} + const classArr = ['', 'list-done', 'list-error', 'list-red', 'list-yellow', '', '', 'list-pay', 'list-gray',]; export default (props) => { const { list, itemClick, curPage, total, changePage, loading } = props; const [page, setPage] = useState(1); - const [pageSize, setPageSize] = useState(() => { - return props.pageSize || 10; - }); + const pageSize = props.pageSize || 10; useEffect(() => { changePage(page); }, [page]); + function goUser(login) { + window.location.href = `/users/${login}`; + } + + function surplusTime(item) { + let surplus = item.collectingDays * 24 * 3600 - (new Date() - new Date(item.publishedAt)) / 1000; + return formatDuring(surplus) + } + return ( loading ? : @@ -29,12 +42,17 @@ export default (props) => {
      { itemClick(item.id) }}> {item.name || item.title} {item.status && {statusArr[item.status]}} - {(!item.status == '8') && item.delayTime && 延期中} + {(item.status !== 8) && item.delayTime && 延期中}
      - {item.visits || 0} - {item.papersCount || 0}人参与 - {(!item.status == '8') && item.delayTime && {item.delayTime}} + { goUser(item.user.login) }}> + 头像加载失败 + {item.user.nickname || item.user.login} + + {item.visits || 0} + {item.papersCount || 0}人参与 + {(item.status !== 8) && item.delayTime && {item.delayTime}} + {(item.status === 3) && (!item.delayTime) && 剩余{surplusTime(item)}}
      diff --git a/src/military/task/components/itemListTask/index.scss b/src/military/task/components/itemListTask/index.scss index cf01bab5..6bc5556d 100644 --- a/src/military/task/components/itemListTask/index.scss +++ b/src/military/task/components/itemListTask/index.scss @@ -7,6 +7,12 @@ background: #fff; border-bottom: 1px solid #dedede; } +.user-box{ + cursor: pointer; + &:hover{ + color: #409eff; + } +} .price { font-weight: 500; padding-top: 10px; diff --git a/src/military/task/components/itemTaskManage/index.jsx b/src/military/task/components/itemTaskManage/index.jsx new file mode 100644 index 00000000..02359292 --- /dev/null +++ b/src/military/task/components/itemTaskManage/index.jsx @@ -0,0 +1,201 @@ +import React, { useEffect, useState } from 'react'; +import { Pagination, Modal, Input, Radio } from 'antd'; +import { Link } from "react-router-dom"; +import Nodata from 'forge/Nodata'; +import Loading from "src/Loading"; +import { timeAgo } from 'educoder'; +import { checkTask } from '../../api'; +import './index.scss'; +import winpng from '../../image/win.png'; + +const { TextArea } = Input; +export default (props) => { + const { list, categoryArr, curPage, total, changePage, loading, showNotification, reloadList } = props; + const [checkedId, setCheckedId] = useState(''); + const [page, setPage] = useState(1); + const [visible, setVisible] = useState(false); + const [isRepairDocument, setIsRepairDocument] = useState('0'); + const [repairAdvice, setRepairAdvice] = useState(''); + const pageSize = props.pageSize || 10; + + useEffect(() => { + changePage(page); + }, [page]); + + + function agreeClick(id) { + Modal.confirm({ + title: '是否确认审批通过?', + onOk() { + checkTask({ + id, + isPassed: 1, + }).then(res => { + if (res.message === 'success') { + showNotification('操作成功'); + reloadList(); + } + }) + } + }); + } + + + function refuseClick(id) { + setCheckedId(id); + setVisible(true); + } + + function refuse() { + if (!repairAdvice) { + showNotification('请输入拒绝的理由'); + return; + } + checkTask({ + id: checkedId, + isPassed: 0, + isRepairDocument, + repairAdvice: repairAdvice + }).then(res => { + if (res.message === 'success') { + showNotification('操作成功'); + reloadList(); + setRepairAdvice(''); + setVisible(false); + } + }); + } + + function goUser(login) { + window.location.href = `/users/${login}`; + } + + function goUserMes(login) { + window.location.href = `/users/${login}/message_detail`; + } + + return ( + loading ? : + + { + list.map(item => { + return ( +
      + + 头像加载失败 +
      +
    • + { goUser(item.user.login) }}>{item.user.nickname || item.user.login} + {timeAgo(item.createdAt)} + + {item.status > 2 && 已同意} + {item.status === 2 && 已拒绝} + + { + item.status === 1 && + { goUserMes(item.user.login) }}>私信 + { agreeClick(item.id) }}>同意 + { refuseClick(item.id) }}>拒绝 + + } + +
    • +
        +
        +
        + + 主体名称: + {item.enterpriseName} + + + 信用代码: + 123456789123456789 + +
        +
        +
        +
        + + 联系手机: + {item.contactPhone}(位置分析:河北-唐山) + + + IP地址: + {item.ip}(位置分析:北京-北京) + +
        +
        +
        + + 所在行业: + {categoryArr[item.categoryId]} + + + 企业规模: + 0-10人 + + + 所在职位: + 普通员工 + +
        +
        +
        + + 任务编号: + {item.number} + + + 任务名称: + + {item.name} + + +
        +
      + + + + ) + }) + } + + {list.length > 0 ? +
      + {total > pageSize && { setPage(page) }} + current={curPage} + total={total} + showTotal={total => `共 ${total} 条`} + />} +
      : + } + + { setVisible(false) }} + className="form-edit-modal" + > + { setIsRepairDocument(e.target.value) }}> + 不允许重新发布 + 允许修缮后重新发布 + +