투표 수정정

This commit is contained in:
khj0414 2025-04-04 10:37:48 +09:00
parent 1fef343fd9
commit 78eefe5a7f
6 changed files with 62 additions and 44 deletions

View File

@ -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,7 +120,6 @@ onMounted(() => {
// //
const getvoteList = () => { const getvoteList = () => {
$api.get('vote/getVoteList',{ $api.get('vote/getVoteList',{
//
params: params:
{ {
page: 1 page: 1
@ -131,7 +129,6 @@ const getvoteList = () => {
}).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);
}) })
}; };
@ -145,18 +142,39 @@ const checkedNames = (numList) => {
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
});
});
}
} }
}) })
} }
@ -209,7 +227,7 @@ 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)}일 전`;
}; };

View File

@ -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>

View File

@ -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"
/> />

View File

@ -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>

View File

@ -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"
/> />

View File

@ -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"