From 6ec6ab2308732ee4106698e4ed27be8f1b869897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=AB=A5=E5=B4=87?= <792998983@qq.com> Date: Wed, 23 Jun 2021 08:54:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=9C=80=E6=B1=82=E7=9A=84?= =?UTF-8?q?=E9=83=A8=E5=88=86bug=E5=8F=8A=E5=AF=B9=E6=8E=A5=E6=88=90?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/DateUtil.js | 131 +++++--- src/common/educoder.js | 2 +- src/military/components/chooseNav/index.scss | 2 + .../components/itemListAchieve/index.jsx | 214 +++++++++--- .../components/itemListMyTask/index.jsx | 4 +- .../components/itemListTask/index.jsx | 4 +- src/military/components/statusNav/index.scss | 1 + src/military/fetch.js | 14 +- src/military/index.scss | 1 + src/military/task/api.js | 91 ++++- src/military/task/myTask/index.jsx | 10 +- src/military/task/static.js | 15 +- src/military/task/taskDetail/index.jsx | 313 +++++++++--------- src/military/task/taskEdit/index.jsx | 83 +++-- src/military/task/taskEdit/index.scss | 7 + src/military/task/taskList/index.jsx | 5 +- 16 files changed, 587 insertions(+), 310 deletions(-) diff --git a/src/common/DateUtil.js b/src/common/DateUtil.js index 859182e1..0912ac49 100644 --- a/src/common/DateUtil.js +++ b/src/common/DateUtil.js @@ -1,4 +1,4 @@ -import moment from "moment"; +import moment from "moment"; // 处理整点 半点 // 取传入时间往后的第一个半点 @@ -12,7 +12,7 @@ export function handleDateString(dateString) { if (miniute < 30 || miniute == 60) { return [ar[0], '30'].join(':') } - if (miniute < 60) { + if (miniute < 60) { // 加一个小时 const tempStr = [ar[0], '00'].join(':'); const format = "YYYY-MM-DD HH:mm"; @@ -20,7 +20,7 @@ export function handleDateString(dateString) { _moment.add(1, 'hours') return _moment.format(format) } - + return dateString } @@ -38,62 +38,91 @@ export function getNextHalfHourOfMoment(moment) { return moment } - export function formatSeconds(value) { +export function formatSeconds(value) { -         var theTime = parseInt(value);// 秒 -         var middle= 0;// 分 -         var hour= 0;// 小时 -      -         if(theTime > 60) { -             middle= parseInt(theTime/60); -             theTime = parseInt(theTime%60); -             if(middle> 60) { -                 hour= parseInt(middle/60); -                 middle= parseInt(middle%60); -             } -         } -         var result = ""+parseInt(theTime)+"秒"; -         if(middle > 0) { - if(hour>0){ - result = ""+parseInt(middle)+"分"; - }else{ - result = ""+parseInt(middle)+"分"+result; - } -              -         } -         if(hour> 0) { -             result = ""+parseInt(hour)+"小时"+result; -         } -         return result; -     } - + var theTime = parseInt(value);// 秒 + var middle = 0;// 分 + var hour = 0;// 小时 -export function formatDuring(mss){ + if (theTime > 60) { + middle = parseInt(theTime / 60); + theTime = parseInt(theTime % 60); + if (middle > 60) { + hour = parseInt(middle / 60); + middle = parseInt(middle % 60); + } + } + var result = "" + parseInt(theTime) + "秒"; + if (middle > 0) { + if (hour > 0) { + result = "" + parseInt(middle) + "分"; + } else { + result = "" + parseInt(middle) + "分" + result; + } + + } + if (hour > 0) { + result = "" + parseInt(hour) + "小时" + result; + } + return result; +} + + +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)); + // 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)); - try { - days = Math.abs(days); - } catch (e) { + try { + days = Math.abs(days); + } catch (e) { - } - try { - hours = Math.abs(hours); - } catch (e) { + } + try { + hours = Math.abs(hours); + } catch (e) { - } - try { - minutes = Math.abs(minutes); - } catch (e) { + } + try { + minutes = Math.abs(minutes); + } catch (e) { - } + } return days + "天" + hours + "小时" + minutes + "分"; } + +/* + 返回多久以前 + backDate:以前的某个日期 +*/ +export function timeAgo(backDate) { + try { + moment(backDate); + } catch (e) { + return; + } + let time = new Date() - moment(backDate); + var days = Math.round(time / (1000 * 60 * 60 * 24)); + var hours = Math.round((time % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); + var minutes = Math.round((time % (1000 * 60 * 60)) / (1000 * 60)); + var seconds = Math.round((time % (1000 * 60 * 60)) / 1000); + if (days) { + return "约" + days + "天前"; + } + if (hours) { + return "约" + hours + "小时前"; + } + if (minutes) { + return "约" + minutes + "分前"; + } + if (seconds) { + return "约" + seconds + "秒前"; + } +} \ No newline at end of file diff --git a/src/common/educoder.js b/src/common/educoder.js index 1fc86893..c6eaf176 100644 --- a/src/common/educoder.js +++ b/src/common/educoder.js @@ -27,7 +27,7 @@ export { markdownToHTML, uploadNameSizeSeperator, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll, isImageExtension, downloadFile, sortDirections, validateLength, mdJSONParse, exportMdtoHtml } from './TextUtil' -export { handleDateString, getNextHalfHourOfMoment, formatDuring, formatSeconds } from './DateUtil' +export { handleDateString, getNextHalfHourOfMoment, formatDuring, formatSeconds ,timeAgo} from './DateUtil' export { configShareForIndex, configShareForPaths, configShareForShixuns, configShareForCourses, configShareForCustom } from './util/ShareUtil' diff --git a/src/military/components/chooseNav/index.scss b/src/military/components/chooseNav/index.scss index bd68f5b3..2aa4d066 100644 --- a/src/military/components/chooseNav/index.scss +++ b/src/military/components/chooseNav/index.scss @@ -16,6 +16,7 @@ text-align: center; color: #333; font-weight: 500; + flex:none; } .choose-box-big{ @@ -27,6 +28,7 @@ .choose-list { display: flex; justify-content: start; + flex-wrap: wrap; } .choose-item { color:#666; diff --git a/src/military/components/itemListAchieve/index.jsx b/src/military/components/itemListAchieve/index.jsx index 0f7e2bf0..3f602395 100644 --- a/src/military/components/itemListAchieve/index.jsx +++ b/src/military/components/itemListAchieve/index.jsx @@ -1,100 +1,212 @@ import React, { useEffect, useState } from 'react'; -import { Icon, Pagination } from 'antd'; -import { getImageUrl } from 'educoder'; +import { Icon, Pagination, Modal, Input ,Button} from 'antd'; +import { getImageUrl, timeAgo } from 'educoder'; +import ReactWEditor from 'wangeditor-for-react'; +import { reportAchieve, thumbUpAchieve, commentAdd } from '../../task/api'; +import { httpUrl } from '../../fetch'; import Nodata from '../../../forge/Nodata'; import Loading from "../../../Loading"; - import './index.scss'; -const statusArr = ["草稿", "待审核", "已拒绝", "成果征集中", "成果评选中", "公示中", "协议签订中", "支付中", "已完成"]; -const classArr = ['', 'list-done', 'list-error', 'list-red', 'list-yellow', '', '', 'list-pay', 'list-gray',]; +const { TextArea } = Input; + +// 如果是开发,那么文件系统默认使用117.50.100.12 +let fileHttpUrl = httpUrl; +if (window.location.href.indexOf('localhost') > -1) { + fileHttpUrl = 'http://117.50.100.12:8001'; +} + +// const classArr = ['', 'list-done', 'list-error', 'list-red', 'list-yellow', '', '', 'list-pay', 'list-gray',]; export default (props) => { - const { list, curPage, total, changePage, loading } = props; + const { list, curPage, total, changePage, loading, applyStatusAllNameArr, relaodList, showNotification } = props; const [page, setPage] = useState(1); const [pageSize, setPageSize] = useState(() => { return props.pageSize || 10; }); + const [checkedItem, setCheckedItem] = useState({}); + const [reportVisible, setReportVisible] = useState(false); + const [reportValue, setReportValue] = useState(''); + const [commentHtml, setCommentHtml] = useState(''); useEffect(() => { changePage(page); }, [page]); + function downFile(item) { + let url = fileHttpUrl + '/busiAttachments/download/' + item.id; + window.open(url); + } + + function report() { + if (!reportValue) { + return; + } + reportAchieve({ + paperId: checkedItem.id, + content: reportValue + }).then(res => { + if (res.message === 'success') { + showNotification('举报成功'); + setReportVisible(false); + setReportValue(''); + } + }); + } + + function thumbUp(id) { + thumbUpAchieve(id).then(res => { + relaodList(); + }); + } + + function commentPush(item) { + commentAdd({ + content:commentHtml, + paperId:'' + }).then(res => { + + }); + } + + function commentEdit(id){ + + } + return ( - loading ? : - - { - list.map(item => { - return ( - + + {loading ? : + + { + list.map(item => { + return (
- + 头像加载失败
  • - 莫胜吕 + {item.user.nickName || item.user.login} - 2 天前 - 待审核 + {timeAgo(item.createdAt)} + {!item.verifyStatus && "待审核"}
  • - 待确认 - + {applyStatusAllNameArr[item.status]} +
- {/*
  • -
    - -
    -
  • */} -
    +
    + { + item.paperDetail.busiAttachments && item.paperDetail.busiAttachments.map(fileItem => { + return
    + { downFile(fileItem) }}> + {fileItem.fileName} + ({fileItem.fileSizeString}) +
    + }) + } +
    + + {/* + */}
  • - 成果编号:#25698320 - 提交时间:2021-06-17 13: 45: 53 - 稿件状态:雇主已浏览 + 成果编号:#{item.number} + 提交时间:{item.createdAt} + 稿件状态:{item.read ? '雇主已浏览' : '雇主未浏览'} - 举报 - 0 - - 2 - + { setReportVisible(true); setCheckedItem(item) }}>举报 + { commentEdit(item.id) }}>0 + { thumbUp(item.id) }}>{item.thumbsUp}
  • -
    + + + { + setCommentHtml(html); + }} + /> + + +
    - - ) - }) - } - {list.length > 0 ? -
    - {total > pageSize && { setPage(page) }} - current={curPage} - total={total} - showTotal={total => `共 ${total} 条`} - />} -
    : - } - + ) + }) + } + + {list.length > 0 ? +
    + {total > pageSize && { setPage(page) }} + current={curPage} + total={total} + showTotal={total => `共 ${total} 条`} + />} +
    : + } + + } + + + { setReportVisible(false) }} + className="form-edit-modal" + > +
    +

    你的申诉信息将发送给平台管理员

    +

    请如实填写有效的申诉原由,我们将尽快完成审核

    +