Merge remote-tracking branch 'origin/master'

0603
wt 5 years ago
commit ede159d77b
  1. 1
      public/money.svg
  2. 71
      src/Active.tsx
  3. 3
      src/App.tsx
  4. 38
      src/Main.tsx
  5. 22
      src/Manager.tsx
  6. 11
      src/User.tsx
  7. 1
      src/account/Register.tsx
  8. 4
      src/api.ts
  9. 6
      src/entity.ts
  10. 8
      src/index.css
  11. 1
      src/public.tsx
  12. 49
      src/result.ts
  13. 2
      src/ui/MyDialog.tsx

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1591090899503" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2747" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M292.790857 242.468571l58.148572 11.337143a18.285714 18.285714 0 1 1-7.021715 35.84l-93.988571-18.285714a18.285714 18.285714 0 0 1-9.472-30.902857A382.793143 382.793143 0 0 1 512 128c212.077714 0 384 171.922286 384 384a382.902857 382.902857 0 0 1-29.147429 147.017143 18.285714 18.285714 0 1 1-33.792-14.043429A346.331429 346.331429 0 0 0 859.428571 512 347.428571 347.428571 0 0 0 512 164.571429a345.965714 345.965714 0 0 0-219.209143 77.897142z m237.494857 203.958858v10.715428H585.142857a18.285714 18.285714 0 1 1 0 36.571429h-54.857143v36.571428H585.142857a18.285714 18.285714 0 1 1 0 36.571429h-54.857143V658.285714a18.285714 18.285714 0 1 1-36.571428 0v-91.428571H438.857143a18.285714 18.285714 0 1 1 0-36.571429h54.857143v-36.571428H438.857143a18.285714 18.285714 0 1 1 0-36.571429h54.857143v-10.715428l-67.803429-67.766858a18.285714 18.285714 0 0 1 25.892572-25.892571L512 413.001143l60.196571-60.233143a18.285714 18.285714 0 0 1 25.892572 25.892571L530.285714 446.427429z m142.774857 323.803428a18.285714 18.285714 0 1 1 7.021715-35.913143l93.988571 18.322286a18.285714 18.285714 0 0 1 9.472 30.902857A382.793143 382.793143 0 0 1 512 896C299.922286 896 128 724.077714 128 512c0-51.090286 9.984-100.790857 29.147429-147.017143a18.285714 18.285714 0 1 1 33.792 14.043429A346.331429 346.331429 0 0 0 164.571429 512a347.428571 347.428571 0 0 0 347.428571 347.428571 345.965714 345.965714 0 0 0 219.209143-77.897142l-58.148572-11.337143z" p-id="2748"></path></svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

@ -1,13 +1,22 @@
import React from "react"; import React from "react";
import {Button, Form, Image, ListGroup, Tab, Table, Tabs} from "react-bootstrap"; import {Button, Form, Image, ListGroup, Tab, Table, Tabs} from "react-bootstrap";
import {ManagerActivity} from "./entity"; import {ManagerActivity, PageProps} from "./entity";
import {JSONResponse, Method, request} from "./interface"; import {JSONResponse, Method, request} from "./interface";
import {API, prefix} from "./api"; import {API, prefix} from "./api";
import {EmptyBodyTransform, FindActivityRes, FindActivityTransform, PageDataMessage, SimpleMessage} from "./result"; import {
EmptyBodyTransform,
FindActivityRes,
FindActivityTransform,
FindTimeScoreRes,
PageDataMessage,
ScoreTransform,
SimpleMessage
} from "./result";
import {MyDialog} from "./ui/MyDialog"; import {MyDialog} from "./ui/MyDialog";
import moment from "moment"; import moment from "moment";
import {Input} from "./ui/InputGroup"; import {Input} from "./ui/InputGroup";
import {UploadImg} from "./ui/UploadImg"; import {UploadImg} from "./ui/UploadImg";
import {Page} from "./ui/Page";
const contentMaxLength=50 const contentMaxLength=50
/** /**
@ -68,7 +77,8 @@ class EditActive extends React.Component<
export class Active extends React.Component<any, { export class Active extends React.Component<any, {
activeList?:Array<ManagerActivity>; activeList?:Array<ManagerActivity>;
tipContent:JSX.Element|null tipContent:JSX.Element|null
dialog:JSX.Element|null dialog:JSX.Element|null,
page?:PageProps
}>{ }>{
@ -77,7 +87,7 @@ export class Active extends React.Component<any, {
this.state={ this.state={
tipContent:null, tipContent:null,
dialog:null dialog:null,
} }
} }
@ -90,9 +100,9 @@ export class Active extends React.Component<any, {
switch (res.customResult) { switch (res.customResult) {
case PageDataMessage.ok: case PageDataMessage.ok:
that.setState({ that.setState({
activeList:res.dataList activeList:res.dataList,
page:res.page
}) })
// that.loadActive(1)
break break
case PageDataMessage.fail: case PageDataMessage.fail:
that.setState({ that.setState({
@ -141,7 +151,7 @@ export class Active extends React.Component<any, {
{active.helpUser != null ? {active.helpUser != null ?
<ListGroup> <ListGroup>
{active.helpUser.map((userId,index) => {active.helpUser.map((userId,index) =>
<ListGroup.Item key={'item'+index}>{userId}</ListGroup.Item>)} <ListGroup.Item key={'item'+index}>{userId}<Image onClick={()=>this.loadScore(userId,active.activityId)} className="timeScore" src={"money.svg"}/></ListGroup.Item>)}
</ListGroup>:'无' </ListGroup>:'无'
} }
</td> </td>
@ -155,6 +165,10 @@ export class Active extends React.Component<any, {
</tbody> </tbody>
</Table> </Table>
{this.state.page?<Page onClick={(page:number)=>this.loadActive(page)} currentPage={this.state.page.currentPage}
totalPage={this.state.page.totalPage} pageSize={this.state.page.pageSize}/>
:<span className="text-danger text-center"></span>}
{this.state.dialog} {this.state.dialog}
<MyDialog content={this.state.tipContent} open={this.state.tipContent!=null} titleId={"user-dialog"} menuName={"操作提示"} <MyDialog content={this.state.tipContent} open={this.state.tipContent!=null} titleId={"user-dialog"} menuName={"操作提示"}
@ -194,4 +208,47 @@ export class Active extends React.Component<any, {
} }
}) })
} }
/*
*/
private loadScore(userId: string, activityId: number) {
let that=this
request(API.account.timeScore,Method.GET,{
userId:userId,
activityId:String(activityId)
},new ScoreTransform(),function (res:FindTimeScoreRes) {
switch (res.customResult) {
case SimpleMessage.ok:
if(res.timeScore==null){
that.setState({
tipContent:<h3 className="text-center text-danger"></h3>
})
}else {
that.setState({
tipContent: <Table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>{moment(res.timeScore?.createTime).format("YYYY-MM-DD HH:mm:ss")}</td>
<td>{res.timeScore?.timeScore}</td>
</tr>
</tbody>
</Table>
})
}
break
case SimpleMessage.fail:
that.setState({
tipContent:<h3 className="text-center text-danger"></h3>
})
break
}
})
}
} }

@ -2,13 +2,10 @@ import React from 'react';
import './App.css'; import './App.css';
import 'bootstrap/dist/css/bootstrap.min.css'; import 'bootstrap/dist/css/bootstrap.min.css';
import {Login} from './account/Login'; import {Login} from './account/Login';
import {instanceOf} from 'prop-types';
import {Cookies, withCookies} from 'react-cookie'; import {Cookies, withCookies} from 'react-cookie';
import {Main} from "./Main"; import {Main} from "./Main";
import {Register} from "./account/Register"; import {Register} from "./account/Register";
import {manager_cookie} from "./account/PropCookie"; import {manager_cookie} from "./account/PropCookie";
import {Method, request} from "./interface";
import {API} from "./api";
import {LoginRes} from "./result"; import {LoginRes} from "./result";

@ -1,11 +1,9 @@
import React from "react"; import React from "react";
import {Navbar,Nav,Button} from "react-bootstrap"; import {Nav, Navbar} from "react-bootstrap";
import {Manager} from "./Manager"; import {Manager} from "./Manager";
import {User} from "./User"; import {User} from "./User";
import {Active} from "./Active"; import {Active} from "./Active";
import {Cookies} from "react-cookie"; import {Cookies} from "react-cookie";
import {manager_cookie} from "./account/PropCookie";
import {fontEnd} from "./api";
/** /**
* *
@ -40,7 +38,17 @@ export class Main extends React.Component<
//获取菜单名颜色 //获取菜单名颜色
getMenuColor(menu:Menu){ getMenuColor(menu:Menu){
return this.state.menu===menu?"black":"blue" if(this.state.menu===menu){
return {
color:"white",
backgroundColor:"blue"
}
}else{
return {
color:"blue",
backgroundColor: "white"
}
}
} }
//切换菜单 //切换菜单
@ -65,22 +73,26 @@ export class Main extends React.Component<
} }
} }
render() { render() {
return ( return (
<div> <div>
<Navbar bg="light"> <Navbar bg="light">
<Nav className="mr-auto"> <Navbar.Brand>+</Navbar.Brand>
<Nav.Link style={{color:this.getMenuColor(Menu.manager)}} onClick={()=>this.changeMenu(Menu.manager)}></Nav.Link> <Nav variant="pills" defaultActiveKey="index" className="w-100">
<Nav.Link style={{color:this.getMenuColor(Menu.user)}} onClick={()=>this.changeMenu(Menu.user)}></Nav.Link> <Nav.Item className="col-2">
<Nav.Link style={{color:this.getMenuColor(Menu.active)}} onClick={()=>this.changeMenu(Menu.active)}></Nav.Link> <Nav.Link style={this.getMenuColor(Menu.manager)} onClick={()=>this.changeMenu(Menu.manager)}></Nav.Link>
</Nav.Item>
<Nav.Item className="col-2">
<Nav.Link style={this.getMenuColor(Menu.user)} onClick={()=>this.changeMenu(Menu.user)}></Nav.Link>
</Nav.Item>
<Nav.Item className="col-2">
<Nav.Link style={this.getMenuColor(Menu.active)} onClick={()=>this.changeMenu(Menu.active)}></Nav.Link>
</Nav.Item>
</Nav> </Nav>
<Navbar.Text>
{this.props.cookies.get(manager_cookie)}
</Navbar.Text>
<Button variant="outline-info" className="ml-3" onClick={()=>window.location.href=fontEnd}></Button>
<Button variant="outline-primary" className="ml-3" onClick={()=>this.props.logout()}></Button>
</Navbar> </Navbar>
{this.state.subMenu} {this.state.subMenu}
</div> </div>

@ -1,14 +1,15 @@
import React from "react"; import React from "react";
import {Button, Form, Tab, Table, Tabs} from "react-bootstrap"; import {Button, Form, Tab, Table, Tabs} from "react-bootstrap";
import {ManagerEntity} from "./entity"; import {ManagerEntity, PageProps} from "./entity";
import {Input} from "./ui/InputGroup"; import {Input} from "./ui/InputGroup";
import {Cookies} from "react-cookie"; import {Cookies} from "react-cookie";
import {MyDialog} from "./ui/MyDialog"; import {MyDialog} from "./ui/MyDialog";
import {JSONResponse, Method, request} from "./interface"; import {JSONResponse, Method, request} from "./interface";
import {API} from "./api"; import {API} from "./api";
import {EmptyBodyTransform, ManagerList, ManagerTransform, SimpleMessage} from "./result"; import {EmptyBodyTransform, ManagerList, ManagerTransform, PageDataMessage, SimpleMessage} from "./result";
import {manager_cookie} from "./account/PropCookie"; import {manager_cookie} from "./account/PropCookie";
import {register} from './public' import {register} from './public'
import {Page} from "./ui/Page";
enum Type { enum Type {
modify, modify,
@ -91,6 +92,7 @@ export class Manager extends React.Component<
dialog:JSX.Element|null; dialog:JSX.Element|null;
//操作反馈 //操作反馈
tipContent:JSX.Element|null; tipContent:JSX.Element|null;
page?:PageProps;
}>{ }>{
constructor(props: Readonly<any>) { constructor(props: Readonly<any>) {
@ -98,7 +100,7 @@ export class Manager extends React.Component<
this.state={ this.state={
tipContent: null, tipContent: null,
dialog:null, dialog:null
} }
} }
@ -138,12 +140,17 @@ export class Manager extends React.Component<
currentPage:page+"" currentPage:page+""
},new ManagerTransform(),function (res:ManagerList) { },new ManagerTransform(),function (res:ManagerList) {
switch (res.customResult) { switch (res.customResult) {
case SimpleMessage.ok: case PageDataMessage.ok:
that.setState({ that.setState({
managerList:res.dataList managerList:res.dataList,
page: res.page
})
break
case PageDataMessage.fail:
that.setState({
tipContent:<h3 className="text-center text-danger"></h3>
}) })
break break
case SimpleMessage.fail:
} }
}) })
@ -234,11 +241,12 @@ export class Manager extends React.Component<
</tbody> </tbody>
</Table> </Table>
{this.state.page?<Page onClick={(page:number)=>this.loadManager(page)} currentPage={this.state.page.currentPage}
totalPage={this.state.page.totalPage} pageSize={this.state.page.pageSize}/>:null}
{this.state.dialog} {this.state.dialog}
<MyDialog content={this.state.tipContent} open={this.state.tipContent!=null} <MyDialog content={this.state.tipContent} open={this.state.tipContent!=null}
titleId={"manager-tip"} menuName={"提示信息"} onClose={()=>this.setState({ titleId={"manager-tip"} menuName={"提示信息"} onClose={()=>this.setState({
tipContent:null tipContent:null

@ -1,6 +1,6 @@
import React from "react"; import React from "react";
import {Button, Form, Image, Tab, Table, Tabs} from "react-bootstrap"; import {Button, Form, Image, Tab, Table, Tabs} from "react-bootstrap";
import {UserEntity, UserType} from "./entity"; import {PageProps, UserEntity, UserType} from "./entity";
import {Input} from "./ui/InputGroup"; import {Input} from "./ui/InputGroup";
import {JSONResponse, Method, request} from "./interface"; import {JSONResponse, Method, request} from "./interface";
import {API, prefix} from "./api"; import {API, prefix} from "./api";
@ -8,6 +8,8 @@ import {EmptyBodyTransform, FindUserRes, FindUserTransform, PageDataMessage, Sim
import {MyDialog} from "./ui/MyDialog"; import {MyDialog} from "./ui/MyDialog";
import {Address} from "./ui/Address"; import {Address} from "./ui/Address";
import {UploadImg} from "./ui/UploadImg"; import {UploadImg} from "./ui/UploadImg";
import {Page} from "./ui/Page";
/** /**
* *
*/ */
@ -162,6 +164,7 @@ export class User extends React.Component<
user?:UserEntity; user?:UserEntity;
headImg?:string; headImg?:string;
dialog:JSX.Element|null; dialog:JSX.Element|null;
page?:PageProps;
}>{ }>{
@ -186,7 +189,8 @@ export class User extends React.Component<
switch (res.customResult) { switch (res.customResult) {
case PageDataMessage.ok: case PageDataMessage.ok:
that.setState({ that.setState({
userList:res.dataList userList:res.dataList,
page:res.page
}) })
break break
case PageDataMessage.fail: case PageDataMessage.fail:
@ -264,6 +268,9 @@ export class User extends React.Component<
</tbody> </tbody>
</Table> </Table>
{this.state.page?<Page onClick={(page:number)=>this.loadUser(page)} currentPage={this.state.page.currentPage}
totalPage={this.state.page.totalPage} pageSize={this.state.page.pageSize}/>
:<span className="text-danger text-center"></span>}
{this.state.dialog} {this.state.dialog}

@ -7,6 +7,7 @@ import {API} from "../api";
import {RegisterRes, RegisterTransform} from "../result"; import {RegisterRes, RegisterTransform} from "../result";
import {MyDialog} from "../ui/MyDialog"; import {MyDialog} from "../ui/MyDialog";
import {register} from '../public' import {register} from '../public'
/** /**
* *
*/ */

@ -29,7 +29,9 @@ export const API={
//查询活动信息 //查询活动信息
findActivity:prefix.manager+'/find/activity', findActivity:prefix.manager+'/find/activity',
//修改活动信息 //修改活动信息
updateActivity:prefix.manager+'/update/' updateActivity:prefix.manager+'/update/',
//加载时间币
timeScore:prefix.manager+'/score'
}, },
user:{ user:{

@ -2,7 +2,6 @@
import {PropCookie} from "./account/PropCookie"; import {PropCookie} from "./account/PropCookie";
export interface ManagerEntity { export interface ManagerEntity {
managerId:string; managerId:string;
} }
@ -200,3 +199,8 @@ export interface OnChangeAddress {
value?:string; value?:string;
} }
export interface TimeScore {
createTime:number;
timeScore:number;
}

@ -27,3 +27,11 @@ code {
height: 20px; height: 20px;
width: 20px; width: 20px;
} }
/**
时间币图标尺寸
*/
.timeScore{
width: 30px;
height: 30px;
}

@ -1,4 +1,3 @@
//注册 //注册
import {JSONResponse, Method, request} from "./interface"; import {JSONResponse, Method, request} from "./interface";
import {API} from "./api"; import {API} from "./api";

@ -1,6 +1,5 @@
import {JSONResponse, Result, TransformData} from "./interface"; import {JSONResponse, TransformData} from "./interface";
import {ManagerActivity, ManagerEntity, PageProps, UserEntity} from "./entity"; import {ManagerActivity, ManagerEntity, PageProps, TimeScore, UserEntity} from "./entity";
import {User} from "./User";
/** /**
* body响应 * body响应
@ -65,22 +64,6 @@ export class RegisterTransform extends EmptyBodyDiffMsg<RegisterRes>{
} }
export class ManagerList extends JSONResponse<SimpleMessage>{
dataList?:Array<ManagerEntity>
}
export class ManagerTransform extends TransformData<SimpleMessage, ManagerList>{
protected newObject(): ManagerList {
return new ManagerList();
}
protected transformBody(data: any) {
if (data.body) {
this.target.dataList = data.body.body
}
}
}
/** /**
* *
*/ */
@ -110,6 +93,19 @@ export abstract class PageDataTransform<T extends PageDataRes> extends Transform
} }
} }
export class ManagerList extends PageDataRes{
dataList?:Array<ManagerEntity>
}
export class ManagerTransform extends PageDataTransform<ManagerList>{
protected newObject(): ManagerList {
return new ManagerList();
}
}
/** /**
* *
*/ */
@ -136,3 +132,18 @@ export class FindActivityTransform extends PageDataTransform<FindActivityRes>{
} }
} }
export class FindTimeScoreRes extends JSONResponse<SimpleMessage>{
timeScore?:TimeScore;
}
export class ScoreTransform extends TransformData<SimpleMessage, FindTimeScoreRes>{
protected newObject(): FindTimeScoreRes {
return new FindTimeScoreRes();
}
protected transformBody(data: any) {
this.target.timeScore=data.body
}
}

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import Dialog from "@material-ui/core/Dialog"; import Dialog from "@material-ui/core/Dialog";
import Draggable from "react-draggable"; import Draggable from "react-draggable";
import {Paper, styled, withWidth} from "@material-ui/core"; import {Paper, styled} from "@material-ui/core";
import {MyDialogProps} from "../entity"; import {MyDialogProps} from "../entity";
import {CloseDialog} from "./CloseDialog"; import {CloseDialog} from "./CloseDialog";

Loading…
Cancel
Save