constructor(props: Readonly<{ user: UserEntity ,modifyUser:Function;}>) {
super(props);
+ this.ages=this.createAge()
+
this.state={
- user:this.props.user,
- tipContent:null
+ user:this.props.user
}
}
render() {
return (
);
}
+
+ private createAge(){
+ let age=[]
+ for(let i=18;i<100;i++){
+ age.push(i)
+ }
+ return age
+ }
+
+ /**
+ * 检查手机号
+ */
+ checkMobile(){
+ return /1[3456789]\d{9}/g.test(this.state.user.mobile.toString())
+ }
+
+ /**
+ * 检查邮箱
+ */
+ private checkEmail() {
+ return /[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}/g.test(this.state.user.email)
+ }
+
+ //检查是否为空
+ isNotEmpty(...value:(string | number)[]){
+ for(let index in value){
+ if(value[index].toString().length===0){
+ return false
+ }
+ }
+ return true
+ }
+
+ private check() {
+ return this.isNotEmpty(this.state.user.userId,this.state.user.name,this.state.user.sex,
+ this.state.user.serviceAddress,this.state.user.userType,this.state.user.info)
+ &&this.checkMobile()&&this.checkEmail()
+ }
}
/**
@@ -107,14 +204,16 @@ export class User extends React.Component<
# |
用户账号 |
姓名 |
- 性别 |
年龄 |
+ 性别 |
+ 住址 |
头像 |
+ 服务地点 |
+ 用户身份 |
电话 |
邮箱 |
- 地点 |
时间币 |
- 个人描述 |
+ 简介 |
操作 |
@@ -124,8 +223,9 @@ export class User extends React.Component<
{index+1} |
{user.userId} |
{user.name} |
- {user.sex} |
{user.age} |
+ {user.sex==='man'?'男':'女'} |
+ {user.address} |
{this.setState({
dialog:}
@@ -135,9 +235,11 @@ export class User extends React.Component<
})}/>
})}/>}
|
+ {user.serviceAddress} |
+ {user.userType===UserType.seekHelp?'服务发起者':'服务接受者'} |
{user.mobile} |
{user.email} |
- {user.address} |
+
{user.timeScore} |
{user.info} |
@@ -173,7 +275,16 @@ export class User extends React.Component<
let that=this
request(API.account.updateUser,Method.POST, {
userId:user.userId,
- name:user.name
+ name:user.name,
+ age:String(user.age),
+ sex:String(user.sex),
+ address:user.address,
+ serviceAddress:user.serviceAddress,
+ userType:user.userType,
+ mobile:user.mobile,
+ email:user.email,
+ info:user.info
+
},new EmptyBodyTransform(),function (res:JSONResponse) {
switch (res.customResult) {
case SimpleMessage.ok:
diff --git a/src/api.ts b/src/api.ts
index bbf0f46..0716d33 100644
--- a/src/api.ts
+++ b/src/api.ts
@@ -6,6 +6,8 @@ export const prefix={
user:'/api/user',
image: "/image/"
}
+//用户前台地址
+export const fontEnd="http://localhost:3001"
//接口地址
export const API={
@@ -25,7 +27,9 @@ export const API={
// 更新用户信息
updateUser:prefix.manager+'/userUpdate',
//查询活动信息
- findActivity:prefix.manager+'/find/activity'
+ findActivity:prefix.manager+'/find/activity',
+ //修改活动信息
+ updateActivity:prefix.manager+'/update/'
},
user:{
diff --git a/src/entity.ts b/src/entity.ts
index acd9f5c..4e040d2 100644
--- a/src/entity.ts
+++ b/src/entity.ts
@@ -172,7 +172,7 @@ export enum UserType {
seekHelp="seekHelp",
help="help"
}
-
+//活动列表
export interface ManagerActivity {
activityId:number;
content:string;
@@ -184,3 +184,16 @@ export interface ManagerActivity {
helpUser:Array;
}
+/**
+ * 地点信息
+ */
+export interface AddressProps {
+ address:string;
+}
+
+export interface OnChangeAddress {
+ onChange:Function;
+ col?:number;
+ value?:string;
+}
+
diff --git a/src/ui/Address.tsx b/src/ui/Address.tsx
new file mode 100644
index 0000000..d7c8bd9
--- /dev/null
+++ b/src/ui/Address.tsx
@@ -0,0 +1,56 @@
+import {Form, InputGroup} from "react-bootstrap";
+import {AddressProps, OnChangeAddress} from "../entity";
+import React from "react";
+
+/**
+ * 加载服务地点信息
+ */
+export class Address extends React.Component }>{
+
+
+ constructor(props: Readonly) {
+ super(props);
+
+ this.state={
+ addressList:[],
+
+ }
+ }
+
+ componentDidMount() {
+ this.loadAddress()
+ }
+
+ /**
+ * 加载服务地点
+ */
+ loadAddress(){
+ this.setState({
+ addressList:[{
+ address:"北京",
+ },
+ {
+ address:"广州",
+ },
+ {
+ address:"上海",
+ }]
+ })
+ }
+
+ render() {
+ return (
+
+
+ 服务地点
+
+ this.props.onChange(e.target.value)}>
+
+ {this.state.addressList.map((address:AddressProps, index:number)=>
+
+ )}
+
+
+ )
+ }
+}
diff --git a/src/ui/MyDialog.tsx b/src/ui/MyDialog.tsx
index 121b946..5793437 100644
--- a/src/ui/MyDialog.tsx
+++ b/src/ui/MyDialog.tsx
@@ -1,10 +1,14 @@
import React from "react";
import Dialog from "@material-ui/core/Dialog";
import Draggable from "react-draggable";
-import {Paper} from "@material-ui/core";
+import {Paper, styled, withWidth} from "@material-ui/core";
import {MyDialogProps} from "../entity";
import {CloseDialog} from "./CloseDialog";
+
+const EditDialogPaper=styled(Paper)({
+ maxWidth:1000
+})
/**
* 我的弹窗
*/
@@ -18,7 +22,7 @@ export class MyDialog extends React.Component
-
+
}
aria-labelledby={this.props.titleId}
classes={{paper:"w-100"}}
diff --git a/yarn.lock b/yarn.lock
index 7f9ae12..668818f 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7101,6 +7101,11 @@ mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@~0.5.1:
dependencies:
minimist "^1.2.5"
+moment@^2.26.0:
+ version "2.26.0"
+ resolved "https://registry.npm.taobao.org/moment/download/moment-2.26.0.tgz#5e1f82c6bafca6e83e808b30c8705eed0dcbd39a"
+ integrity sha1-Xh+Cxrr8pug+gIswyHBe7Q3L05o=
+
move-concurrently@^1.0.1:
version "1.0.1"
resolved "https://registry.npm.taobao.org/move-concurrently/download/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"
|