From 21a3c54754d0fdc57554ca647c10a8f1febd61d9 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, 6 Jul 2021 14:46:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9BUG=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/military/components/sortBox/index.jsx | 20 +- src/military/fetch.js | 26 --- src/military/index.scss | 88 +------ src/military/task.js | 145 +++++++----- src/military/task/api.js | 49 +++- .../task/components/itemListMyTask/index.jsx | 49 ++-- .../task/components/itemListPaper/index.jsx | 151 +++++++++--- .../task/components/itemListTask/index.jsx | 4 +- .../task/components/itemTaskManage/index.jsx | 6 +- .../task/components/proofModal/index.jsx | 104 +++++++++ .../task/components/proofModal/index.scss | 0 src/military/task/index.scss | 38 +++- src/military/task/myTask/joinTask.jsx | 102 ++++----- src/military/task/paperComplain/index.js | 214 ++++++++++++++++++ src/military/task/paperManage/index.jsx | 21 +- src/military/task/taskDetail/index.jsx | 58 +++-- src/military/task/taskDetail/index.scss | 2 +- src/military/task/taskEdit/index.jsx | 4 +- src/military/task/taskList/index.jsx | 35 +-- 19 files changed, 782 insertions(+), 334 deletions(-) create mode 100644 src/military/task/components/proofModal/index.jsx create mode 100644 src/military/task/components/proofModal/index.scss create mode 100644 src/military/task/paperComplain/index.js diff --git a/src/military/components/sortBox/index.jsx b/src/military/components/sortBox/index.jsx index ebfcc7dc..4cb0f4f3 100644 --- a/src/military/components/sortBox/index.jsx +++ b/src/military/components/sortBox/index.jsx @@ -1,13 +1,18 @@ -import React, { useEffect, useState ,memo} from 'react'; +import React, { useEffect, useState, memo } from 'react'; import { Icon, } from 'antd'; import classNames from 'classnames'; import './index.scss'; export default memo((props) => { - const { options, changeOptionId, type, defaultValue } = props; + const { options, changeOptionId, type } = props; - const [myOptions, setMyOptions] = useState(options); - const [option, setOption] = useState(defaultValue); + const [myOptions, setMyOptions] = useState(()=>{ + return JSON.parse(JSON.stringify(options)); + }); + const [option, setOption] = useState({ + name: '综合', + type: 'default', + }); useEffect(() => { changeOptionId(option, type); @@ -18,15 +23,16 @@ export default memo((props) => { ...activeItem, desc: !activeItem.desc }; - for(const item of myOptions){ - if(item.type===activeItem.type){ - item.desc=newOption.desc; + for (const item of myOptions) { + if (item.type === activeItem.type) { + item.desc = newOption.desc; } } setOption(newOption); setMyOptions(myOptions); } + console.log('-----options----') return (
diff --git a/src/military/fetch.js b/src/military/fetch.js index 9ddf58ce..da73e6fd 100644 --- a/src/military/fetch.js +++ b/src/military/fetch.js @@ -2,28 +2,6 @@ import { notification } from 'antd'; import axios from 'axios'; 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://106.75.31.211:58088'; -// export const httpUrl = 'http://192.168.31.72:8089'; -<<<<<<< HEAD -<<<<<<< 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.104:8081'; ->>>>>>> 2aa8942... 增加成果审核页面 - -// export const httpUrl = 'http://192.168.31.168:8081'; ->>>>>>> 5131dac... 修复成果提交时的bug,联调我是创客 let actionUrl = ''; @@ -91,10 +69,6 @@ service.interceptors.response.use( message: "提示", description: '账户或密码错误!', }); -<<<<<<< HEAD -======= - // window.location.href="/404"; ->>>>>>> 09e81b9... 添加成果内容 return Promise.reject('error'); } if (response.status !== 200 && res.status !== 200) { diff --git a/src/military/index.scss b/src/military/index.scss index fc49071c..7964b096 100644 --- a/src/military/index.scss +++ b/src/military/index.scss @@ -11,9 +11,6 @@ .color-deep-blue{ color:#1B8FFF; } -.text-center{ - text-align: center; -} .centerbox { width: 1200px; margin: 40px auto; @@ -30,25 +27,23 @@ } } width: 80vw; - max-width: 1200px; + max-width: 1280px; margin: 40px auto; position: relative; } .center-content { - padding-top:5px; background: #fff; - box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.05); - border-radius: 5px; - overflow: auto; + border: 1px solid #dedede; + box-shadow: #eee 0px 1px 1px 3px; } .centerScreen { display: flex; justify-content: space-between; - height: 60px; + height: 46px; background-color: #fff; border-bottom: 1px solid #dedede; +} -<<<<<<< HEAD // 内容标题左侧样式 .center-left-but { display: flex; @@ -76,8 +71,6 @@ .center-left-butDACT { background-color: #409eff; color: #fff; -======= ->>>>>>> 216e984... 上传我的成果静态页面 } .head-navigation { @@ -137,7 +130,6 @@ max-width: 500px; } -<<<<<<< HEAD .link{ color: #0089ff; cursor: pointer; @@ -156,9 +148,6 @@ } .none_panels{ -======= -.none_panels { ->>>>>>> 2ed7e0d... 上传创客新增任务及列表代码 display: flex; justify-content: center; align-items: center; @@ -173,7 +162,6 @@ text-align: left; } -<<<<<<< HEAD // 富文本样式 .w-e-text table td, .w-e-text table th{ height: 30px; @@ -217,69 +205,3 @@ width: 98%; } } -======= - -.ant-modal-footer{ - text-align: center; - border: 0; -} -<<<<<<< HEAD ->>>>>>> 92f3934... 上传我的需求及 -======= - -// 富文本样式 -.w-e-text table td, .w-e-text table th{ - height: 30px; -} -// 富文本生成的内容的样式 -.editor-w-text table td, .editor-w-text table th{ - border-bottom: 1px solid #ccc; - border-right: 1px solid #ccc; - padding: 3px 5px; - height: 30px; - min-height: 30px; -} -.editor-w-text table th { - border-bottom: 2px solid #ccc; - text-align: center; - background-color: #f1f1f1; -} -.editor-w-text table { - border-top: 1px solid #ccc; - border-left: 1px solid #ccc; -} -.editor-w-text blockquote { - display: block; - border-left: 8px solid #d0e5f2; - padding: 5px 10px; - margin: 10px 0; - line-height: 1.4; - font-size: 100%; - background-color: #f1f1f1; -} -.user-box{ - cursor: pointer; - &:hover{ - color: #409eff; - } -} - - -@media screen and (max-width: 1200px){ - .centerbox { - width: 100vw; - } - .newHeaders{ - min-width: 325px; - } - .newContainers{ - min-width: 325px; - .newMain{ - min-width: 325px; - } - } - .newFooter{ - min-width: 325px; - } -} ->>>>>>> 216e984... 上传我的成果静态页面 diff --git a/src/military/task.js b/src/military/task.js index aabb29b1..4eaaa264 100644 --- a/src/military/task.js +++ b/src/military/task.js @@ -1,4 +1,4 @@ -import React, { Component } from "react"; +import React, { Component, useEffect, useState } from "react"; import { Route, Switch } from "react-router-dom"; import { withRouter } from "react-router"; @@ -7,6 +7,7 @@ import { CNotificationHOC } from "../modules/courses/common/CNotificationHOC"; import { TPMIndexHOC } from "../modules/tpm/TPMIndexHOC"; import Loadable from "react-loadable"; import Loading from "../Loading"; +import { getUserInfo } from './task/api'; import { ImageLayerOfCommentHOC } from "../modules/page/layers/ImageLayerOfCommentHOC"; import './index.scss'; @@ -40,67 +41,93 @@ const PaperManage = Loadable({ loading: Loading, }); -class Index extends Component { - render() { - return ( -
- +const PaperComplain = Loadable({ + loader: () => import("./task/paperComplain"), + loading: Loading, +}); - ( - - )} - > - - ( - - )} - > - - ( - - )} - > - - ( - - )} - > - - ( - - )} - > - - ( - - )} - > - - ( - - )} - > - - - -
- ); +const Index = (propsTransmit) => { + // 开发时,从代理的位置获取用户信息 + const [currentUser, setCurrentUser] = useState(null); + const isDev = window.location.href.indexOf('3007') > -1 ? true : false; + useEffect(() => { + isDev && getUserInfo().then(res => { + if (res && res.data) { + setCurrentUser(res.data); + } + }) + }, [isDev]) + let propsF = { ...propsTransmit }; + if (isDev && currentUser) { + propsF.current_user = currentUser; } + + return ( +
+ + + ( + + )} + > + + ( + + )} + > + + ( + + )} + > + + ( + + )} + > + + ( + + )} + > + + ( + + )} + > + + ( + + )} + > + + ( + + )} + > + + + +
+ ); } +// } export default withRouter( ImageLayerOfCommentHOC({ imgSelector: ".imageLayerParent img, .imageLayerParent .imageTarget", diff --git a/src/military/task/api.js b/src/military/task/api.js index 9f3d4e3a..29d2df67 100644 --- a/src/military/task/api.js +++ b/src/military/task/api.js @@ -1,4 +1,4 @@ -import fetch from '../fetch'; +import fetch,{} from '../fetch'; import { notification } from 'antd'; // 获取字典分类列表 @@ -9,6 +9,14 @@ export function getDictionary(id) { }); } +// 获取用户信息 +export function getUserInfo() { + return fetch({ + url: '/user/getUserInfo', + method: 'get' + }); +} + // 获取任务领域 export async function getTaskCategory() { let res = await fetch({ @@ -250,6 +258,43 @@ export function checkPaper(data){ return fetch({ url: `/api/paper/admin/complainPaper/${data.paperId}`, method: 'post', - data: data + data: data.auditingVo }); } + +// 成果申诉 +export function complainPaper(data){ + return fetch({ + url: `/api/paper/complainInfo/${data.paperId}`, + method: 'post', + data: data.params + }); +} + +// 审核申诉材料列表查询 +export async function complainPaperList(params) { + let res = await fetch({ + url: '/api/paper/admin/readyComplaintPapers', + method: 'get', + params, + }); + if (res.data) { + return res.data; + } else { + notification.open({ + message: "提示", + description: res.message || '请求错误', + }); + } +} + +// 审核申诉材料 +export function checkComplain(data){ + return fetch({ + url: `/api/paper/admin/complainMaterial/${data.paperId}`, + method: 'post', + data: data.auditingVo + }); +} + + diff --git a/src/military/task/components/itemListMyTask/index.jsx b/src/military/task/components/itemListMyTask/index.jsx index e0466394..f1f1cc7e 100644 --- a/src/military/task/components/itemListMyTask/index.jsx +++ b/src/military/task/components/itemListMyTask/index.jsx @@ -1,9 +1,11 @@ -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useState, useCallback } from 'react'; import { Modal, Pagination } from 'antd'; import { Link } from "react-router-dom"; import Nodata from 'forge/Nodata'; import Loading from "src/Loading"; +import ProofModal from '../proofModal'; import { publishModeArr, taskStatusAllArr } from '../../static'; +import '../../index.scss'; import './index.scss'; const statusArr = []; @@ -11,11 +13,11 @@ for (const item of taskStatusAllArr) { statusArr[item.dicItemCode] = item.dicItemName; } export default (props) => { - const { list, curPage, total, changePage, taskCategoryValueArr, loading, publish } = 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 [taskId, setTaskId] = useState({}); const pageSize = props.pageSize || 10; useEffect(() => { @@ -24,13 +26,13 @@ export default (props) => { function uploadProofs(item) { setVisibleProofs(true); - setActiveItem(item); + setTaskId(item.id); } - function repairAdvice(repairAdvice){ + function repairAdvice(repairAdvice) { Modal.info({ title: '审核意见', - content:repairAdvice + content: repairAdvice }) } @@ -81,9 +83,11 @@ export default (props) => { } {item.status === 4 && 成果评选} - {item.status === 4 && item.papersCount && (!item.isProofBoolean) && { uploadProofs(item) }} className="line_1 color-blue">上传佐证材料} + { + // 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">审核意见} + {(item.status === 9) && { repairAdvice(item.repairAdvice) }} className="line_1 color-blue">审核意见} {/* 支付登记 */} {/* 上传支付凭证 */} @@ -108,31 +112,12 @@ export default (props) => { } - { setVisibleProofs(false) }} - className="form-edit-modal" - > - {/*
- - - - - - - - -
*/} -
+ changeVisible={setVisibleProofs} + /> ) -} \ No newline at end of file +} diff --git a/src/military/task/components/itemListPaper/index.jsx b/src/military/task/components/itemListPaper/index.jsx index 3abad470..469f7d44 100644 --- a/src/military/task/components/itemListPaper/index.jsx +++ b/src/military/task/components/itemListPaper/index.jsx @@ -1,11 +1,12 @@ -import React, { useEffect, useState } from 'react'; -import { Pagination, Modal, Input, Button } from 'antd'; +import React, { useEffect, useState, useCallback } from 'react'; +import { Pagination, Modal, Form, Input, Button } from 'antd'; 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 { reportPaper, thumbUpPaper, commentAdd } from '../../api'; +import Upload from 'military/components/Upload'; +import { reportPaper, thumbUpPaper, commentAdd, complainPaper } from '../../api'; import { httpUrl } from '../../../fetch'; import winpng from '../../image/win.png'; @@ -13,12 +14,11 @@ import './index.scss'; const { TextArea } = Input; -export default (props) => { - const { list, curPage, total, changePage, loading, applyStatusAllNameArr, reloadList, showNotification } = props; +export default Form.create()((props) => { + const { list, curPage, total, changePage, loading, applyStatusAllNameArr, reloadList, showNotification, current_user, form } = props; + const { getFieldDecorator, validateFields, } = form; const [page, setPage] = useState(1); - const [pageSize, setPageSize] = useState(() => { - return props.pageSize || 10; - }); + const pageSize = props.pageSize || 10; const [checkedItem, setCheckedItem] = useState({}); const [reportVisible, setReportVisible] = useState(false); const [reportValue, setReportValue] = useState(''); @@ -26,6 +26,10 @@ export default (props) => { const [commentId, setCommentId] = useState(undefined); + const [complainVisible, setComplainVisible] = useState(false); + const [complainValue, setComplainValue] = useState(''); + const [fileList, setFileList] = useState(null); + useEffect(() => { changePage(page); }, [page]); @@ -36,17 +40,18 @@ export default (props) => { } function report() { - if (!reportValue) { - return; - } - reportPaper({ - paperId: checkedItem.id, - content: reportValue - }).then(res => { - if (res.message === 'success') { - showNotification('举报成功'); - setReportVisible(false); - setReportValue(''); + validateFields((error, values) => { + if (!error) { + reportPaper({ + paperId: checkedItem.id, + content: values.reportValue + }).then(res => { + if (res.message === 'success') { + showNotification('举报成功'); + setReportVisible(false); + setReportValue(''); + } + }); } }); } @@ -92,6 +97,49 @@ export default (props) => { window.location.href = `/users/${login}`; } + function complain() { + if (!fileList || !fileList.length) { + showNotification('请提交申诉文件!'); + return; + } + validateFields((error, values) => { + if (!error) { + let files = []; + for (const item of fileList) { + files.push(item.id || item.response.data.id); + } + complainPaper({ + paperId: checkedItem.id, + params: { + content: values.complainValue, + files: files.join() + } + }).then(res => { + if (res.message === 'success') { + showNotification('申诉提交成功'); + setComplainVisible(false); + setComplainValue(''); + setFileList(null); + } + }); + } + }); + } + + // 上传附件后得到的文件数组 + function UploadFunc(fileList) { + setFileList(fileList); + } + + const helper = useCallback( + (name, rules, widget) => ( + + {getFieldDecorator(name, { rules, validateFirst: true })(widget)} + + ), + [] + ); + return ( {loading ? : @@ -110,13 +158,16 @@ export default (props) => { {item.user.nickname || item.user.login} {timeAgo(item.createdAt)} - {!item.verifyStatus && "待审核"} + {item.verifyStatus ? applyStatusAllNameArr[item.status] : "待审核"}
  • - + {/* {applyStatusAllNameArr[item.status]} - + */} + {item.needComplain && (current_user.login === item.user.login) && { setComplainVisible(true); setCheckedItem(item) }}> + 申诉 + }
  • @@ -203,17 +254,64 @@ export default (props) => { onOk={report} onCancel={() => { setReportVisible(false) }} className="form-edit-modal" + > +
    +

    你的举报信息将发送给平台管理员

    +

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

    + { + helper('reportValue', [{ required: reportVisible, message: "(必填)请在此输入发起举报的原因,最大限制100个字符" }, + { max: 100, message: '长度不能超过100个字符' }], +