2023-04-03 01:00:37 +04:00
|
|
|
<template lang="">
|
|
|
|
<div class='text-center mx-auto'>
|
2023-04-29 14:20:44 +04:00
|
|
|
<form onsubmit="return false">
|
2023-04-03 01:00:37 +04:00
|
|
|
<p class='h3 m-3'>Авторизация</p>
|
|
|
|
<p class='h6 m-3'> Имя:</p>
|
2023-04-29 14:20:44 +04:00
|
|
|
<input v-model='firstName' id="firstNameTF" required>
|
|
|
|
<p class='h6 m-3'> Фамилия:</p>
|
|
|
|
<input v-model='lastName' id="lastNameTF" required>
|
2023-04-03 01:00:37 +04:00
|
|
|
<p class='h6 m-3'> Отчество:</p>
|
2023-04-29 14:20:44 +04:00
|
|
|
<input v-model='middleName' id="middleNameTF">
|
|
|
|
<p class='h6 m-3'> Эл. почта:</p>
|
|
|
|
<input v-model='email' id="emailTF" required>
|
|
|
|
<p class='h6 m-3'> Пароль:</p>
|
|
|
|
<input v-model='password' id="passwordTF" required>
|
|
|
|
|
|
|
|
<p class="h6 m-3">{{message}}</p>
|
2023-04-03 01:00:37 +04:00
|
|
|
|
|
|
|
<p class='mt-5'>
|
|
|
|
<button v-on:click="enterButtonClick" type='button' class='btn btn-primary'>Войти</button>
|
|
|
|
</p>
|
|
|
|
<p>
|
2023-04-29 14:20:44 +04:00
|
|
|
<button v-on:click="registerButtonClick" type='submit' class='btn btn-success'>Регистрация</button>
|
2023-04-03 01:00:37 +04:00
|
|
|
</p>
|
|
|
|
<p>
|
2023-04-29 14:20:44 +04:00
|
|
|
<button v-on:click="testButtonClick" type='button' class='btn btn-light'>Войти как тестировщик</button>
|
2023-04-03 01:00:37 +04:00
|
|
|
</p>
|
2023-04-29 14:20:44 +04:00
|
|
|
</form>
|
|
|
|
|
2023-04-03 01:00:37 +04:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import axios from 'axios'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
firstName: '',
|
|
|
|
lastName: '',
|
|
|
|
middleName: '',
|
2023-04-29 14:20:44 +04:00
|
|
|
email: '',
|
|
|
|
password: '',
|
|
|
|
abiturId: -1,
|
|
|
|
message: ''
|
2023-04-03 01:00:37 +04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2023-04-29 14:20:44 +04:00
|
|
|
enterButtonClick() {
|
|
|
|
this.$router.push(
|
|
|
|
{
|
|
|
|
name: "Enter"
|
2023-04-03 01:00:37 +04:00
|
|
|
}
|
2023-04-29 14:20:44 +04:00
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
testButtonClick(){
|
2023-04-03 01:00:37 +04:00
|
|
|
this.$router.push(
|
|
|
|
{
|
2023-04-29 14:20:44 +04:00
|
|
|
name: "Test"
|
2023-04-03 01:00:37 +04:00
|
|
|
}
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2023-04-29 14:20:44 +04:00
|
|
|
registerButtonClick() {
|
2023-04-03 01:00:37 +04:00
|
|
|
let data = JSON.stringify({
|
|
|
|
"first_name": this.firstName,
|
|
|
|
"last_name": this.lastName,
|
2023-04-29 14:20:44 +04:00
|
|
|
"middle_name": this.middleName,
|
|
|
|
"email": this.email,
|
|
|
|
"password": this.password
|
2023-04-03 01:00:37 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
let config = {
|
|
|
|
method: 'post',
|
|
|
|
maxBodyLength: Infinity,
|
|
|
|
url: 'http://127.0.0.1:8080/api/abitur',
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
},
|
|
|
|
data : data
|
|
|
|
};
|
|
|
|
|
|
|
|
axios.request(config)
|
|
|
|
.then((response) => {
|
|
|
|
this.abiturId =response.data['id']
|
|
|
|
console.log(this.abiturId)
|
2023-04-29 14:20:44 +04:00
|
|
|
if (this.abiturId>0) {
|
|
|
|
this.message = 'Успешная регистрация'
|
|
|
|
this.$router.push(
|
|
|
|
{
|
|
|
|
name: "Enter"
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else this.message = 'Ошибка при регистрации'
|
2023-04-03 01:00:37 +04:00
|
|
|
})
|
2023-04-29 14:20:44 +04:00
|
|
|
|
|
|
|
if (this.message == "") this.message = 'Ошибка при регистрации'
|
2023-04-03 01:00:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style lang="">
|
|
|
|
|
|
|
|
</style>
|