You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
help_admin/src/public.tsx

36 lines
1.3 KiB

//注册
import {JSONResponse, Method, request} from "./interface";
import {API} from "./api";
import {RegisterRes, RegisterTransform} from "./result";
import {Button} from "react-bootstrap";
import * as React from "react";
export function register(that:React.Component<any,any>,managerId:string,password:string,onSuccess?:Function){
request(API.account.register,Method.POST, {
managerId:managerId,
password:password
},new RegisterTransform(),function (res:JSONResponse<RegisterRes>) {
switch (res.customResult) {
case RegisterRes.ok:
that.setState({
tipContent:<div><h3 className="text-center text-info"></h3>
{that.props.toLogin?<Button className={"col-3 ml-auto mr-auto"} block={true} onClick={()=>that.props.toLogin()}></Button>:null}</div>
})
if(onSuccess){
onSuccess()
}
break
case RegisterRes.fail:
that.setState({
tipContent:<h3 className="text-center text-danger">,</h3>
})
break
case RegisterRes.user_repeat:
that.setState({
tipContent:<h3 className="text-center text-danger">{that.state.managerId}</h3>
})
break
}
})
}