diff --git a/public/money.svg b/public/money.svg new file mode 100644 index 0000000..729d9fc --- /dev/null +++ b/public/money.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/Active.tsx b/src/Active.tsx index a26a652..c9a4d1a 100644 --- a/src/Active.tsx +++ b/src/Active.tsx @@ -1,13 +1,22 @@ import React from "react"; 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 {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 moment from "moment"; import {Input} from "./ui/InputGroup"; import {UploadImg} from "./ui/UploadImg"; +import {Page} from "./ui/Page"; const contentMaxLength=50 /** @@ -68,7 +77,8 @@ class EditActive extends React.Component< export class Active extends React.Component; tipContent:JSX.Element|null - dialog:JSX.Element|null + dialog:JSX.Element|null, + page?:PageProps }>{ @@ -77,7 +87,7 @@ export class Active extends React.Component {active.helpUser.map((userId,index) => - {userId})} + {userId}this.loadScore(userId,active.activityId)} className="timeScore" src={"money.svg"}/>)} :'无' } @@ -155,6 +165,10 @@ export class Active extends React.Component + {this.state.page?this.loadActive(page)} currentPage={this.state.page.currentPage} + totalPage={this.state.page.totalPage} pageSize={this.state.page.pageSize}/> + :丢失分页数据} + {this.state.dialog} 该用户没有结算时间币记录 + }) + }else { + that.setState({ + tipContent: + + + + + + + + + + + + +
结算时间时间币
{moment(res.timeScore?.createTime).format("YYYY-MM-DD HH:mm:ss")}{res.timeScore?.timeScore}
+ }) + } + break + case SimpleMessage.fail: + that.setState({ + tipContent:

时间币查询失败,请联系管理员

+ }) + break + } + }) + } } diff --git a/src/App.test.tsx b/src/App.test.tsx index 4db7ebc..56f0583 100644 --- a/src/App.test.tsx +++ b/src/App.test.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', () => { diff --git a/src/App.tsx b/src/App.tsx index 7e9ae08..85ed38f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -2,13 +2,10 @@ import React from 'react'; import './App.css'; import 'bootstrap/dist/css/bootstrap.min.css'; import {Login} from './account/Login'; -import {instanceOf} from 'prop-types'; import {Cookies, withCookies} from 'react-cookie'; import {Main} from "./Main"; import {Register} from "./account/Register"; import {manager_cookie} from "./account/PropCookie"; -import {Method, request} from "./interface"; -import {API} from "./api"; import {LoginRes} from "./result"; diff --git a/src/Main.tsx b/src/Main.tsx index 50f2ee9..a694567 100644 --- a/src/Main.tsx +++ b/src/Main.tsx @@ -1,11 +1,9 @@ import React from "react"; -import {Navbar,Nav,Button} from "react-bootstrap"; +import {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"; /** * 菜单标记 @@ -40,7 +38,17 @@ export class Main extends React.Component< //获取菜单名颜色 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() { return (
-
diff --git a/src/Manager.tsx b/src/Manager.tsx index 1245d5b..03027c5 100644 --- a/src/Manager.tsx +++ b/src/Manager.tsx @@ -1,14 +1,15 @@ import React from "react"; import {Button, Form, Tab, Table, Tabs} from "react-bootstrap"; -import {ManagerEntity} from "./entity"; +import {ManagerEntity, PageProps} from "./entity"; import {Input} from "./ui/InputGroup"; import {Cookies} from "react-cookie"; import {MyDialog} from "./ui/MyDialog"; import {JSONResponse, Method, request} from "./interface"; 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 {register} from './public' +import {Page} from "./ui/Page"; enum Type { modify, @@ -91,6 +92,7 @@ export class Manager extends React.Component< dialog:JSX.Element|null; //操作反馈 tipContent:JSX.Element|null; + page?:PageProps; }>{ constructor(props: Readonly) { @@ -98,7 +100,7 @@ export class Manager extends React.Component< this.state={ tipContent: null, - dialog:null, + dialog:null } } @@ -138,12 +140,17 @@ export class Manager extends React.Component< currentPage:page+"" },new ManagerTransform(),function (res:ManagerList) { switch (res.customResult) { - case SimpleMessage.ok: + case PageDataMessage.ok: that.setState({ - managerList:res.dataList + managerList:res.dataList, + page: res.page + }) + break + case PageDataMessage.fail: + that.setState({ + tipContent:

加载数据失败,请联系管理员

}) break - case SimpleMessage.fail: } }) @@ -234,11 +241,12 @@ export class Manager extends React.Component< + {this.state.page?this.loadManager(page)} currentPage={this.state.page.currentPage} + totalPage={this.state.page.totalPage} pageSize={this.state.page.pageSize}/>:null} {this.state.dialog} - this.setState({ tipContent:null diff --git a/src/User.tsx b/src/User.tsx index 6625657..7c61ce8 100644 --- a/src/User.tsx +++ b/src/User.tsx @@ -1,6 +1,6 @@ import React from "react"; 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 {JSONResponse, Method, request} from "./interface"; import {API, prefix} from "./api"; @@ -8,6 +8,8 @@ import {EmptyBodyTransform, FindUserRes, FindUserTransform, PageDataMessage, Sim import {MyDialog} from "./ui/MyDialog"; import {Address} from "./ui/Address"; import {UploadImg} from "./ui/UploadImg"; +import {Page} from "./ui/Page"; + /** * 图片尺寸限制 */ @@ -162,6 +164,7 @@ export class User extends React.Component< user?:UserEntity; headImg?:string; dialog:JSX.Element|null; + page?:PageProps; }>{ @@ -186,7 +189,8 @@ export class User extends React.Component< switch (res.customResult) { case PageDataMessage.ok: that.setState({ - userList:res.dataList + userList:res.dataList, + page:res.page }) break case PageDataMessage.fail: @@ -264,6 +268,9 @@ export class User extends React.Component< + {this.state.page?this.loadUser(page)} currentPage={this.state.page.currentPage} + totalPage={this.state.page.totalPage} pageSize={this.state.page.pageSize}/> + :丢失分页数据} {this.state.dialog} diff --git a/src/account/PropCookie.ts b/src/account/PropCookie.ts index 7323f25..0b980f4 100644 --- a/src/account/PropCookie.ts +++ b/src/account/PropCookie.ts @@ -1,4 +1,4 @@ -import {Cookies } from 'react-cookie'; +import {Cookies} from 'react-cookie'; /** * cookie信息,组件间传递 diff --git a/src/account/Register.tsx b/src/account/Register.tsx index cc3e721..16233b4 100644 --- a/src/account/Register.tsx +++ b/src/account/Register.tsx @@ -7,6 +7,7 @@ import {API} from "../api"; import {RegisterRes, RegisterTransform} from "../result"; import {MyDialog} from "../ui/MyDialog"; import {register} from '../public' + /** * 注册 */ diff --git a/src/api.ts b/src/api.ts index 0716d33..10fe2bc 100644 --- a/src/api.ts +++ b/src/api.ts @@ -29,7 +29,9 @@ export const API={ //查询活动信息 findActivity:prefix.manager+'/find/activity', //修改活动信息 - updateActivity:prefix.manager+'/update/' + updateActivity:prefix.manager+'/update/', + //加载时间币 + timeScore:prefix.manager+'/score' }, user:{ diff --git a/src/entity.ts b/src/entity.ts index 6bae0be..1d50daa 100644 --- a/src/entity.ts +++ b/src/entity.ts @@ -2,7 +2,6 @@ import {PropCookie} from "./account/PropCookie"; - export interface ManagerEntity { managerId:string; } @@ -200,3 +199,8 @@ export interface OnChangeAddress { value?:string; } +export interface TimeScore { + createTime:number; + timeScore:number; +} + diff --git a/src/index.css b/src/index.css index 3c3b1b6..1cabd84 100644 --- a/src/index.css +++ b/src/index.css @@ -27,3 +27,11 @@ code { height: 20px; width: 20px; } + +/** +时间币图标尺寸 + */ +.timeScore{ + width: 30px; + height: 30px; +} diff --git a/src/index.tsx b/src/index.tsx index a4e0dd0..50aa992 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -3,7 +3,7 @@ import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import * as serviceWorker from './serviceWorker'; -import { CookiesProvider } from 'react-cookie'; +import {CookiesProvider} from 'react-cookie'; ReactDOM.render( diff --git a/src/public.tsx b/src/public.tsx index 247d3c5..8224b43 100644 --- a/src/public.tsx +++ b/src/public.tsx @@ -1,4 +1,3 @@ - //注册 import {JSONResponse, Method, request} from "./interface"; import {API} from "./api"; diff --git a/src/result.ts b/src/result.ts index 6ba9519..5d30a64 100644 --- a/src/result.ts +++ b/src/result.ts @@ -1,6 +1,5 @@ -import {JSONResponse, Result, TransformData} from "./interface"; -import {ManagerActivity, ManagerEntity, PageProps, UserEntity} from "./entity"; -import {User} from "./User"; +import {JSONResponse, TransformData} from "./interface"; +import {ManagerActivity, ManagerEntity, PageProps, TimeScore, UserEntity} from "./entity"; /** * 空body响应 @@ -65,22 +64,6 @@ export class RegisterTransform extends EmptyBodyDiffMsg{ } -export class ManagerList extends JSONResponse{ - dataList?:Array -} - -export class ManagerTransform extends TransformData{ - 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 extends Transform } } + + + +export class ManagerList extends PageDataRes{ + dataList?:Array +} + +export class ManagerTransform extends PageDataTransform{ + protected newObject(): ManagerList { + return new ManagerList(); + } +} + /** * 用户信息实体 */ @@ -136,3 +132,18 @@ export class FindActivityTransform extends PageDataTransform{ } } + +export class FindTimeScoreRes extends JSONResponse{ + timeScore?:TimeScore; +} + +export class ScoreTransform extends TransformData{ + protected newObject(): FindTimeScoreRes { + return new FindTimeScoreRes(); + } + + + protected transformBody(data: any) { + this.target.timeScore=data.body + } +} diff --git a/src/ui/MyDialog.tsx b/src/ui/MyDialog.tsx index 5793437..e97749d 100644 --- a/src/ui/MyDialog.tsx +++ b/src/ui/MyDialog.tsx @@ -1,7 +1,7 @@ import React from "react"; import Dialog from "@material-ui/core/Dialog"; 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 {CloseDialog} from "./CloseDialog";