众包调整

dev_aliyun
杨树明 5 years ago
parent 1898f2ad1e
commit 3ea9ebb0ef

@ -39,7 +39,8 @@ window.__useKindEditor = false;
// TODO 读取到package.json中的配置 // TODO 读取到package.json中的配置
var proxy = "http://localhost:3000" var proxy = "http://localhost:3000"
// proxy = "http://testbdweb.trustie.net" // proxy = "http://testbdweb.trustie.net"
proxy = "http://testbdweb.educoder.net" // proxy = "http://testbdweb.educoder.net"
// proxy ="http://192.168.2.63:3000"
// proxy='https://www.educoder.net' // proxy='https://www.educoder.net'
const requestMap={}; const requestMap={};
// 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求 // 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求

@ -267,6 +267,7 @@ export default class MDEditors extends Component {
this.setState({showError: true}) this.setState({showError: true})
} }
onEditorChange = () => { onEditorChange = () => {
this.props.setcheckoutcontent()
if (!this.answers_editormd) return; if (!this.answers_editormd) return;
const val = this.answers_editormd.getValue(); const val = this.answers_editormd.getValue();
try { try {
@ -319,7 +320,7 @@ export default class MDEditors extends Component {
<div className={`df ${className} mt20`} > <div className={`df ${className} mt20`} >
{/* padding10-20 */} {/* padding10-20 */}
<div className="edu-back-greyf5 radius4" id={`mdEditor_${mdID}`} style={{..._style}}> <div className="edu-back-greyf5 radius4" id={`mdEditor_${mdID}`} style={{..._style}}>
<textarea style={{display: 'none'}} id="evaluate_script_show" name="content"></textarea> <textarea style={{display: 'none'}} id="evaluate_script_show" name="content" ></textarea>
<div className="CodeMirror cm-s-defualt"> <div className="CodeMirror cm-s-defualt">
</div> </div>
</div> </div>

@ -6,29 +6,29 @@ import moment from 'moment';
import '../packageconcnet.css'; import '../packageconcnet.css';
const { Search } = Input; const { Search } = Input;
let categorylist=[ // let categorylist=[
{name:"全部",value:undefined}, // {name:"全部",value:undefined},
{name:"前端开发",value:"front"}, // {name:"前端开发",value:"front"},
{name:"后端开发",value:"backend"}, // {name:"后端开发",value:"backend"},
{name:"移动开发",value:"mobile"}, // {name:"移动开发",value:"mobile"},
{name:"数据库",value:"database"}, // {name:"数据库",value:"database"},
{name:"云计算和大数据",value:"cloud_compute_and_big_data"}, // {name:"云计算和大数据",value:"cloud_compute_and_big_data"},
{name:"人工智能",value:"ai"}, // {name:"人工智能",value:"ai"},
{name:"其他",value:"other"}, // {name:"其他",value:"other"},
] // ]
//
function setcategorylist(val){ // function setcategorylist(val){
let vals="" // let vals=""
categorylist.some((item,key)=> { // categorylist.some((item,key)=> {
if (item.value === val) { // if (item.value === val) {
vals=item.name // vals=item.name
return true // return true
} // }
} // }
) // )
//
return vals // return vals
} // }
@ -44,6 +44,7 @@ class PackageConcent extends Component {
sort_direction:"desc", sort_direction:"desc",
page:1, page:1,
per_page:20, per_page:20,
categories:[]
} }
} }
//desc, desc, asc //desc, desc, asc
@ -52,13 +53,24 @@ class PackageConcent extends Component {
componentDidMount() { componentDidMount() {
let {category,keyword,sort_by,sort_direction,page}=this.state let {category,keyword,sort_by,sort_direction,page}=this.state
this.setdatas(category,keyword,sort_by,sort_direction,page) this.setdatas(category,keyword,sort_by,sort_direction,page)
let Url = `/api/v1/project_package_categories.json`;
axios.get(Url).then((response) => {
console.log(response)
this.setState({
categories:response.data.categories
})
}).catch((error) => {
console.log(error)
})
} }
setdatas=(category,keyword,sort_by,sort_direction,page)=>{ setdatas=(category,keyword,sort_by,sort_direction,page)=>{
let Url = `/api/v1/project_packages.json`; let Url = `/api/v1/project_packages.json`;
axios.get(Url,{params:{ axios.get(Url,{params:{
category:category, category_id:category,
keyword:keyword, keyword:keyword,
sort_by:sort_by, sort_by:sort_by,
sort_direction:sort_direction, sort_direction:sort_direction,
@ -156,11 +168,10 @@ class PackageConcent extends Component {
<p className="clearfix mb30 shaiContent"> <p className="clearfix mb30 shaiContent">
<span className="shaiTitle fl mt3">类型</span> <span className="shaiTitle fl mt3">类型</span>
<div className="fl pr shaiAllItem pagetype"> <div className="fl pr shaiAllItem pagetype">
{categorylist.map((item,key)=>{ <li className={category===undefined?"shaiItem shixun_repertoire active":"shaiItem shixun_repertoire"} onClick={()=>this.setcategory(undefined)}>全部</li>
console.log(category) {this.state.categories.map((item,key)=>{
console.log(item.value)
return( return(
<li key={key} className={category===item.value?"shaiItem shixun_repertoire active":"shaiItem shixun_repertoire"} value={item.value} onClick={()=>this.setcategory(item.value)}>{item.name}</li> <li key={key} className={category===item.id?"shaiItem shixun_repertoire active":"shaiItem shixun_repertoire"} value={item.id} onClick={()=>this.setcategory(item.id)}>{item.name}</li>
) )
})} })}
@ -202,7 +213,7 @@ class PackageConcent extends Component {
<div className="project-package-item"> <div className="project-package-item">
<div className="item-image"> <div className="item-image">
<img src={"/images/educoder/project_packages/"+item.category+".png"}/> <img src={"/images/educoder/project_packages/"+item.contact_name+".png"}/>
</div> </div>
<div className=" item-body"> <div className=" item-body">
@ -225,7 +236,7 @@ class PackageConcent extends Component {
</div> </div>
<div className=" item-category"> <div className=" item-category">
<div className=" item-category-item">{setcategorylist(item.category)}</div> <div className=" item-category-item">{item.category}</div>
</div> </div>
<div className=" item-other"> <div className=" item-other">

@ -10,29 +10,29 @@ import './pds.css'
import gouxuan from './img/gouxuan.png' import gouxuan from './img/gouxuan.png'
import weigouxuan from './img/weigouxuan.png' import weigouxuan from './img/weigouxuan.png'
const { Search } = Input; const { Search } = Input;
let categorylist=[ // let categorylist=[
{name:"全部",value:undefined}, // {name:"全部",value:undefined},
{name:"前端开发",value:"front"}, // {name:"前端开发",value:"front"},
{name:"后端开发",value:"backend"}, // {name:"后端开发",value:"backend"},
{name:"移动开发",value:"mobile"}, // {name:"移动开发",value:"mobile"},
{name:"数据库",value:"database"}, // {name:"数据库",value:"database"},
{name:"云计算和大数据",value:"cloud_compute_and_big_data"}, // {name:"云计算和大数据",value:"cloud_compute_and_big_data"},
{name:"人工智能",value:"ai"}, // {name:"人工智能",value:"ai"},
{name:"其他",value:"other"}, // {name:"其他",value:"other"},
] // ]
//
function setcategorylist(val){ // function setcategorylist(val){
let vals="" // let vals=""
categorylist.some((item,key)=> { // categorylist.some((item,key)=> {
if (item.value === val) { // if (item.value === val) {
vals=item.name // vals=item.name
return true // return true
} // }
} // }
) // )
//
return vals // return vals
} // }
class PackageIndexNEITaskDetails extends Component { class PackageIndexNEITaskDetails extends Component {
constructor(props) { constructor(props) {
@ -275,14 +275,14 @@ class PackageIndexNEITaskDetails extends Component {
{data&&data.creator.name} {data&&data.creator.name}
</div> </div>
{this.props.current_user.login!=data&&data.creator&&data&&data.creator.login?<div className=" edu-back-white ml5 mt10 " {data&&data.creator?this.props.current_user.login!=data&&data.creator.login?<div className=" edu-back-white ml5 mt10 "
onMouseOver={this.setover} onMouseOver={this.setover}
onMouseOut={this.setout} onMouseOut={this.setout}
> >
{overtype===false?<a className="ContacttheTA fl" href={`/users/${this.props.current_user.login}/private_messages`}> <img alt="头像" class="mr5" src={require('./newsone.png')} />联系TA</a>: {overtype===false?<a className="ContacttheTA fl" href={`/users/${this.props.current_user.login}/private_messages`}> <img alt="头像" class="mr5" src={require('./newsone.png')} />联系TA</a>:
<a className="ContacttheTAs fl" href={`/users/${this.props.current_user.login}/private_messages`}> <img alt="头像" className="mr5" <a className="ContacttheTAs fl" href={`/users/${this.props.current_user.login}/private_messages`}> <img alt="头像" className="mr5"
src={require('./newstwo.png')}/>联系TA</a>} src={require('./newstwo.png')}/>联系TA</a>}
</div>:""} </div>:"":""}
</div> </div>
@ -306,7 +306,7 @@ class PackageIndexNEITaskDetails extends Component {
</div> </div>
<div className="item-category"> <div className="item-category">
<div className="item-category-item">{setcategorylist(data&&data.category)}</div> <div className="item-category-item">{data&&data.category}</div>
</div> </div>
<div className=" item-other"> <div className=" item-other">
@ -371,8 +371,6 @@ class PackageIndexNEITaskDetails extends Component {
<div className="packageabsolute"> <div className="packageabsolute">
{data&&data.operation.can_bidding===true?<Button type="primary" className="defalutSubmitbtn fl ml20 defalutSubmitbtns" onClick={this.setBiddingApply}>竞标报名</Button>:""} {data&&data.operation.can_bidding===true?<Button type="primary" className="defalutSubmitbtn fl ml20 defalutSubmitbtns" onClick={this.setBiddingApply}>竞标报名</Button>:""}
{data&&data.operation.can_select_bidding_user===true?<Button type="primary" className="defalutSubmitbtn fl ml20 defalutSubmitbtns" onClick={this.setbiddingman}>选择中标者</Button>:""} {data&&data.operation.can_select_bidding_user===true?<Button type="primary" className="defalutSubmitbtn fl ml20 defalutSubmitbtns" onClick={this.setbiddingman}>选择中标者</Button>:""}
<Button type="primary" className="defalutSubmitbtn fl ml20 defalutSubmitbtns" onClick={this.setbiddingman}>选择中标者</Button>
</div> </div>
</div> </div>
</div> </div>
@ -394,7 +392,7 @@ class PackageIndexNEITaskDetails extends Component {
) )
})} })}
{data&&data.bidding_users.length===0?<div className="edu-back-white"> {data&&data.bidding_users.length===0?<div className="edu-back-white" style={{width: '1200px'}}>
<div className="edu-tab-con-box clearfix edu-txt-center"> <div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src="https://www.educoder.net/images/educoder/nodata.png" /> <img className="edu-nodata-img mb20" src="https://www.educoder.net/images/educoder/nodata.png" />
<p className="edu-nodata-p mb20">暂无人员竞标~</p></div> <p className="edu-nodata-p mb20">暂无人员竞标~</p></div>
@ -435,6 +433,13 @@ class PackageIndexNEITaskDetails extends Component {
</div> </div>
) )
})} })}
{data&&data.bidding_users.length===0?<div className="edu-back-white" style={{width: '1200px'}}>
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src="https://www.educoder.net/images/educoder/nodata.png" />
<p className="edu-nodata-p mb20">暂无人员竞标~</p></div>
</div>:""}
</div> </div>
</div> </div>
</div> </div>

@ -49,7 +49,7 @@ class PackageIndexNEIBannerConcent extends Component {
contact_phone:undefined, contact_phone:undefined,
code:undefined, code:undefined,
publish:false, publish:false,
categories:[]
} }
} }
@ -79,6 +79,16 @@ class PackageIndexNEIBannerConcent extends Component {
}) })
} }
let Url = `/api/v1/project_package_categories.json`;
axios.get(Url).then((response) => {
console.log(response)
this.setState({
categories:response.data.categories
})
}).catch((error) => {
console.log(error)
})
// this.contentMdRef.current.setValue("测试赋值") // this.contentMdRef.current.setValue("测试赋值")
} }
//获取验证码; //获取验证码;
@ -155,11 +165,108 @@ class PackageIndexNEIBannerConcent extends Component {
onChangeTimePicker = (value, dateString) => { onChangeTimePicker = (value, dateString) => {
if(moment(handleDateString(dateString))===undefined||moment(handleDateString(dateString))===null||moment(handleDateString(dateString))===""){
this.setState({
deadline_attypes:true
})
}else{
this.setState({
deadline_attypes:false
})
}
if(moment(handleDateString(dateString))<moment(new Date())){
this.setState({
deadline_attypexy:true
})
}else{
this.setState({
deadline_attypexy:false
})
}
this.setState({ this.setState({
deadline_at: moment(handleDateString(dateString)) deadline_at: moment(handleDateString(dateString))
}) })
} }
setcheckoutcontent=()=>{
const content = this.contentMdRef.current.getValue().trim();
if(content===undefined||content===null||content===""){
this.setState({
contenttypes:true
})
}else{
this.setState({
contenttypes:false
})
}
}
setcheckout=()=>{
let {min_price,max_price}=this.state;
if(min_price===undefined||max_price===undefined){
this.setState({
min_pricetype:true
})
}else{
this.setState({
min_pricetype:false
})
}
if(parseInt(min_price)===undefined||parseInt(min_price)===null||parseInt(min_price)===""){
this.setState({
min_pricetype:true
})
}else{
this.setState({
min_pricetype:false
})
}
if(parseInt(max_price)===undefined||parseInt(max_price)===null||parseInt(max_price)===""){
this.setState({
min_pricetype:true
})
}else{
this.setState({
min_pricetype:false
})
}
if(parseInt(min_price)<=0||parseInt(max_price)<=0){
this.setState({
smallstype:true
})
}else{
this.setState({
smallstype:false
})
}
if(parseInt(max_price)<parseInt(min_price)){
this.setState({
minmaxtype:true
})
}else{
this.setState({
minmaxtype:false
})
}
}
setPublication=(type)=>{ setPublication=(type)=>{
const content = this.contentMdRef.current.getValue().trim(); const content = this.contentMdRef.current.getValue().trim();
// console.log(content) // console.log(content)
@ -210,6 +317,15 @@ class PackageIndexNEIBannerConcent extends Component {
return return
} }
if(min_price===undefined||max_price===undefined){
this.setState({
min_pricetype:true
})
}else{
this.setState({
min_pricetype:false
})
}
if(parseInt(min_price)===undefined||parseInt(min_price)===null||parseInt(min_price)===""){ if(parseInt(min_price)===undefined||parseInt(min_price)===null||parseInt(min_price)===""){
this.setState({ this.setState({
@ -286,7 +402,7 @@ class PackageIndexNEIBannerConcent extends Component {
const url = `/api/v1/project_packages.json`; const url = `/api/v1/project_packages.json`;
axios.post(url, { axios.post(url, {
category: category, category_id: category,
title: title, title: title,
content: content, content: content,
attachment_ids: attachment_ids, attachment_ids: attachment_ids,
@ -334,7 +450,7 @@ class PackageIndexNEIBannerConcent extends Component {
const url = `/api/v1/project_packages/${this.props.match.params.id}.json`; const url = `/api/v1/project_packages/${this.props.match.params.id}.json`;
axios.put(url, { axios.put(url, {
category: category, category_id: category,
title: title, title: title,
content: content, content: content,
attachment_ids: attachment_ids, attachment_ids: attachment_ids,
@ -397,12 +513,32 @@ class PackageIndexNEIBannerConcent extends Component {
setcategory=(value)=>{ setcategory=(value)=>{
if(value===undefined||value===null||value===""){
this.setState({
categorytypes:true
})
}else{
this.setState({
categorytypes:false
})
}
this.setState({ this.setState({
category:value category:value
}) })
} }
settitlefun=(e)=>{ settitlefun=(e)=>{
if(e.target.value===undefined||e.target.value===null||e.target.value===""){
this.setState({
titletypes:true
})
}else{
this.setState({
titletypes:false
})
}
this.setState({ this.setState({
title:e.target.value title:e.target.value
}) })
@ -410,30 +546,77 @@ class PackageIndexNEIBannerConcent extends Component {
onChangemin_prices=(e)=>{ onChangemin_prices=(e)=>{
this.props.setcheckout()
this.setState({ this.setState({
min_price:e.target.value min_price:e.target.value
}) })
} }
onChangemax_prices=(e)=>{ onChangemax_prices=(e)=>{
this.props.setcheckout()
this.setState({ this.setState({
max_price:e.target.value max_price:e.target.value
}) })
} }
onChangeContact_name=(e)=>{ onChangeContact_name=(e)=>{
if(e.target.value===undefined||e.target.value===""||e.target.value===null){
this.setState({
contact_nametype:true
})
}else{
this.setState({
contact_nametype:false
})
}
this.setState({ this.setState({
contact_name:e.target.value contact_name:e.target.value
}) })
} }
onChangeContact_phone=(e)=>{ onChangeContact_phone=(e)=>{
let {modalCancel}=this.state;
if(modalCancel===true){
if(e.target.value===undefined||e.target.value===null||e.target.value===""){
this.setState({
contact_phonetype:true
})
}else{
this.setState({
contact_phonetype:false
})
}
if(checkPhone(e.target.value)===false){
this.setState({
contact_phonetypes:true
})
}else{
this.setState({
contact_phonetypes:false
})
}
}
this.setState({ this.setState({
contact_phone:e.target.value contact_phone:e.target.value
}) })
} }
onChangeCode=(e)=>{ onChangeCode=(e)=>{
if(e.target.value===undefined||e.target.value===""||e.target.value===null){
this.setState({
codeypes:true
})
}else{
this.setState({
codeypes:false
})
}
this.setState({ this.setState({
code:e.target.value code:e.target.value
}) })
@ -461,6 +644,8 @@ class PackageIndexNEIBannerConcent extends Component {
{name:"人工智能",value:"ai"}, {name:"人工智能",value:"ai"},
{name:"其他",value:"other"}, {name:"其他",value:"other"},
] ]
return ( return (
<div className="mb20 touchSelect"> <div className="mb20 touchSelect">
@ -479,9 +664,10 @@ class PackageIndexNEIBannerConcent extends Component {
<p className="clearfix mb20 shaiContent" > <p className="clearfix mb20 shaiContent" >
<div className="fl pr shaiAllItem pagetype"> <div className="fl pr shaiAllItem pagetype">
{categorylist.map((item,key)=>{ <li className={category===undefined?"shaiItem shixun_repertoire active":"shaiItem shixun_repertoire"} onClick={()=>this.setcategory(undefined)}>全部</li>
{this.state.categories.map((item,key)=>{
return( return(
<li key={key} className={category===item.value?"shaiItem shixun_repertoire active borderccc":"shaiItem shixun_repertoire borderccc"} value={item.value} onClick={()=>this.setcategory(item.value)}>{item.name}</li> <li key={key} className={category===item.id?"shaiItem shixun_repertoire active borderccc":"shaiItem shixun_repertoire borderccc"} value={item.id} onClick={()=>this.setcategory(item.id)}>{item.name}</li>
) )
})} })}
</div> </div>
@ -496,7 +682,7 @@ class PackageIndexNEIBannerConcent extends Component {
value={title} onInput={this.settitlefun}/> value={title} onInput={this.settitlefun}/>
{this.state.titletypes===true?<div className={"color-red mt10"}>不能为空</div>:""} {this.state.titletypes===true?<div className={"color-red mt10"}>不能为空</div>:""}
<MDEditors ref={this.contentMdRef} placeholder="请填写清晰完整的需求内容" mdID={'courseContentMD'} refreshTimeout={1500} <MDEditors ref={this.contentMdRef} placeholder="请填写清晰完整的需求内容" mdID={'courseContentMD'} refreshTimeout={1500}
watch={false} className="courseMessageMD" initValue={this.state.content}></MDEditors> watch={false} className="courseMessageMD" initValue={this.state.content} setcheckoutcontent={()=>this.setcheckoutcontent()}></MDEditors>
{/* 请求status 422 */} {/* 请求status 422 */}
{this.state.contenttypes===true?<div className={"color-red"}>不能为空</div>:""} {this.state.contenttypes===true?<div className={"color-red"}>不能为空</div>:""}
<div className="df uploadBtn"> <div className="df uploadBtn">
@ -611,7 +797,8 @@ class PackageIndexNEIBannerConcent extends Component {
/> />
{this.state.contact_nametype===true?<div className={"color-red ml100"}>不能为空</div>:""} {this.state.contact_nametype===true?<div className={"color-red ml100"}>不能为空</div>:""}
</p> </p>
{modalCancel===false?<p className="clearfix mb20 shaiContent">
{modalCancel===false&&this.props.current_user.phone!=null?<p className="clearfix mb20 shaiContent">
<span className="shaiTitle fl mt5 ml25">手机号</span> <span className="shaiTitle fl mt5 ml25">手机号</span>
<Input <Input
className={"fafafas fl"} className={"fafafas fl"}
@ -625,7 +812,7 @@ class PackageIndexNEIBannerConcent extends Component {
</a> </a>
</p>:""} </p>:""}
{this.state.current_userphonetype===true?<div className={"color-red ml100"}>不能为空</div>:""} {this.state.current_userphonetype===true?<div className={"color-red ml100"}>不能为空</div>:""}
{modalCancel===true?<p className="clearfix mb20 shaiContent"> {modalCancel===true||this.props.current_user.phone===null?<p className="clearfix mb20 shaiContent">
<span className="shaiTitle mt5 fl"> <span className="shaiTitle mt5 fl">
<span className="shaiTitle fl mt5 ml25"> <span className="shaiTitle fl mt5 ml25">
{/*未注册才显示!*/} {/*未注册才显示!*/}

Loading…
Cancel
Save