From 5061dd4a9f706caae6685c9ed968dba4375f699f Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Wed, 3 Jun 2020 03:23:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E9=A1=B5=E9=80=BB=E8=BE=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/account/Register.tsx | 6 ++++-- src/entity.ts | 5 +++++ src/my/MyFriend.tsx | 28 +++++++--------------------- src/my/MyHelp.tsx | 18 ++++-------------- src/my/MyInfo.tsx | 8 ++++---- src/public.tsx | 2 +- src/sub/IndexMenu.tsx | 2 +- src/sub/Volunteer.tsx | 6 +++--- 8 files changed, 29 insertions(+), 46 deletions(-) diff --git a/src/account/Register.tsx b/src/account/Register.tsx index 33503c6..ce757cd 100644 --- a/src/account/Register.tsx +++ b/src/account/Register.tsx @@ -1,7 +1,7 @@ import React from "react"; import {Input} from "../ui/InputGroup"; import {Button, Form} from 'react-bootstrap' -import {RegisterProps, RegisterState, UserType} from "../entity"; +import {RegisterProps, RegisterState, Sex, UserType} from "../entity"; import {UploadImg} from "../ui/UploadImg"; import {Address} from "../ui/Address"; import {JSONResponse, Method, request} from "../interface" @@ -155,7 +155,9 @@ export class Register extends React.Component{ { this.setState({sex:value}) }} - options={[,,]}/> + options={[, + , + ]}/> { diff --git a/src/entity.ts b/src/entity.ts index b928f4b..af8da7f 100644 --- a/src/entity.ts +++ b/src/entity.ts @@ -418,3 +418,8 @@ export interface HelpEntity { //活动结束状态 hasEnd:boolean; } + +export enum Sex { + man='man', + women='women' +} diff --git a/src/my/MyFriend.tsx b/src/my/MyFriend.tsx index 931fb1e..2a3b4d8 100644 --- a/src/my/MyFriend.tsx +++ b/src/my/MyFriend.tsx @@ -109,16 +109,16 @@ export class MyFriend extends React.Component< /** * 查找用户 */ - queryUser(name:string,page:number){ + queryUser(userId:string,page:number){ - if(!name){ + if(!userId){ this.setState({ userList:[] }) }else { let that = this - request(Api.account.findUser, Method.GET, {name:name}, new UserTransform(), function (res: UserRes) { + request(Api.account.findUser, Method.GET, {targetUserId:userId}, new UserTransform(), function (res: UserRes) { switch (res.customResult) { case PageDataMessage.ok: that.setState({ @@ -177,29 +177,15 @@ export class MyFriend extends React.Component< 查看用户信息this.setState({userId:friend.userId})}/> + + ):null} + 没有好友搜索结果 + {this.state.scrollTip!==null?this.setState({scrollTip:null})} duration={1000}/>:null} - - - 添加好友 - - { - this.setState({ - queryUser:e.target.value - }) - this.queryUser(e.target.value,1) - }}/> - - {this.state.userList?this.state.userList.length>0?this.state.userList.map((user:User,index:number)=> - - {user.name} - - 查看用户信息this.setState({userId:user.userId})}/> - - ):没有匹配任何用户:null} diff --git a/src/my/MyHelp.tsx b/src/my/MyHelp.tsx index 93e51c0..213a6d1 100644 --- a/src/my/MyHelp.tsx +++ b/src/my/MyHelp.tsx @@ -80,19 +80,9 @@ export class MyHelp extends React.Component<{ * @param help */ getAction(help:HelpEntity){ - if(help.activityScore){ - return ( - 已评价 - - {help.activityScore} - ) - } - else if(help.joinTime&&help.completeTime){ + if(help.completeTime){ return ( 已完成 - - - ) }else if(help.joinTime){ @@ -110,7 +100,7 @@ export class MyHelp extends React.Component<{ }) }} variant={"info"}>完成} - + ) }else{ return ( @@ -125,7 +115,7 @@ export class MyHelp extends React.Component<{ }) }} variant={"info"}>参与:null} - + ) } @@ -190,7 +180,7 @@ export class MyHelp extends React.Component<{ )} - {["参与状态","操作","活动评分"].map((text:string,index:number)=> + {["参与状态","操作"].map((text:string,index:number)=> {text} )} diff --git a/src/my/MyInfo.tsx b/src/my/MyInfo.tsx index 603c54e..6c55d86 100644 --- a/src/my/MyInfo.tsx +++ b/src/my/MyInfo.tsx @@ -1,6 +1,6 @@ import React from "react"; import {Button, Col, Container, Form, FormControl, Image, Row} from "react-bootstrap"; -import {User, UserEdit, UserType} from "../entity"; +import {Sex, User, UserEdit, UserType} from "../entity"; import {Input} from "../ui/InputGroup"; import {JSONResponse, Method, request} from "../interface"; import { @@ -294,9 +294,9 @@ export class MyInfo extends React.Component< this.setState({ userEdit:{...this.state.userEdit,...{ sex:event.target.value}} })}> - - - :this.state.userInfo?.sex==='man'?"男":"女"} + + + :this.state.userInfo?.sex===Sex.man?"男":"女"} diff --git a/src/public.tsx b/src/public.tsx index c981f2b..b060163 100644 --- a/src/public.tsx +++ b/src/public.tsx @@ -32,7 +32,7 @@ export function changeActivity(activityId:number,activityStatus:ActivityStatus,t callback(res.timeScore) that.setState({ result:
-

{getStatus(activityStatus)}成功,{ActivityStatus.complete===activityStatus?'关闭此窗口将刷新时间币':null}

+

{getStatus(activityStatus)}成功{ActivityStatus.complete===activityStatus?',关闭此窗口将刷新时间币':null}

});break case SimpleMessage.fail: diff --git a/src/sub/IndexMenu.tsx b/src/sub/IndexMenu.tsx index 6be5b0b..fdc2a96 100644 --- a/src/sub/IndexMenu.tsx +++ b/src/sub/IndexMenu.tsx @@ -68,7 +68,7 @@ export class IndexMenu extends React.Component<{ cookies:Cookies }, });break; case PageDataMessage.ok: that.setState({ - activityList: page===1?res.dataList||[]:(that.state.activityList||[]).concat(res.dataList||[]), + activityList:res.dataList, page: res.page, }) break diff --git a/src/sub/Volunteer.tsx b/src/sub/Volunteer.tsx index 62e00da..e5d59db 100644 --- a/src/sub/Volunteer.tsx +++ b/src/sub/Volunteer.tsx @@ -1,7 +1,7 @@ import React from "react"; import {Button, Table} from "react-bootstrap"; import {Input} from "../ui/InputGroup"; -import {PageProps, User, UserType} from "../entity"; +import {PageProps, Sex, User, UserType} from "../entity"; import {Page} from "../ui/Page"; import {Address} from "../ui/Address"; import {Method, request} from "../interface" @@ -56,7 +56,7 @@ export class Volunteer extends React.Component<{ undefined?:undefined }, case PageDataMessage.ok: that.setState({ - volunteerList: page===1?res.dataList||[]:(that.state.volunteerList||[]).concat(res.dataList||[]), + volunteerList: res.dataList, page: res.page, form:{ keyword:that.state.form.keyword, @@ -118,7 +118,7 @@ export class Volunteer extends React.Component<{ undefined?:undefined },
- {[[volunteer.name,volunteer.sex,volunteer.age],[volunteer.mobile,volunteer.email,volunteer.serviceAddress]].map((tr, index)=> + {[[volunteer.name,volunteer.sex===Sex.man?'男':'女',volunteer.age],[volunteer.mobile,volunteer.email,volunteer.serviceAddress]].map((tr, index)=> {tr.map((td,index)=>)}
{td}