투표 수정정
This commit is contained in:
parent
1fef343fd9
commit
78eefe5a7f
@ -29,7 +29,7 @@
|
|||||||
<small ><strong>{{ truncateTitle(item.localVote.LOCVOTTTL) }}</strong></small>
|
<small ><strong>{{ truncateTitle(item.localVote.LOCVOTTTL) }}</strong></small>
|
||||||
</div>
|
</div>
|
||||||
<small class="d-flex align-items-center lh-1 me-4 mb-4 mb-sm-0"><span >
|
<small class="d-flex align-items-center lh-1 me-4 mb-4 mb-sm-0"><span >
|
||||||
</span> {{ getDaysAgo(item.localVote.formatted_LOCVOTEDT) }} ({{item.localVote.total_voted}}/{{ item.localVote.total_votable }})</small>
|
</span>{{getDaysAgo(item.localVote.formatted_LOCVOTEDT)}}({{item.localVote.total_voted}}/{{ item.localVote.total_votable }})</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -58,6 +58,7 @@
|
|||||||
<template #body>
|
<template #body>
|
||||||
<div>
|
<div>
|
||||||
<vote-list
|
<vote-list
|
||||||
|
:key="voteListKey"
|
||||||
:data="selectVoteDate"
|
:data="selectVoteDate"
|
||||||
@checkedNames="checkedNames"
|
@checkedNames="checkedNames"
|
||||||
@addContents="addContents"
|
@addContents="addContents"
|
||||||
@ -70,9 +71,6 @@
|
|||||||
<BackButton @click="closeModal" />
|
<BackButton @click="closeModal" />
|
||||||
</template>
|
</template>
|
||||||
</CenterModal>
|
</CenterModal>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -83,8 +81,12 @@ import CenterModal from '@c/modal/CenterModal.vue';
|
|||||||
import BackButton from '@c/button/BackBtn.vue';
|
import BackButton from '@c/button/BackBtn.vue';
|
||||||
import voteList from '@c/voteboard/voteCardList.vue';
|
import voteList from '@c/voteboard/voteCardList.vue';
|
||||||
import { useToastStore } from '@s/toastStore';
|
import { useToastStore } from '@s/toastStore';
|
||||||
const toastStore = useToastStore();
|
|
||||||
|
|
||||||
|
const toastStore = useToastStore();
|
||||||
|
const currentPage = ref(1);
|
||||||
|
const voteset = ref(0);
|
||||||
|
const voteListData= ref([]);
|
||||||
|
const voteListKey = ref(0); //초기화
|
||||||
// 로그 모달 상태
|
// 로그 모달 상태
|
||||||
const isModalOpen = ref(false);
|
const isModalOpen = ref(false);
|
||||||
const selectVoteDate = ref([]);
|
const selectVoteDate = ref([]);
|
||||||
@ -99,8 +101,8 @@ const openModal = async (id) => {
|
|||||||
// 로그 모달 닫기
|
// 로그 모달 닫기
|
||||||
const closeModal = () => {
|
const closeModal = () => {
|
||||||
isModalOpen.value = false;
|
isModalOpen.value = false;
|
||||||
|
voteListKey.value++;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 프로필 이미지
|
// 프로필 이미지
|
||||||
const baseUrl = $api.defaults.baseURL.replace(/api\/$/, '');
|
const baseUrl = $api.defaults.baseURL.replace(/api\/$/, '');
|
||||||
const defaultProfile = "/img/icons/icon.png";
|
const defaultProfile = "/img/icons/icon.png";
|
||||||
@ -111,9 +113,6 @@ const setDefaultImage = (event) => {
|
|||||||
event.target.src = defaultProfile;
|
event.target.src = defaultProfile;
|
||||||
};
|
};
|
||||||
|
|
||||||
const currentPage = ref(1);
|
|
||||||
const voteset = ref(0);
|
|
||||||
const voteListData= ref([]);
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getvoteList();
|
getvoteList();
|
||||||
});
|
});
|
||||||
@ -121,44 +120,63 @@ onMounted(() => {
|
|||||||
//투표목록
|
//투표목록
|
||||||
const getvoteList = () => {
|
const getvoteList = () => {
|
||||||
$api.get('vote/getVoteList',{
|
$api.get('vote/getVoteList',{
|
||||||
//목록조회시 파라미터 전달
|
params:
|
||||||
params:
|
{
|
||||||
{
|
page: 1
|
||||||
page: 1
|
,voteset:'2' //투표중
|
||||||
,voteset:'2' //투표중
|
,myVote:'2' //내가 안한 투표
|
||||||
,myVote:'2' //내가 안한 투표
|
}
|
||||||
}
|
}).then(res => {
|
||||||
}).then(res => {
|
voteListData.value = res.data.data.list;
|
||||||
voteListData.value = res.data.data.list;
|
voteListData.value = res.data.data.list.slice(0, 6);
|
||||||
voteListData.value = res.data.data.list.slice(0, 6);
|
})
|
||||||
|
};
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
//투표하기
|
//투표하기
|
||||||
const checkedNames = (numList) => {
|
const checkedNames = (numList) => {
|
||||||
$api.post('vote/insertCheckedNums',{
|
$api.post('vote/insertCheckedNums',{
|
||||||
checkedList :numList
|
checkedList :numList
|
||||||
,votenum : numList[0].LOCVOTSEQ
|
,votenum : numList[0].LOCVOTSEQ
|
||||||
}).then((res)=>{
|
}).then((res)=>{
|
||||||
if(res.data.status === 'OK'){
|
if(res.data.status === 'OK'){
|
||||||
toastStore.onToast('투표가 완료되었습니다.', 's');
|
toastStore.onToast('투표가 완료되었습니다.', 's');
|
||||||
isModalOpen.value = false;
|
isModalOpen.value = false;
|
||||||
getvoteList();
|
getvoteList();
|
||||||
}
|
voteListKey.value++;
|
||||||
})
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
//투표항목추가
|
//투표항목추가
|
||||||
const addContents = (itemList, voteId) => {
|
const addContents = (itemList, voteId) => {
|
||||||
console.log('itemList',itemList)
|
|
||||||
$api.post('vote/insertWord',{
|
$api.post('vote/insertWord',{
|
||||||
itemList :itemList
|
itemList :itemList
|
||||||
,voteId :voteId
|
,voteId :voteId
|
||||||
}).then((res)=>{
|
}).then((res)=>{
|
||||||
if(res.data.status === 'OK'){
|
if(res.data.status === 'OK'){
|
||||||
toastStore.onToast('항목이 등록되었습니다.', 's');
|
toastStore.onToast('항목이 등록되었습니다.', 's');
|
||||||
|
getvoteList();
|
||||||
|
const updatedVote = selectVoteDate.value.find(vote => vote.localVote.LOCVOTSEQ === voteId);
|
||||||
|
if (updatedVote) {
|
||||||
|
if (!updatedVote.voteDetails) {
|
||||||
|
updatedVote.voteDetails = [];
|
||||||
|
}
|
||||||
|
const maxSeq = updatedVote.voteDetails.reduce((max, item) => {
|
||||||
|
return item.VOTDETSEQ > max ? item.VOTDETSEQ : max;
|
||||||
|
}, 0);
|
||||||
|
// 새 항목을 voteDetails에 추가
|
||||||
|
itemList.forEach(item => {
|
||||||
|
updatedVote.voteDetails.push({
|
||||||
|
VOTDETSEQ: maxSeq + 1,
|
||||||
|
LOCVOTSEQ: voteId,
|
||||||
|
LOCVOTCON: item.content,
|
||||||
|
LOCVOTLIK: item.url,
|
||||||
|
VOTE_COUNT: 0,
|
||||||
|
yesvote: 0
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
//투표종료
|
//투표종료
|
||||||
const endVoteId = (endVoteId) => {
|
const endVoteId = (endVoteId) => {
|
||||||
@ -209,9 +227,9 @@ const getDaysAgo = (dateString) => {
|
|||||||
const dayDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24))+1; // 일 단위 변환
|
const dayDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24))+1; // 일 단위 변환
|
||||||
|
|
||||||
// 오늘 날짜인 경우 "오늘" 반환
|
// 오늘 날짜인 경우 "오늘" 반환
|
||||||
if (dayDiff === 0) return "금일 종료";
|
if (dayDiff === 0) return "⏰금일 종료";
|
||||||
|
|
||||||
return ` ⏰종료 ${Math.abs(dayDiff)}일 전`;
|
return `⏰종료 ${Math.abs(dayDiff)}일 전`;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<ul class="list-group list-group-flush">
|
<ul class="list-group list-group-flush">
|
||||||
<li class="list-group-item d-flex justify-content-between align-items-center flex-wrap border-top-0 p-0">
|
<li class="list-group-item d-flex justify-content-between align-items-center flex-wrap border-top-0 p-0">
|
||||||
<div class="d-flex flex-wrap align-items-center">
|
<div class="d-flex flex-wrap align-items-center">
|
||||||
<ul class="list-unstyled users-list d-flex align-items-center avatar-group m-0 me-2">
|
<ul class="list-unstyled users-list d-flex align-items-center avatar-group">
|
||||||
<vote-complete-user-list-card :data="data"/>
|
<vote-complete-user-list-card :data="data"/>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
<img
|
<img
|
||||||
class="rounded-circle user-avatar border border-3"
|
class="rounded-circle user-avatar border border-3"
|
||||||
:src="`${baseUrl}upload/img/profile/${data.MEMBERPRF}`"
|
:src="`${baseUrl}upload/img/profile/${data.MEMBERPRF}`"
|
||||||
:style="`border-color: ${data.usercolor} !important;`"
|
:style="`border-color: ${data.usercolor} !important; width: 90%; height: auto;`"
|
||||||
@error="$event.target.src = '/img/icons/icon.png'"
|
@error="$event.target.src = '/img/icons/icon.png'"
|
||||||
alt="user"
|
alt="user"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<ul class="list-group list-group-flush">
|
<ul class="list-group list-group-flush">
|
||||||
<li class="list-group-item d-flex justify-content-between align-items-center flex-wrap border-top-0 p-0">
|
<li class="list-group-item d-flex justify-content-between align-items-center flex-wrap border-top-0 p-0">
|
||||||
<div class="d-flex flex-wrap align-items-center">
|
<div class="d-flex flex-wrap align-items-center">
|
||||||
<ul class="list-unstyled users-list d-flex align-items-center avatar-group m-0 me-2">
|
<ul class="list-unstyled users-list d-flex align-items-center avatar-group ">
|
||||||
<vote-in-complete-user-list-card :data="data" />
|
<vote-in-complete-user-list-card :data="data" />
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
<img
|
<img
|
||||||
class="rounded-circle user-avatar border border-3"
|
class="rounded-circle user-avatar border border-3"
|
||||||
:src="`${baseUrl}upload/img/profile/${data.MEMBERPRF}`"
|
:src="`${baseUrl}upload/img/profile/${data.MEMBERPRF}`"
|
||||||
:style="`border-color: ${data.usercolor} !important;`"
|
:style="`border-color: ${data.usercolor} !important; width: 90%; height: auto;`"
|
||||||
@error="$event.target.src = '/img/icons/icon.png'"
|
@error="$event.target.src = '/img/icons/icon.png'"
|
||||||
alt="user"
|
alt="user"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<div class="d-flex align-items-start mt-3">
|
<div class="d-flex align-items-start mt-3">
|
||||||
<!--투표한 사람 목록 -->
|
<!--투표한 사람 목록 -->
|
||||||
<div class="d-flex align-items-center gap-2 flex-wrap">
|
<div class="d-flex align-items-center gap-2 flex-wrap">
|
||||||
<i class='bx bxs-user-check link-info fa-3x'></i>
|
<i class='bx bxs-user-check link-info fa-2x'></i>
|
||||||
<vote-complete-user-list
|
<vote-complete-user-list
|
||||||
v-for="(item, index) in voetedUsers"
|
v-for="(item, index) in voetedUsers"
|
||||||
:key="index"
|
:key="index"
|
||||||
@ -11,7 +11,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- 투표안한 사람 목록 -->
|
<!-- 투표안한 사람 목록 -->
|
||||||
<div class="d-flex align-items-center gap-2 ms-auto flex-wrap">
|
<div class="d-flex align-items-center gap-2 ms-auto flex-wrap">
|
||||||
<i class='bx bxs-user-x link-danger fa-3x'></i>
|
<i class='bx bxs-user-x link-danger fa-2x'></i>
|
||||||
<vote-in-complete-user-list
|
<vote-in-complete-user-list
|
||||||
v-for="(item, index) in noVoetedUsers"
|
v-for="(item, index) in noVoetedUsers"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user