添加个人信息-我的求助页面

master
pan 4 years ago
parent db95a92aa1
commit bff7c0dec8
  1. 2
      src/App.test.tsx
  2. 2
      src/App.tsx
  3. 3
      src/Main.tsx
  4. 12
      src/account/Login.tsx
  5. 13
      src/account/Register.tsx
  6. 2
      src/bootstrap/InputGroup.tsx
  7. 52
      src/entity.ts
  8. 4
      src/index.css
  9. 23
      src/my/CloseDialog.tsx
  10. 34
      src/my/MyDialog.tsx
  11. 4
      src/my/MyHelp.tsx
  12. 150
      src/my/SeekHelp.tsx
  13. 3
      src/sub/IndexMenu.tsx
  14. 3
      src/sub/Volunteer.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { render } from '@testing-library/react';
import {render} from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {

@ -2,7 +2,7 @@ import React from 'react';
import './App.css';
import 'bootstrap/dist/css/bootstrap.min.css';
import {Login} from './account/Login';
import { withCookies } from 'react-cookie';
import {withCookies} from 'react-cookie';
import {Main} from "./Main";
import {Register} from "./account/Register";
import {user_cookie} from "./account/PropCookie";

@ -1,5 +1,5 @@
import React from "react";
import {Navbar,Nav,Dropdown} from "react-bootstrap";
import {Dropdown, Nav, Navbar} from "react-bootstrap";
import {IndexMenu} from "./sub/IndexMenu";
import {Volunteer} from "./sub/Volunteer";
import {MyHelp} from "./sub/MyHelp";
@ -7,6 +7,7 @@ import {MyFriend} from "./my/MyFriend";
import {MyDialog} from "./my/MyDialog";
import {MyLeaveWord} from "./my/MyLeaveWord";
import {MyMessage} from "./my/MyMessage";
/**
*
*/

@ -1,5 +1,5 @@
import React from "react";
import {Button} from 'react-bootstrap'
import {Button, Form} from 'react-bootstrap'
import {LoginProps, LoginState} from "./LoginProps";
import {Input} from "../bootstrap/InputGroup";
@ -22,13 +22,15 @@ export class Login extends React.Component<LoginProps, LoginState>{
return (
<div className="d-flex align-items-center" style={{height:window.screen.availHeight+'px'}}>
<div className="container">
<Input name="user" type="text" desc="用户账号" value={this.state.user} onChange={(value: string)=>{this.setState({user:value})}}/>
<Form>
<Input name="user" type="text" desc="用户账号" value={this.state.user} onChange={(value: string)=>{this.setState({user:value})}}/>
<Input name="password" type="password" desc="用户密码" value={this.state.password} onChange={(value: string)=>{this.setState({password:value})}}/>
<Input name="password" type="password" desc="用户密码" value={this.state.password} onChange={(value: string)=>{this.setState({password:value})}}/>
<Button variant="success" className="mt-3 col-2 mr-3" onClick={()=>this.props.login(this.state.user,this.state.password)}></Button>
<Button variant="success" className="mt-3 col-2 mr-3" onClick={()=>this.props.login(this.state.user,this.state.password)}></Button>
<Button variant="info" className="mt-3 col-2" onClick={()=>this.props.toRegister()}></Button>
<Button variant="info" className="mt-3 col-2" onClick={()=>this.props.toRegister()}></Button>
</Form>
</div>
</div>
);

@ -1,7 +1,8 @@
import React from "react";
import {RegisterProps, RegisterState} from "./RegisterProps";
import {Input} from "../bootstrap/InputGroup";
import {Button} from 'react-bootstrap'
import {Button, Form} from 'react-bootstrap'
/**
*
*/
@ -24,13 +25,15 @@ export class Register extends React.Component<RegisterProps, RegisterState>{
return (
<div className="d-flex align-items-center" style={{height:window.screen.availHeight+'px'}}>
<div className="container">
<Input name="user" type="text" desc="用户账号" value={this.state.user} onChange={(value: string)=>{this.setState({user:value})}}/>
<Form>
<Input name="user" type="text" desc="用户账号" value={this.state.user} onChange={(value: string)=>{this.setState({user:value})}}/>
<Input name="password" type="password" desc="用户密码" value={this.state.password} onChange={(value: string)=>{this.setState({password:value})}}/>
<Input name="password" type="password" desc="用户密码" value={this.state.password} onChange={(value: string)=>{this.setState({password:value})}}/>
<Button variant="success" className="mt-3 col-2 mr-3" onClick={()=>this.register()}></Button>
<Button variant="success" className="mt-3 col-2 mr-3" onClick={()=>this.register()}></Button>
<Button variant="info" className="mt-3 col-2" onClick={()=>this.props.toLogin()}></Button>
<Button variant="info" className="mt-3 col-2" onClick={()=>this.props.toLogin()}></Button>
</Form>
</div>
</div>
);

@ -1,5 +1,5 @@
import React from "react";
import {InputGroup,FormControl} from 'react-bootstrap'
import {FormControl, InputGroup} from 'react-bootstrap'
import {FormInputProps} from "./LoginFormDesc";

@ -52,20 +52,37 @@ export enum RecommendType {
auto="系统推荐"
}
/**
*
*/
export interface MyHelpState {
export interface BaseHelp {
//活动标题
title:string;
//活动内容
content:string;
//活动背景图
activeImg:string;
}
//我的求助信息
export interface InfoHelpState extends BaseHelp{
//求助时间
time:number;
//活动报名志愿者
applyVolunteerList:Array<User>;
//活动参加志愿者
joinVolunteerList:Array<User>;
//活动完成志愿者
completeVolunteerList:Array<User>;
}
/**
*
*/
export interface MyHelpState extends BaseHelp{
//开始时间
startTime:string;
//结束时间
endTime:string;
//活动背景图
activeImg:any;
//服务地点
address:string;
//推荐方式
@ -80,6 +97,8 @@ export interface MyHelpState {
};
}
/**
*
*/
@ -94,18 +113,27 @@ export interface PageProps {
onClick:Function;
}
export interface BaseDialogProps {
//弹窗名
menuName:string;
//关闭事件
onClose:Function;
}
export interface CloseDialogProps extends BaseDialogProps{
//
titleId:string;
}
/**
*
*/
export interface MyDialogProps {
//弹窗名
menuName:string;
export interface MyDialogProps extends BaseDialogProps{
//弹窗内容
content:React.Component;
//弹窗状态
open:boolean;
//关闭事件
onClose:Function;
}
@ -142,7 +170,7 @@ export interface User{
}
/**
*
*
*/
export interface UserEdit extends User{
//编辑模式

@ -57,3 +57,7 @@
.my-info-desc{
height: 100px;
}
.seek-help-height{
height: 400px;
}

@ -0,0 +1,23 @@
import React from "react";
import {Tooltip} from "@material-ui/core";
import {CloseDialogProps} from "../entity";
/**
*
*/
export class CloseDialog extends React.Component<CloseDialogProps, any>{
render() {
return (
<div className="d-flex justify-content-between p-3" >
<span className="invisible"/>
<Tooltip title="按下光标拖放弹窗到其他位置" placement="left">
<h3 id={this.props.titleId} style={{cursor:"move"}}>{this.props.menuName}</h3>
</Tooltip>
<Tooltip title="关闭弹窗" placement="left">
<img src="close.svg" alt="关闭弹窗" className="closeIcon40" onClick={()=>this.props.onClose()}/>
</Tooltip>
</div>
)
}
}

@ -1,8 +1,9 @@
import React from "react";
import Dialog from "@material-ui/core/Dialog";
import Draggable from "react-draggable";
import {Paper, Tooltip} from "@material-ui/core";
import {Paper} from "@material-ui/core";
import {MyDialogProps} from "../entity";
import {CloseDialog} from "./CloseDialog";
/**
*
@ -10,42 +11,31 @@ import {MyDialogProps} from "../entity";
export class MyDialog extends React.Component<MyDialogProps, any>{
constructor(props: Readonly<MyDialogProps>) {
super(props);
this.state={
titleId:"my-dialog"
}
}
render() {
return (
<Dialog
hideBackdrop={true}
open={this.props.open}
// onClose={handleClose}
PaperComponent={(props)=>
<Draggable handle="#draggable-dialog-title" cancel={'[class*="MuiDialogContent-root"]'}>
<Draggable handle={"#"+this.state.titleId} cancel={'[class*="MuiDialogContent-root"]'}>
<Paper {...props} />
</Draggable>}
aria-labelledby="draggable-dialog-title"
aria-labelledby={this.state.titleId}
classes={{paper:"w-100"}}
>
<div className="d-flex justify-content-between p-3" >
<span className="invisible"/>
<Tooltip title="按下光标拖放弹窗到其他位置" placement="left">
<h3 id="draggable-dialog-title" style={{cursor:"move"}}>{this.props.menuName}</h3>
</Tooltip>
<Tooltip title="关闭弹窗" placement="left">
<img src="close.svg" alt="关闭弹窗" className="closeIcon40" onClick={()=>this.props.onClose()}/>
</Tooltip>
</div>
<CloseDialog menuName={this.props.menuName} onClose={()=>this.props.onClose()} titleId={this.state.titleId}/>
<div className="p-3">
{this.props.content}
</div>
{/*<DialogActions>*/}
{/* <Button autoFocus color="primary">*/}
{/* Cancel*/}
{/* </Button>*/}
{/* <Button color="primary">*/}
{/* Subscribe*/}
{/* </Button>*/}
{/*</DialogActions>*/}
</Dialog>
);
}

@ -10,9 +10,7 @@ export class MyHelp extends React.Component<any, any>{
return (
<Container>
<Row>
<Col>
</Col>
<Col></Col>
</Row>
</Container>
)

@ -1,18 +1,154 @@
import React from "react";
import {Col, Container, Row} from "react-bootstrap";
import {Button, ButtonGroup, Col, Container, Image, ListGroup, Row} from "react-bootstrap";
import {InfoHelpState, User} from "../entity";
import moment from "moment";
import Dialog from "@material-ui/core/Dialog";
import {CloseDialog} from "./CloseDialog";
import {Paper, Tooltip} from "@material-ui/core";
import Draggable from "react-draggable";
/**
*
*/
enum VolunteerStatus {
apply="报名",
join="参加",
complete="完成"
}
const titleId="seek-help-dialog"
/**
*
*/
export class SeekHelp extends React.Component<any, any>{
export class SeekHelp extends React.Component<any,{
data:Array<InfoHelpState>,
open:boolean,
status?:VolunteerStatus,
volunteerList?:Array<User>}>{
constructor(props: Readonly<any>) {
super(props);
this.state={
data:[],
open:false
}
}
componentDidMount() {
this.loadHelp()
}
/**
*
*/
loadHelp(){
this.setState({data:[
{
applyVolunteerList: [{
headImg:"logo512.png",
userId:"admin",
name:"张三",
age:Math.ceil(Math.random()*100)+1,
mobile:1234567879,
email:"admin@qq.com",
address:"上海高新区",
info:"个人简介",
},
{
headImg:"logo512.png",
userId:"admin",
name:"李四",
age:Math.ceil(Math.random()*100)+1,
mobile:1234567879,
email:"admin@qq.com",
address:"上海高新区",
info:"个人简介",
}],
completeVolunteerList: [],
joinVolunteerList: [],
activeImg: "logo512.png",
content: "活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容",
time: new Date().getTime(),
title:"活动标题"
},
{
applyVolunteerList: [],
completeVolunteerList: [],
joinVolunteerList: [],
activeImg: "logo512.png",
content: "活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容",
time: new Date().getTime(),
title:"活动标题"
},
{
applyVolunteerList: [],
completeVolunteerList: [],
joinVolunteerList: [],
activeImg: "logo512.png",
content: "活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容活动内容",
time: new Date().getTime(),
title:"活动标题"
}
]})
console.debug(this.state)
}
render() {
return (
<Container>
<Row>
<Col></Col>
</Row>
</Container>
<div className="overflow-auto seek-help-height">
{this.state.data.map((help:InfoHelpState,index:number)=>
<div key={"list"+index} className="mt-3 mb-3 border-info border">
<Container>
<Row>
<Col xs={4}>
<Image src={help.activeImg} className="activeImage"/>
</Col>
<Col>
<h5>{help.title}</h5>
<h6>{help.content}</h6>
</Col>
</Row>
<Row>
<Col xs={4} className="mt-auto mb-auto">
<span>{moment(help.time).format("YYYY-MM-DD HH:mm:ss")}</span>
</Col>
<Col>
<ButtonGroup>
<Button variant={"primary"} disabled={help.applyVolunteerList.length===0} onClick={()=>this.setState({open:true,status:VolunteerStatus.apply,volunteerList:help.applyVolunteerList})}>:{help.applyVolunteerList.length}</Button>
<Button variant={"success"} disabled={help.joinVolunteerList.length===0} onClick={()=>this.setState({open:true,status:VolunteerStatus.join,volunteerList:help.joinVolunteerList})}>:{help.joinVolunteerList.length}</Button>
<Button variant={"light"} disabled={help.completeVolunteerList.length===0} onClick={()=>this.setState({open:true,status:VolunteerStatus.complete,volunteerList:help.completeVolunteerList})}>:{help.completeVolunteerList.length}</Button>
</ButtonGroup>
</Col>
</Row>
</Container>
</div>
)}
<Dialog hideBackdrop={true} open={this.state.open}
PaperComponent={(props)=>
<Draggable handle={"#"+titleId} cancel={'[class*="MuiDialogContent-root"]'}>
<Paper {...props} />
</Draggable>}
aria-labelledby={titleId}>
<CloseDialog menuName={this.state.status+"活动志愿者"} onClose={()=>this.setState({open:false})} titleId={titleId}/>
<ListGroup>
{(this.state.volunteerList||[]).map((user:User,index:number)=>
<ListGroup.Item key={"list"+index} className="d-flex justify-content-between" variant="info">
<span>{user.name}</span>
<Tooltip title="查看用户信息" placement="right">
<img src="user.svg" alt="查看用户信息" className="userIcon"/>
</Tooltip>
</ListGroup.Item>
)}
</ListGroup>
</Dialog>
</div>
)
}
}

@ -1,7 +1,8 @@
import React from "react";
import {Container,Row,Col,Card,ListGroup,Button} from "react-bootstrap";
import {Button, Card, Col, Container, ListGroup, Row} from "react-bootstrap";
import {ActiveProps} from "../entity";
import {Page} from "../Page";
/**
*
*/

@ -1,9 +1,10 @@
import React from "react";
import {Button, Container, Row, Col, Card, Table} from "react-bootstrap";
import {Button, Card, Col, Container, Row, Table} from "react-bootstrap";
import {Input} from "../bootstrap/InputGroup";
import {VolunteerProps} from "../entity";
import {Page} from "../Page";
import {Address} from "../Address";
/**
*
*/

Loading…
Cancel
Save