project_pack
杨树明 5 years ago
parent 52315f5426
commit 7c92a28494

@ -15,7 +15,7 @@ export function handleDateString(dateString) {
if (miniute < 60) { if (miniute < 60) {
// 加一个小时 // 加一个小时
const tempStr = [ar[0], '00'].join(':'); 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) const _moment = moment(tempStr, format)
_moment.add(1, 'hours') _moment.add(1, 'hours')
return _moment.format(format) return _moment.format(format)

@ -40,7 +40,7 @@ window.__useKindEditor = false;
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.0.195:3000' proxy = 'http://192.168.2.63:3001/'
// proxy='https://www.educoder.net' // proxy='https://www.educoder.net'
const requestMap={}; const requestMap={};
// 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求 // 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求

@ -120,16 +120,16 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback, initV
// mine // mine
toolbarIcons: function (mdEditor) { toolbarIcons: function (mdEditor) {
//
let react_id = `react_${id}`; // let react_id = `react_${id}`;
const __that = window[react_id] // const __that = window[react_id]
// Or return editormd.toolbarModes[name]; // full, simple, mini // Or return editormd.toolbarModes[name]; // full, simple, mini
// Using "||" set icons align right. // Using "||" set icons align right.
const icons = ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"]; const icons = ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"];
if (__that.props.showNullButton) { // if (__that.props.showNullButton) {
icons.push('nullBtton') // icons.push('nullBtton')
} // }
return icons return icons

@ -6,22 +6,106 @@ import '../packageconcnet.css';
const { Search } = Input; const { Search } = Input;
class PackageConcent extends Component { class PackageConcent extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { 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() { 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() { 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 ( return (
<div className="educontent clearfix" style={{flex: "1 0 auto"}}> <div className="educontent clearfix" style={{flex: "1 0 auto"}}>
@ -41,7 +125,7 @@ class PackageConcent extends Component {
style={{ width: 749}} style={{ width: 749}}
className="packinput" className="packinput"
enterButton={<span><Icon type="search" className="mr5"/> 搜索</span>} enterButton={<span><Icon type="search" className="mr5"/> 搜索</span>}
onSearch={value => console.log(value)} /> onSearch={ (value)=>this.setdatafuns(value)} />
<Button type="primary" className="setissues fr" size={"large"}> <Button type="primary" className="setissues fr" size={"large"}>
<a href="/project_packages/new" >发布需求</a> <a href="/project_packages/new" >发布需求</a>
</Button> </Button>
@ -50,29 +134,44 @@ class PackageConcent extends Component {
</div> </div>
</div> </div>
<div className="edu-back-white mb20"> <div className="edu-back-white mb20">
<p className="clearfix padding30"> <p className="clearfix padding30">
<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">
<li className="shaiItem shixun_repertoire active" value="a">全部</li> {categorylist.map((item,key)=>{
<li className="shaiItem shixun_repertoire " value="a">前端开发</li> console.log(category)
<li className="shaiItem shixun_repertoire " value="a">后端开发</li> console.log(item.value)
<li className="shaiItem shixun_repertoire " value="a">移动开发</li> return(
<li className="shaiItem shixun_repertoire " value="a">数据库</li> <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 className="shaiItem shixun_repertoire " value="a">云计算和大数据</li> )
<li className="shaiItem shixun_repertoire " value="a">运维与测试</li> })}
<li className="shaiItem shixun_repertoire " value="a">人工智能</li>
<li className="shaiItem shixun_repertoire " value="a">其他</li>
</div> </div>
</p> </p>
<p className="clearfix shaiContent"> <p className="clearfix shaiContent">
<span className="shaiTitle fl mt3">排序</span> <span className="shaiTitle fl mt3">排序</span>
<div className="fl pr shaiAllItem pagetype"> <div className="fl pr shaiAllItem">
<li className="shaiItem shixun_repertoire active" value="a">最新</li> <li className="shaiItem shixun_repertoire" value="recently" onClick={()=>this.setsort_byfun("recently")}>
<li className="shaiItem shixun_repertoire " value="a">价格</li> <span className={sort_by==="recently"?"color-blue":""}>最新</span>
<sapn className="relativef">
<i className={sort_by==="recently"&&sort_direction==="asc"?
"iconfont icon-sanjiaoxing-up font-12 topsj color-blue" :"iconfont icon-sanjiaoxing-up font-12 topsj"}></i>
<i className={sort_by==="recently"&&sort_direction==="desc"?
"iconfont icon-sanjiaoxing-down font-12 bottomsj color-blue":"iconfont icon-sanjiaoxing-down font-12 bottomsj"}></i>
</sapn>
</li>
<li className="shaiItem shixun_repertoire " value="price" onClick={()=>this.setsort_byfun("price")}>
<span className={sort_by==="price"?"color-blue":""}>价格</span>
<sapn className="relativef">
<i className={sort_by==="price"&&sort_direction==="asc"?
"iconfont icon-sanjiaoxing-up font-12 topsj color-blue" :"iconfont icon-sanjiaoxing-up font-12 topsj"}></i>
<i className={sort_by==="price"&&sort_direction==="desc"?
"iconfont icon-sanjiaoxing-down font-12 bottomsj color-blue":"iconfont icon-sanjiaoxing-down font-12 bottomsj"}></i>
</sapn>
</li>
</div> </div>
</p> </p>
</p> </p>
@ -139,7 +238,7 @@ class PackageConcent extends Component {
</div> </div>
<div className={"mt40"}> <div className={"mt40"}>
<Pagination className="edu-txt-center" defaultCurrent={1} total={50} /> <Pagination className="edu-txt-center" hideOnSinglePage={true} pageSize={20} current={page} total={data&&data.count} />
</div> </div>

@ -6,9 +6,11 @@ import { handleDateString} from 'educoder';
import locale from 'antd/lib/date-picker/locale/zh_CN'; import locale from 'antd/lib/date-picker/locale/zh_CN';
import MDEditors from '../MDEditors'; import MDEditors from '../MDEditors';
import PhoneModel from './PhoneModel'; import PhoneModel from './PhoneModel';
import moment from 'moment'
import '../packageconcnet.css'; import '../packageconcnet.css';
const { Search } = Input; const { Search } = Input;
class PackageIndexNEIBannerConcent extends Component { class PackageIndexNEIBannerConcent extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
@ -17,12 +19,25 @@ class PackageIndexNEIBannerConcent extends Component {
modalCancel:false, modalCancel:false,
getverificationcodes:true, getverificationcodes:true,
seconds:35, 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() { componentDidMount() {
// this.contentMdRef.current.setValue("测试赋值")
} }
//获取验证码; //获取验证码;
getverificationcode =()=>{ getverificationcode =()=>{
@ -77,41 +92,72 @@ class PackageIndexNEIBannerConcent extends Component {
} }
//短信验证 //短信验证
SMSverification = () => { SMSverification = () => {
// var url = `/accounts/get_verification_code.json`; let {contact_phone,code}=this.state;
// axios.get((url), { var url = `/account/get_verification_code.json`;
// params: { axios.get((url), {
// login: this.state.logins, params: {
// type: 1, login: contact_phone,
// } type: code,
// }).then((result) => { }
// //验证有问题{"status":1,"message":"success"} }).then((result) => {
// // console.log(result); //验证有问题{"status":1,"message":"success"}
// this.openNotification("验证码已发送,请注意查收!",2); // console.log(result);
// this.openNotification("验证码已发送,请注意查收!",2);
//
// }).catch((error) => {
// console.log(error); }).catch((error) => {
// console.log(error);
// })
} })
setclick=()=>{
const mdContnet = this.contentMdRef.current.getValue().trim();
console.log(mdContnet)
} }
onChangeTimePicker = (value, dateString) => { onChangeTimePicker = (value, dateString) => {
this.setState({ 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() this.props.setPublicationfun()
} }
modalCancel=()=>{ modalCancel=()=>{
this.setState({ 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() { 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 ( return (
<div className="mb20"> <div className="mb20">
<PhoneModel {/*<PhoneModel*/}
modalsType={modalCancel} {/*modalsType={modalCancel}*/}
modalCancel={this.modalCancel} {/*modalCancel={this.modalCancel}*/}
/> {/*/>*/}
<p className="clearfix "> <p className="clearfix ">
<div className={"stud-class-set pd30a0 coursenavbox edu-back-white"}> <div className={"stud-class-set pd30a0 coursenavbox edu-back-white"}>
@ -140,14 +239,11 @@ 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">
<li className="shaiItem shixun_repertoire active borderccc" value="a">前端开发</li> {categorylist.map((item,key)=>{
<li className="shaiItem shixun_repertoire borderccc" value="a">后端开发</li> return(
<li className="shaiItem shixun_repertoire borderccc" value="a">移动开发</li> <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 className="shaiItem shixun_repertoire borderccc" value="a">数据库</li> )
<li className="shaiItem shixun_repertoire borderccc" value="a">云计算和大数据</li> })}
<li className="shaiItem shixun_repertoire borderccc" value="a">运维与测试</li>
<li className="shaiItem shixun_repertoire borderccc" value="a">人工智能</li>
<li className="shaiItem shixun_repertoire borderccc" value="a">其他</li>
</div> </div>
</p> </p>
@ -156,10 +252,11 @@ class PackageIndexNEIBannerConcent extends Component {
<label htmlFor="coursesNew_description" className="ant-form-item-required font-16" >需求标题和详情</label> <label htmlFor="coursesNew_description" className="ant-form-item-required font-16" >需求标题和详情</label>
</div> </div>
<Input placeholder="请输入需求标题示例美食类APP开发最大限制60个字符" maxLength="60" className="input-100-40s mt5 fafafas mb20" /> <Input placeholder="请输入需求标题示例美食类APP开发最大限制60个字符" maxLength="60" className="input-100-40s mt5 fafafas mb20"
value={title} onInput={this.settitlefun}/>
<MDEditors ref={this.contentMdRef} placeholder="请填写清晰完整的需求内容" mdID={'courseContentMD'} refreshTimeout={5000} <MDEditors ref={this.contentMdRef} placeholder="请填写清晰完整的需求内容" mdID={'courseContentMD'} refreshTimeout={1500}
watch={false} className="courseMessageMD" initValue={this.state.description}></MDEditors> watch={false} className="courseMessageMD" initValue={this.state.content}></MDEditors>
{/* 请求status 422 */} {/* 请求status 422 */}
<div className="df uploadBtn"> <div className="df uploadBtn">
<a href="javascript:void(0);" className="fl" onClick={() => window.$('#_file').click()} <a href="javascript:void(0);" className="fl" onClick={() => window.$('#_file').click()}
@ -213,6 +310,7 @@ class PackageIndexNEIBannerConcent extends Component {
format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
placeholder="请选择任务的竞标截止日期" placeholder="请选择任务的竞标截止日期"
className={"fafas"} className={"fafas"}
value={this.state.deadline_at}
onChange={this.onChangeTimePicker} onChange={this.onChangeTimePicker}
/> />
</p> </p>
@ -221,9 +319,9 @@ class PackageIndexNEIBannerConcent extends Component {
<Input <Input
className={"fafas"} className={"fafas"}
style={{"width": "260px"}} style={{"width": "260px"}}
format="YYYY-MM-DD HH:mm:ss" value={this.state.min_price}
placeholder="支付多少费用(最低)" placeholder="支付多少费用(最低)"
onChange={this.onChangeTimePicker} onInput={this.onChangemin_prices}
suffix={ suffix={
<span >¥</span> <span >¥</span>
} }
@ -232,9 +330,9 @@ class PackageIndexNEIBannerConcent extends Component {
<Input <Input
className={"fafas"} className={"fafas"}
style={{"width": "260px"}} style={{"width": "260px"}}
format="YYYY-MM-DD HH:mm:ss" value={this.state.max_price}
placeholder="支付多少费用(最高)" placeholder="支付多少费用(最高)"
onChange={this.onChangeTimePicker} onInput={this.onChangemax_prices}
suffix={ suffix={
<span>¥</span> <span>¥</span>
@ -249,9 +347,9 @@ class PackageIndexNEIBannerConcent extends Component {
<Input <Input
className={"fafafas"} className={"fafafas"}
style={{"width": "260px"}} style={{"width": "260px"}}
format="YYYY-MM-DD HH:mm:ss" value={this.state.contact_name}
placeholder="请输入姓名" placeholder="请输入姓名"
onChange={this.onChangeTimePicker} onInput={this.onChangeContact_name}
/> />
</p> </p>
<p className="clearfix mb20 shaiContent"> <p className="clearfix mb20 shaiContent">
@ -259,18 +357,16 @@ class PackageIndexNEIBannerConcent extends Component {
<Input <Input
className={"fafafas fl"} className={"fafafas fl"}
style={{"width": "260px"}} style={{"width": "260px"}}
format="YYYY-MM-DD HH:mm" value={this.state.contact_phone}
showTime={{ format: 'HH:mm' }}
placeholder="请输入手机号" placeholder="请输入手机号"
disabled={true} disabled={true}
onChange={this.onChangeTimePicker}
/> />
<a className="fl ml20"> <a className="fl ml20">
<i className="iconfont icon-bianjidaibeijing font-26 color-blue" onClick={()=>this.editmodels()}></i> <i className="iconfont icon-bianjidaibeijing font-26 color-blue" onClick={()=>this.editmodels()}></i>
</a> </a>
</p> </p>
<p className="clearfix mb20 shaiContent"> {modalCancel===true?<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">
{/*未注册才显示!*/} {/*未注册才显示!*/}
@ -279,10 +375,9 @@ class PackageIndexNEIBannerConcent extends Component {
<Input <Input
className={"fafafas fl"} className={"fafafas fl"}
style={{"width": "260px"}} style={{"width": "260px"}}
format="YYYY-MM-DD HH:mm" value={this.state.contact_phone}
showTime={{ format: 'HH:mm' }}
placeholder="请输入手机号码" placeholder="请输入手机号码"
onChange={this.onChangeTimePicker} onInput={this.onChangeContact_phone}
/> />
</span> </span>
@ -290,28 +385,32 @@ class PackageIndexNEIBannerConcent extends Component {
<span> <span>
<Search <Search
style={{ width: 300 }} style={{ width: 300 }}
value={this.state.code}
className="fafas" className="fafas"
placeholder="请输入验证码" placeholder="请输入验证码"
enterButton={ enterButton={
getverificationcodes === undefined ? <span>重新发送 ({seconds}s)</span>: getverificationcodes === true ?<span ></span> :<span ></span>} getverificationcodes === undefined ? <span>重新发送 ({seconds}s)</span>: getverificationcodes === true ?<span ></span> :<span ></span>}
onSearch={()=>this.getverificationcode()} onSearch={()=>this.getverificationcode()}
onInput={this.onChangeCode}
/> />
</span> </span>
<span> <span>
{/*<Button type="primary" className="defalutSubmitbtn ml10 defalutSubmitbtnmodels">重新发送()</Button>*/} {/*<Button type="primary" className="defalutSubmitbtn ml10 defalutSubmitbtnmodels">重新发送()</Button>*/}
</span> </span>
</span> </span>
</p> <a className="fl mt13">
<span className="font-18 color-blue" onClick={()=>this.modalCancel()}>X</span>
</a>
</p>:""}
</div> </div>
</div> </div>
</p> </p>
<div className="clearfix mt30 mb30"> <div className="clearfix mt30 mb30">
<Button type="primary" className="defalutSubmitbtn fl mr20 defalutSubmitbtns" onClick={this.setPublication}>申请发布</Button> <Button type="primary" className="defalutSubmitbtn fl mr20 defalutSubmitbtns" onClick={()=>this.setPublication(true)}>申请发布</Button>
<a className="defalutCancelbtns fl">保存</ a> <a className="defalutCancelbtns fl" onClick={()=>this.setPublication(false)}>保存</ a>
</div> </div>
</div> </div>
) )

@ -288,3 +288,11 @@
display: block; display: block;
} }
.topsj{
position: absolute;
top: -3px;
}
.bottomsj{
position: absolute;
bottom: -4px;
}
Loading…
Cancel
Save