修改创客删除与恢复
This commit is contained in:
parent
c9e7da7df3
commit
1bad39e83a
|
@ -120,10 +120,17 @@ export async function getTaskDetail(id) {
|
|||
if (res.data) {
|
||||
return res.data;
|
||||
} else {
|
||||
notification.open({
|
||||
message: "提示",
|
||||
description: res.message || '请求错误',
|
||||
});
|
||||
if(res.message&&res.message.indexOf('exist')>-1){
|
||||
notification.open({
|
||||
message: "提示",
|
||||
description: "未查到该任务",
|
||||
});
|
||||
}else{
|
||||
notification.open({
|
||||
message: "提示",
|
||||
description: res.message || '请求错误',
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,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',
|
||||
});
|
||||
}
|
||||
|
@ -499,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',
|
||||
|
@ -557,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,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
||||
});
|
||||
|
|
|
@ -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,deleteTask } 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,11 +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 [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');
|
||||
|
@ -46,6 +47,7 @@ export default Form.create()(({ form, showNotification, match, history }) => {
|
|||
curPage,
|
||||
pageSize: 10,
|
||||
orderBy: order + sort,
|
||||
isDelete,
|
||||
};
|
||||
setLoading(true);
|
||||
getTaskAdminList(params).then(data => {
|
||||
|
@ -55,7 +57,7 @@ export default Form.create()(({ form, showNotification, match, history }) => {
|
|||
}
|
||||
setLoading(false);
|
||||
})
|
||||
}, [statusString, order, sort, publishMode, showUserMode, curPage, searchObj,reload]);
|
||||
}, [statusString, order, sort, publishMode, showUserMode, curPage, searchObj, isDelete, reload]);
|
||||
|
||||
|
||||
const helper = useCallback(
|
||||
|
@ -102,7 +104,7 @@ export default Form.create()(({ form, showNotification, match, history }) => {
|
|||
dataIndex: 'name',
|
||||
width: "15%",
|
||||
render: (text, record) => (
|
||||
<Link className="line_1 primary-link" to={`/task/taskDetail/${record.id}`}>{text}</Link>
|
||||
<Link className="line_1 primary-link" target="_blank" to={`/task/taskDetail/${record.id}`} >{text}</Link>
|
||||
),
|
||||
},
|
||||
{
|
||||
|
@ -201,21 +203,34 @@ export default Form.create()(({ form, showNotification, match, history }) => {
|
|||
key: 'action',
|
||||
render: (text, record) => (
|
||||
<React.Fragment>
|
||||
<Button className="mr5 font-12" type="danger" size="small" onClick={() => { deletItem(record.id) }}>删除</Button>
|
||||
|
||||
{
|
||||
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){
|
||||
deleteTask(id).then(res=>{
|
||||
if(res.message==='success'){
|
||||
showNotification('删除成功!');
|
||||
setReload(Math.random());
|
||||
}
|
||||
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());
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -243,13 +258,18 @@ 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');
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="centerbox task-manage-all ">
|
||||
|
||||
|
||||
<div className="search-screen" >
|
||||
{helper(
|
||||
"任务名称",
|
||||
|
@ -301,25 +321,40 @@ export default Form.create()(({ form, showNotification, match, history }) => {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<Form.Item className="inline-form" label="排序">
|
||||
<Select
|
||||
style={{ width: '200px' }}
|
||||
showArrow
|
||||
onChange={changeSortName}
|
||||
defaultValue='createdAt'
|
||||
>
|
||||
<Option key={'createdAt'} >创建时间</Option>
|
||||
<Option key={'publishedAt'} >发布时间</Option>
|
||||
</Select>
|
||||
<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>
|
||||
|
||||
<span className={classNames({ "sort-active": sort === 'Desc', 'sort-icon': true, 'ml10': true })} onClick={() => { changeSort('Desc') }}>
|
||||
<i className="fa fa-long-arrow-down font-16 "></i>
|
||||
</span>
|
||||
<span className={classNames({ "sort-active": sort === 'Asc', 'sort-icon': true })} onClick={() => { changeSort('Asc') }}>
|
||||
<i className="fa fa-long-arrow-up font-16 "></i>
|
||||
</span>
|
||||
<Form.Item className="inline-form" label="排序">
|
||||
<Select
|
||||
style={{ width: '200px' }}
|
||||
showArrow
|
||||
onChange={changeSortName}
|
||||
defaultValue='createdAt'
|
||||
>
|
||||
<Option key={'createdAt'} >创建时间</Option>
|
||||
<Option key={'publishedAt'} >发布时间</Option>
|
||||
</Select>
|
||||
|
||||
<span className={classNames({ "sort-active": sort === 'Desc', 'sort-icon': true, 'ml10': true })} onClick={() => { changeSort('Desc') }}>
|
||||
<i className="fa fa-long-arrow-down font-16 "></i>
|
||||
</span>
|
||||
<span className={classNames({ "sort-active": sort === 'Asc', 'sort-icon': true })} onClick={() => { changeSort('Asc') }}>
|
||||
<i className="fa fa-long-arrow-up font-16 "></i>
|
||||
</span>
|
||||
|
||||
</Form.Item>
|
||||
</div>
|
||||
|
||||
</Form.Item>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -48,6 +48,12 @@
|
|||
a.primary-link {
|
||||
color: #1890ff;
|
||||
}
|
||||
|
||||
.select-box{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.inline-form {
|
||||
|
|
|
@ -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]);
|
||||
|
||||
// 检查用户是否同意协议
|
||||
|
|
Loading…
Reference in New Issue