add doors
This commit is contained in:
parent
4f6a96a49a
commit
48d2a814fe
@ -32,6 +32,27 @@
|
|||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button-dialog {
|
||||||
|
background-color: var(--main-color);
|
||||||
|
font-weight: 600;
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
padding: 6px 14px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 15px;
|
||||||
|
font-size: 16px;
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-dialog:hover {
|
||||||
|
background-color: var(--main-color);
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-dialog:disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
.input-custom, .button-custom {
|
.input-custom, .button-custom {
|
||||||
padding: 12px 16px;
|
padding: 12px 16px;
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
|
|||||||
@ -11,14 +11,23 @@ type Application = {
|
|||||||
name: string
|
name: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Door = {
|
||||||
|
code: string
|
||||||
|
name: string
|
||||||
|
show: boolean
|
||||||
|
}
|
||||||
|
|
||||||
type Action = {
|
type Action = {
|
||||||
id: string
|
id: string
|
||||||
place: string
|
place: string
|
||||||
name: string
|
name: string
|
||||||
text: string
|
text: string
|
||||||
applications: Application[]
|
applications: Application[]
|
||||||
|
hidden: boolean
|
||||||
|
doors: Door[]
|
||||||
|
|
||||||
isOpen: boolean
|
isOpen: boolean
|
||||||
|
buttons: Door[]
|
||||||
}
|
}
|
||||||
|
|
||||||
type Team = {
|
type Team = {
|
||||||
@ -71,7 +80,6 @@ function getTeam() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const res = response.json()
|
const res = response.json()
|
||||||
console.log(res)
|
|
||||||
return res
|
return res
|
||||||
})
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
@ -88,6 +96,10 @@ function getTeam() {
|
|||||||
if (actions.value.length !== newActions?.length) {
|
if (actions.value.length !== newActions?.length) {
|
||||||
actions.value = newActions
|
actions.value = newActions
|
||||||
}
|
}
|
||||||
|
for (let i = 0; i < team.value.actions.length; i++) {
|
||||||
|
const element = team.value.actions[i];
|
||||||
|
team.value.actions[i].buttons = element.doors.filter((door) => { return door.show })
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error('Ошибка:', error)
|
console.error('Ошибка:', error)
|
||||||
@ -101,6 +113,12 @@ function addAction() {
|
|||||||
place.value = ""
|
place.value = ""
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
letsgo(placeValue)
|
||||||
|
place.value = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
function letsgo(place: string) {
|
||||||
|
console.log("letsgo to " + place)
|
||||||
fetch(
|
fetch(
|
||||||
getApiUrl("/team/actions"),
|
getApiUrl("/team/actions"),
|
||||||
{
|
{
|
||||||
@ -110,11 +128,10 @@ function addAction() {
|
|||||||
"X-Password": password.value
|
"X-Password": password.value
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
"place": placeValue
|
"place": place
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(async () => { place.value = "" })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const scrollToBottom = async (behavior: ScrollBehavior = 'smooth'): Promise<void> => {
|
const scrollToBottom = async (behavior: ScrollBehavior = 'smooth'): Promise<void> => {
|
||||||
@ -237,6 +254,12 @@ onMounted(() => {
|
|||||||
<div class="message-content">
|
<div class="message-content">
|
||||||
{{ action.text }}
|
{{ action.text }}
|
||||||
</div>
|
</div>
|
||||||
|
<hr class="hr" v-if="action.buttons?.length" />
|
||||||
|
<button v-for="door in action.buttons" :key="door.code" class="button-dialog"
|
||||||
|
v-on:click="letsgo(door.code)" :disabled="gameState !== 'RUN' || !door.show">
|
||||||
|
{{ door.name }}
|
||||||
|
</button>
|
||||||
|
|
||||||
<hr class="hr" v-if="action.applications.length" />
|
<hr class="hr" v-if="action.applications.length" />
|
||||||
<div class="message-footer" v-for="application in action.applications" :key="application.name">
|
<div class="message-footer" v-for="application in action.applications" :key="application.name">
|
||||||
Приложение: {{ application.name }}
|
Приложение: {{ application.name }}
|
||||||
@ -357,9 +380,12 @@ body {
|
|||||||
.text-truncate {
|
.text-truncate {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
white-space: nowrap; /* Запрещаем перенос текста */
|
white-space: nowrap;
|
||||||
overflow: hidden; /* Обрезаем все, что не помещается */
|
/* Запрещаем перенос текста */
|
||||||
text-overflow: ellipsis; /* Добавляем троеточие */
|
overflow: hidden;
|
||||||
|
/* Обрезаем все, что не помещается */
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
/* Добавляем троеточие */
|
||||||
padding: 2px 7px;
|
padding: 2px 7px;
|
||||||
margin: 0 20px;
|
margin: 0 20px;
|
||||||
background: rgb(40, 69, 87);
|
background: rgb(40, 69, 87);
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
export function getApiUrl(path: string) {
|
export function getApiUrl(path: string) {
|
||||||
const url = "http://" + window.location.host.split(":")[0] + ":8090" + path
|
const url = "http://" + window.location.host.split(":")[0] + ":8090" + path
|
||||||
console.log(url)
|
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user