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