ну вроде как все готово НО КТО ЗНАЕТ ЧТО ТАМ ЕЩЕ ПРИДЕТ В ГОЛОВУ ПРОВЕРЯЮЩЕМУ

This commit is contained in:
Данила Мочалов 2023-04-29 14:20:44 +04:00
parent 472a1900a1
commit a0eb089d1c
14 changed files with 446 additions and 49 deletions

View File

@ -1,11 +1,24 @@
const db = require('../db')
const crypto = require('crypto');
const AbiturControllerInterface = require('./interfaces/abitur.controller.interface')
class AbiturController extends AbiturControllerInterface{
async createAbitur(req, res) {
const {first_name, last_name, middle_name} = req.body
const newAbitur = await db.query('INSERT INTO abitur (first_name, last_name, middle_name) VALUES ($1, $2, $3) RETURNING *', [first_name, last_name, middle_name])
const {first_name, last_name, middle_name, email, password} = req.body
var hash = crypto.createHash('md5').update(password).digest('hex');
const newAbitur = await db.query('INSERT INTO abitur (first_name, last_name, middle_name, email, password) VALUES ($1, $2, $3, $4, $5) RETURNING *', [first_name, last_name, middle_name, email, hash])
res.json(newAbitur.rows[0])
}
async createAbiturWithId(req, res) {
const {id, first_name, last_name, middle_name, email, password} = req.body
var hash = crypto.createHash('md5').update(password).digest('hex');
const newAbitur = await db.query('INSERT INTO abitur (id, first_name, last_name, middle_name, email, password) VALUES ($1, $2, $3, $4, $5, $6) RETURNING *', [id, first_name, last_name, middle_name, email, hash])
res.json(newAbitur.rows[0])
}
async getAbiturs(req, res) {
@ -17,6 +30,13 @@ class AbiturController extends AbiturControllerInterface{
const abiturs = await db.query('SELECT * FROM abitur WHERE id=$1', [id])
res.json(abiturs.rows[0])
}
async authAbitur(req, res) {
const {email, password} = req.body
var hash = crypto.createHash('md5').update(password).digest('hex');
const abitur = await db.query('SELECT * FROM abitur WHERE email = $1 AND password = $2', [email, hash])
res.json(abitur.rows[0])
}
async updateAbitur(req, res) {
const {id, first_name, last_name, middle_name} = req.body
const newAbitur = await db.query('UPDATE abitur SET first_name=$1, last_name=$2, middle_name=$3 WHERE id=$4 RETURNING *', [first_name, last_name, middle_name, id])
@ -27,6 +47,10 @@ class AbiturController extends AbiturControllerInterface{
const abiturs = await db.query('DELETE FROM abitur WHERE id=$1', [id])
res.json(abiturs.rows[0])
}
async deleteAll(req, res) {
const abiturs = await db.query('DELETE FROM abitur')
res.json(abiturs.rows)
}
}
module.exports = new AbiturController()

View File

@ -8,6 +8,11 @@ class ExamResultController extends ExamResultControllerInterface {
const newExamResult = await db.query('INSERT INTO exam_result (title, result, abitur_id) VALUES ($1, $2, $3) RETURNING *', [title, result, abitur_id])
res.json(newExamResult.rows[0])
}
async createExamResultWithId(req, res) {
const {id, title, result, abitur_id} = req.body
const newExamResult = await db.query('INSERT INTO exam_result (id, title, result, abitur_id) VALUES ($1, $2, $3, $4) RETURNING *', [id, title, result, abitur_id])
res.json(newExamResult.rows[0])
}
async getExamResults(req, res) {
const results = await db.query('SELECT * FROM exam_result')
res.json(results.rows)
@ -32,6 +37,11 @@ class ExamResultController extends ExamResultControllerInterface {
const results = await db.query('SELECT * FROM exam_result WHERE abitur_id=$1', [id])
res.json(results.rows)
}
async getAverageResultBySpecialization(req, res) {
const id = req.params.id
const result = await db.query('select avg(result) from exam_result where id in (select exam_result_id from request_exam_result where request_id in (select id from request where specialization_id = $1))', [id])
res.json(result.rows[0])
}
}
module.exports = new ExamResultController()

View File

@ -8,6 +8,11 @@ class RequestController extends RequestControllerInterface {
const newRequest = await db.query('INSERT INTO request (abitur_id, education_form_id, specialization_id, date) VALUES ($1, $2, $3, $4) RETURNING *', [abitur_id, education_form_id, specialization_id, new Date()])
res.json(newRequest.rows[0])
}
async createRequestWithId(req, res) {
const {id, abitur_id, education_form_id, specialization_id} = req.body
const newRequest = await db.query('INSERT INTO request (id, abitur_id, education_form_id, specialization_id, date) VALUES ($1, $2, $3, $4, $5) RETURNING *', [id, abitur_id, education_form_id, specialization_id, new Date()])
res.json(newRequest.rows[0])
}
async getRequests(req, res) {
const requests = await db.query('SELECT * FROM request')
res.json(requests.rows)
@ -32,6 +37,11 @@ class RequestController extends RequestControllerInterface {
const requests = await db.query('SELECT * FROM request WHERE abitur_id=$1', [id])
res.json(requests.rows)
}
async getCountBySpec(req, res) {
const id = req.params.id
const requests = await db.query('SELECT COUNT(*) FROM request WHERE specialization_id=$1', [id])
res.json(requests.rows[0])
}
}
module.exports = new RequestController()

View File

@ -5,7 +5,7 @@
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"start": "pm2 start index.js --watch"
"start": "pm2 start index.js"
},
"dependencies": {
"axios": "^1.3.4",

View File

@ -4,9 +4,12 @@ const router = new Router()
const abiturController = require('../controllers/abitur.controller')
router.post('/abitur', abiturController.createAbitur)
router.post('/abitur/manual', abiturController.createAbiturWithId)
router.get('/abitur', abiturController.getAbiturs)
router.get('/abitur/:id', abiturController.getOneAbitur)
router.post('/abitur/auth/', abiturController.authAbitur)
router.put('/abitur', abiturController.updateAbitur)
router.delete('/abitur/:id', abiturController.deleteAbitur)
router.delete('/abitur', abiturController.deleteAll)
module.exports = router

View File

@ -4,10 +4,12 @@ const router = new Router()
const examResultController = require('../controllers/examresult.controller')
router.post('/examresult', examResultController.createExamResult)
router.post('/examresult/manual', examResultController.createExamResultWithId)
router.get('/examresult', examResultController.getExamResults)
router.get('/examresult/:id', examResultController.getOneExamResult)
router.put('/examresult', examResultController.updateExamResult)
router.delete('/examresult/:id', examResultController.deleteExamResult)
router.get('/examresult/abitur/:id', examResultController.getAbiturExamResults)
router.get('/examresult/avgBySpec/:id', examResultController.getAverageResultBySpecialization)
module.exports = router

View File

@ -4,10 +4,12 @@ const router = new Router()
const requestController = require('../controllers/request.controller')
router.post('/request', requestController.createRequest)
router.post('/request/manual', requestController.createRequestWithId)
router.get('/request', requestController.getRequests)
router.get('/request/:id', requestController.getRequests)
router.get('/request/:id', requestController.getOneRequest)
router.put('/request', requestController.updateRequest)
router.delete('/request/:id', requestController.deleteRequest)
router.get('/request/abitur/:id', requestController.getAbiturRequests)
router.get('/request/spec/:id', requestController.getCountBySpec)
module.exports = router

View File

@ -1,4 +1,6 @@
<template lang="">
<div class='text-end me-3'><a href="http://localhost:8081" class='text-decoration-none'>Выход</a></div>
<router-view></router-view>
</template>

View File

@ -1,9 +1,21 @@
<template>
<div class='text-center mx-auto m-3'>
<div class='text-center mx-auto m-3 w-50'>
<p class='h3'>
Здравствуйте, {{this.firstName}} {{this.lastName}}
</p>
<!--
Добавить логин и пароль для абитуриента при регистрации и авторизации (хранить в бд) done!
Добавить уведомления при регистрации и авторизации done!
Добавить секретную страничку для админа с отчетом
Добавить отчет
Добавить генерацию данных для отчета и замер запроса для отчета
При выборе предметов во время создания заявки сделать более удобный выбор предметов и их добавление done!
Шифровка пароля done!
-->
<p class='h5'>Мои результаты:</p>
<ul class='text-start'>
<li v-for='result in examResults'>
@ -51,7 +63,7 @@
<ul class='text-start'>
<li v-for='request in requests'>
<p>
Дата: {{ request['date']}}
Дата: {{ request['date'].slice(0,10)}}
</p>
<p>
<button @click="onRequestButtonClick(request['id'])" type="button" class="btn btn-warning ms-3" >
@ -108,12 +120,15 @@ export default {
async onAddExamResultClick() {
if (this.selectedExamTitle == 'Выберите предмет') return;
for(const res of this.examResults) {
if (res['title'] == this.selectedExamTitle) return
}
let data = JSON.stringify({
"title": this.selectedExamTitle,
"result": this.selectedExamResult,
"abitur_id": this.abiturId
});
console.log(data)
let config = {
method: 'post',
maxBodyLength: Infinity,

View File

@ -1,22 +1,31 @@
<template lang="">
<div class='text-center mx-auto'>
<form onsubmit="return false">
<p class='h3 m-3'>Авторизация</p>
<p class='h6 m-3'> Имя:</p>
<textarea v-model='firstName' id="firstNameTF" cols="30" rows="1" style="resize: none;"></textarea>
<input v-model='firstName' id="firstNameTF" required>
<p class='h6 m-3'> Фамилия:</p>
<textarea v-model='lastName' id="lastNameTF" cols="30" rows="1" style="resize: none;"></textarea>
<input v-model='lastName' id="lastNameTF" required>
<p class='h6 m-3'> Отчество:</p>
<textarea v-model='middleName' id="middleNameTF" cols="30" rows="1" style="resize: none;"></textarea>
<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>
<p class='mt-5'>
<button v-on:click="enterButtonClick" type='button' class='btn btn-primary'>Войти</button>
</p>
<p>
<button v-on:click="registerButtonClick" type='button' class='btn btn-success'>Регистрация</button>
<button v-on:click="registerButtonClick" type='submit' class='btn btn-success'>Регистрация</button>
</p>
<p>
<button type='button' class='btn btn-light'>Войти как администратор</button>
<button v-on:click="testButtonClick" type='button' class='btn btn-light'>Войти как тестировщик</button>
</p>
</form>
</div>
</template>
<script>
@ -28,33 +37,36 @@ export default {
firstName: '',
lastName: '',
middleName: '',
abiturId: -1
email: '',
password: '',
abiturId: -1,
message: ''
}
},
methods: {
async enterButtonClick() {
var abiturs = await (await axios.get('http://127.0.0.1:8080/api/abitur', )).data
abiturs.forEach(element => {
if (element['first_name'] == this.firstName && element['last_name'] == this.lastName && element['middle_name'] == this.middleName) {
this.abiturId = element['id']
console.log(this.abiturId)
}
});
enterButtonClick() {
this.$router.push(
{
name: "AbiturMain",
params: {
abiturId: this.abiturId
}
name: "Enter"
}
);
},
async registerButtonClick() {
testButtonClick(){
this.$router.push(
{
name: "Test"
}
);
},
registerButtonClick() {
let data = JSON.stringify({
"first_name": this.firstName,
"last_name": this.lastName,
"middle_name": this.middleName
"middle_name": this.middleName,
"email": this.email,
"password": this.password
});
let config = {
@ -71,7 +83,18 @@ export default {
.then((response) => {
this.abiturId =response.data['id']
console.log(this.abiturId)
if (this.abiturId>0) {
this.message = 'Успешная регистрация'
this.$router.push(
{
name: "Enter"
}
);
}
else this.message = 'Ошибка при регистрации'
})
if (this.message == "") this.message = 'Ошибка при регистрации'
}

View File

@ -0,0 +1,74 @@
<template lang="">
<div class='text-center mx-auto'>
<p class='h3 m-3'>Вход в аккаунт</p>
<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>
<p class='mt-5'>
<button v-on:click="enterButtonClick" type='button' class='btn btn-primary'>Войти</button>
</p>
</div>
</template>
<script>
import axios from 'axios'
export default {
data() {
return {
email: '',
password: '',
abiturId: -1,
message: ''
}
},
methods: {
async enterButtonClick() {
const axios = require('axios');
let data = JSON.stringify({
"email": this.email,
"password": this.password
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'http://127.0.0.1:8080/api/abitur/auth/',
headers: {
'Content-Type': 'application/json'
},
data : data
};
await axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
this.abiturId = response.data['id']
})
.catch((error) => {
this.message = 'Ошибка при входе в аккаунт'
console.log(error);
});
if (this.abiturId <= 0 || this.abiturId == null) {
this.message = 'Ошибка при входе в аккаунт'
return
}
this.$router.push(
{
name: "AbiturMain",
params: {
abiturId: this.abiturId
}
}
);
},
}
}
</script>
<style lang="">
</style>

View File

@ -1,26 +1,26 @@
<template>
<div class="text-center m-3">
<p class="h3"> Ваша заявка: </p>
<p class=""> Дата: {{ this.request['date'].slice(0,10) }} </p>
<p class=""> Дата: {{ this.request['date'].slice(0,10) ?? ''}} </p>
<div class="h4">
Специализация:
<button class="btn btn-secondary dropdown-toggle" type="button" id="examResult" data-bs-toggle="dropdown" aria-expanded="false">
{{ specialization['title'] }}
{{ specialization['title'] ?? '' }}
</button>
<ul class="dropdown-menu" aria-labelledby="examResult">
<li v-for="spec in specializations">
<a class="dropdown-item" href="#" v-on:click="specialization=spec ">{{ spec['title']}}</a>
<a class="dropdown-item" href="#" v-on:click="specialization=spec ">{{ spec['title'] ?? ''}}</a>
</li>
</ul>
</div>
<div class="h4">
Форма обучения:
<button class="btn btn-secondary dropdown-toggle" type="button" id="examResult" data-bs-toggle="dropdown" aria-expanded="false">
{{ educationForm['title'] }}
{{ educationForm['title'] ?? ''}}
</button>
<ul class="dropdown-menu" aria-labelledby="examResult">
<li v-for="form in forms">
<a class="dropdown-item" href="#" v-on:click="educationForm=form ">{{ form['title']}}</a>
<a class="dropdown-item" href="#" v-on:click="educationForm=form ">{{ form['title'] ?? ''}}</a>
</li>
</ul>
</div>
@ -29,10 +29,10 @@
<ul class='text-start ms-5'>
<li v-for='result in results'>
<p>
Предмет: {{ result['title']}}
Предмет: {{ result['title'] ?? ''}}
</p>
<p>
Результат: {{ result['result']}}
Результат: {{ result['result'] ?? ''}}
</p>
<p>
<button @click="deleteResultClick(result['id'])" type="button" class="btn btn-danger ms-3" >
@ -42,8 +42,8 @@
</li>
</ul>
<p class="h6"> Добавить результат к заявке </p>
<div class="dropdown">
<p class="h6"> Добавить ваши результаты к заявке </p>
<!-- <div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="examResult" data-bs-toggle="dropdown" aria-expanded="false">
<div v-if="selectedExamResult == null" >Выберите результат</div>
<div v-else>{{ selectedExamResult['title'] }}: {{ selectedExamResult['result'] }} </div>
@ -55,6 +55,14 @@
</ul>
<button type="button" @click="addResultToRequest" class="btn btn-success p-3 ms-5"> Добавить </button>
</div> -->
<div>
<div v-for="res in allResults" >
<p>
<span class="me-4">{{res['title'] ?? '' }}: {{ res['result'] ?? '' }} баллов</span>
<button class="btn btn-info" @click="addResultToRequest(res)">Добавить</button>
</p>
</div>
</div>
<button type="button" @click="saveRequest" class="btn btn-primary p-3 ps-5 pe-5 mt-5">Сохранить</button>
@ -105,14 +113,14 @@ export default {
window.location.reload()
},
async addResultToRequest() {
async addResultToRequest(res) {
const axios = require('axios');
console.log('Save new result')
console.log(this.requestId)
console.log(this.selectedExamResult)
console.log(res)
var request_result_pairs = (await axios.get('http://127.0.0.1:8080/api/request_examresult/' + this.requestId)).data
for (const pair of request_result_pairs) {
if (pair['request_id'] == this.requestId && pair['exam_result_id']==this.selectedExamResult['id']) {
if (pair['request_id'] == this.requestId && pair['exam_result_id']==res['id']) {
return;
}
}
@ -120,7 +128,7 @@ export default {
let data = JSON.stringify({
"request_id": this.requestId,
"exam_result_id": this.selectedExamResult['id']
"exam_result_id": res['id']
});
let config = {
@ -181,28 +189,45 @@ export default {
}
},
async beforeMount() {
async created() {
// получаем заявку
this.requestId = this.$route.params.requestId
this.request = (await axios.get('http://127.0.0.1:8080/api/request/' + this.requestId)).data[0]
console.log(this.requestId)
this.request = (await axios.get('http://127.0.0.1:8080/api/request/' + this.requestId)).data
console.log(this.request)
// получаем ее специализацию и форму обучения
this.educationForm = (await axios.get('http://127.0.0.1:8080/api/educationform/' + this.request['education_form_id'])).data
console.log(this.educationForm)
//console.log(this.educationForm)
this.specialization = (await axios.get('http://127.0.0.1:8080/api/specialization/' + this.request['specialization_id'])).data
console.log(this.specialization)
//получаем закрепленные за заявкой результаты
var request_result_pairs = (await axios.get('http://127.0.0.1:8080/api/request_examresult/' + this.requestId)).data
var results = []
for(const pair of request_result_pairs) {
console.log(pair)
results.push((await axios.get('http://127.0.0.1:8080/api/examresult/' + pair['exam_result_id'])).data)
//console.log(pair)
this.results.push((await axios.get('http://127.0.0.1:8080/api/examresult/' + pair['exam_result_id'])).data)
}
this.results = results
// console.log(this.results)
//получаем все результаты абитуриента
this.allResults = (await axios.get('http://127.0.0.1:8080/api/examresult/abitur/' + this.request['abitur_id'])).data
var allResults = (await axios.get('http://127.0.0.1:8080/api/examresult/abitur/' + this.request['abitur_id'])).data
//console.log(allResults)
//
var flag = true;
for (const allRes of allResults) {
flag = true;
for(const res of this.results) {
if (allRes['id'] == res['id'])
flag = false
}
if (flag) {
this.allResults.push(allRes)
}
}
// получаем все формы обучения и специализации
this.specializations = (await axios.get('http://127.0.0.1:8080/api/specialization')).data
this.forms = (await axios.get('http://127.0.0.1:8080/api/educationform')).data
}
}
</script>

View File

@ -0,0 +1,195 @@
<template>
<div class="text-center m-3">
<div class="h2 mb-5">Страница с отчетами и прочими приколами</div>
<div class="mb-5">
<p>Приколы</p>
<button class="btn btn-danger mb-2" @click="deleteAllAbiturs">Удалить всех пользователей</button>
<p class="fw-bold">{{deleteAllMessage}}</p>
</div>
<div>
<p>Средний балл по специализации</p>
<button class="btn btn-secondary dropdown-toggle" type="button" id="examResult" data-bs-toggle="dropdown" aria-expanded="false">
{{ specialization['title'] ?? '' }}
</button>
<ul class="dropdown-menu" aria-labelledby="examResult">
<li v-for="spec in specializations">
<a class="dropdown-item" href="#" v-on:click="specialization=spec">{{ spec['title'] ?? ''}}</a>
</li>
</ul>
<p class="m-5">YOUR DESTINY: {{destiny}}</p>
<button class="btn btn-danger" @click="getDestiny"> KNOW YOUR DESTINY </button>
</div>
<div class="m-3">
<button class="btn btn-warning" @click="generateSlaves"> PUSH ME 4 MAGIC</button>
<p class="m-3">{{magicMessage}}</p>
</div>
</div>
</template>
<script>
import axios from 'axios'
export default {
data(){
return {
specializations: [],
specialization: null,
destiny: 'UNKNOWN',
deleteAllMessage: '',
magicMessage: 'Magic is not done yet'
}
},
methods: {
async getDestiny() {
if (this.specialization == null) return
var avg = (await axios.get('http://127.0.0.1:8080/api/examresult/avgBySpec/'+this.specialization['id'])).data
console.log(avg['avg'])
var count = (await axios.get('http://127.0.0.1:8080/api/request/spec/'+this.specialization['id'])).data
console.log(count['count'])
if (count == null || avg == null) {
this.destiny = 'YOUR DESTINY IS BROKEN. KYS.'
return
}
this.destiny = 'COUNT OF REQUESTS: ' + count['count'] + ', AVERAGE SCORE: ' + avg['avg'] + '. GOOD LUCK, BASTARD'
},
async deleteAllAbiturs() {
try {
console.log('ok')
await axios.delete('http://127.0.0.1:8080/api/abitur')
this.deleteAllMessage='THEYRE ALL GONE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
console.log('still ok')
} catch (error) {
console.log('bullshit')
this.deleteAllMessage='THEY SURVIVED. ITS YOUR FAULT!!!!!!!!!!!!!'
}
},
// крч все работать должно, надо просто или прописать отдельные пути с айдишниками, либо в уже существующие добавить айдишники и в контроллерах при наличии айди в параметре заносить его в бд
async generateSlaves() {
if (this.specializations == null || this.specialization.length == 0) {
return
}
console.log(this.specializations)
try {
for(const spec of this.specializations) {
// создаем бедных студентиков сто штучек оптовая цена
console.log('создаем бедных студентиков сто штучек оптовая цена ' + parseInt(spec['id'], 10))
for (let abiturNum = 0 + parseInt(spec['id'], 10) * 100; abiturNum < 100 + parseInt(spec['id'], 10) * 100; abiturNum++) {
console.log('внутри форика ' + abiturNum)
let data = JSON.stringify({
"id": abiturNum,
"first_name": "Vasya " + abiturNum,
"last_name": "Pupkin " + abiturNum,
"middle_name": "Vasylyevich " + abiturNum,
"email": "mylo" + abiturNum,
"password": "parol" + abiturNum
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'http://127.0.0.1:8080/api/abitur/manual',
headers: {
'Content-Type': 'application/json'
},
data : data
};
await axios.request(config)
// как студента с пылу с жару закинули обратно в печь, ему надо дать результаты его писанины три штуки на руки
console.log('как студента с пылу с жару закинули обратно в печь, ему надо дать результаты его писанины три штуки на руки')
for(let resultNum = 0; resultNum < 3; resultNum++) {
console.log('писанина №' + resultNum)
let dataResult = JSON.stringify({
"id": abiturNum*3 + resultNum,
"title": 'Предмет' + resultNum,
"result": this.getRandomInt(100),
"abitur_id": abiturNum
});
console.log('завещание составлено')
console.log(dataResult)
let configResult = {
method: 'post',
maxBodyLength: Infinity,
url: 'http://127.0.0.1:8080/api/examresult/manual',
headers: {
'Content-Type': 'application/json'
},
data : dataResult
};
console.log('завещание настроено')
await axios.request(configResult)
console.log('завещание отправлено')
}
// теперь студентику будущему добавим заявку на поступление в шарагу местную
console.log('теперь студентику будущему добавим заявку на поступление в шарагу местную ')
let dataRequest = JSON.stringify({
"id": abiturNum,
"abitur_id": abiturNum,
"education_form_id": 2,
"specialization_id": parseInt(spec['id'], 10)
});
let configRequest = {
method: 'post',
maxBodyLength: Infinity,
url: 'http://127.0.0.1:8080/api/request/manual',
headers: {
'Content-Type': 'application/json'
},
data : dataRequest
};
await axios.request(configRequest)
// добавим к заявочке результаты писанин и вуаля
console.log('добавим к заявочке результаты писанин и вуаля ')
for(let resultNum = 0; resultNum < 3; resultNum++) {
let dataRecord = JSON.stringify({
"request_id": abiturNum,
"exam_result_id": abiturNum * 3 + resultNum,
});
let configRecord = {
method: 'post',
maxBodyLength: Infinity,
url: 'http://127.0.0.1:8080/api/request_examresult',
headers: {
'Content-Type': 'application/json'
},
data : dataRecord
};
await axios.request(configRecord)
}
console.log('готово номер ' + spec['id'])
}
this.magicMessage='MAGIC IS SOOOOOOOOO READY'
}
} catch (error) {
this.magicMessage='MAGIC IS SOOOOOOOOO FAILED'
}
},
getRandomInt(max) {
console.log('matan start')
var matan = Math.floor(Math.random() * max);
console.log('matan end')
return matan
}
},
async created() {
this.specializations = (await axios.get('http://127.0.0.1:8080/api/specialization')).data
this.specialization = this.specializations[0]
}
}
</script>
<style lang="">
</style>

View File

@ -5,6 +5,8 @@ import { createRouter, createWebHistory } from "vue-router"
import Auth from './components/Auth'
import AbiturMain from './components/AbiturMain'
import Request from './components/Request'
import Test from './components/TestPage'
import Enter from './components/Enter'
const routes = [
{
@ -23,6 +25,16 @@ const routes = [
name: 'Request',
component: Request,
props: true
},
{
path:'/test',
component: Test,
name: 'Test'
},
{
path:'/enter',
component: Enter,
name: 'Enter'
}
]