|
|
@ -7,10 +7,10 @@ import "react-datetime/css/react-datetime.css"; |
|
|
|
import moment from 'moment'; |
|
|
|
import moment from 'moment'; |
|
|
|
import {Address} from "../ui/Address"; |
|
|
|
import {Address} from "../ui/Address"; |
|
|
|
import {UploadImg} from "../ui/UploadImg"; |
|
|
|
import {UploadImg} from "../ui/UploadImg"; |
|
|
|
import {userObj} from "../ui/TestData"; |
|
|
|
|
|
|
|
import {API, JSONResponse, Method, request} from "../interface" |
|
|
|
import {API, JSONResponse, Method, request} from "../interface" |
|
|
|
import {EmptyBodyTransform, SimpleMessage} from "../result"; |
|
|
|
import {EmptyBodyTransform, SimpleMessage} from "../result"; |
|
|
|
import {MyDialog} from "../ui/MyDialog"; |
|
|
|
import {MyDialog} from "../ui/MyDialog"; |
|
|
|
|
|
|
|
import {loadMyFriend} from "../public"; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 活动内容限长字符数 |
|
|
|
* 活动内容限长字符数 |
|
|
@ -56,31 +56,6 @@ export class SendHelp extends React.Component<{ onSendActivityOK:Function }, Sen |
|
|
|
this.friendIndex=React.createRef() |
|
|
|
this.friendIndex=React.createRef() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 搜索好友 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
searchFriend(keyword:string){ |
|
|
|
|
|
|
|
this.setState({friendList:[ |
|
|
|
|
|
|
|
userObj, |
|
|
|
|
|
|
|
userObj]}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取推荐类型 |
|
|
|
|
|
|
|
* @param value |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
getRecommendType(value:string){ |
|
|
|
|
|
|
|
switch (value) { |
|
|
|
|
|
|
|
case RecommendType.no: |
|
|
|
|
|
|
|
return RecommendType.no; |
|
|
|
|
|
|
|
case RecommendType.auto: |
|
|
|
|
|
|
|
return RecommendType.auto; |
|
|
|
|
|
|
|
case RecommendType.choose: |
|
|
|
|
|
|
|
return RecommendType.choose; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return RecommendType.no |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//发布求助信息
|
|
|
|
//发布求助信息
|
|
|
|
sendHelp(){ |
|
|
|
sendHelp(){ |
|
|
|
let that=this |
|
|
|
let that=this |
|
|
@ -90,7 +65,10 @@ export class SendHelp extends React.Component<{ onSendActivityOK:Function }, Sen |
|
|
|
activityStartTime:this.state.activityStartTime, |
|
|
|
activityStartTime:this.state.activityStartTime, |
|
|
|
activityEndTime:this.state.activityEndTime, |
|
|
|
activityEndTime:this.state.activityEndTime, |
|
|
|
activityImgFile:this.state.activityImgFile, |
|
|
|
activityImgFile:this.state.activityImgFile, |
|
|
|
serviceAddress:this.state.serviceAddress |
|
|
|
serviceAddress:this.state.serviceAddress, |
|
|
|
|
|
|
|
recommendType:this.state.recommendType, |
|
|
|
|
|
|
|
friendUserId:Object.keys(this.state.chooseFriendList).map(value => this.state.chooseFriendList[value].userId) |
|
|
|
|
|
|
|
|
|
|
|
},new EmptyBodyTransform(),function (res:JSONResponse<SimpleMessage>) { |
|
|
|
},new EmptyBodyTransform(),function (res:JSONResponse<SimpleMessage>) { |
|
|
|
switch (res.customResult) { |
|
|
|
switch (res.customResult) { |
|
|
|
case SimpleMessage.ok: |
|
|
|
case SimpleMessage.ok: |
|
|
@ -119,6 +97,14 @@ export class SendHelp extends React.Component<{ onSendActivityOK:Function }, Sen |
|
|
|
return this.isNotEmpty(this.state.title,this.state.content,this.state.serviceAddress)&&this.state.activityImgFile!=null |
|
|
|
return this.isNotEmpty(this.state.title,this.state.content,this.state.serviceAddress)&&this.state.activityImgFile!=null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getRecommendType(type:RecommendType){ |
|
|
|
|
|
|
|
switch (type) { |
|
|
|
|
|
|
|
case RecommendType.auto:return "系统推荐" |
|
|
|
|
|
|
|
case RecommendType.choose:return "手动推荐" |
|
|
|
|
|
|
|
case RecommendType.no:return "不推荐" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
render() { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<Container> |
|
|
|
<Container> |
|
|
@ -169,9 +155,9 @@ export class SendHelp extends React.Component<{ onSendActivityOK:Function }, Sen |
|
|
|
</InputGroup.Prepend> |
|
|
|
</InputGroup.Prepend> |
|
|
|
<Form.Control as="select" custom onChange={(e)=> |
|
|
|
<Form.Control as="select" custom onChange={(e)=> |
|
|
|
{ |
|
|
|
{ |
|
|
|
this.setState({recommendType:this.getRecommendType(e.target.value)}) |
|
|
|
this.setState({recommendType:e.target.value}) |
|
|
|
}}> |
|
|
|
}}> |
|
|
|
{recommendType.map((value:RecommendType,index:number) => <option key={"option"+index} value={value}>{value}</option>)} |
|
|
|
{recommendType.map((value:RecommendType,index:number) => <option key={"option"+index} value={value}>{this.getRecommendType(value)}</option>)} |
|
|
|
</Form.Control> |
|
|
|
</Form.Control> |
|
|
|
</InputGroup> |
|
|
|
</InputGroup> |
|
|
|
|
|
|
|
|
|
|
@ -180,7 +166,7 @@ export class SendHelp extends React.Component<{ onSendActivityOK:Function }, Sen |
|
|
|
<InputGroup.Text>推荐好友</InputGroup.Text> |
|
|
|
<InputGroup.Text>推荐好友</InputGroup.Text> |
|
|
|
</InputGroup.Prepend> |
|
|
|
</InputGroup.Prepend> |
|
|
|
<InputGroup.Prepend> |
|
|
|
<InputGroup.Prepend> |
|
|
|
<FormControl placeholder="请输入好友关键字" onChange={(e)=>this.searchFriend(e.target.value)}/> |
|
|
|
<FormControl placeholder="请输入好友关键字" onChange={(e)=>loadMyFriend(e.target.value,this)}/> |
|
|
|
</InputGroup.Prepend> |
|
|
|
</InputGroup.Prepend> |
|
|
|
<Form.Control as="select" custom ref={this.friendIndex}> |
|
|
|
<Form.Control as="select" custom ref={this.friendIndex}> |
|
|
|
{this.state.friendList.map((friend:User,index:number)=><option key={"option"+index} value={index+""}>{friend.name}</option>)} |
|
|
|
{this.state.friendList.map((friend:User,index:number)=><option key={"option"+index} value={index+""}>{friend.name}</option>)} |
|
|
|