Commit d3e9eefb authored by xiaoye's avatar xiaoye

fix

parent 9f836d6b
......@@ -2,7 +2,7 @@
<view id = 'page'>
<view id = 'head'>
<view>
<button id = 'search_button' class = 'click' @click = 'page.show.search()'>
<button class = 'button click' @click = 'page.show.search()'>
<uni-icons class = 'click' :type = "page.search ? 'left' : 'search'"></uni-icons>
</button>
</view>
......@@ -93,7 +93,7 @@
>
</uni-data-select>
<br>
<view id = 'search_button' class = 'click' @click = 'search.on()'>
<view class = 'button click' @click = 'search.on()'>
<view class = 'click'>
<span class = 'click'>搜索</span>
<uni-icons class = 'click' type = 'search'></uni-icons>
......@@ -153,13 +153,13 @@
import { selectTournament } from '../script/const.ts'
import PageTournament from './tournament.vue';
const token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Nzc3NjY4LCJpYXQiOjE3NDUzODcwNDksImV4cCI6MTc3NjkyMzA0OX0.pyyGtE_WjU8qtz1r2NKbe3jufsYW1PCk6wnczxuMHmM'
let page = reactive({
user : false,
search : false,
menu : true,
tournament : false,
// menu : true,
// tournament : false,
menu : false,
tournament : true,
show : {
user : () : void => {
page.user = !page.user;
......
<template>
<view class = 'PageTournament'>
<uni-card
<!-- <uni-card
v-if = 'tournament.tournament'
:is-full = 'true'
:title = 'tournament.tournament.name'
:sub-title = 'tournament.tournament.description'
:extra = 'tournament.tournament.createdAt.toLocaleDateString()'
>
> -->
<uni-card>
<uni-forms>
<uni-forms-item>
<uni-easyinput type = 'text' placeholder = '添加选手' v-model = 'participant.name'/>
</uni-forms-item>
<view class = 'button' @click = 'participant.add()'>
<uni-icons type = 'personadd'></uni-icons>
</view>
<!-- <view class = 'button' @click = 'participant.add()'>
<uni-icons type = 'personadd'></uni-icons>
</view> -->
</uni-forms>
<br>
<uni-card
:is-full = 'true'
title = '参与者'
......@@ -32,12 +45,15 @@
>
<template v-slot:header>
{{ i.player1Id }}
<br>
{{ i.player1Score }}
</template>
<template v-slot:body>
{{ i.player1Id }}
</template>
<template v-slot:footer>
{{ i.player2Id }}
<br>
{{ i.player2Score }}
</template>
</uni-list-item>
</uni-list>
......@@ -66,6 +82,18 @@
}
});
let participant = reactive({
add : async() : Promise<void> => {
// @ts-ignore
if (await Tabulator.Participant.Create(Mycard.token, { name : participant.name, tournamentId : tournament.tournament.id})) {
await (new Promise(resolve => setTimeout(resolve, 500)));
// @ts-ignore
tournament.participants = await Tabulator.Participant.FindALL(Mycard.token, {tournamentId : tournament.tournament.id});
}
},
name : ''
});
onMounted(() => {
// @ts-ignore
emitter.on(selectTournament, tournament.get);
......@@ -75,4 +103,9 @@
// @ts-ignore
emitter.off(selectTournament, tournament.get);
});
</script>
\ No newline at end of file
</script>
<style scoped lang = 'scss'>
@import '../style/style.scss';
@import '../style/tournament.scss';
</style>
\ No newline at end of file
......@@ -13,8 +13,6 @@ class Match {
player2Id : number;
winnerId : number;
childMatchId : number;
player1 : Participant;
player2 : Participant;
constructor(obj : MatchObject) {
this.id = obj.id;
......@@ -29,11 +27,6 @@ class Match {
this.winnerId = obj.winnerId;
this.childMatchId = obj.childMatchId;
}
pushPlayer = (t : Array<Participant>) : void => {
this.player1 = t.find(i => i.id == this.player1Id) as Participant;
this.player2 = t.find(i => i.id == this.player2Id) as Participant;
};
}
......
......@@ -11,7 +11,7 @@
cursor: pointer;
}
}
#search_button {
.button {
width: 30%;
}
}
......@@ -45,7 +45,7 @@
width: var(--size);
height: 80%;
overflow-y: auto;
#search_button {
.button {
border: 1px solid #409eff;
display: grid;
justify-content: center;
......
.PageTournament {
:deep(.uni-forms) {
.button {
border: 1px solid #409eff;
display: flex;
width: 10%;
justify-content: center;
&:hover {
cursor: pointer;
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment