From bac329e31e54903bfbdcf112530044ccc778e2b1 Mon Sep 17 00:00:00 2001 From: snoop Date: Sat, 27 May 2017 18:40:13 +0900 Subject: [PATCH] Merge branch 'master' of https://git.loafle.net/overflow/Test_Web --- src/ts/containers/member/regist.tsx | 256 +++++++++++++--------------- 1 file changed, 119 insertions(+), 137 deletions(-) diff --git a/src/ts/containers/member/regist.tsx b/src/ts/containers/member/regist.tsx index 8293cf3..85f9ba7 100644 --- a/src/ts/containers/member/regist.tsx +++ b/src/ts/containers/member/regist.tsx @@ -56,24 +56,28 @@ const muiTheme = getMuiTheme({ }, }); +var EMailRegex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + export class MemberRegist extends React.Component { constructor(props: any, context: any) { super(props, context); this.handleSignUp = this.handleSignUp.bind(this); - + this.state = { open: false, value: 1, - id:0, + id: 0, email: "", name: "", company: "", phone: "", pw: "", + + isEmail: true }; } @@ -81,7 +85,7 @@ export class MemberRegist extends React.Component { private emailInput: any; - + handleSignUp = () => { @@ -95,57 +99,30 @@ export class MemberRegist extends React.Component { "phone": this.state.phone }; - let os: OFRest = new OFRest("Member", "Regist", obj); - - os.Call().then(function (res) { - return res.json(); - }).then(function(json) { - console.log(json); - ReactDOM.render(, document.getElementById('example')); - }).catch(function(err) { -console.log(err); - }); - - // let exeObj: any; - // exeObj = { - // "serviceName": "Member", - // "methodName": "Regist", - // "param": obj - // } - - - // output = JSON.stringify(exeObj); - - // // obj = { "value": output }; - - // fetch('http://192.168.1.203:8080/v1/overflow/services', { - // method: 'POST', - // headers: { - // 'Accept': 'application/json', - // // mode: 'no-cors' - // }, - // body: output - // }).then(function (response) { - // return response.json(); - // }).then(function (json) { - // console.log(json); - // ReactDOM.render(, document.getElementById('example') - // ); - // }).catch((err) => { - // console.log(err); - // }); - + + let os: OFRest = new OFRest("Member", "Regist", obj); + os.Call().then(function (res) { + return res.json(); + }).then(function(json) { + console.log(json); + ReactDOM.render(, document.getElementById('example')); + }).catch(function(err) { + console.log(err); + }); + } + public validateEmail(email: any) { + return EMailRegex.test(email); } handleTestRead = () => { let output: string; let obj: any; //new object declaration obj = { - "id":this.state.id, + "id": this.state.id, "email": this.state.email, "pwSalt": this.state.pw, "name": this.state.name, @@ -176,15 +153,15 @@ console.log(err); }).then(function (json) { console.log(json); }).catch((err) => { - console.log(err); - }); -} + console.log(err); + }); + } -handleTestUpdate = () => { + handleTestUpdate = () => { let output: string; let obj: any; //new object declaration obj = { - "id":this.state.id, + "id": this.state.id, "email": this.state.email, "pwSalt": this.state.pw, "name": this.state.name, @@ -215,15 +192,15 @@ handleTestUpdate = () => { }).then(function (json) { console.log(json); }).catch((err) => { - console.log(err); - }); -} + console.log(err); + }); + } -handleTestDelete = () => { + handleTestDelete = () => { let output: string; let obj: any; //new object declaration obj = { - "id":this.state.id, + "id": this.state.id, "email": this.state.email, "pwSalt": this.state.pw, "name": this.state.name, @@ -254,104 +231,109 @@ handleTestDelete = () => { }).then(function (json) { console.log(json); }).catch((err) => { - console.log(err); - }); + console.log(err); + }); } -handleResultContainer = () => { - ReactDOM.render( - , - document.getElementById('example') - ); -} + handleResultContainer = () => { + ReactDOM.render( + , + document.getElementById('example') + ); + } -btnTouchTap = () => { - alert(event) -}; + btnTouchTap = () => { + alert(event) + }; -render() { + render() { - return ( - + return ( + -
- Get started with Overflow +
+ Get started with Overflow
- this.setState({ email: newValue })} - /> -
- this.setState({ name: newValue })} + { + this.setState({ email: newValue }); - /> -
+ this.state.isEmail = this.validateEmail(this.state.email); + } + } + /> +
+ this.setState({ name: newValue })} - this.setState({ company: newValue })} - /> -
+ /> +
- this.setState({ phone: newValue })} - /> -
+ this.setState({ company: newValue })} + /> +
- this.setState({ pw: newValue })} - /> -
+ this.setState({ phone: newValue })} + /> +
+ + this.setState({ pw: newValue })} + /> +
- - - - -
- this.setState({ id: newValue })} - /> -
+ + + + +
+ - ); -} + style={styles.textfield} + value={this.state.id} + onChange={(e, newValue) => this.setState({ id: newValue })} + /> +
+ +
+ ); + } }