From 7c92a2849421c2e77c3489952552c3e500319fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 12 Jul 2019 14:38:19 +0800 Subject: [PATCH] b --- public/react/src/common/DateUtil.js | 2 +- public/react/src/index.js | 2 +- .../src/modules/projectPackages/MDEditors.js | 12 +- .../PackageIndex/PackageConcent.js | 135 +++++++++-- .../PackageIndexNEIBannerConcent.js | 215 +++++++++++++----- .../projectPackages/packageconcnet.css | 8 + 6 files changed, 290 insertions(+), 84 deletions(-) diff --git a/public/react/src/common/DateUtil.js b/public/react/src/common/DateUtil.js index 652b72eb..5ad02a7c 100644 --- a/public/react/src/common/DateUtil.js +++ b/public/react/src/common/DateUtil.js @@ -15,7 +15,7 @@ export function handleDateString(dateString) { if (miniute < 60) { // 加一个小时 const tempStr = [ar[0], '00'].join(':'); - const format = "YYYY-MM-DD HH:mm"; + const format = "YYYY-MM-DD HH:mm:ss"; const _moment = moment(tempStr, format) _moment.add(1, 'hours') return _moment.format(format) diff --git a/public/react/src/index.js b/public/react/src/index.js index 38ac53e1..78f76b68 100644 --- a/public/react/src/index.js +++ b/public/react/src/index.js @@ -40,7 +40,7 @@ window.__useKindEditor = false; var proxy = "http://localhost:3000" // proxy = "http://testbdweb.trustie.net" // proxy = "http://testbdweb.educoder.net" -// proxy = 'http://192.168.0.195:3000' + proxy = 'http://192.168.2.63:3001/' // 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 c91c4d16..3174389a 100644 --- a/public/react/src/modules/projectPackages/MDEditors.js +++ b/public/react/src/modules/projectPackages/MDEditors.js @@ -120,16 +120,16 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback, initV // mine toolbarIcons: function (mdEditor) { - - let react_id = `react_${id}`; - const __that = window[react_id] + // + // let react_id = `react_${id}`; + // const __that = window[react_id] // Or return editormd.toolbarModes[name]; // full, simple, mini // Using "||" set icons align right. const icons = ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"]; - if (__that.props.showNullButton) { - icons.push('nullBtton') - } + // if (__that.props.showNullButton) { + // icons.push('nullBtton') + // } return icons diff --git a/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js b/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js index e74a2cd1..615e1a39 100644 --- a/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js +++ b/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js @@ -6,22 +6,106 @@ import '../packageconcnet.css'; const { Search } = Input; - - class PackageConcent extends Component { constructor(props) { super(props) this.state = { - + data:undefined, + project_packages:undefined, + category:undefined, + keyword:undefined, + sort_by:"recently", + sort_direction:"desc", + page:1, + per_page:20, } } + //desc’, ‘desc’, ‘asc’ + //否 string 排序,默认最新, ‘recently’, ‘price’ + // 否 string 类型, front,backend,mobile,database, cloud_compute_and_big_data,devops_and_test,ai,other componentDidMount() { + let {category,keyword,sort_by,sort_direction,page}=this.state + this.setdatas(category,keyword,sort_by,sort_direction,page) + } + + setdatas=(category,keyword,sort_by,sort_direction,page)=>{ + + let Url = `/api/v1/project_packages.json`; + axios.get(Url,{params:{ + category:category, + keyword:keyword, + sort_by:sort_by, + sort_direction:sort_direction, + page:page, + per_page:20, + }} + ).then((response) => { + this.setState({ + data:response.data, + project_packages:response.data.project_packages + }) + }).catch((error) => { + console.log(error) + }) + } + + setdatafuns=(value)=>{ + let {category,keyword,sort_by,sort_direction,page}=this.state + this.setState({ + keyword:value + }) + this.setdatas(category,value,sort_by,sort_direction,page) + } + setcategory=(value)=>{ + let {category,keyword,sort_by,sort_direction,page}=this.state + this.setState({ + category:value + }) + this.setdatas(value,keyword,sort_by,sort_direction,page) } + setsort_byfun=(value)=>{ + let {category,keyword,sort_by,sort_direction,page}=this.state + + this.setState({ + sort_by:value + }) + let sort_directionvalue; + if(value===sort_by){ + if(sort_direction==="desc"){ + this.setState({ + sort_direction:"asc" + }) + sort_directionvalue="asc"; + }else{ + this.setState({ + sort_direction:"desc" + }) + sort_directionvalue="desc"; + } + }else{ + this.setState({ + sort_direction:"desc" + }) + sort_directionvalue="desc"; + } + this.setdatas(category,keyword,value,sort_directionvalue,page) + } render() { + let {data,page,category,sort_by,sort_direction}=this.state; + 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"}, + ] return (
@@ -41,7 +125,7 @@ class PackageConcent extends Component { style={{ width: 749}} className="packinput" enterButton={ 搜索} - onSearch={value => console.log(value)} /> + onSearch={ (value)=>this.setdatafuns(value)} /> @@ -50,29 +134,44 @@ class PackageConcent extends Component {
-

类型:

-
  • 全部
  • -
  • 前端开发
  • -
  • 后端开发
  • -
  • 移动开发
  • -
  • 数据库
  • -
  • 云计算和大数据
  • -
  • 运维与测试
  • -
  • 人工智能
  • -
  • 其他
  • + {categorylist.map((item,key)=>{ + console.log(category) + console.log(item.value) + return( +
  • this.setcategory(item.value)}>{item.name}
  • + ) + })} +

    排序: -

    -
  • 最新
  • -
  • 价格
  • +
    +
  • this.setsort_byfun("recently")}> + 最新 + + + + +
  • + +
  • this.setsort_byfun("price")}> + 价格 + + + + +
  • @@ -139,7 +238,7 @@ class PackageConcent extends Component {
    - +
    diff --git a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js index fe222c66..9523459c 100644 --- a/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js +++ b/public/react/src/modules/projectPackages/PackageIndexNewandEdit/PackageIndexNEIBannerConcent.js @@ -6,9 +6,11 @@ import { handleDateString} from 'educoder'; import locale from 'antd/lib/date-picker/locale/zh_CN'; import MDEditors from '../MDEditors'; import PhoneModel from './PhoneModel'; +import moment from 'moment' import '../packageconcnet.css'; const { Search } = Input; + class PackageIndexNEIBannerConcent extends Component { constructor(props) { super(props) @@ -17,12 +19,25 @@ class PackageIndexNEIBannerConcent extends Component { modalCancel:false, getverificationcodes:true, seconds:35, + + category:undefined, + title:undefined, + content:undefined, + attachment_ids:undefined, + deadline_at:undefined, + min_price:undefined, + max_price:undefined, + contact_name:undefined, + contact_phone:undefined, + code:undefined, + publish:false, } } componentDidMount() { + // this.contentMdRef.current.setValue("测试赋值") } //获取验证码; getverificationcode =()=>{ @@ -77,41 +92,72 @@ class PackageIndexNEIBannerConcent extends Component { } //短信验证 SMSverification = () => { - // var url = `/accounts/get_verification_code.json`; - // axios.get((url), { - // params: { - // login: this.state.logins, - // type: 1, - // } - // }).then((result) => { - // //验证有问题{"status":1,"message":"success"} - // // console.log(result); - // this.openNotification("验证码已发送,请注意查收!",2); - // - // - // }).catch((error) => { - // console.log(error); - // - // }) - } - setclick=()=>{ - const mdContnet = this.contentMdRef.current.getValue().trim(); - console.log(mdContnet) + let {contact_phone,code}=this.state; + var url = `/account/get_verification_code.json`; + axios.get((url), { + params: { + login: contact_phone, + type: code, + } + }).then((result) => { + //验证有问题{"status":1,"message":"success"} + // console.log(result); + this.openNotification("验证码已发送,请注意查收!",2); + + + }).catch((error) => { + console.log(error); + + }) } + onChangeTimePicker = (value, dateString) => { this.setState({ - TimePickervalue: dateString + deadline_at: moment(handleDateString(dateString)) }) } - setPublication=()=>{ + setPublication=(type)=>{ + const content = this.contentMdRef.current.getValue().trim(); + // console.log(content) + // console.log(this.state.deadline_at._i) + this.setState({ + publish:type + }) + let types=type; + let {category,title,attachment_ids,deadline_at,min_price,max_price,contact_name,contact_phone,code}=this.state; + const url = `/api/v1/project_packages.json`; + + axios.post(url, { + category: category, + title: title, + content: content, + attachment_ids: attachment_ids, + deadline_at:deadline_at._i, + min_price:parseInt(min_price).toFixed(2), + max_price:parseInt(max_price).toFixed(2), + contact_name: contact_name, + contact_phone: contact_phone, + code:code, + publish:types + } + ).then((response) => { + debugger + }).catch((error) => { + console.log(error) + }) + + + this.props.setPublicationfun() } modalCancel=()=>{ this.setState({ - modalCancel:false + modalCancel:false, + contact_phone:undefined, + code:undefined, }) } @@ -122,14 +168,67 @@ class PackageIndexNEIBannerConcent extends Component { } + setcategory=(value)=>{ + this.setState({ + category:value + }) + } + + settitlefun=(e)=>{ + this.setState({ + title:e.target.value + }) + } + + + onChangemin_prices=(e)=>{ + this.setState({ + min_price:e.target.value + }) + + } + onChangemax_prices=(e)=>{ + this.setState({ + max_price:e.target.value + }) + } + + onChangeContact_name=(e)=>{ + this.setState({ + contact_name:e.target.value + }) + } + + onChangeContact_phone=(e)=>{ + this.setState({ + contact_phone:e.target.value + }) + } + + onChangeCode=(e)=>{ + this.setState({ + code:e.target.value + }) + } + render() { - let {modalCancel,seconds,getverificationcodes}=this.state; + let {modalCancel,seconds,getverificationcodes, + category,title}=this.state; + let categorylist=[ + {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"}, + ] return (
    - + {/**/}

    @@ -140,14 +239,11 @@ class PackageIndexNEIBannerConcent extends Component {

    -
  • 前端开发
  • -
  • 后端开发
  • -
  • 移动开发
  • -
  • 数据库
  • -
  • 云计算和大数据
  • -
  • 运维与测试
  • -
  • 人工智能
  • -
  • 其他
  • + {categorylist.map((item,key)=>{ + return( +
  • this.setcategory(item.value)}>{item.name}
  • + ) + })}

    @@ -156,10 +252,11 @@ class PackageIndexNEIBannerConcent extends Component {
    - + - + {/* 请求status 422 */}
    window.$('#_file').click()} @@ -213,6 +310,7 @@ class PackageIndexNEIBannerConcent extends Component { format="YYYY-MM-DD HH:mm:ss" placeholder="请选择任务的竞标截止日期" className={"fafas"} + value={this.state.deadline_at} onChange={this.onChangeTimePicker} />

    @@ -221,9 +319,9 @@ class PackageIndexNEIBannerConcent extends Component { ¥ } @@ -232,9 +330,9 @@ class PackageIndexNEIBannerConcent extends Component { ¥ @@ -249,9 +347,9 @@ class PackageIndexNEIBannerConcent extends Component {

    @@ -259,18 +357,16 @@ class PackageIndexNEIBannerConcent extends Component { this.editmodels()}>

    -

    + {modalCancel===true?

    {/*未注册才显示!*/} @@ -279,10 +375,9 @@ class PackageIndexNEIBannerConcent extends Component { @@ -290,28 +385,32 @@ class PackageIndexNEIBannerConcent extends Component { 重新发送 ({seconds}s): getverificationcodes === true ?获取验证码 :重新发送} + getverificationcodes === undefined ? 重新发送 ({seconds}s): getverificationcodes === true ?获取验证码 :重新发送} onSearch={()=>this.getverificationcode()} + onInput={this.onChangeCode} /> - {/**/} -

    + + this.modalCancel()}>X + +

    :""}
    -

    +
    - - 保存 + + this.setPublication(false)}>保存
    ) diff --git a/public/react/src/modules/projectPackages/packageconcnet.css b/public/react/src/modules/projectPackages/packageconcnet.css index e59a0d42..8f4086ea 100644 --- a/public/react/src/modules/projectPackages/packageconcnet.css +++ b/public/react/src/modules/projectPackages/packageconcnet.css @@ -288,3 +288,11 @@ display: block; } +.topsj{ + position: absolute; + top: -3px; +} +.bottomsj{ + position: absolute; + bottom: -4px; +} \ No newline at end of file