|
|
|
@ -7,7 +7,7 @@ import {MyFriend} from "./my/MyFriend"; |
|
|
|
|
import {MyDialog} from "./ui/MyDialog"; |
|
|
|
|
import {MyLeaveWord} from "./my/MyLeaveWord"; |
|
|
|
|
import {MyMessage} from "./my/MyMessage"; |
|
|
|
|
import {User} from "./entity"; |
|
|
|
|
import {User, UserEdit, UserType} from "./entity"; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 菜单标记 |
|
|
|
@ -30,16 +30,22 @@ enum DialogType { |
|
|
|
|
/** |
|
|
|
|
* 主菜单 |
|
|
|
|
*/ |
|
|
|
|
export class Main extends React.Component<{ user:string,logout:Function }, |
|
|
|
|
export class Main extends React.Component< |
|
|
|
|
{ user:string,userType?:string,logout:Function}, |
|
|
|
|
{ |
|
|
|
|
//菜单
|
|
|
|
|
menu:Menu; |
|
|
|
|
//子菜单
|
|
|
|
|
subMenu:JSX.Element; |
|
|
|
|
friendList:Array<User>; |
|
|
|
|
//我的菜单
|
|
|
|
|
my:{ |
|
|
|
|
menuName:string; |
|
|
|
|
content:JSX.Element|null; |
|
|
|
|
open:boolean; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//用户身份
|
|
|
|
|
userType?:string; |
|
|
|
|
} |
|
|
|
|
>{ |
|
|
|
|
|
|
|
|
@ -125,12 +131,16 @@ export class Main extends React.Component<{ user:string,logout:Function }, |
|
|
|
|
break; |
|
|
|
|
case DialogType.message: |
|
|
|
|
this.setState({ |
|
|
|
|
my:{menuName:dialogType,content:<MyMessage user={this.props.user}/>,open:true} |
|
|
|
|
my:{menuName:dialogType,content:<MyMessage onUserUpdate={(user:UserEdit)=>this.setState({userType:user.userType})} user={this.props.user}/>,open:true} |
|
|
|
|
}) |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
onUserUpdate(user:UserEdit){ |
|
|
|
|
console.debug(user) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
|
return ( |
|
|
|
|
<div> |
|
|
|
@ -159,7 +169,10 @@ export class Main extends React.Component<{ user:string,logout:Function }, |
|
|
|
|
</Dropdown.Menu> |
|
|
|
|
</Dropdown> |
|
|
|
|
|
|
|
|
|
<Navbar.Brand className="ml-3">等待接受帮助</Navbar.Brand> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{(this.state.userType||this.props.userType)?<Navbar.Brand className="ml-3">{(this.state.userType||this.props.userType)===UserType.help.toString()?"等待接受帮助":"等待前往帮助"}</Navbar.Brand>:null} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<MyDialog titleId="my-dialog" menuName={this.state.my.menuName} content={this.state.my.content} open={this.state.my.open} onClose={()=>this.closeDialog()}/> |
|
|
|
|
</Nav> |
|
|
|
|