From 3ea9ebb0ef393d68c91460b69f5b6a10e7687683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 13 Jul 2019 12:24:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=97=E5=8C=85=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/index.js | 3 +- .../src/modules/projectPackages/MDEditors.js | 3 +- .../PackageIndex/PackageConcent.js | 71 +++-- .../PackageIndexNEITaskDetails.js | 83 +++--- .../PackageIndexNEIBannerConcent.js | 257 +++++++++++++++--- 5 files changed, 311 insertions(+), 106 deletions(-) diff --git a/public/react/src/index.js b/public/react/src/index.js index a1006955..8107571d 100644 --- a/public/react/src/index.js +++ b/public/react/src/index.js @@ -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控制,避免用户通过双击等操作发出重复的请求; diff --git a/public/react/src/modules/projectPackages/MDEditors.js b/public/react/src/modules/projectPackages/MDEditors.js index 960203b3..030fb6cf 100644 --- a/public/react/src/modules/projectPackages/MDEditors.js +++ b/public/react/src/modules/projectPackages/MDEditors.js @@ -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 {
{/* padding10-20 */}
- +
diff --git a/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js b/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js index 8e5bc4bd..2c895b50 100644 --- a/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js +++ b/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js @@ -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 {

类型:

- {categorylist.map((item,key)=>{ - console.log(category) - console.log(item.value) +
  • this.setcategory(undefined)}>全部
  • + {this.state.categories.map((item,key)=>{ return( -
  • this.setcategory(item.value)}>{item.name}
  • +
  • this.setcategory(item.id)}>{item.name}
  • ) })} @@ -202,7 +213,7 @@ class PackageConcent extends Component {
    - +
    @@ -225,7 +236,7 @@ class PackageConcent extends Component {
    -
    {setcategorylist(item.category)}
    +
    {item.category}
    diff --git a/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js b/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js index 17d1918a..b6ecdba6 100644 --- a/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js +++ b/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js @@ -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}
    - {this.props.current_user.login!=data&&data.creator&&data&&data.creator.login?
    {overtype===false? 头像联系TA: 头像联系TA} -
    :""} +
    :"":""}
    @@ -306,7 +306,7 @@ class PackageIndexNEITaskDetails extends Component {
    -
    {setcategorylist(data&&data.category)}
    +
    {data&&data.category}
    @@ -371,8 +371,6 @@ class PackageIndexNEITaskDetails extends Component {
    {data&&data.operation.can_bidding===true?:""} {data&&data.operation.can_select_bidding_user===true?:""} - -
    @@ -394,7 +392,7 @@ class PackageIndexNEITaskDetails extends Component { ) })} - {data&&data.bidding_users.length===0?
    + {data&&data.bidding_users.length===0?

    暂无人员竞标~

    @@ -426,16 +424,23 @@ class PackageIndexNEITaskDetails extends Component {
    - {data&&data.bidding_users.map((item,key)=>{ - return( -
    this.Clickteacher2(item.id)}> - {item.bool===true?:} - -

    {item.name}

    -
    - ) - })} -
    + {data&&data.bidding_users.map((item,key)=>{ + return( +
    this.Clickteacher2(item.id)}> + {item.bool===true?:} + +

    {item.name}

    +
    + ) + })} + + {data&&data.bidding_users.length===0?
    +
    + +

    暂无人员竞标~

    +
    :""} + +
    } diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js index 32a58af9..fbbc6899 100644 --- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js +++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js @@ -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)){ + 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){ 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){ + 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 (
    @@ -479,9 +664,10 @@ class PackageIndexNEIBannerConcent extends Component {

    - {categorylist.map((item,key)=>{ +
  • this.setcategory(undefined)}>全部
  • + {this.state.categories.map((item,key)=>{ return( -
  • this.setcategory(item.value)}>{item.name}
  • +
  • this.setcategory(item.id)}>{item.name}
  • ) })}
    @@ -496,7 +682,7 @@ class PackageIndexNEIBannerConcent extends Component { value={title} onInput={this.settitlefun}/> {this.state.titletypes===true?
    不能为空
    :""} + watch={false} className="courseMessageMD" initValue={this.state.content} setcheckoutcontent={()=>this.setcheckoutcontent()}> {/* 请求status 422 */} {this.state.contenttypes===true?
    不能为空
    :""}
    @@ -611,7 +797,8 @@ class PackageIndexNEIBannerConcent extends Component { /> {this.state.contact_nametype===true?
    不能为空
    :""}

    - {modalCancel===false?

    + + {modalCancel===false&&this.props.current_user.phone!=null?

    手机号:

    :""} {this.state.current_userphonetype===true?
    不能为空
    :""} - {modalCancel===true?

    + {modalCancel===true||this.props.current_user.phone===null?

    {/*未注册才显示!*/}