From d85cd51428056e293785dbeddd44c3b57ed8bfcc Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Wed, 3 Jun 2020 03:22:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=A0=B7=E5=BC=8F=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/Main.tsx | 9 ++- src/User.tsx | 161 +++++++++++++++++++++++++----------------- src/entity.ts | 9 ++- src/ui/Address.tsx | 2 +- src/ui/InputGroup.tsx | 2 +- src/ui/MyDialog.tsx | 16 +++-- src/ui/UploadImg.tsx | 14 ++-- 7 files changed, 132 insertions(+), 81 deletions(-) diff --git a/src/Main.tsx b/src/Main.tsx index a694567..3bc84d1 100644 --- a/src/Main.tsx +++ b/src/Main.tsx @@ -1,9 +1,11 @@ import React from "react"; -import {Nav, Navbar} from "react-bootstrap"; +import {Button, Nav, Navbar} from "react-bootstrap"; import {Manager} from "./Manager"; import {User} from "./User"; import {Active} from "./Active"; import {Cookies} from "react-cookie"; +import {manager_cookie} from "./account/PropCookie"; +import {fontEnd} from "./api"; /** * 菜单标记 @@ -92,6 +94,11 @@ export class Main extends React.Component< this.changeMenu(Menu.active)}>活动管理 + + 欢迎管理员{this.props.cookies.get(manager_cookie)}登录 + + + {this.state.subMenu} diff --git a/src/User.tsx b/src/User.tsx index 7c61ce8..5e4ac98 100644 --- a/src/User.tsx +++ b/src/User.tsx @@ -1,5 +1,5 @@ import React from "react"; -import {Button, Form, Image, Tab, Table, Tabs} from "react-bootstrap"; +import {Button, Col, Form, Image, Row, Tab, Table, Tabs} from "react-bootstrap"; import {PageProps, UserEntity, UserType} from "./entity"; import {Input} from "./ui/InputGroup"; import {JSONResponse, Method, request} from "./interface"; @@ -39,71 +39,102 @@ class EditUser extends React.Component<{ render() { return (
-
- - this.setState({ user:{...this.state.user,...{activityImgFile:value}}})} /> -
- - this.setState({ - user:{...this.state.user,...{name:value}} - })} valid={{check:this.isNotEmpty(this.state.user.name)}}/> - - - this.setState({ - user:{...this.state.user,...{age:+value}} - }) - } as={"select"} options={this.ages.map(value=>)}/> - - { - this.setState({ - user:{...this.state.user,...{sex:value}} - }) - }} - options={[ - , - , - ]}/> - - this.setState({ - user:{...this.state.user,...{address:value}} - })} valid={{check:this.isNotEmpty(this.state.user.address)}}/> - -
-
+ + + + this.setState({ user:{...this.state.user,...{activityImgFile:value}}})} /> + + + + + + this.setState({ + user:{...this.state.user,...{name:value}} + })} valid={{check:this.isNotEmpty(this.state.user.name)}}/> + + + + this.setState({ - user:{...this.state.user,...{serviceAddress:value}} + user:{...this.state.user,...{age:+value}} }) - }/> -
- - - this.setState({ - user:{...this.state.user,...{userType:value}} - }) - } - options={[, - , - ]}/> - - - this.setState({ - user:{...this.state.user,...{mobile:value}} - }) - } valid={{check:this.checkMobile()}}/> - - - this.setState({ - user:{...this.state.user,...{email:value}} - }) - } valid={{check:this.checkEmail()}}/> - - - this.setState({ - user:{...this.state.user,...{info:value}} - }) - } - valid={{check:this.isNotEmpty(this.state.user.info)}}/> - + } as={"select"} valid={{check:true}} options={this.ages.map(value=>)}/> + + + + + + { + this.setState({ + user:{...this.state.user,...{sex:value}} + }) + }} + options={[ + , + , + ]}/> + + + + this.setState({ + user:{...this.state.user,...{address:value}} + })} valid={{check:this.isNotEmpty(this.state.user.address)}}/> + + + + + + +
+ this.setState({ + user:{...this.state.user,...{serviceAddress:value}} + }) + }/> + + + + + this.setState({ + user:{...this.state.user,...{userType:value}} + }) + } + options={[, + , + ]}/> + + + + + + + + + this.setState({ + user:{...this.state.user,...{mobile:value}} + }) + } valid={{check:this.checkMobile()}}/> + + + + + this.setState({ + user:{...this.state.user,...{email:value}} + }) + } valid={{check:this.checkEmail()}}/> + + + + + + + + this.setState({ + user:{...this.state.user,...{info:value}} + }) + } + valid={{check:this.isNotEmpty(this.state.user.info)}}/> + + @@ -259,7 +290,7 @@ export class User extends React.Component< {user.info} diff --git a/src/entity.ts b/src/entity.ts index 1d50daa..eeb0a65 100644 --- a/src/entity.ts +++ b/src/entity.ts @@ -75,12 +75,14 @@ export interface FormInputProps { valid?: String; invalid?: String; } - //bootstrap col - col?: number //长度 maxLength?: number //选项 options?:Array; + //bootstrap col + col?: number + //整体样式,若存在会覆盖col局部样式 + className?:string; } /** @@ -147,6 +149,8 @@ export interface MyDialogProps extends CloseDialogProps{ content:JSX.Element|null; //弹窗状态 open:boolean; + //窗口宽度 + maxWidth?:number; } /** @@ -197,6 +201,7 @@ export interface OnChangeAddress { onChange:Function; col?:number; value?:string; + className?:string; } export interface TimeScore { diff --git a/src/ui/Address.tsx b/src/ui/Address.tsx index d7c8bd9..2b9d645 100644 --- a/src/ui/Address.tsx +++ b/src/ui/Address.tsx @@ -40,7 +40,7 @@ export class Address extends React.Component + 服务地点 diff --git a/src/ui/InputGroup.tsx b/src/ui/InputGroup.tsx index 32bcdfb..daa702b 100644 --- a/src/ui/InputGroup.tsx +++ b/src/ui/InputGroup.tsx @@ -27,7 +27,7 @@ export class Input extends React.Component + {this.props.desc} diff --git a/src/ui/MyDialog.tsx b/src/ui/MyDialog.tsx index e97749d..a3b295a 100644 --- a/src/ui/MyDialog.tsx +++ b/src/ui/MyDialog.tsx @@ -6,14 +6,20 @@ import {MyDialogProps} from "../entity"; import {CloseDialog} from "./CloseDialog"; -const EditDialogPaper=styled(Paper)({ - maxWidth:1000 -}) /** * 我的弹窗 */ -export class MyDialog extends React.Component{ +export class MyDialog extends React.Component{ + private EditDialogPaper:any; + + constructor(props: Readonly) { + super(props); + + this.EditDialogPaper=styled(Paper)({ + maxWidth:this.props.maxWidth?this.props.maxWidth:600 + }) + } render() { return ( @@ -22,7 +28,7 @@ export class MyDialog extends React.Component - + {} } aria-labelledby={this.props.titleId} classes={{paper:"w-100"}} diff --git a/src/ui/UploadImg.tsx b/src/ui/UploadImg.tsx index b37e879..cf2dba2 100644 --- a/src/ui/UploadImg.tsx +++ b/src/ui/UploadImg.tsx @@ -1,5 +1,5 @@ import React from "react"; -import {Form, Image} from "react-bootstrap"; +import {Form, Image, Row} from "react-bootstrap"; import path from "path"; /** @@ -16,6 +16,8 @@ export class UploadImg extends React.Component< }; //上传事件 onChange:Function; + //默认样式 + imgClass?:string; }, { //imgObj imgObj?:any; @@ -24,7 +26,7 @@ export class UploadImg extends React.Component< }>{ - constructor(props: Readonly<{ tip: string; maxImageSize: { width: number; height: number }; onChange: Function }>) { + constructor(props: Readonly<{ tip: string; maxImageSize: { width: number; height: number }; onChange: Function; imgClass: string }>) { super(props); this.state={} @@ -32,11 +34,11 @@ export class UploadImg extends React.Component< render() { return ( -
+ {/* 预览背景图 */} - { + { if (s.target instanceof HTMLImageElement) { //限制图片显示大小 s.target.width = s.target.width > this.props.maxImageSize.width ? this.props.maxImageSize.width : s.target.width @@ -47,7 +49,7 @@ export class UploadImg extends React.Component< }/> {/*上传背景图*/} -
+
-
+
) } }