Compare commits
No commits in common. "75c11b36a602a2a6940a7eda1fd0ea216883ceed" and "a9b92b334fc31fda73812041cfe1e3843cf844b1" have entirely different histories.
75c11b36a6
...
a9b92b334f
@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, nextTick, watch, onMounted } from 'vue';
|
import { ref, nextTick, watch, onMounted } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
import { host } from './net';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
@ -27,7 +28,7 @@
|
|||||||
|
|
||||||
function getTeam() {
|
function getTeam() {
|
||||||
fetch(
|
fetch(
|
||||||
"/team",
|
host+"/team",
|
||||||
{
|
{
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
@ -51,9 +52,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addAction() {
|
function addAction() {
|
||||||
fetch(
|
fetch(host+"/team/actions", {
|
||||||
"/team/actions",
|
|
||||||
{
|
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"X-Id": sessionStorage.getItem("teamId") || "",
|
"X-Id": sessionStorage.getItem("teamId") || "",
|
||||||
@ -62,8 +61,7 @@
|
|||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
"place": place.value
|
"place": place.value
|
||||||
})
|
})
|
||||||
}
|
})
|
||||||
)
|
|
||||||
.then(async () => {place.value = ""})
|
.then(async () => {place.value = ""})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,20 +1,15 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
import { host } from './net';
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const login = ref("")
|
const login = ref("")
|
||||||
const password = ref("")
|
const password = ref("")
|
||||||
const buttonText = ref("Вход")
|
|
||||||
const errorMsg = ref("")
|
|
||||||
|
|
||||||
function onClickLogin() {
|
function onClickLogin() {
|
||||||
const oldText = buttonText.value
|
|
||||||
buttonText.value = "Загрузка..."
|
|
||||||
errorMsg.value = ""
|
|
||||||
fetch(
|
fetch(
|
||||||
"/team",
|
host+"/team",
|
||||||
{
|
{
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
@ -29,15 +24,11 @@
|
|||||||
sessionStorage.setItem("password", password.value)
|
sessionStorage.setItem("password", password.value)
|
||||||
router.push('/');
|
router.push('/');
|
||||||
}
|
}
|
||||||
if (response.status == 401) {
|
|
||||||
errorMsg.value = "Не верны название команды или пароль"
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(error => {console.error('Ошибка:', error)});
|
||||||
errorMsg.value = "Сервер не доступен"
|
|
||||||
})
|
|
||||||
.finally(() => {buttonText.value = oldText});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onClickLogin()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -54,18 +45,12 @@
|
|||||||
<input class="input-custom" v-model="password" type="text" placeholder="Пароль" autocapitalize="off">
|
<input class="input-custom" v-model="password" type="text" placeholder="Пароль" autocapitalize="off">
|
||||||
</div>
|
</div>
|
||||||
<div class="button-container">
|
<div class="button-container">
|
||||||
<button class="button-custom" type="submit">{{ buttonText }}</button>
|
<button class="button-custom" type="submit">Вход</button>
|
||||||
</div>
|
|
||||||
<div class="error-message">
|
|
||||||
{{ errorMsg }}
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.error-message {
|
|
||||||
color: brown;
|
|
||||||
margin: 16px 0;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
1
src/components/net.ts
Normal file
1
src/components/net.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export const host = "http://192.168.0.110:8090"
|
Loading…
x
Reference in New Issue
Block a user