Skip to content

Commit

Permalink
Merge branch 'issue-135'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mui2108 committed Jan 25, 2020
2 parents bf423ef + 05f98e1 commit 85b4880
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions client/src/components/Register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
dark
flat
> <v-icon>mdi-account-plus</v-icon>&nbsp;&nbsp;
<v-card-title class="title font-weight-regular">สมัคสมาชิก</v-card-title>
<v-card-title ><h1>สมัครสมาชิก</h1></v-card-title>

<v-spacer></v-spacer>

Expand Down Expand Up @@ -97,13 +97,17 @@
</table>
<div v-if = "clickRegister == true">
<div v-if = "registerCheck == true">

<v-alert type="success">Register Completed</v-alert>
</div>
<div v-if = "registerCheck == false">
<v-alert type="error">Can't Register</v-alert>
</div>

<div v-if = "UsernameCheck == false">
<v-alert type="error">Username ถูกใช้ไปแล้ว</v-alert>
</div>
</div>

</v-form>
</v-card>

Expand Down Expand Up @@ -131,6 +135,7 @@ export default {
Gender : [],
registerCheck: false,
clickRegister: false,
UsernameCheck: true
};
},
Expand Down Expand Up @@ -172,35 +177,36 @@ export default {
},
SaveRe() {
this.clickRegister = true;
if (this.username==null || this.pw ==null||
this.selectGender==null || this.name==null ||
this.selectJob==null ||
this.age==null|| this.selectCountry==null ||
this.tel==null){
//alert("กรุณากรอกข้อมูลให้ครบถ้วน!");
this.clickRegister = true;
} else {
this.checkUsername();
}
},
checkUsername() {this.registerCheckUsernae = false;
checkUsername() {
http
.get("/user/check/" + this.username)
.then(res => {
if (!res.data) {
this.registered();}
else{
alert("Username ถูกใช้ไปแล้ว")
// alert("Username ถูกใช้ไปแล้ว")
this.UsernameCheck = false;
}
})
.catch(e => {
console.log(e);
});
},
registered() {
this.registerCheck = true;
http
.post("/user/" +
this.username+"/"+this.pw+"/"+this.selectGender
Expand All @@ -209,6 +215,7 @@ export default {
console.log(response);
//alert("บันทึกข้อมูลสำเร็จ");
// window.location.reload()
this.registerCheck = true;
})
.catch(e => {
console.log(e);
Expand All @@ -230,3 +237,16 @@ export default {
},
};
</script>
<style>
@import url('https://fonts.googleapis.com/css?family=Prompt&display=swap');
div {
font-family: 'Prompt', sans-serif;
}
v-card{
font-family: 'Prompt', sans-serif;
}
</style>

0 comments on commit 85b4880

Please sign in to comment.