fix
This commit is contained in:
1 parent
9a4e6152bb
commit
19aa061230
3 files changed
+30
-33
No files matched your search
@@ -7,7 +7,7 @@
|
||||
</v-card-text>
|
||||
<v-img cover :src="voteCard.pictures" />
|
||||
<v-card-text class="text-body-1">{{ voteCard.subtitle }}</v-card-text>
|
||||
<TimerUI :endTime="voteCard.endDate" />
|
||||
<TimerUI :endTime="voteCard.dateend" />
|
||||
<v-card-actions class="justify-space-between">
|
||||
<v-btn
|
||||
v-if="!voteCard.voted"
|
||||
@@ -42,7 +42,7 @@ export default {
|
||||
title: "Допустим, здесь могла быть ваша реклама",
|
||||
subtitle: "Но таких денег у вас нет, чтобы получить ее на нашем прекрасном голосовании",
|
||||
pictures: "https://cdn.vuetifyjs.com/images/parallax/material.jpg",
|
||||
endDate: new Date(new Date().getTime() + 600000),
|
||||
dateend: new Date(new Date().getTime() + 600000),
|
||||
voted: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,21 +98,21 @@ async function getVotes(status) {
|
||||
}
|
||||
}
|
||||
|
||||
getVotes('completed')
|
||||
.then(data => {
|
||||
console.log('Завершённые голосования:', data);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Ошибка:', err);
|
||||
});
|
||||
// getVotes('completed')
|
||||
// .then(data => {
|
||||
// console.log('Завершённые голосования:', data);
|
||||
// })
|
||||
// .catch(err => {
|
||||
// console.error('Ошибка:', err);
|
||||
// });
|
||||
|
||||
getVotes('active')
|
||||
.then(data => {
|
||||
console.log('Активные голосования:', data);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Ошибка:', err);
|
||||
});
|
||||
// getVotes('active')
|
||||
// .then(data => {
|
||||
// console.log('Активные голосования:', data);
|
||||
// })
|
||||
// .catch(err => {
|
||||
// console.error('Ошибка:', err);
|
||||
// });
|
||||
|
||||
async function createVote(voteData, files) {
|
||||
try {
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
:key="voting.id"
|
||||
cols="12" lg="3" md="4"
|
||||
>
|
||||
<v-card :class="{ 'voted-card': voting.voted }">
|
||||
<VoteCardVue :voteCard="voting"/>
|
||||
<!-- <v-card :class="{ 'voted-card': voting.voted }">
|
||||
<v-card-title class="d-flex justify-space-between">{{ voting.title }}
|
||||
<v-btn flat size="medium" @click="openEditVoteModal(voting)">
|
||||
<v-icon color="orange-lighten-1">mdi-pencil</v-icon>
|
||||
@@ -48,7 +49,7 @@
|
||||
<v-icon>mdi-delete</v-icon>
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-card> -->
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
@@ -143,34 +144,30 @@
|
||||
import {computed, ref} from "vue";
|
||||
import VoteConstructor from "@/components/vote/VoteConstructor.vue";
|
||||
import CurrentVote from "@/components/vote/CurrentVote.vue";
|
||||
import VoteCardVue from "@/components/vote/VoteCard.vue";
|
||||
import {votingData} from '@/test/testDataForVote'
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
votingData() {
|
||||
return votingData
|
||||
}
|
||||
},
|
||||
components: {CurrentVote, VoteConstructor},
|
||||
components: {CurrentVote, VoteConstructor, VoteCardVue},
|
||||
setup() {
|
||||
const currentTab = ref("current");
|
||||
const votes = ref([
|
||||
{
|
||||
id: 1,
|
||||
title: "Голосование 1",
|
||||
endDate: new Date(new Date().getTime() + 600000), // 10 минут
|
||||
dateend: new Date(new Date().getTime() + 600000), // 10 минут
|
||||
voted: false,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: "Голосование 2",
|
||||
endDate: new Date(new Date().getTime() - 600000), // Уже завершено
|
||||
dateend: new Date(new Date().getTime() - 600000), // Уже завершено
|
||||
voted: true,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: "Голосование 3",
|
||||
endDate: new Date(new Date().getTime() + 3600000), // 1 час
|
||||
dateend: new Date(new Date().getTime() + 3600000), // 1 час
|
||||
voted: true,
|
||||
},
|
||||
]);
|
||||
@@ -182,19 +179,19 @@ export default {
|
||||
|
||||
const sortedCurrentVotes = computed(() => {
|
||||
return votes.value
|
||||
.filter((v) => new Date(v.endDate) > new Date())
|
||||
.sort((a, b) => new Date(a.endDate) - new Date(b.endDate));
|
||||
.filter((v) => new Date(v.dateend) > new Date())
|
||||
.sort((a, b) => new Date(a.dateend) - new Date(b.dateend));
|
||||
});
|
||||
|
||||
const sortedCompletedVotes = computed(() => {
|
||||
return votes.value
|
||||
.filter((v) => new Date(v.endDate) <= new Date())
|
||||
.sort((a, b) => new Date(b.endDate) - new Date(a.endDate));
|
||||
.filter((v) => new Date(v.dateend) <= new Date())
|
||||
.sort((a, b) => new Date(b.dateend) - new Date(a.dateend));
|
||||
});
|
||||
|
||||
const timeRemaining = (endDate) => {
|
||||
const timeRemaining = (dateend) => {
|
||||
const now = new Date();
|
||||
const diff = new Date(endDate) - now;
|
||||
const diff = new Date(dateend) - now;
|
||||
return diff > 0 ? `${Math.floor(diff / 60000)} минут` : "Завершено";
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user