1
0
mirror of https://github.com/actix/examples synced 2025-02-02 17:39:05 +01:00

189 lines
3.4 KiB
Vue
Raw Normal View History

<template>
2023-07-17 22:26:11 +01:00
<div id="app">
<div id="content">
<div id="title">
<a to="#">SignUp</a>
</div>
<input
type="text"
name="username"
placeholder="Username"
v-model="Username"
required
/>
<input
type="text"
name="email"
placeholder="E-mail"
v-model="Email"
required
/>
<input
type="password"
name="password"
placeholder="Password"
v-model="Password"
required
/>
<input
type="password"
name="confirm_password"
placeholder="Confirm password"
v-model="ConfirmPassword"
required
/><br />
2023-07-17 22:26:11 +01:00
<button id="submit" @click="signup">Sign up</button>
<div id="user-info">
<p>
Click Above 'Sign up' Button <br />
Then Get Your Signup Info!
</p>
<p>email : {{ email }}</p>
<p>username : {{ username }}</p>
<p>password : {{ password }}</p>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'app',
2023-07-17 22:26:11 +01:00
data() {
return {
Username: '',
Email: '',
Password: '',
ConfirmPassword: '',
2023-07-17 22:26:11 +01:00
email: '',
username: '',
password: '',
}
},
methods: {
signup() {
let username = this.Username
let email = this.Email
let password = this.Password
let confirm_password = this.ConfirmPassword
let data = {
username: username,
email: email,
password: password,
confirm_password: confirm_password,
}
fetch('http://localhost:8080/user/info', {
body: JSON.stringify(data),
headers: {
'content-type': 'application/json',
},
method: 'POST',
})
2023-07-18 22:54:35 +01:00
.then(response => response.json())
.then(json => {
2023-07-17 22:26:11 +01:00
console.log(json)
this.email = json.email
this.username = json.username
this.password = json.password
})
2023-07-18 22:54:35 +01:00
.catch(e => {
2023-07-17 22:26:11 +01:00
console.log(e)
})
},
},
}
</script>
<style scoped>
#content {
width: 250px;
margin: 0 auto;
padding-top: 33px;
}
2023-07-18 22:54:35 +01:00
#title {
2023-07-17 22:26:11 +01:00
padding: 0.5rem 0;
font-size: 22px;
font-weight: bold;
background-color: bisque;
text-align: center;
}
2023-07-18 22:54:35 +01:00
2023-07-17 22:26:11 +01:00
input[type='text'],
input[type='password'] {
margin: 6px auto auto;
width: 250px;
height: 36px;
border: none;
2023-07-17 22:26:11 +01:00
border-bottom: 1px solid #aaa;
font-size: 16px;
}
2023-07-18 22:54:35 +01:00
2023-07-17 22:26:11 +01:00
#submit {
margin: 10px 0 20px 0;
width: 250px;
height: 33px;
2023-07-17 22:26:11 +01:00
background-color: bisque;
border: none;
border-radius: 2px;
font-family: 'Roboto', sans-serif;
font-weight: bold;
transition: 0.1s ease;
cursor: pointer;
}
2023-07-18 22:54:35 +01:00
2023-07-17 22:26:11 +01:00
input[type='checkbox'] {
margin-top: 11px;
}
2023-07-18 22:54:35 +01:00
dialog {
2023-07-17 22:26:11 +01:00
top: 50%;
width: 80%;
border: 5px solid rgba(0, 0, 0, 0.3);
}
2023-07-18 22:54:35 +01:00
2023-07-17 22:26:11 +01:00
dialog::backdrop {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.7);
}
2023-07-18 22:54:35 +01:00
#closeDialog {
2023-07-17 22:26:11 +01:00
display: inline-block;
border-radius: 3px;
border: none;
font-size: 1rem;
padding: 0.4rem 0.8em;
background: #eb9816;
border-bottom: 1px solid #f1b75c;
color: white;
font-weight: bold;
text-align: center;
}
2023-07-18 22:54:35 +01:00
2023-07-17 22:26:11 +01:00
#closeDialog:hover,
#closeDialog:focus {
opacity: 0.92;
cursor: pointer;
}
2023-07-18 22:54:35 +01:00
#user-info {
width: 250px;
margin: 0 auto;
padding-top: 44px;
}
2023-07-18 22:54:35 +01:00
@media only screen and (min-width: 600px) {
2023-07-17 22:26:11 +01:00
#content {
margin: 0 auto;
padding-top: 100px;
}
}
2019-03-30 09:47:04 +08:00
</style>