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