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

@ -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)

@ -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控制避免用户通过双击等操作发出重复的请求

@ -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

@ -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 (
<div className="educontent clearfix" style={{flex: "1 0 auto"}}>
@ -41,7 +125,7 @@ class PackageConcent extends Component {
style={{ width: 749}}
className="packinput"
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"}>
<a href="/project_packages/new" >发布需求</a>
</Button>
@ -50,29 +134,44 @@ class PackageConcent extends Component {
</div>
</div>
<div className="edu-back-white mb20">
<p className="clearfix padding30">
<p className="clearfix mb30 shaiContent">
<span className="shaiTitle fl mt3">类型</span>
<div className="fl pr shaiAllItem pagetype">
<li className="shaiItem shixun_repertoire active" 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>
<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>
<li className="shaiItem shixun_repertoire " value="a">其他</li>
{categorylist.map((item,key)=>{
console.log(category)
console.log(item.value)
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>
)
})}
</div>
</p>
<p className="clearfix shaiContent">
<span className="shaiTitle fl mt3">排序</span>
<div className="fl pr shaiAllItem pagetype">
<li className="shaiItem shixun_repertoire active" value="a">最新</li>
<li className="shaiItem shixun_repertoire " value="a">价格</li>
<div className="fl pr shaiAllItem">
<li className="shaiItem shixun_repertoire" value="recently" onClick={()=>this.setsort_byfun("recently")}>
<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>
</p>
</p>
@ -139,7 +238,7 @@ class PackageConcent extends Component {
</div>
<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>

@ -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 (
<div className="mb20">
<PhoneModel
modalsType={modalCancel}
modalCancel={this.modalCancel}
/>
{/*<PhoneModel*/}
{/*modalsType={modalCancel}*/}
{/*modalCancel={this.modalCancel}*/}
{/*/>*/}
<p className="clearfix ">
<div className={"stud-class-set pd30a0 coursenavbox edu-back-white"}>
@ -140,14 +239,11 @@ class PackageIndexNEIBannerConcent extends Component {
<p className="clearfix mb20 shaiContent">
<div className="fl pr shaiAllItem pagetype">
<li className="shaiItem shixun_repertoire active 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>
<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>
{categorylist.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>
)
})}
</div>
</p>
@ -156,10 +252,11 @@ class PackageIndexNEIBannerConcent extends Component {
<label htmlFor="coursesNew_description" className="ant-form-item-required font-16" >需求标题和详情</label>
</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}
watch={false} className="courseMessageMD" initValue={this.state.description}></MDEditors>
<MDEditors ref={this.contentMdRef} placeholder="请填写清晰完整的需求内容" mdID={'courseContentMD'} refreshTimeout={1500}
watch={false} className="courseMessageMD" initValue={this.state.content}></MDEditors>
{/* 请求status 422 */}
<div className="df uploadBtn">
<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"
placeholder="请选择任务的竞标截止日期"
className={"fafas"}
value={this.state.deadline_at}
onChange={this.onChangeTimePicker}
/>
</p>
@ -221,9 +319,9 @@ class PackageIndexNEIBannerConcent extends Component {
<Input
className={"fafas"}
style={{"width": "260px"}}
format="YYYY-MM-DD HH:mm:ss"
value={this.state.min_price}
placeholder="支付多少费用(最低)"
onChange={this.onChangeTimePicker}
onInput={this.onChangemin_prices}
suffix={
<span >¥</span>
}
@ -232,9 +330,9 @@ class PackageIndexNEIBannerConcent extends Component {
<Input
className={"fafas"}
style={{"width": "260px"}}
format="YYYY-MM-DD HH:mm:ss"
value={this.state.max_price}
placeholder="支付多少费用(最高)"
onChange={this.onChangeTimePicker}
onInput={this.onChangemax_prices}
suffix={
<span>¥</span>
@ -249,9 +347,9 @@ class PackageIndexNEIBannerConcent extends Component {
<Input
className={"fafafas"}
style={{"width": "260px"}}
format="YYYY-MM-DD HH:mm:ss"
value={this.state.contact_name}
placeholder="请输入姓名"
onChange={this.onChangeTimePicker}
onInput={this.onChangeContact_name}
/>
</p>
<p className="clearfix mb20 shaiContent">
@ -259,18 +357,16 @@ class PackageIndexNEIBannerConcent extends Component {
<Input
className={"fafafas fl"}
style={{"width": "260px"}}
format="YYYY-MM-DD HH:mm"
showTime={{ format: 'HH:mm' }}
value={this.state.contact_phone}
placeholder="请输入手机号"
disabled={true}
onChange={this.onChangeTimePicker}
/>
<a className="fl ml20">
<i className="iconfont icon-bianjidaibeijing font-26 color-blue" onClick={()=>this.editmodels()}></i>
</a>
</p>
<p className="clearfix mb20 shaiContent">
{modalCancel===true?<p className="clearfix mb20 shaiContent">
<span className="shaiTitle mt5 fl">
<span className="shaiTitle fl mt5 ml25">
{/*未注册才显示!*/}
@ -279,10 +375,9 @@ class PackageIndexNEIBannerConcent extends Component {
<Input
className={"fafafas fl"}
style={{"width": "260px"}}
format="YYYY-MM-DD HH:mm"
showTime={{ format: 'HH:mm' }}
value={this.state.contact_phone}
placeholder="请输入手机号码"
onChange={this.onChangeTimePicker}
onInput={this.onChangeContact_phone}
/>
</span>
@ -290,28 +385,32 @@ class PackageIndexNEIBannerConcent extends Component {
<span>
<Search
style={{ width: 300 }}
value={this.state.code}
className="fafas"
placeholder="请输入验证码"
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()}
onInput={this.onChangeCode}
/>
</span>
<span>
{/*<Button type="primary" className="defalutSubmitbtn ml10 defalutSubmitbtnmodels">重新发送()</Button>*/}
</span>
</span>
</p>
<a className="fl mt13">
<span className="font-18 color-blue" onClick={()=>this.modalCancel()}>X</span>
</a>
</p>:""}
</div>
</div>
</p>
<div className="clearfix mt30 mb30">
<Button type="primary" className="defalutSubmitbtn fl mr20 defalutSubmitbtns" onClick={this.setPublication}>申请发布</Button>
<a className="defalutCancelbtns fl">保存</ a>
<Button type="primary" className="defalutSubmitbtn fl mr20 defalutSubmitbtns" onClick={()=>this.setPublication(true)}>申请发布</Button>
<a className="defalutCancelbtns fl" onClick={()=>this.setPublication(false)}>保存</ a>
</div>
</div>
)

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