투표 수정

This commit is contained in:
khj0414 2025-03-14 15:26:50 +09:00
parent fe8abc7f7c
commit d5c54d8195
11 changed files with 146 additions and 133 deletions

View File

@ -5,28 +5,32 @@
<span v-if="isEssential" class="text-danger">*</span>
</label>
<div class="col-md-10">
<input
:id="name"
class="form-control"
:type="type"
v-model="inputValue"
:maxLength="maxlength"
:placeholder="title"
:disabled="disabled"
:min="min"
autocomplete="off"
@focusout="$emit('focusout', modelValue)"
@input="handleInput"
/>
<div class="d-flex align-items-center">
<input
:id="name"
class="form-control"
:type="type"
v-model="inputValue"
:maxLength="maxlength"
:placeholder="title"
:disabled="disabled"
:min="min"
autocomplete="off"
@focusout="$emit('focusout', modelValue)"
@input="handleInput"
/>
<div v-if="isBtn" class="ms-2">
<slot name="append"></slot>
</div>
</div>
<div class="invalid-feedback" :class="isAlert ? 'd-block' : ''">{{ title }} 확인해주세요.</div>
<!-- 카테고리 중복 -->
<div class="invalid-feedback" :class="isCateAlert ? 'd-block' : ''">카테고리 중복입니다.</div>
</div>
</div>
</template>
<script setup>
import { ref, watch } from 'vue';
import { ref, watch } from 'vue';
// Props
const props = defineProps({
@ -78,6 +82,11 @@
default: '',
required: false,
},
isBtn: {
type: Boolean,
default: false,
required: false,
}
});
// Emits

View File

@ -1,16 +1,16 @@
<template>
<div class="card mb-6" :class="{ 'disabled-class': data.localVote.LOCVOTDDT && (topVoters.length == 1 || data.localVote.LOCVOTRES || voteResult == 0)}">
<div v-if="data.voteMembers.some(item => item.MEMBERSEQ === userStore.user.id)"
class="card mb-6" :class="{ 'disabled-class': data.localVote.LOCVOTDDT && (topVoters.length == 1 || data.localVote.LOCVOTRES || voteResult == 0)}">
<div class="card-body" v-if="!data.localVote.LOCVOTDEL" >
<h5 class="card-title mb-1">
<div class="list-unstyled users-list d-flex align-items-center gap-1">
<img
class="rounded-circle user-avatar border border-3 w-px-40"
:src="`${baseUrl}upload/img/profile/${data.localVote.MEMBERPRF}`"
:style="`border-color: ${data.localVote.usercolor} !important;`"
@error="$event.target.src = '/img/icons/icon.png'"
alt="user"
/>
<img
class="rounded-circle user-avatar border border-3 w-px-40"
:src="`${baseUrl}upload/img/profile/${data.localVote.MEMBERPRF}`"
:style="`border-color: ${data.localVote.usercolor} !important;`"
@error="$event.target.src = '/img/icons/icon.png'"
alt="user"
/>
<div class="w-100">
<div class="d-flex justify-content-between">
<div class="user-info">
@ -23,20 +23,21 @@
<button
v-if="!data.localVote.LOCVOTDDT"
type="button"
class="btn btn-label-danger btn-icon"
class="btn btn-label-danger btn-icon m-1"
@click="endBtn(data.localVote.LOCVOTSEQ)"
><i class="bx bx-power-off"></i>
</button>
<DeleteBtn v-if="!data.localVote.LOCVOTDDT" @click="voteDelete(data.localVote.LOCVOTSEQ)" />
</div>
<p v-if="data.localVote.LOCVOTDDT" class="btn-icon btn-danger rounded-2"><i class="bx bx-power-off"></i></p>
<i v-if="yesVotetotal != '0'" class="bx bxs-check-circle link-success"></i>
</div>
</div>
</div>
</div>
</h5>
<h5 class="mb-1">{{ data.localVote.LOCVOTTTL }}</h5>
<h5 class="mb-1">{{ data.localVote.LOCVOTTTL }}
<i v-if="yesVotetotal != '0'" class="bx bxs-check-circle link-success"></i>
</h5>
<small >{{ data.localVote.formatted_LOCVOTRDT }} ~ {{ data.localVote.formatted_LOCVOTEDT }}</small>
<!-- 투표안했을시-->
<div v-if="data.localVote.LOCVOTDDT && voteResult == 0">
@ -50,9 +51,7 @@
:data="data.voteDetails"
:voteInfo="data.localVote"
:total="data.voteDetails.length "/>
<small v-if="yesVotetotal != 0 && !data.localVote.LOCVOTDDT">투표 완료 : 종료시 투표 결과가 나타납니다.</small>
<!-- 투표 결과 -->
<div v-if="data.localVote.LOCVOTDDT" class="mt-3">
<vote-result-list :data="topVoters" @randomList="randomList" :randomResultNum="data.localVote.LOCVOTRES" :locvotreg="data.localVote.LOCVOTREG"/>
@ -96,6 +95,7 @@ const yesVotetotal = computed(() => {
return props.data.voteDetails.reduce((sum, item) => sum + item.yesvote, 0);
});
// (1)
const topVoters = computed(() => {
// VOTE_COUNT

View File

@ -1,42 +1,42 @@
<template>
<div class="card-text">
<div class="demo-inline-spacing mt-4">
<!-- 투표리스트 -->
<div class="demo-inline-spacing">
<!-- 투표리스트 -->
<div v-for="(item, index) in data"
:key="index">
<vote-card-check-list
:data="item"
:multiIs = voteInfo.LOCVOTMUL
:selectedValues="checkedNames"
@update:selectedValues="updateCheckedNames"
/>
<div v-if="voteInfo.LOCVOTADD ==='1' && index === data.length - 1">
<div v-for="(item, index) in itemList" :key="index" class="d-flex align-items-start mt-2">
<div class="flex-grow-1 me-2 ">
<form-input
:title="'항목 ' + (index + data.length + 1)"
:name="'content' + index"
:is-essential="false"
:is-alert="contentAlerts[index]"
v-model="item.content"
<vote-card-check-list
:data="item"
:multiIs = voteInfo.LOCVOTMUL
:selectedValues="checkedNames"
@update:selectedValues="updateCheckedNames"
/>
<link-input v-model="item.url" />
</div>
<delete-btn @click="removeItem(index)" />
</div>
<div class="mb-4 d-flex justify-content mt-3">
<plus-btn @click="addItem" :disabled="total >= 10" class="mb-2" />
<button class="btn btn-primary btn-icon mb-3" @click="addContentSave(item.LOCVOTSEQ)" :disabled="isSaveDisabled">
<i class="bx bx-check"></i>
</button>
</div>
</div>
<div v-if="voteInfo.LOCVOTADD ==='1' && index === data.length - 1">
<div v-for="(item, index) in itemList" :key="index" class=" mt-2">
<form-input
:title="'항목 ' + (index + data.length + 1)"
:name="'content' + index"
:is-essential="false"
:is-alert="contentAlerts[index]"
v-model="item.content"
:is-btn="true"
>
<template v-slot:append>
<delete-btn @click="removeItem(index)" />
</template>
</form-input>
<link-input v-model="item.url" class="mb-1"/>
</div>
<div class="d-flex justify-content">
<plus-btn @click="addItem" :disabled="total >= 10" class="m-1" />
<button class="btn btn-primary btn-icon mt-1" @click="addContentSave(item.LOCVOTSEQ)" :disabled="isSaveDisabled">
<i class="bx bx-check"></i>
</button>
</div>
</div>
</div>
</div>
</div>
<save-btn class="btn-sm mt-2" @click="selectVote"/>
<save-btn class="mt-2" @click="selectVote"/>
</template>
<script setup>

View File

@ -1,34 +1,34 @@
<template>
<div class="d-flex align-items-center">
<div class="mb-2 row">
<!-- 링크 아이콘 -->
<i class="bx bx-link-alt me-2" @click="togglePopover"></i>
<label for="name" class="col-md-2 col-form-label">
<div class="d-flex align-items-center">
<!-- 링크 아이콘 -->
<i class="bx bx-link-alt me-2" @click="togglePopover"></i>
<!-- 등록된 링크, 입력창이 보이지 않고 등록된 링크만 보일 -->
<span v-if="isLinkSaved && !isPopoverVisible" class="ms-2">
<a :href="formattedLink" class="d-inline-block text-truncate" target="_blank" rel="noopener noreferrer">
{{ link }}
</a>
</span>
</div>
</label>
<!-- 링크 입력창 (옆으로 나오게) -->
<div
v-if="isPopoverVisible"
class="d-flex"
>
<input
v-model="link"
placeholder="URL을 입력해주세요"
class="form-control"
style="min-width: 500px;"
/>
<save-btn class="btn-sm" @click="saveLink"/>
<div v-if="isPopoverVisible" class="col-md-10">
<div class="d-flex align-items-center">
<input
v-model="link"
placeholder="URL을 입력해주세요"
class="form-control me-2"
/>
<save-btn class="btn-icon" @click="saveLink"/>
</div>
</div>
<!-- 등록된 링크, 입력창이 보이지 않고 등록된 링크만 보일 -->
<span v-if="isLinkSaved && !isPopoverVisible" class="ms-2">
<a :href="formattedLink" class="d-inline-block text-truncate" target="_blank" rel="noopener noreferrer">
{{ link }}
</a>
</span>
</div>
</template>
<script setup>
import SaveBtn from '@c/button/SaveBtn.vue'
import { ref, computed } from "vue";
const props = defineProps({

View File

@ -1,19 +1,19 @@
<template>
<div>
<ul class="timeline mb-0">
<li class="timeline-item ps-6 ">
<span class="timeline-indicator-advanced timeline-indicator-primary border-0 shadow-none">
<i class="icon-base bx bx-check-circle"></i>
</span>
<div class="timeline-event ps-1">
<div class="timeline-header">
<small class="text-primary text-uppercase">투표결과</small>
</div>
<h6 v-if="data" class="my-50">{{ data[0].LOCVOTCON }}</h6>
<h6 v-if="randomResultNum" class="my-50">{{randomResultNum }}</h6>
</div>
</li>
</ul>
<ul class="timeline mb-0">
<li class="timeline-item ps-6 ">
<span class="timeline-indicator-advanced timeline-indicator-primary border-0 shadow-none">
<i class="icon-base bx bx-check-circle"></i>
</span>
<div class="timeline-event ps-1">
<div class="timeline-header">
<small class="text-primary text-uppercase">투표결과</small>
</div>
<h6 v-if="data" class="my-50">{{ data[0].LOCVOTCON }}</h6>
<h6 v-if="randomResultNum" class="my-50">{{randomResultNum }}</h6>
</div>
</li>
</ul>
</div>
</template>

View File

@ -1,11 +1,11 @@
<template>
<div class="card mb-6 border border-2 border-primary rounded primary-shadow">
<div class="card-body">
<!-- 1위가 여러개일때 -->
<vote-result-random v-if="topVoters.length > 1" :data="topVoters" :randomResultNum="randomResultNum" :locvotreg="locvotreg"
@randomList="randomList"/>
<!-- 1위가 하나일때-->
<vote-result-card v-if="topVoters.length == 1" :data="topVoters"/>
<!-- 1위가 여러개일때 -->
<vote-result-random v-if="topVoters.length > 1" :data="topVoters" :randomResultNum="randomResultNum" :locvotreg="locvotreg"
@randomList="randomList"/>
<!-- 1위가 하나일때-->
<vote-result-card v-if="topVoters.length == 1" :data="topVoters"/>
</div>
</div>
</template>

View File

@ -1,17 +1,16 @@
<template>
<div v-if="!isRandom && !randomResultNum">
<h6><i class="icon-base bx bx-error icon-lg link-warning"></i> 1위가 중복 되었습니다</h6>
<!-- 중복된 1 리스트 -->
<vote-result-random-list
v-for="(item,index) in data"
:key="index"
:data="item"
:randomResultNum="randomResultNum"/>
<h6><i class="icon-base bx bx-error icon-lg link-warning"></i> 1위가 중복 되었습니다</h6>
<!-- 중복된 1 리스트 -->
<vote-result-random-list
v-for="(item,index) in data"
:key="index"
:data="item"
:randomResultNum="randomResultNum"/>
</div>
<div v-if="isRandom === false && randomResultNum">
<vote-result-card :randomResultNum="randomResultNum"/>
</div>
<button v-if="isRandom" class="btn btn-primary" type="button" disabled="">
<span class="spinner-grow me-1" role="status" aria-hidden="true"></span>
random..

View File

@ -2,7 +2,7 @@
<div class="d-flex align-items-center">
<!--투표한 사람 목록 -->
<div class="d-flex align-items-center gap-2">
<i class='bx bxs-user-check link-info'></i>
<i class='bx bxs-user-check link-info fa-3x'></i>
<vote-complete-user-list
v-for="(item, index) in voetedUsers"
:key="index"
@ -11,7 +11,7 @@
</div>
<!-- 투표안한 사람 목록 -->
<div class="d-flex align-items-center gap-2 ms-auto">
<i class='bx bxs-user-x link-danger'></i>
<i class='bx bxs-user-x link-danger fa-3x'></i>
<vote-in-complete-user-list
v-for="(item, index) in noVoetedUsers"
:key="index"

View File

@ -13,7 +13,7 @@
:is-essential="false"
/>
</div>
<div class="col-2 btn-margin" v-if="!isDisabled">
<div class="col-2" v-if="!isDisabled">
<PlusBtn @click="toggleInput"/>
</div>
</div>

View File

@ -1,21 +1,25 @@
<template>
<div class="container-xxl flex-grow-1 container-p-y">
<div class="row g-3">
<div class="mt-8">
<div class="">
<!-- 투표 작성 -->
<WriteBtn @click="voteWrite" />
<!-- 투표마감/투표중 셀렉트 -->
<FormSelect class="col-3" name="cate" :isLabel="false" title="투표상태" :data="categoryList" @update:data="category = $event" @change="selectHandler"/>
<div v-for="(item, index) in categoryList" @change="selectHandler"
:key="index"
class="form-check form-check-inline" >
<input class="form-check-input" type="radio" name="cate" :id="'inlineRadio' + index"
:value="index" v-model="category">
<label class="form-check-label" :for="'inlineRadio' + index">{{ item }}</label>
</div>
<!-- 내가한 투표 보기 -->
<div class="p-4">
<div class="">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="defaultCheck1" v-model="ischeked" @change="changeCheck">
<label class="form-check-label" for="defaultCheck1"> 내가 투표 </label>
</div>
</div>
<!-- 투표리스트 -->
<div v-if="voteListCardData.length == 0 " class="mt66">등록된 투표가 없습니다.</div>
<div v-if="voteListCardData.length == 0 " >투표가 없습니다.</div>
<vote-list
:data="voteListCardData"
@addContents="addContents"
@ -27,7 +31,7 @@
@randomList="randomList"
/>
</div>
</div>
</div>
<!-- 페이지네이션 -->
<div class="row g-3">
<div class="mt-8">
@ -36,8 +40,7 @@
v-bind="PageData"
:currentPage="currentPage"
@update:currentPage="handlePageChange"
/>
</div>
/>
</div>
</div>
</template>

View File

@ -31,21 +31,23 @@
@change="ValidHandlerendDate"
/>
<!-- 항목 입력 반복 -->
<div v-for="(item, index) in itemList" :key="index" class="d-flex align-items-start ">
<div class="flex-grow-1 me-2 ">
<div v-for="(item, index) in itemList" :key="index">
<form-input
:title="'항목 ' + (index + 1)"
:name="'content' + index"
:is-essential="index < 2"
:is-alert="contentAlerts[index]"
v-model="item.content"
@keyup="ValidHandler('content' + (index + 1))"
/>
:title="'항목 ' + (index + 1)"
:name="'content' + index"
:is-essential="index < 2"
:is-alert="contentAlerts[index]"
v-model="item.content"
@keyup="ValidHandler('content' + (index + 1))"
:is-btn="true"
>
<template v-slot:append>
<delete-btn @click="removeItem(index)" :disabled="index < 2" />
</template>
</form-input>
<link-input v-model="item.url" class="mb-1"/>
</div>
<!-- delete-btn을 오른쪽으로 정렬 -->
<delete-btn @click="removeItem(index)" :disabled="index < 2" />
</div>
<plus-btn @click="addItem" :disabled="itemList.length >= 10" class="mb-3" />
<div>