Commit 9f52027c authored by xiaoye's avatar xiaoye

fix

parent d3e9eefb
This diff is collapsed.
This diff is collapsed.
const selectTournament = 'selectTournament';
const selectTournament = '1';
const tournamentInfo = '2';
const tournamentExit = '3';
export {
selectTournament
selectTournament,
tournamentInfo,
tournamentExit
};
\ No newline at end of file
......@@ -49,7 +49,7 @@ class MyCard {
logout() {
window.localStorage.removeItem('mycardLogin');
window.location.href = window.location.href.replace(/\/\?.*/, '');
window.location.replace(window.location.href.replace(/\/\?.*/, ''))
}
}
......
......@@ -18,7 +18,8 @@ import {
ApiKeyObject,
ApiKeyCreateObject,
ApiKeyFindObject,
AllTournament
AllTournament,
AllParticipant
} from './type.ts'
class TabulatorAPI {
......@@ -89,6 +90,10 @@ class TabulatorAPI {
}
},
FindALL : async (token : string, obj : TournamentFindObject = {}) : Promise<AllTournament> => {
const filter = (obj : any) : any => {
const v = obj ?? '';
return v != '' && v != ' ' ? obj : undefined;
}
let response : {
data : {
total : number;
......@@ -101,11 +106,11 @@ class TabulatorAPI {
recordsPerPage : 20,
pageCount : obj.pageCount ?? 1,
id : (obj.id ?? 0) > 0 ? obj.id : undefined,
creator : (obj.creator ?? '') != '' ? obj.creator : undefined,
name : (obj.name ?? '') != '' ? obj.name : undefined,
rule : (obj.rule ?? '') != '' ? obj.rule : undefined,
visibility : (obj.visibility ?? '') != '' ? obj.visibility : undefined,
status : (obj.status ?? '') != '' ? obj.status : undefined,
creator : filter(obj.creator),
name : filter(obj.name),
rule : filter(obj.rule),
visibility : filter(obj.visibility),
status : filter(obj.status),
createdAtBefore: obj.before?.toISOString() ?? undefined,
createdAtAfter: obj.after?.toISOString() ?? undefined
},
......@@ -212,13 +217,17 @@ class TabulatorAPI {
},
}
Participant = {
Create : async (token : string, Data : ParticipantCreateObject) : Promise<boolean> => {
Create : async (token : string, Data : ParticipantCreateObject, Array : Array<Participant>) : Promise<boolean> => {
let response : {
data : {
success : boolean;
}
};
try {
if (Data.name.length == 0)
throw new Error('请填写名称');
if (Array.findIndex(i => Data.name == i.name) > -1)
throw new Error('名称重复');
response = await this.url.post(`/api/participant`, Data, {
headers : {
'x-user-token' : token
......@@ -271,9 +280,10 @@ class TabulatorAPI {
return undefined;
}
},
FindALL : async (token : string, obj : ParticipantFindObject = {}) : Promise<Array<Participant>> => {
FindALL : async (token : string, obj : ParticipantFindObject = {}) : Promise<AllParticipant> => {
let response : {
data : {
total : number;
data : Array<ParticipantObject>;
}
};
......@@ -295,11 +305,17 @@ class TabulatorAPI {
response.data.data.forEach((i : ParticipantObject) => {
participants.push(new Participant(i));
})
return participants;
return {
total : response.data.total,
participants : participants
};
}
catch(error) {
console.error(error);
return [];
return {
total : 0,
participants : []
};
}
},
Update : async (token : string, id : number, Data : ParticipantUpdateObject) : Promise<boolean> => {
......
......@@ -139,6 +139,10 @@ interface AllTournament extends All {
tournaments : Array<Tournament>;
}
interface AllParticipant extends All {
participants : Array<Participant>;
}
export {
Score,
TournamentObject,
......@@ -155,5 +159,6 @@ export {
ApiKeyObject,
ApiKeyCreateObject,
ApiKeyFindObject,
AllTournament
AllTournament,
AllParticipant
}
\ No newline at end of file
......@@ -18,7 +18,7 @@
#body {
width: var(--size);
margin: 0 auto;
:deep(.uni-list-item) {
:deep(#list) {
transition: all 0.3s ease;
&:hover {
cursor: pointer;
......@@ -39,7 +39,7 @@
}
}
}
:deep(#search) {
:deep(#drawer) {
position: absolute;
z-index: 1;
width: var(--size);
......
.PageTournament {
:deep(.uni-forms) {
.button {
border: 1px solid #409eff;
display: flex;
width: 10%;
justify-content: center;
&:hover {
cursor: pointer;
#PageTournament {
:deep(.uni-forms) {
.button_list {
display: flex;
.button {
border: 1px solid #409eff;
display: flex;
width: 20%;
justify-content: center;
&:hover {
cursor: pointer;
}
}
}
}
:deep(.uni-list-item) {
#header {
min-width: 30%;
.rank {
margin-top: 6rpx;
color: #999;
font-size: 12px;
overflow: hidden;
}
}
#footer {
.button {
display: flex;
width: 10%;
justify-content: center;
:hover {
color: red;
cursor: pointer;
}
}
}
}
}
......
.switch {
&-enter-active,
&-leave-active {
transition: opacity 0.5s ease;
}
&-enter-from,
&-leave-to {
opacity: 0;
}
&-enter-to,
&-leave-from {
opacity: 1;
}
}
.move_left {
&-enter-active,
&-leave-active {
transition: transform 0.5s ease;
}
&-enter-from,
&-leave-to {
transform: translateX(-200%);
}
&-enter-to,
&-leave-from {
transform: translateX(0%);
}
}
.move_right {
&-enter-active,
&-leave-active {
transition: transform 0.5s ease;
}
&-enter-from,
&-leave-to {
transform: translateX(200%);
}
&-enter-to,
&-leave-from {
transform: translateX(0%);
}
}
\ No newline at end of file
......@@ -343,7 +343,7 @@
background-color: #fff;
flex-direction: row;
/* #ifdef H5 */
cursor: pointer;
// cursor: pointer;
/* #endif */
}
......
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