上传我的需求及

This commit is contained in:
何童崇 2021-06-18 17:07:10 +08:00
parent 97bc41e771
commit d7fd642f7f
16 changed files with 650 additions and 178 deletions

View File

@ -0,0 +1,129 @@
import React, { useEffect, useState } from 'react';
import { Icon, Modal, Pagination } from 'antd';
import { Link } from "react-router-dom";
import Nodata from '../../../forge/Nodata';
import Loading from "../../../Loading";
import { publishModeArr } from '../../task/static';
import './index.scss';
const statusArr = ["草稿", "待审核", "已拒绝", "成果征集中", "成果评选中", "公示中", "协议签订中", "支付中", "已完成"];
export default (props) => {
const { list, itemClick, curPage, total, changePage, taskCategoryValueArr, loading } = props;
const [page, setPage] = useState(1);
const [activeItem, setActiveItem] = useState('');
const [visibleProofs, setVisibleProofs] = useState(false);
const [pageSize, setPageSize] = useState(() => {
return props.pageSize || 10;
});
useEffect(() => {
changePage(page);
}, [page]);
function uploadProofs(item) {
setVisibleProofs(true);
setActiveItem(item);
}
return (
<React.Fragment>
<ul className="df needs_condition_content_nav">
<li key={1} className="with35 edu-txt-left">任务</li>
<li key={2} className="with15">类型</li>
<li key={3} className="with10 draft_only">应征投稿</li>
<li key={4} className="with10">金额</li>
<li key={5} className="flex1">任务状态</li>
<li key={6} className="with15">操作</li>
</ul>
{loading ? <Loading /> : <React.Fragment>
{
list.map(item => {
return (
<div key={item.id} className="needs_condition_content">
<p className="needs_condition_content_t color-dark-grey">
任务编号{item.number}
<i className="ml20 mr5 iconfont icon-shijian color-grey9 font-16"></i>
{item.createdAt}
</p>
<ul className="df">
<li key={1} className="with35 edu-txt-left font-16 font-bd" style={{ justifyContent: "left" }}>
<Link className="color-grey3 font-16 font-bd" to={`/task/taskDetail/${item.id}`}>{item.name}</Link>
{item.status == 4 && <span className="list_status ml10">待确认</span>}
</li>
<li key={2} className="with15 flex-column">
<span className="line_1">{taskCategoryValueArr[item.categoryId]}</span>
<span className="line_1">{publishModeArr[item.publishMode]}</span>
</li>
<li key={3} className="with10 draft_only">{item.papersCount}</li>
<li key={4} className="with10 color-orange">{item.bounty}</li>
<li className="flex1">
<span>
<span className="line_1">{statusArr[item.status]}</span>
</span>
</li>
<li key={5} className="with15 flex-column">
{
item.status == 0 ?
<Link className="line_1 color-grey3" to={`/task/taskEdit/${item.id}`}>编辑草稿</Link> :
<Link className="line_1 color-grey3" to={`/task/taskDetail/${item.id}`}>查看详情</Link>
}
{item.status == 4 && <Link className="line_1 color-blue" to={`/task/taskDetail/${item.id}`}>成果评选</Link>}
{item.status == 4 && item.papersCount && (!item.isProofBoolean) && <a onClick={() => { uploadProofs(item) }} className="line_1 color-blue">上传佐证材料</a>}
{/* <a href="javascript:void(0)" className="line_1 color-blue" onClick="paying_register_popup()">支付登记</a> */}
{/* <a href="javascript:void(0)" className="color-blue line_1">上传支付凭证</a> */}
</li>
</ul>
</div>
)
})
}
{list.length > 0 ?
<div className="edu-txt-center mt20 mb20">
{total > pageSize && <Pagination
showQuickJumper
onChange={(page) => { setPage(page) }}
current={curPage}
total={total}
showTotal={total => `${total}`}
/>}
</div> :
<Nodata _html="暂无数据" />}
</React.Fragment>
}
<Modal
title="上传评选佐证材料"
visible={visibleProofs}
// onOk={checkItem}
onCancel={() => { setVisibleProofs(false) }}
className="form-edit-modal"
>
{/* <Form {...formModalLayout}>
<Form.Item label={"新手机号码:"} >
<Input
className="tel-input"
placeholder="请输入11位手机号"
/>
</Form.Item>
<Form.Item label={"验证码:"} >
<Input
className="code-input"
placeholder="请输入验证码"
/>
<Button className="ml10" type="primary" disabled={num !== 0} onClick={getCode}>{num || '获取验证码'}</Button>
</Form.Item>
</Form> */}
</Modal>
</React.Fragment>
)
}

View File

@ -0,0 +1,64 @@
.needs_condition_content_nav {
padding: 0px 20px;
background: #f7f7f7;
height: 50px;
line-height: 50px;
color: #656565;
text-align: center;
margin-bottom: 10px;
}
.needs_condition_content {
border: 1px solid #eaeaea;
border-radius: 4px;
margin-bottom: 20px;
ul {
margin: 0;
padding: 20px;
box-sizing: border-box;
li {
text-align: center;
justify-content: center;
align-items: center;
display: -webkit-flex;
}
}
.list_status {
border-radius: 10px;
padding: 0px 10px;
height: 22px;
line-height: 22px;
display: inline-block;
color: #fff;
background: #fa6400;
margin-left: 0.625rem;
font-size: 0.8rem;
}
.needs_condition_content_t {
height: 40px;
padding: 0px 20px;
background: #f7f7f7;
color: #333;
border-bottom: 1px solid #eaeaea;
line-height: 40px;
}
}
.tab-list-box {
position: relative;
display: flex;
justify-content: space-between;
padding: 20px;
background: #fff;
border-bottom: 1px solid #dedede;
}
.flex-column {
display: flex;
flex-flow: column nowrap;
justify-content: center;
align-items: center;
}

View File

@ -1,56 +1,64 @@
import React, { useEffect, useState } from 'react';
import { Icon, Pagination } from 'antd';
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',];
export default (props) => {
const { list, itemClick, curPage, total, changePage } = props;
const { list, itemClick, curPage, total, changePage, loading } = props;
const [page, setPage] = useState(1);
const [pageSize, setPageSize] = useState(() => {
return props.pageSize || 10;
});
useEffect(() => {
changePage(page);
}, [page]);
return (
<React.Fragment>
{
list.map(item => {
return (
<div className="list-box" key={item.id}>
<div className="list-content">
<div className="list-title mb10" onClick={() => { itemClick(item.id) }}>
{item.name || item.title}
{item.status && <span className={classArr[item.status]}>{statusArr[item.status]}</span>}
</div>
<div className="list-other">
<span className=" mr30"><i className="iconfont icon-dianjiliang mr3 font-12" />{item.visits}</span>
<span className=" mr30"><Icon type="user" /><span className="color-orange">{item.papersCount}</span>人参与</span>
loading ? <Loading /> :
<React.Fragment>
{
list.map(item => {
return (
<div className="list-box" key={item.id}>
<div className="list-content">
<div className="list-title mb10" onClick={() => { itemClick(item.id) }}>
{item.name || item.title}
{item.status && <span className={classArr[item.status]}>{statusArr[item.status]}</span>}
{(!item.status == '8') && item.delayTime && <span className="list-yellow">延期中</span>}
</div>
<div className="list-other">
<span className=" mr30"><i className="iconfont icon-dianjiliang mr3 font-12" />{item.visits}</span>
<span className=" mr30"><Icon type="user" /><span className="color-orange">{item.papersCount}</span>人参与</span>
{(!item.status == '8') && item.delayTime && <span className=" mr30"><i className="mr5 iconfont icon-shijian color-grey9 font-14"></i>{item.delayTime}</span>}
</div>
</div>
<span className="price color-deep-blue ">
<span className="font-16"></span>
<span className="font-24">{item.bounty}</span>
</span>
</div>
)
})
}
<span className="price color-deep-blue ">
<span className="font-16"></span>
<span className="font-24">{item.bounty}</span>
</span>
</div>
)
})
}
{list.length > 0 ?
<div className="edu-txt-center mt20 mb20">
<Pagination
showQuickJumper
onChange={(page) => { setPage(page) }}
current={curPage}
total={total}
showTotal={total => `${total}`}
/>
</div> :
<Nodata _html="暂无数据" />}
</React.Fragment>
{list.length > 0 ?
<div className="edu-txt-center mt20 mb20">
{total > pageSize && <Pagination
showQuickJumper
onChange={(page) => { setPage(page) }}
current={curPage}
total={total}
showTotal={total => `${total}`}
/>}
</div> :
<Nodata _html="暂无数据" />}
</React.Fragment>
)
}

View File

@ -22,9 +22,9 @@
}
.list-title span {
padding: 2px 10px;
margin-left: 0.5em;
margin-left: .625rem;
background: #f8c753;
font-size: 13px;
font-size: .8rem;
color: #fff;
border-radius: 14px;
}

View File

@ -1,5 +1,5 @@
.status-list {
padding: 1rem 1.8rem;
padding: 1rem 0;
display: flex;
justify-content: start;
}

View File

@ -166,6 +166,7 @@
text-align: left;
}
<<<<<<< HEAD
// 富文本样式
.w-e-text table td, .w-e-text table th{
height: 30px;
@ -209,3 +210,9 @@
width: 98%;
}
}
=======
.ant-modal-footer{
text-align: center;
}
>>>>>>> 92f3934... 上传我的需求及

View File

@ -20,7 +20,7 @@ const TaskDetail = Loadable({
loading: Loading,
});
const TaskAdd = Loadable({
const TaskEdit = Loadable({
loader: () => import("./task/taskEdit"),
loading: Loading,
});
@ -46,7 +46,14 @@ class Index extends Component {
<Route
path="/task/taskAdd"
render={(props) => (
<TaskAdd {...this.props} {...props} />
<TaskEdit {...this.props} {...props} />
)}
></Route>
<Route
path="/task/taskEdit/:taskId"
render={(props) => (
<TaskEdit {...this.props} {...props} />
)}
></Route>

View File

@ -63,10 +63,10 @@ export async function getMyTaskList(params) {
// 详情查询
export async function getTaskDetail(id) {
let res = await fetch({
url: '/api/tasks/' + id,
url: '/api/tasks/getTask/' + id,
method: 'get',
});
if (res.code === '1') {
if (res.data) {
return res.data;
} else {
notification.open({
@ -94,9 +94,9 @@ export function deleteTask(id) {
}
//更新
export function editTask(data) {
export function updateTask(data) {
return fetch({
url: '/api/tasks/update',
url: '/api/tasks/',
method: 'put',
data: data
});

View File

@ -1,11 +1,8 @@
import React, { useEffect, useState } from 'react';
import { Tabs, Pagination, Input, Button } from 'antd';
import moment from 'moment';
import { Tabs, Input, Button, } from 'antd';
import StatusNav from '../../components/statusNav';
import SortBox from '../../components/sortBox';
import ItemListTask from '../../components/itemListTask';
import Nodata from '../../../forge/Nodata';
import { taskTimeArr, taskStatusArr, taskStatusAllArr, sortArr, taskModeIdArr } from '../static';
import ItemListMyTask from '../../components/itemListMyTask';
import { taskStatusAllArr, } from '../static';
import { getTaskList, getTaskCategory } from '../api';
import './index.scss';
const Search = Input.Search;
@ -15,33 +12,56 @@ const publishStatusArr = taskStatusAllArr.slice(3);
const unpublishStatusArr = taskStatusAllArr.slice(0, 3);
export default ({ history, current_user }) => {
const [identity, setIdentity] = useState('1');
const [type, setType] = useState('1');
export default ({ location, history, current_user }) => {
let defaultValue = decodeURI(location.search.split("=")[1] || "");
const [identity, setIdentity] = useState('1');
const [taskCategoryValueArr, setTaskCategoryValueArr] = useState([]);
const [statusType, setStatusType] = useState(() => {
return defaultValue === 'false' ? '2' : '1';
});
const [statusString, setStatusString] = useState(() => {
return defaultValue === 'false' ? '0,1,2' : '3,4,5,6,7,8';
});
const [status, setStatus] = useState('');
const [searchInput, setSearchInput] = useState('');
const [orderBy, setOrderBy] = useState('');
const [curPage, setCurPage] = useState(1);
const [total, setTotal] = useState(0);
const [taskList, setTaskList] = useState([]);
const [loading, setLoading] = useState(false);
//
useEffect(() => {
getTaskCategory().then(data => {
if (data) {
const taskCategoryValueArr = [];
for (const item of data) {
taskCategoryValueArr[item.id] = item.name;
}
setTaskCategoryValueArr(taskCategoryValueArr);
}
});
}, []);
useEffect(() => {
const params = {
status,
statusString,
searchInput,
orderBy,
curPage,
pageSize: 10,
};
setLoading(true);
getTaskList(params).then(data => {
if (data) {
setTaskList(data.rows);
setTotal(data.total);
}
setLoading(false);
})
}, [status, searchInput, orderBy, curPage]);
}, [statusString, searchInput, orderBy, curPage]);
function taskClick(id) {
@ -53,17 +73,40 @@ export default ({ history, current_user }) => {
}
function changeOptionId(option, type) {
if(type==='publishStatus'){
setStatus(option.dicItemCode);
if (type === 'publishStatus') {
setStatusString(option.dicItemCode.toString() || '3,4,5,6,7,8');
} else if (type === 'unpublishStatus') {
setStatusString(option.dicItemCode.toString() || '0,1,2');
}
setCurPage(1);
}
function changeStatusType(key) {
if (key === '1') {
setStatusString('3,4,5,6,7,8');
} else {
setStatusString('0,1,2');
}
setCurPage(1);
setStatusType(key);
}
return (
<div className="centerbox my-task">
<Tabs defaultActiveKey={identity} onChange={(key) => { setIdentity(key) }}>
<TabPane tab="我是雇主" key="1">
<Tabs className="childTab" defaultActiveKey={type} onChange={(key) => { setType(key) }}>
<Tabs className="childTab"
activeKey={statusType}
onChange={changeStatusType}
tabBarExtraContent={
<Search
maxLength={20}
style={{ width: "300px" }}
placeholder="请输入任务编号/任务名称关键字"
onSearch={(value) => setSearchInput(value)}
/>
}
>
<TabPane tab="我发布的需求" key="1">
<StatusNav
key={'publishStatus'}
@ -72,14 +115,17 @@ export default ({ history, current_user }) => {
changeOptionId={changeOptionId}
/>
<ItemListTask
<ItemListMyTask
list={taskList}
itemClick={taskClick}
curPage={curPage}
total={total}
taskCategoryValueArr={taskCategoryValueArr}
changePage={(page) => { setCurPage(page) }}
loading={loading}
/>
</TabPane>
<TabPane tab="需求草稿" key="2">
<StatusNav
key={'unpublishStatus'}
@ -87,13 +133,23 @@ export default ({ history, current_user }) => {
options={unpublishStatusArr}
changeOptionId={changeOptionId}
/>
<ItemListMyTask
list={taskList}
itemClick={taskClick}
curPage={curPage}
total={total}
taskCategoryValueArr={taskCategoryValueArr}
changePage={(page) => { setCurPage(page) }}
loading={loading}
/>
</TabPane>
</Tabs>
</TabPane>
<TabPane tab="我是创客" key="2">
请稍候
</TabPane>
</Tabs>

View File

@ -4,27 +4,36 @@
background: #fff;
text-align: center;
}
.ant-tabs-tab{
.ant-tabs-tab {
height: 4.5rem;
line-height: 3rem;
font-size: 1.15rem;
font-weight: 500;
}
.ant-tabs-extra-content {
line-height: 4.5rem;
}
.childTab{
.childTab {
background: #fff;
.ant-tabs-top-bar {
padding: 0 1.8rem 0 0.8rem;
background: #fff;
text-align: left;
}
.ant-tabs-tab{
.ant-tabs-tab {
height: 4.5rem;
line-height: 3rem;
font-size: 1rem;
font-weight: normal;
}
.ant-tabs-ink-bar{
.ant-tabs-ink-bar {
visibility: hidden;
}
.ant-tabs-tabpane {
padding: 1rem 1.8rem;
line-height: 2;
}
}
}

View File

@ -1,7 +1,7 @@
// 开始
export const taskStatusArr = [
{ dicItemCode: 999, name: "正在进行中", dicItemName: '正在进行中' },
{ dicItemCode: 0, name: "已完成", dicItemName: '已完成' },
{ dicItemCode: '3,4,5,6,7', name: "正在进行中", dicItemName: '正在进行中' },
{ dicItemCode: '8', name: "已完成", dicItemName: '已完成' },
];
export const taskStatusAllArr = [
@ -14,7 +14,7 @@ export const taskStatusAllArr = [
{ dicItemCode: 6, name: "协议签订中", dicItemName: '协议签订中' },
{ dicItemCode: 7, name: "支付中", dicItemName: '支付中' },
{ dicItemCode: 8, name: "已完成", dicItemName: '已完成' },
]
];
export const taskTimeArr = [
{ dicItemCode: 1, name: "24小时到期", dicItemName: "24小时到期" },
@ -28,6 +28,7 @@ export const taskModeIdArr = [
{ dicItemCode: 3, name: "计件悬赏", dicItemName: "计件悬赏" },
]
export const publishModeArr=["自主提交","统筹任务"];
export const sortArr = [{
name: '综合',

View File

@ -1,59 +1,149 @@
import React, { useEffect, useState } from 'react';
import React, { useEffect, useState, useCallback } from 'react';
import { Link } from "react-router-dom";
import { getImageUrl } from 'educoder';
import { httpUrl } from '../../fetch';
import { getTaskDetail } from '../api';
import { taskStatus, taskType } from '../static';
import { getTaskDetail, getTaskCategory } from '../api';
import { taskModeIdArr} from '../static';
import './index.scss';
import classNames from 'classnames';
const taskStatusArr = [];
const taskTypeArr = [];
for (const item of taskStatus) {
taskStatusArr.push(item.name);
}
for (const item of taskType) {
taskTypeArr.push(item.name);
const taskModeNameArr=[];
for(const item of taskModeIdArr){
taskModeNameArr[item.dicItemCode]=item.dicItemName;
}
export default ({ match,history, showNotification }) => {
const [detailData, setDetailData] = useState({});
export default ({ match, current_user, history, showNotification }) => {
console.log(current_user);
const id = match.params.taskId;
const [detailData, setDetailData] = useState({});
const [taskCategoryValueArr, setTaskCategoryValueArr] = useState([]);
//
useEffect(() => {
getTaskCategory().then(data => {
if (data) {
const taskCategoryValueArr = [];
for (const item of data) {
taskCategoryValueArr[item.id] = item.name;
}
setTaskCategoryValueArr(taskCategoryValueArr);
}
});
}, []);
useEffect(() => {
id && getTaskDetail(id).then(data => {
setDetailData(data || {});
console.log(data);
})
}, [id]);
const process = useCallback((title, days, active) => {
return (
<li key={title} className={classNames({ active: active })} >
<span>{title}</span>
{days && <p className="color-grey-6 font-12">
{days}
</p>}
</li>
)
}, []);
function downFile(item) {
let url = httpUrl + '/busiAttachments/download/' + item.id;
window.open(url);
}
return (
<React.Fragment>
<div className="centerbox">
<div className="head-navigation">
<span onClick={()=>{history.go(-1)}}>公告 &gt; </span>&nbsp;<span >详情 </span>
<Link to="/task">创客空间 &gt;</Link>
<Link to="/task">任务大厅 &gt;</Link>
&nbsp;任务编号{detailData.number}
</div>
<div className="center-content">
<div className="centerScreen">
<div className="center-left-but">{detailData.title}</div>
<div className="edu-back-white padding30">
<div className="df mb20">
<div className="mr30">
<a href="/users/p51497208" alt="用户头像"><img alt="头像加载失败" className="bor-radius-all" height="60" src={getImageUrl("images/educoder/competition/1.png")} width="60" /></a>
<p className="lineh-20 mt10 edu-txt-center">{current_user.username}</p>
</div>
<div className="flex1">
<ul className="clearfix mb20">
<li className="font-18 mr20 font-bd task-hide lineh-20 fl" style={{ maxWidth: "800px" }}>{detailData.name}</li>
<span className="task_tag">{taskCategoryValueArr[detailData.categoryId]}</span>
</ul>
<div className="clearfix">
<ul className="fl">
<li><span className="mr10 color-grey9">悬赏模式</span><span className="color-grey3">{taskModeNameArr[detailData.taskModeId]}</span></li>
<li><span className="mr10 color-grey9">任务编号</span><span className="color-grey3">{detailData.number}</span></li>
<li><span className="mr10 color-grey9">发布时间</span><span className="color-grey3">{detailData.publishedAt}</span></li>
<li><span className="mr10 color-grey9">截止时间</span><span className="color-grey3">{detailData.expiredAt}</span></li>
</ul>
<ul className="fr edu-txt-right">
<li className="color-orange font-bd lineh-30"><span className="font-18"></span><span className="font-28">{detailData.bounty}</span></li>
{/* <a className="base_largeBtn orange_line_btn">
<i className="iconfont icon-kehuliuyan font-18 mr10"></i>联系TA
</a> */}
</ul>
</div>
</div>
</div>
<div className="content-task">
<div className="center-author">
{detailData.publisher && <p className="mr20" key={1}>发布单位{detailData.publisher}</p>}
<p className="mr20" key={2}>发布时间{detailData.publishDate || detailData.createdAt}</p>
<p key={3}>截止时间{detailData.closingDate}</p>
</div>
{/* 富文本内容插入 */}
<div className="content-text" dangerouslySetInnerHTML={{ __html: detailData.text }}>
</div>
<div className="clearfix padding20 mb30" style={{ background: "#FAFAFA" }}>
<ul className="tasks_status clearfix">
<li className="active"><span>发布任务</span></li>
{process('成果提交', detailData.collectingDays, detailData.status > 2)}
{process('成果评选', detailData.choosingDays, detailData.status > 3)}
{process('结果公示', detailData.makePublicDays, detailData.status > 4)}
{process('任务协议签订', detailData.signingDays, detailData.status > 5)}
{process('支付', detailData.payingDays, detailData.status > 6)}
{process('任务完成', '', detailData.status > 7)}
</ul>
</div>
<div className="font-16 font-bd">需求详情</div>
{/* 富文本内容插入 */}
<div className="content-text" dangerouslySetInnerHTML={{ __html: detailData.description }}></div>
{detailData.tasksAttachments && <React.Fragment>
<div className="font-16 font-bd">需求文件</div>
{
detailData.fileDownloadPath && <React.Fragment>
<p>公告附件</p>
<p className="content-download" onClick={() => { window.open(httpUrl + detailData.fileDownloadPath) }} >{detailData.fileName}</p>
</React.Fragment>
detailData.tasksAttachments.map(item => {
return <div className="file-list-box" key={item.id}>
<a onClick={() => { downFile(item) }}><i className="iconfont icon-fujian color-green font-14 mr3"></i>
{item.fileName} </a>
<span className="ml10 color-grey-9">({item.fileSizeString})</span>
</div>
})
}
</React.Fragment>
}
</div>
<div className="font-16 font-bd mt10">知识产权说明</div>
<p className="color-grey-6 lineh-20 padding10-15 mb10">
1参赛作品一经采用其所有权修改权和使用权均归主办方所有设计者不得再在任何地方使用<br />
2应征者所提交的作品必须由应征者本人创作或参与创作应征者应确认其作品的原创性主办单位不承担因作品侵犯他人或单位的权利而产生的法律责任其法律责任由应征者本人承担
</p>
<div className="font-16 font-bd">交稿声明</div>
<p className="color-grey-6 lineh-20 padding10-15 mb10">
应征者提交的稿件必须是设计作品广告等无效交稿一律不采用
</p>
</div>
</div>

View File

@ -14,22 +14,73 @@
position: absolute;
top:-2.3em;
}
// 内容详情
.item-content {
padding: 10px 10px 0 30px;
}
.content-notice {
padding: 20px;
.task_tag {
padding: 0px 12px;
background: #F1F8FF;
border-radius: 4px;
float: left;
color: #459BE6;
height: 1.25rem;
line-height: 1.25rem;
}
.center-author {
display: flex;
align-items: center;
.tasks_status li {
float: left;
position: relative;
margin-right: 20px;
background: #EBEBEB;
width: 140px;
height: 35px;
line-height: 35px;
color: #05101A;
text-align: center;
margin-bottom: 32px;
}
.content-text {
margin: 1em 0;
min-height: 30vh;
.tasks_status li.active {
background: #4CACFF;
color: #fff;
}
.tasks_status li:not(:first-child):before {
width: 0;
height: 0;
border-width: 17px;
content: '';
position: absolute;
left: 0px;
border-style: solid;
top: 0px;
border-color: transparent transparent #fafafa transparent;
transform: rotate(90deg);
}
.tasks_status li:not(:last-child):after {
width: 0;
height: 0;
border-width: 17px;
content: '';
position: absolute;
right: -34px;
border-style: solid;
top: 0px;
border-color: transparent transparent #EBEBEB transparent;
transform: rotate(90deg);
}
.tasks_status li.active:after {
border-color: transparent transparent #4CACFF transparent;
transform: rotate(90deg);
}
.file-list-box{
padding:0 1.25rem;
}
.content-text{
padding: 1.25rem;
}
.content-download{

View File

@ -1,51 +1,57 @@
import React, { forwardRef, useCallback, useEffect, useState } from 'react';
import { Form, Radio, Input, InputNumber, Icon, Button, Modal } from 'antd';
import classNames from 'classnames';
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 { getTaskDetail, addTask, updateTask, getTaskCategory } from '../api';
import {formItemLayout,tailFormItemLayout,formModalLayout}from '../static';
import { formItemLayout, formModalLayout } from '../static';
import './index.scss';
const { info } = Modal;
let actionUrl = '';
if (window.location.href.indexOf('localhost') > -1) {
actionUrl = httpUrl;
}
function getSomeDayAfter(nDay) {
return moment(new Date().setDate(new Date().getDate() + nDay)).format('YYYY-MM-DD HH:mm:ss');
}
export default Form.create()(forwardRef(({ current_user, form, showNotification, match, history }, ref) => {
const [taskCategoryArr, setTaskCategoryArr] = useState([]);
const [fileList, setFileList] = useState(null);
const [publishMode, setPublishMode] = useState(0);
const [publishMode, setPublishMode] = useState('0');
const [categoryId, setCategoryId] = useState('7');
const [description, setDescription] = useState('');
const [enterpriseName, setEnterpriseName] = useState('神马科技股份有限公司');
const [displayTime, setDisplayTime] = useState(() => {
return {
collectingTime: getSomeDayAfter(30),
choosingTime: getSomeDayAfter(30 + 15),
makePublicTime: getSomeDayAfter(30 + 15 + 7),
signingTime: getSomeDayAfter(30 + 15 + 7 + 15),
payingTime: getSomeDayAfter(30 + 15 + 7 + 15 + 15)
}
});
// console.log(displayTime);
const [visible, setVisible] = useState(false);
const [num, setNum] = useState(0) //
const [isSend, setIsSend] = useState(false) //
const id = match.params.requireId;
const id = match.params.taskId;
const { getFieldDecorator, validateFields, setFieldsValue, } = form;
// id
useEffect(() => {
let formValue = {
taskModeId: 1,
collectionMode: 1,
publishMode: 0,
collectingDays: 30,
choosingDays: 15,
makePublicDays: 7,
signingDays: 15,
payingDays: 15,
};
let categoryId = '7';
if (id) {
getTaskDetail(id).then(data => {
formValue = {
let formValue = {
name: data.name,
contactName: data.contactName,
contactPhone: data.contactPhone,
@ -63,20 +69,42 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
signingDays: data.signingDays,
payingDays: data.payingDays,
};
categoryId = data.categoryId;
if (data.attachmentList.length) {
for (const item of data.attachmentList) {
if (data.tasksAttachments && data.tasksAttachments.length) {
for (const item of data.tasksAttachments) {
item.name = item.fileName;
item.size = item.fileSize;
item.uid = "rc-upload" + item.id
}
setFileList(data.attachmentList);
setFileList(data.tasksAttachments);
}
setFieldsValue(formValue);
setEnterpriseName(data.enterpriseName);
setCategoryId(data.categoryId);
setDescription(data.description);
let collectingTime = getSomeDayAfter(data.collectingDays);
let choosingTime = getSomeDayAfter(data.collectingDays + data.choosingDays);
let makePublicTime = getSomeDayAfter(data.collectingDays + data.choosingDays + data.makePublicDays);
let signingTime = getSomeDayAfter(data.collectingDays + data.choosingDays + data.makePublicDays + data.signingDays);
let payingTime = getSomeDayAfter(data.collectingDays + data.choosingDays + data.makePublicDays + data.signingDays + data.payingDays);
setDisplayTime({ collectingTime, choosingTime, makePublicTime, signingTime, payingTime });
console.log(data);
});
} else {
let formValue = {
taskModeId: 1,
collectionMode: 1,
publishMode: 0,
collectingDays: 30,
choosingDays: 15,
makePublicDays: 7,
signingDays: 15,
payingDays: 15,
};
setFieldsValue(formValue);
setCategoryId('7');
}
setFieldsValue(formValue);
setCategoryId(categoryId);
}, [id]);
useEffect(() => {
@ -91,9 +119,8 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
});
}, []);
/** 倒计时显示*/
useEffect(() => {
useEffect(() => {
let timer = 0;
if (isSend && num !== 0) {
timer = setInterval(() => {
@ -102,7 +129,7 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
setIsSend(false)
clearInterval(timer)
}
return n - 1;
return n - 1;
});
}, 1000);
}
@ -112,7 +139,7 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
};
}, [isSend]);
function getCode(){
function getCode() {
setIsSend(true);
setNum(60);
}
@ -145,6 +172,7 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
{getFieldDecorator(name, { rules, initialValue, validateFirst: true, })(widget)}
</Form.Item>
<span className="days-word color-grey-9 "></span>
</div>
), []);
@ -155,13 +183,39 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
setDescription(html);
}
//
const publishDeal = useCallback((status, publishMode, res) => {
if (res.data) {
showNotification("需求保存成功!");
if (!status) {
history.push("/task/myTask?published=false")
} else if (publishMode == 1) {
info({
title: '提示',
content: <div>
<h4>发布申请已提交请等待管理员的审核</h4>
<p>我们将在1-2个工作日内完成审核</p>
</div>,
onOk() {
history.push("/task/myTask?published=false");
},
});
} else {
history.push("/task/myTask");
}
} else {
showNotification(res.message);
}
}, []);
//
function saveItem() {
function saveItem(status) {
validateFields((error, values) => {
if (!error) {
let params = {
...values,
enterpriseName: '神马科技股份有限公司',
status,
enterpriseName: enterpriseName,
categoryId,
};
let dateSum = params.collectingDays + params.choosingDays + params.makePublicDays + params.signingDays + params.payingDays;
@ -173,48 +227,46 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
//
params.id = id;
updateTask(params).then(res => {
if (res.code === '1') {
showNotification("需求更新成功!");
history.go(-1);
} else {
showNotification(res.message);
}
publishDeal();
});
} else {
//
addTask(params).then(res => {
if (res.code === '1') {
showNotification("需求新增成功!");
history.go(-1);
} else {
showNotification(res.message);
}
publishDeal();
});
}
}
})
}
function changeDate(v, field) {
validateFields((error, values) => {
let collectingTime = getSomeDayAfter(values.collectingDays);
let choosingTime = getSomeDayAfter(values.collectingDays + values.choosingDays);
let makePublicTime = getSomeDayAfter(values.collectingDays + values.choosingDays + values.makePublicDays);
let signingTime = getSomeDayAfter(values.collectingDays + values.choosingDays + values.makePublicDays + values.signingDays);
let payingTime = getSomeDayAfter(values.collectingDays + values.choosingDays + values.makePublicDays + values.signingDays + values.payingDays);
setDisplayTime({ collectingTime, choosingTime, makePublicTime, signingTime, payingTime });
})
}
return (
<div className="centerbox">
<div className="head-navigation">
<Link className="color-grey-9" to="/task">创客空间 &gt;</Link>
<Link className="color-grey-9" to="/task">任务大厅 &gt;</Link>
<Link to="/task">创客空间 &gt;</Link>
<Link to="/task">任务大厅 &gt;</Link>
&nbsp;<span >发布需求 </span>
</div>
<p className="font-18 font-bd mb15">任务需求提交</p>
<div className="edu-back-white mb110">
<div className="edu-back-white mb30">
<div className="padding30 bor-bottom-greyE">
<p className="partTitle">联系方式<span className="color-red font-14">*必填</span></p>
<Form {...formItemLayout}>
<Form.Item label='主体信息:'>
{"神马科技股份有限公司"}
{enterpriseName}
</Form.Item>
{helper(
@ -384,6 +436,7 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
"collectingDays",
[{ required: true, message: "请输入天数" }],
<InputNumber
onChange={(v) => { changeDate(v, 'collectingDays') }}
className="date-input"
/>
)}
@ -436,15 +489,15 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
<span className="color-orange mr2 ">*</span>
任务天数总和不得超过180天
</p>
<Form.Item {...tailFormItemLayout}>
<Button className="mr20" type={"primary"} onClick={saveItem}>保存</Button>
<Button onClick={() => { history.go(-1) }}>取消</Button>
</Form.Item>
</Form>
</div>
</div>
<Button className="mr20" type={"primary"} onClick={() => { saveItem(1) }}>发布</Button>
<Button className="mr20" type={"primary"} onClick={() => { saveItem(0) }}>保存</Button>
<Button onClick={() => { history.go(-1) }}>取消</Button>
<Modal
title="修改联系电话"
visible={visible}
@ -459,13 +512,12 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
placeholder="请输入11位手机号"
/>
</Form.Item>
<Form.Item label={"验证码:"} >
<Input
className="code-input"
placeholder="请输入验证码"
/>
<Button className="ml10" type="primary" disabled={num!==0} onClick={getCode}>{num||'获取验证码'}</Button>
<Button className="ml10" type="primary" disabled={num !== 0} onClick={getCode}>{num || '获取验证码'}</Button>
</Form.Item>
</Form>
</Modal>

View File

@ -138,6 +138,3 @@
line-height: 40px;
}
.ant-modal-footer{
text-align: center;
}

View File

@ -4,20 +4,19 @@ import moment from 'moment';
import ChooseNav from '../../components/chooseNav';
import SortBox from '../../components/sortBox';
import ItemListTask from '../../components/itemListTask';
import Nodata from '../../../forge/Nodata';
import { taskTimeArr, taskStatusArr, sortArr, taskModeIdArr } from '../static';
import { getTaskList, getTaskCategory } from '../api';
const Search = Input.Search;
export default ({ history, current_user }) => {
console.log(current_user);
const [loading, setLoading] = useState(false);
const [taskCategoryArr, setTaskCategoryArr] = useState([]);
const [categoryId, setCategoryId] = useState('');
const [taskModeId, setTaskModeId] = useState('');
const [expiredStartTime, setExpiredStartTime] = useState('');
const [expiredEndTime, setExpiredEndTime] = useState('');
const [status, setStatus] = useState('');
const [statusString, setStatusString] = useState('3,4,5,6,7,8');
const [searchInput, setSearchInput] = useState('');
const [orderBy, setOrderBy] = useState('');
const [curPage, setCurPage] = useState(1);
@ -42,20 +41,21 @@ export default ({ history, current_user }) => {
taskModeId,
expiredStartTime,
expiredEndTime,
status,
statusString,
searchInput,
orderBy,
curPage,
pageSize: 10,
};
setLoading(true);
getTaskList(params).then(data => {
if (data) {
setTaskList(data.rows);
setTotal(data.total);
}
setLoading(false);
})
}, [categoryId, taskModeId, expiredStartTime, expiredEndTime, status, searchInput, orderBy, curPage]);
}, [categoryId, taskModeId, expiredStartTime, expiredEndTime, statusString, searchInput, orderBy, curPage]);
function changeOptionId(option, type) {
@ -74,7 +74,7 @@ export default ({ history, current_user }) => {
setExpiredEndTime('');
}
} else if (type === 'taskStatus') {
setStatus(option.dicItemCode);
setStatusString(option.dicItemCode||'3,4,5,6,7,8');
}
}
@ -101,7 +101,6 @@ export default ({ history, current_user }) => {
}
return (
<div className="centerbox">
<div className="nav-content">
<ChooseNav
@ -154,7 +153,8 @@ export default ({ history, current_user }) => {
maxLength={20}
style={{ width: "300px" }}
placeholder="请输入任务编号/任务名称关键字"
onSearch={(value) => setSearchInput(value)} />
onSearch={(value) => setSearchInput(value)}
/>
<Button className="mr20 font-12" type="primary" onClick={goAdd}><i className="iconfont icon-zaibianji font-12 mr3"></i>发布需求</Button>
@ -167,6 +167,7 @@ export default ({ history, current_user }) => {
curPage={curPage}
total={total}
changePage={(page) => { setCurPage(page) }}
loading={loading}
/>
</div>