Merge pull request 'merge after release' (#309) from pre_dev_military into dev_military

This commit is contained in:
baladiwei 2021-12-08 13:48:40 +08:00
commit 846a24aef4
21 changed files with 172 additions and 196 deletions

View File

@ -1,7 +1,7 @@
import React, { useEffect, useState } from "react";
import { Upload, Button } from 'antd';
import { appendFileSizeToUploadFileAll } from 'educoder';
import { httpUrl } from '../fetch';
import { httpUrl } from '../task/fetch';
function Uploads({ className, size, actionUrl, fileList, showNotification, load }) {
const [files, setFiles] = useState(undefined);

View File

@ -1,4 +1,4 @@
import { httpUrl } from '../fetch';
import { httpUrl } from '../task/fetch';
export const editorConfig = {
placeholder: '请输入',

View File

@ -1,24 +1,20 @@
import { notification,message } from 'antd';
import { notification} from 'antd';
import axios from 'axios';
import cookie from 'react-cookies';
let settings=JSON.parse(localStorage.chromesetting);
let actionUrl = settings.api_urls? settings.api_urls.task :'https://task.osredm.com';
if (window.location.href.indexOf('localhost') < 0) {
export const TokenKey = 'autologin_forge_military';
export default function javaFetch(actionUrl){
if (window.location.href.indexOf('localhost') < 0) {
axios.defaults.withCredentials = true;
}
export const httpUrl = actionUrl;
}
const TokenKey = 'autologin_forge_military';
// 创建axios实例
const service = axios.create({
baseURL: actionUrl,
timeout: 1800000, // 请求超时时间
});
// 创建axios实例
const service = axios.create({
baseURL: httpUrl,
timeout: 10000, // 请求超时时间
});
// request拦截器
// request拦截器
service.interceptors.request.use(config => {
if (cookie.load(TokenKey)) {
console.log(cookie.load(TokenKey));
@ -26,11 +22,11 @@ service.interceptors.request.use(config => {
}
if (window.location.port === "3007") {
// 模拟token为登录用户
const taskToken = sessionStorage.taskToken;
const osredmToken = sessionStorage.osredmToken;
if (config.url.indexOf('?') === -1) {
config.url = `${config.url}?token=${taskToken}`;
config.url = `${config.url}?token=${osredmToken}`;
} else {
config.url = `${config.url}&token=${taskToken}`;
config.url = `${config.url}&token=${osredmToken}`;
}
}
return config;
@ -110,4 +106,5 @@ service.interceptors.response.use(
}
);
export default service;
return service;
}

View File

@ -1,114 +1,10 @@
import { notification } from 'antd';
import axios from 'axios';
import cookie from 'react-cookies';
import javaFetch from '../javaFetch';
let settings = JSON.parse(localStorage.chromesetting);
let actionUrl = settings.api_urls ? settings.api_urls.notice : 'https://info.osredm.com';
if (window.location.href.indexOf('localhost')< 0) {
axios.defaults.withCredentials = true;
}
let settings=JSON.parse(localStorage.chromesetting);
let actionUrl = settings.api_urls? settings.api_urls.notice :'https://info.osredm.com';
const service = javaFetch(actionUrl);
export const httpUrl = actionUrl;
const TokenKey = 'autologin_forge_military';
// 创建axios实例
const service = axios.create({
baseURL: httpUrl,
timeout: 10000, // 请求超时时间
});
// request拦截器
service.interceptors.request.use(config => {
if (cookie.load(TokenKey)) {
console.log(cookie.load(TokenKey));
config.headers['Authorization'] = cookie.load(TokenKey); // 让每个请求携带自定义token 请根据实际情况自行修改
}
if (window.location.port === "3007") {
// 模拟token为登录用户
const taskToken = sessionStorage.taskToken;
if (config.url.indexOf('?') === -1) {
config.url = `${config.url}?token=${taskToken}`;
} else {
config.url = `${config.url}&token=${taskToken}`;
}
}
return config;
}, error => {
// Do something with request error
console.log(error); // for debug
Promise.reject(error);
});
// respone拦截器
service.interceptors.response.use(
response => {
const res = response;
if (res.status === 400) {
notification.open({
message: "提示",
description: res.data.message || '验证失败',
});
return Promise.reject('error');
}
if (res.status === 401) {
notification.open({
message: "提示",
description: res.data.message || '未授权,请登录!',
});
return Promise.reject('error');
}
if (res.status === 403) {
notification.open({
message: "提示",
description: res.data.message || '无权限',
});
return Promise.reject('error');
}
if (res.status === 40001) {
notification.open({
message: "提示",
description: '账户或密码错误!',
});
return Promise.reject('error');
}
if (response.status !== 200 && res.status !== 200) {
notification.open({
message: "提示",
description: res.message,
});
} else {
return response.data;
}
},
error => {
console.log(error);
let res = error.response || {};
if (res.status === 400) {
notification.open({
message: "提示",
description: res.data.message || '操作失败',
});
return Promise.reject('error');
}
if (res.status === 401) {
notification.open({
message: "提示",
description: res.data.message || '登录信息已过期',
});
return Promise.reject('error');
}
if (res.status === 403) {
notification.open({
message: "提示",
description: res.data.message || '无权限!',
});
window.location.href = "/403";
return Promise.reject('error');
}
return Promise.reject(error);
}
);
export default service;

View File

@ -1,6 +1,5 @@
import fetch, { } from '../fetch';
import fetch, { } from './fetch';
import { notification } from 'antd';
import { func } from 'prop-types';
// 获取字典分类列表
export function getDictionary(id) {
@ -121,11 +120,18 @@ export async function getTaskDetail(id) {
if (res.data) {
return res.data;
} else {
if(res.message&&res.message.indexOf('exist')>-1){
notification.open({
message: "提示",
description: "未查到该任务",
});
}else{
notification.open({
message: "提示",
description: res.message || '请求错误',
});
}
}
}
//新增任务
@ -147,9 +153,9 @@ export function updateTask(data) {
}
//删除
export function deleteTask(id) {
export function deleteTask(id, isDelete) {
return fetch({
url: '/api/tasks/' + id,
url: '/api/tasks/' + id + '?isDelete=' + isDelete,
method: 'DELETE',
});
}
@ -500,7 +506,7 @@ export async function uploadPayProofList(params) {
}
// 管理员上传支付凭证
export function uploadPayProof(data){
export function uploadPayProof(data) {
return fetch({
url: `/api/sign/admin/paper/payment/${data.paperId}`,
method: 'post',
@ -558,7 +564,7 @@ export function delayTask(data) {
return fetch({
url: `/api/tasks/backend/admin/task/delay/${data.taskId}`,
method: 'post',
data:data.params,
data: data.params,
});
}

View File

@ -30,7 +30,7 @@ export default props => {
<Menu.Item><a href="/task/payProof">支付报酬凭证上传</a></Menu.Item>
</SubMenu>
<Menu.Item><a href="/task/taskAdmin">创客列表</a></Menu.Item>
<Menu.Item><a href="/task/taskAdmin">任务列表</a></Menu.Item>
<Menu.Item><a href="/task/paperManage">创意征集评论</a></Menu.Item>
</Menu>
});
@ -66,7 +66,8 @@ export default props => {
return <Menu>
<Menu.Item><a target="_blank" rel="noopener noreferrer" href={`${main_web_site_url}/managements/enterprise_authentication`}>企业认证</a></Menu.Item>
<Menu.Item><a target="_blank" rel="noopener noreferrer" href={`${main_web_site_url}/admin/reviews/projects_list`}>开源项目</a></Menu.Item>
<Menu.Item><a href="/task/taskManage">统筹任务发布审批</a></Menu.Item>
<Menu.Item><a href="/task/taskManage/1">统筹任务发布审批</a></Menu.Item>
<Menu.Item><a href="/task/taskManage/0">自主任务发布审批</a></Menu.Item>
<Menu.Item><a href="/task/paperComplain">成果上传申诉审批</a></Menu.Item>
<Menu.Item><a href="/task/publicityComplain">公示期成果申诉审批</a></Menu.Item>
<Menu.Item><a href="/task/agreementManage">协议审批</a></Menu.Item>

View File

@ -5,7 +5,7 @@ import Nodata from 'forge/Nodata';
import Loading from "src/Loading";
import { timeAgo, getImageUrl } from 'educoder';
import { adminCheckAgreement } from '../../api';
import { httpUrl } from 'military/fetch';
import { httpUrl } from '../../fetch';
import './index.scss';
const { TextArea } = Input;

View File

@ -7,7 +7,7 @@ import Upload from 'military/components/Upload';
import ProofModal from '../proofModal';
import { publishModeArr, taskStatusAllArr, myPaperStatusArr } from '../../static';
import { signMethod, uploadAgreeRequire, downAgreement } from "../../api";
import { httpUrl } from 'military/fetch';
import { httpUrl } from '../../fetch';
import '../../index.scss';
import './index.scss';

View File

@ -9,7 +9,7 @@ import AgreementModal from '../agreementModal';
import ComplainModal from '../complainModal';
import { reportPaper, thumbUpPaper, commentAdd, confirmReceipt } from '../../api';
import { paperCheckStatusArr } from '../../static';
import { httpUrl } from '../../../fetch';
import { httpUrl } from '../../fetch';
import winpng from '../../image/winner.png';
import './index.scss';

View File

@ -5,7 +5,7 @@ import Nodata from 'forge/Nodata';
import Loading from "src/Loading";
import { timeAgo, getImageUrl } from 'educoder';
import { checkProof } from '../../api';
import { httpUrl } from 'military/fetch';
import { httpUrl } from '../../fetch';
import './index.scss';
const { TextArea } = Input;

View File

@ -5,7 +5,7 @@ import Nodata from 'forge/Nodata';
import Loading from "src/Loading";
import { timeAgo, getImageUrl } from 'educoder';
import { checkPublicity } from '../../api';
import { httpUrl } from 'military/fetch';
import { httpUrl } from '../../fetch';
import './index.scss';
const { TextArea } = Input;

View File

@ -155,6 +155,10 @@ export default (props) => {
<div className="clearfix"></div>
<div className="width100">
<span className="with40 fl lineh-35">
<span className="color-grey-9 fl">发布方式:</span>
<span className="infos_item mr15 fl">{item.publishMode == 1 ? '统筹任务' : '自主提交'}</span>
</span>
<span className="with25 fl lineh-35">
<span className="color-grey-9 fl">所在行业:</span>
<span className="infos_item" style={{ maxWidth: '100px' }}>{categoryArr[item.categoryId]}</span>
</span>
@ -163,6 +167,7 @@ export default (props) => {
<span className="color-grey-9 fl">企业规模:</span>
<span className="infos_item" style={{ maxWidth: '100px' }}>{scale(item.enterpriseSimple.scale)}</span>
</span>}
{/* <span className="inline-block lineh-35">
<span className="color-grey-9 fl">所在职位:</span>
<span className="infos_item">普通员工</span>

View File

@ -2,7 +2,7 @@ import React, { useEffect, useState, useCallback, useMemo } from 'react';
import { Modal, Table, Form, Input, Button, Pagination } from 'antd';
import Upload from 'military/components/Upload';
import { readyCheckPapers, proofAdd } from "../../api";
import { httpUrl } from 'military/fetch';
import { httpUrl } from '../../fetch';
import '../../index.scss';
import './index.scss';

View File

@ -0,0 +1,10 @@
import javaFetch from '../javaFetch';
let settings=JSON.parse(localStorage.chromesetting);
let actionUrl = settings.api_urls? settings.api_urls.task :'https://task.osredm.com';
const service = javaFetch(actionUrl);
export const httpUrl = actionUrl;
export default service;

View File

@ -5,7 +5,7 @@ import { Link } from "react-router-dom";
import StatusNav from '../../components/statusNav';
import { complainPaperList, checkComplain } from '../api';
import { paperComplainStatusArr } from '../static';
import { httpUrl } from 'military/fetch';
import { httpUrl } from '../fetch';
import '../index.scss';

View File

@ -1,10 +1,10 @@
import React, { useCallback, useEffect, useState, useMemo } from 'react';
import classNames from 'classnames';
import { Input, Select, Button, Form, DatePicker, Table, Pagination, } from 'antd';
import { Input, Select, Button, Form, DatePicker, Table, Pagination, Modal } from 'antd';
import { Link } from "react-router-dom";
import { paperCheckStatusArr, publishModeArr, taskStatusAllArr, showUserModeArr ,main_web_site_url} from '../static';
import { getTaskAdminList, changeShowUserMode } from '../api';
import { paperCheckStatusArr, publishModeArr, taskStatusAllArr, showUserModeArr, main_web_site_url } from '../static';
import { getTaskAdminList, changeShowUserMode, deleteTask } from '../api';
import '../index.scss';
import './index.scss';
const format = "YYYY-MM-DD HH:mm:ss";
@ -23,10 +23,12 @@ for (const item of paperCheckStatusArr) {
export default Form.create()(({ form, showNotification, match, history }) => {
const { getFieldDecorator, setFieldsValue, getFieldsValue } = form;
const [reload, setReload] = useState();
const [loading, setLoading] = useState(false);
const [statusString, setStatusString] = useState('');
const [publishMode, setPublishMode] = useState('');
const [showUserMode, setShowUserMode] = useState('');
const [isDelete, setIsDelete] = useState('0');
const [sort, setSort] = useState('Desc');
const [order, setOrder] = useState('createdAt');
@ -45,6 +47,7 @@ export default Form.create()(({ form, showNotification, match, history }) => {
curPage,
pageSize: 10,
orderBy: order + sort,
isDelete,
};
setLoading(true);
getTaskAdminList(params).then(data => {
@ -54,7 +57,7 @@ export default Form.create()(({ form, showNotification, match, history }) => {
}
setLoading(false);
})
}, [statusString, order, sort, publishMode, showUserMode, curPage, searchObj]);
}, [statusString, order, sort, publishMode, showUserMode, curPage, searchObj, isDelete, reload]);
const helper = useCallback(
@ -101,7 +104,7 @@ export default Form.create()(({ form, showNotification, match, history }) => {
dataIndex: 'name',
width: "15%",
render: (text, record) => (
<Link className="line_1 color-grey3" to={`/task/taskDetail/${record.id}`}>{text}</Link>
<Link className="line_1 primary-link" target="_blank" to={`/task/taskDetail/${record.id}`} >{text}</Link>
),
},
{
@ -195,18 +198,41 @@ export default Form.create()(({ form, showNotification, match, history }) => {
</Select>
}
},
// {
// title: '',
// key: 'action',
// render: (text, record) => (
// <React.Fragment>
// {/* <Button className="mr5 font-12" type="danger" size="small" onClick={() => { deletItem(record.id) }}></Button> */}
// <Link className="line_1 color-grey3" to={`/task/taskDetail/${record.taskId}`}></Link>
// </React.Fragment>
// ),
// },
{
title: '操作',
key: 'action',
render: (text, record) => (
<React.Fragment>
{
isDelete == '0' ? <Button className="mr5 font-12" type="danger" size="small" onClick={() => { deletItem(record.id, '1') }}>隐藏</Button>
: <Button className="mr5 font-12" type="primary" size="small" onClick={() => { deletItem(record.id, '0') }}>恢复</Button>
}
{/* <Link className="line_1 color-grey3" to={`/task/taskDetail/${record.taskId}`}>查看</Link> */}
</React.Fragment>
),
},
]
}, []);
}, [isDelete]);
function deletItem(id, isDelete) {
Modal.confirm({
title: "警告",
content: isDelete == '0' ? "确认恢复该任务吗?恢复后用户可以重新看到该任务!" : "确认隐藏?隐藏后用户无法看到该任务!",
okText: '确定',
cancelText: '取消',
onOk() {
deleteTask(id, isDelete).then(res => {
if (res.message === 'success') {
showNotification('操作成功!');
setReload(Math.random());
}
});
},
});
}
function changeStatus(showUserMode, taskId) {
changeShowUserMode({
@ -232,6 +258,11 @@ export default Form.create()(({ form, showNotification, match, history }) => {
setCurPage(1);
}, []);
const changeShow = useCallback((isDelete) => {
setIsDelete(isDelete);
setCurPage(1);
})
function downloadFile() {
window.open(main_web_site_url + '/admin/tasks.xlsx');
}
@ -290,6 +321,19 @@ export default Form.create()(({ form, showNotification, match, history }) => {
</div>
</div>
<div className="select-box">
<Form.Item className="inline-form" label="显示状态">
<Select
style={{ width: '200px' }}
showArrow
onChange={changeShow}
defaultValue='0'
>
<Option key={'0'} >正常显示默认</Option>
<Option key={'1'} >已隐藏</Option>
</Select>
</Form.Item>
<Form.Item className="inline-form" label="排序">
<Select
style={{ width: '200px' }}
@ -309,6 +353,8 @@ export default Form.create()(({ form, showNotification, match, history }) => {
</span>
</Form.Item>
</div>

View File

@ -44,6 +44,16 @@
padding: 1rem 0.2rem;
text-align: center;
}
a.primary-link {
color: #1890ff;
}
.select-box{
display: flex;
justify-content: space-between;
}
}
.inline-form {

View File

@ -59,7 +59,7 @@ const AdminPage = (propsF) => {
<Switch {...propsF}>
{/* 任务管理审核 */}
<Route
path="/task/taskManage"
path="/task/taskManage/:publishMode"
render={(props) => (
<TaskManage {...propsF} {...props} />
)}

View File

@ -10,7 +10,7 @@ import ItemListPaper from '../components/itemListPaper';
import ProofModal from '../components/proofModal';
import { getTaskDetail, getTaskCategory, getTaskPaper, makePublic, addPaper, getAgreement, agreement, checkAgreement, checkHavePaper } from '../api';
import { taskModeIdArr, applyStatusArr, applyStatusAllArr, agreementContent, paperCheckTextArr } from '../static';
import { httpUrl } from '../../fetch';
import { httpUrl } from '../fetch';
import './index.scss';
const { TextArea } = Input;
@ -53,7 +53,6 @@ export default Form.create()(
const [visibleProofs, setVisibleProofs] = useState(false);
//
useEffect(() => {
getTaskCategory().then(data => {
@ -70,8 +69,11 @@ export default Form.create()(
//
useEffect(() => {
id && getTaskDetail(id).then(data => {
if(!data){
history.push('/task');
}
setDetailData(data || {});
})
});
}, [id, reload]);
//

View File

@ -5,7 +5,7 @@ import moment from 'moment';
import ReactWEditor from 'wangeditor-for-react';
import { Link } from "react-router-dom";
import Upload from '../../components/Upload';
import { httpUrl } from '../../fetch';
import { httpUrl } from '../fetch';
import { getTaskDetail, addTask, updateTask, getTaskCategory, getCompanyInfo } from '../api';
import { formItemLayout, formModalLayout } from '../static';
import { editorConfig } from '../../components/config';

View File

@ -1,4 +1,4 @@
import React, { useCallback, forwardRef, useEffect, useState } from 'react';
import React, { useCallback, useEffect, useState } from 'react';
import { Input, Button, Form } from 'antd';
import ItemTaskManage from '../components/itemTaskManage';
import StatusNav from '../../components/statusNav';
@ -6,7 +6,9 @@ import { approveArr, main_web_site_url } from '../static';
import { getTaskAdminList, getTaskCategory } from '../api';
import '../index.scss';
export default Form.create()(({ current_user, form, showNotification, match, history }) => {
export default Form.create()(({ form, showNotification, match, history }) => {
const publishMode = match.params.publishMode;
const { getFieldDecorator, validateFields, setFieldsValue, getFieldsValue } = form;
const [categoryArr, setCategoryArr] = useState([]);
@ -20,6 +22,7 @@ export default Form.create()(({ current_user, form, showNotification, match, his
const [reload, setReload] = useState(0);
useEffect(() => {
getTaskCategory().then(data => {
if (data) {
@ -39,7 +42,7 @@ export default Form.create()(({ current_user, form, showNotification, match, his
orderBy: 'createdAtDesc',
curPage,
pageSize: 10,
publishMode: 1
publishMode: publishMode || 1
};
setLoading(true);
getTaskAdminList(params).then(data => {