众包调整

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

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

@ -267,6 +267,7 @@ export default class MDEditors extends Component {
this.setState({showError: true})
}
onEditorChange = () => {
this.props.setcheckoutcontent()
if (!this.answers_editormd) return;
const val = this.answers_editormd.getValue();
try {
@ -319,7 +320,7 @@ export default class MDEditors extends Component {
<div className={`df ${className} mt20`} >
{/* padding10-20 */}
<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>
</div>

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

@ -10,29 +10,29 @@ import './pds.css'
import gouxuan from './img/gouxuan.png'
import weigouxuan from './img/weigouxuan.png'
const { Search } = Input;
let categorylist=[
{name:"全部",value:undefined},
{name:"前端开发",value:"front"},
{name:"后端开发",value:"backend"},
{name:"移动开发",value:"mobile"},
{name:"数据库",value:"database"},
{name:"云计算和大数据",value:"cloud_compute_and_big_data"},
{name:"人工智能",value:"ai"},
{name:"其他",value:"other"},
]
function setcategorylist(val){
let vals=""
categorylist.some((item,key)=> {
if (item.value === val) {
vals=item.name
return true
}
}
)
return vals
}
// let categorylist=[
// {name:"全部",value:undefined},
// {name:"前端开发",value:"front"},
// {name:"后端开发",value:"backend"},
// {name:"移动开发",value:"mobile"},
// {name:"数据库",value:"database"},
// {name:"云计算和大数据",value:"cloud_compute_and_big_data"},
// {name:"人工智能",value:"ai"},
// {name:"其他",value:"other"},
// ]
//
// function setcategorylist(val){
// let vals=""
// categorylist.some((item,key)=> {
// if (item.value === val) {
// vals=item.name
// return true
// }
// }
// )
//
// return vals
// }
class PackageIndexNEITaskDetails extends Component {
constructor(props) {
@ -275,14 +275,14 @@ class PackageIndexNEITaskDetails extends Component {
{data&&data.creator.name}
</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}
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>:
<a className="ContacttheTAs fl" href={`/users/${this.props.current_user.login}/private_messages`}> <img alt="头像" className="mr5"
src={require('./newstwo.png')}/>联系TA</a>}
</div>:""}
</div>:"":""}
</div>
@ -306,7 +306,7 @@ class PackageIndexNEITaskDetails extends Component {
</div>
<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 className=" item-other">
@ -371,8 +371,6 @@ class PackageIndexNEITaskDetails extends Component {
<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_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>
@ -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">
<img className="edu-nodata-img mb20" src="https://www.educoder.net/images/educoder/nodata.png" />
<p className="edu-nodata-p mb20">暂无人员竞标~</p></div>
@ -426,16 +424,23 @@ class PackageIndexNEITaskDetails extends Component {
<div className="ysllogin_section">
<div className="ysldivhome2">
<div style={{height: "20px"}}> </div>
{data&&data.bidding_users.map((item,key)=>{
return(
<div className="ysldivhomediv1" onClick={()=>this.Clickteacher2(item.id)}>
{item.bool===true?<img src={gouxuan} className="yslgouxuanimg"/>:<img src={weigouxuan} className="yslgouxuanimg"/>}
<img className="div1img" src={item.avatar_url}/>
<span className={item.bool===true?"textall mt10 color-blue":"textall mt10"} title={item.name}> <p className="ptext">{item.name}</p></span>
</div>
)
})}
</div>
{data&&data.bidding_users.map((item,key)=>{
return(
<div className="ysldivhomediv1" onClick={()=>this.Clickteacher2(item.id)}>
{item.bool===true?<img src={gouxuan} className="yslgouxuanimg"/>:<img src={weigouxuan} className="yslgouxuanimg"/>}
<img className="div1img" src={item.avatar_url}/>
<span className={item.bool===true?"textall mt10 color-blue":"textall mt10"} title={item.name}> <p className="ptext">{item.name}</p></span>
</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>}

@ -49,7 +49,7 @@ class PackageIndexNEIBannerConcent extends Component {
contact_phone:undefined,
code:undefined,
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("测试赋值")
}
//获取验证码;
@ -155,11 +165,108 @@ class PackageIndexNEIBannerConcent extends Component {
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({
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)=>{
const content = this.contentMdRef.current.getValue().trim();
// console.log(content)
@ -194,13 +301,13 @@ class PackageIndexNEIBannerConcent extends Component {
return
}
if(deadline_at===undefined||deadline_at===null||deadline_at===""){
this.setState({
deadline_attypes:true
})
this.scrollToAnchor("publishtime");
return
}
if(deadline_at===undefined||deadline_at===null||deadline_at===""){
this.setState({
deadline_attypes:true
})
this.scrollToAnchor("publishtime");
return
}
if(moment(deadline_at)<moment(new Date())){
@ -210,6 +317,15 @@ class PackageIndexNEIBannerConcent extends Component {
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)===""){
this.setState({
@ -225,12 +341,12 @@ class PackageIndexNEIBannerConcent extends Component {
return
}
if(parseInt(min_price)<=0||parseInt(max_price)<=0){
this.setState({
smallstype:true
})
return
}
if(parseInt(min_price)<=0||parseInt(max_price)<=0){
this.setState({
smallstype:true
})
return
}
if(parseInt(max_price)<parseInt(min_price)){
this.setState({
@ -239,21 +355,21 @@ class PackageIndexNEIBannerConcent extends Component {
return
}
if(contact_name===undefined||contact_name===""||contact_name===null){
this.setState({
contact_nametype:true
})
return
}
if(contact_name===undefined||contact_name===""||contact_name===null){
this.setState({
contact_nametype:true
})
return
}
if(modalCancel===false){
if(this.props.current_user.phone===undefined||this.props.current_user.phone===null||this.props.current_user.phone===""){
this.setState({
current_userphonetype:true
})
return
}
}
if(modalCancel===false){
if(this.props.current_user.phone===undefined||this.props.current_user.phone===null||this.props.current_user.phone===""){
this.setState({
current_userphonetype:true
})
return
}
}
if(modalCancel===true){
@ -286,7 +402,7 @@ class PackageIndexNEIBannerConcent extends Component {
const url = `/api/v1/project_packages.json`;
axios.post(url, {
category: category,
category_id: category,
title: title,
content: content,
attachment_ids: attachment_ids,
@ -334,7 +450,7 @@ class PackageIndexNEIBannerConcent extends Component {
const url = `/api/v1/project_packages/${this.props.match.params.id}.json`;
axios.put(url, {
category: category,
category_id: category,
title: title,
content: content,
attachment_ids: attachment_ids,
@ -397,12 +513,32 @@ class PackageIndexNEIBannerConcent extends Component {
setcategory=(value)=>{
if(value===undefined||value===null||value===""){
this.setState({
categorytypes:true
})
}else{
this.setState({
categorytypes:false
})
}
this.setState({
category:value
})
}
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({
title:e.target.value
})
@ -410,30 +546,77 @@ class PackageIndexNEIBannerConcent extends Component {
onChangemin_prices=(e)=>{
this.props.setcheckout()
this.setState({
min_price:e.target.value
})
}
onChangemax_prices=(e)=>{
this.props.setcheckout()
this.setState({
max_price:e.target.value
})
}
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({
contact_name:e.target.value
})
}
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({
contact_phone:e.target.value
})
}
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({
code:e.target.value
})
@ -461,6 +644,8 @@ class PackageIndexNEIBannerConcent extends Component {
{name:"人工智能",value:"ai"},
{name:"其他",value:"other"},
]
return (
<div className="mb20 touchSelect">
@ -479,9 +664,10 @@ class PackageIndexNEIBannerConcent extends Component {
<p className="clearfix mb20 shaiContent" >
<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(
<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>
@ -496,7 +682,7 @@ class PackageIndexNEIBannerConcent extends Component {
value={title} onInput={this.settitlefun}/>
{this.state.titletypes===true?<div className={"color-red mt10"}>不能为空</div>:""}
<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 */}
{this.state.contenttypes===true?<div className={"color-red"}>不能为空</div>:""}
<div className="df uploadBtn">
@ -611,7 +797,8 @@ class PackageIndexNEIBannerConcent extends Component {
/>
{this.state.contact_nametype===true?<div className={"color-red ml100"}>不能为空</div>:""}
</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>
<Input
className={"fafafas fl"}
@ -625,7 +812,7 @@ class PackageIndexNEIBannerConcent extends Component {
</a>
</p>:""}
{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 fl mt5 ml25">
{/*未注册才显示!*/}

Loading…
Cancel
Save