This commit is contained in:
2026-04-07 14:50:23 +09:00
commit b4e485502b
4778 changed files with 2017091 additions and 0 deletions

View File

@@ -0,0 +1,495 @@
<!-- This example requires Tailwind CSS v2.0+ -->
<template>
<div class="pb-8 px-4 sm:px-6 lg:px-8">
<br />
<div class="sm:flex sm:items-center">
<div class="sm:flex-auto">
<h1 class="text-xl font-semibold text-gray-900">
{{ pageTitle }}
</h1>
<p class="mt-2 text-sm text-gray-700">
{{ pageDescription }}
</p>
</div>
<div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">
<div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">
<button
type="button"
class="inline-flex items-center justify-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 sm:w-auto"
@click="$router.push(activeListPath)"
>
활성 항목 리스트
</button>
</div>
<div
v-if="currentTarget == 'inquiry'"
class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none"
>
<label for="mobile-search-candidate" class="sr-only"
>Search</label
>
<label for="desktop-search-candidate" class="sr-only"
>Search</label
>
<div class="flex rounded-md shadow-sm">
<div class="relative flex-grow focus-within:z-10">
<div
class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"
>
<MagnifyingGlassCircleIcon
class="h-5 w-5 text-gray-400"
aria-hidden="true"
/>
</div>
<input
id="mobile-search-candidate"
v-model="searchKeyword"
type="text"
name="mobile-search-candidate"
class="focus:ring-indigo-500 focus:border-indigo-500 block w-full rounded-none rounded-l-md pl-10 sm:hidden border-gray-300"
placeholder=""
/>
<input
id="desktop-search-candidate"
v-model="searchKeyword"
type="text"
name="desktop-search-candidate"
class="hidden focus:ring-indigo-500 focus:border-indigo-500 w-full rounded-none rounded-l-md pl-10 sm:block sm:text-sm border-gray-300"
placeholder=""
/>
</div>
<button
type="button"
class="-ml-px relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-r-md text-gray-700 bg-gray-50 hover:bg-gray-100 focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500"
@click="doAction('search', searchKeyword)"
>
<span class="ml-2">검색</span>
</button>
</div>
</div>
</div>
</div>
<BaseList1
:headings="listHeadings"
:actions="listActions"
:keys="listKeys"
:data="listData"
:action-key="actionKey"
:column-filter="columnFilter"
:do-action="doAction"
/>
<BasePagination1
:total-page-count="totalPageCount"
:current-page-number="currentPageNumber"
:page-size="pageSize"
:records-total="recordsTotal"
:page-move="pageMove"
/>
</div>
</template>
<script setup lang="ts">
import {
ChevronDownIcon,
MagnifyingGlassCircleIcon,
} from '@heroicons/vue/24/solid';
const route = useRoute();
definePageMeta({
middleware: 'check-auth-admin',
});
const searchKeyword = ref('');
const currentTarget = ref('notice');
const pageTitle = ref('제목');
const pageDescription = ref('설명');
const listActions = ref(['상세보기']);
const actionKey = ref('serial');
const listKeys = ref(['serial', 'uid', 'name', 'domain', 'email', 'role']);
const listHeadings = ref([]);
const doActionTargetName = 'admin-support-target-edit';
let listSource = 'list';
let listTarget = 'dummy';
let activeListPath = '/admin/key/deleted';
let makeNewTargetPath = 'admin-support-notice-new';
const inquiryListOptionTags = ['대기중', '검토중', '답변완료', '삭제'];
if (route.params.target instanceof Array) {
if (route.params.target.length != 1) {
throwError('$404');
} else {
if (
route.params.target[0] != 'notice' &&
route.params.target[0] != 'faq' &&
route.params.target[0] != 'inquiry'
) {
throwError('$404');
} else {
currentTarget.value = route.params.target[0];
console.log('currentTarget.value=', currentTarget.value);
switch (route.params.target[0]) {
case 'notice':
pageTitle.value = '삭제된 공지사항';
pageDescription.value =
'삭제된 공지사항을 보고 복구 합니다.';
listHeadings.value = [
{
title: '일련번호',
class: 'py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6',
key: 'serial',
hiddenInfo: {
headClass: 'font-normal lg:hidden',
dts: [],
dds: [],
},
subClass:
'w-full max-w-0 py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:w-auto sm:max-w-none sm:pl-6',
},
{
title: '제목',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 lg:table-cell',
key: 'title',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 lg:table-cell',
},
{
title: '상태',
class: 'px-3 py-3.5 text-left text-sm font-semibold text-gray-900',
key: 'status',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass: 'px-3 py-4 text-sm text-gray-500',
},
{
title: '수정일',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell',
key: 'updated',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 sm:table-cell',
},
{
title: '작성일',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell',
key: 'created',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 sm:table-cell',
},
];
listActions.value = ['상세보기'];
actionKey.value = 'serial';
listKeys.value = [
'serial',
'title',
'status',
'updated',
'created',
];
makeNewTargetPath = '/admin/support/notice/new';
listSource = 'list';
listTarget = 'notice:deleted';
activeListPath =
'/admin/support/' + route.params.target[0] + '/list';
break;
case 'faq':
pageTitle.value = '삭제된 자주 묻는 질문';
pageDescription.value = '삭제된 FAQ를 보고 복구 합니다.';
listHeadings.value = [
{
title: '일련번호',
class: 'py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6',
key: 'serial',
hiddenInfo: {
headClass: 'font-normal lg:hidden',
dts: [],
dds: [],
},
subClass:
'w-full max-w-0 py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:w-auto sm:max-w-none sm:pl-6',
},
{
title: '질문',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 lg:table-cell',
key: 'question',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 lg:table-cell',
},
{
title: '상태',
class: 'px-3 py-3.5 text-left text-sm font-semibold text-gray-900',
key: 'status',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass: 'px-3 py-4 text-sm text-gray-500',
},
{
title: '수정일',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell',
key: 'updated',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 sm:table-cell',
},
{
title: '작성일',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell',
key: 'created',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 sm:table-cell',
},
];
listActions.value = ['상세보기'];
actionKey.value = 'serial';
listKeys.value = [
'serial',
'question',
'status',
'updated',
'created',
];
makeNewTargetPath = '/admin/support/faq/new';
listSource = 'list';
listTarget = 'faq:deleted';
activeListPath =
'/admin/support/' + route.params.target[0] + '/list';
break;
case 'inquiry':
pageTitle.value = '처리 완료된 1:1 문의';
pageDescription.value =
'처리 완료된 1:1 문의 내용을 확인할 수 있습니다.';
listHeadings.value = [
{
title: '일련번호',
class: 'py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6',
key: 'serial',
hiddenInfo: {
headClass: 'font-normal lg:hidden',
dts: [],
dds: [],
},
subClass:
'w-full max-w-0 py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:w-auto sm:max-w-none sm:pl-6',
},
{
title: '아이디',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 lg:table-cell',
key: 'name',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 lg:table-cell',
},
{
title: '제목',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 lg:table-cell',
key: 'title',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 lg:table-cell',
},
{
title: '상태',
class: 'px-3 py-3.5 text-left text-sm font-semibold text-gray-900',
key: 'status',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass: 'px-3 py-4 text-sm text-gray-500',
},
{
title: '수정일',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell',
key: 'updated',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 sm:table-cell',
},
{
title: '작성일',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell',
key: 'created',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 sm:table-cell',
},
];
listActions.value = ['상세보기'];
actionKey.value = 'serial';
listKeys.value = [
'serial',
'name',
'title',
'status',
'updated',
'created',
];
makeNewTargetPath = '/admin/support/inquiry/new';
listSource = 'list';
listTarget = 'admin:inquiry:done';
activeListPath =
'/admin/support/' + route.params.target[0] + '/list';
break;
}
}
}
} else {
throwError('$404');
}
const listData = ref([]);
const totalPageCount = ref(0);
const currentPageNumber = ref(1);
const pageSize = ref(10);
const recordsTotal = ref(0);
// const order = [{ column: 'serial', dir: 'desc' }];
// const columns = { serial: { data: 'serial' } };
const { $dayjs } = useNuxtApp();
function columnFilter(key, val) {
// console.log("columnFilter(), key = ", key, ", val = ", val);
if (key == 'updated' || key == 'created') {
// return $dayjs(val).format('YY/MM/DD A h:mm:ss');
return $dayjs(val).format('YY/MM/DD');
} else if (key == 'status') {
if (currentTarget.value == 'inquiry') {
return inquiryListOptionTags[val];
} else {
return val;
}
} else {
return val;
}
}
const router = useRouter();
function doAction(tag, target) {
console.log('on doAction(), tag=', tag, ', target=', target);
navigateTo('/admin/support/' + currentTarget.value + '/edit/' + target);
/*
router.push({
name: doActionTargetName,
params: { hero: target, target: [currentTarget.value] },
});
*/
}
function makeNewOne() {
/*
router.push({
path: makeNewTargetPath,
params: {},
});
*/
navigateTo({ path: makeNewTargetPath, params: {} });
}
function pageMove(targetPageIdex) {
console.log('on pageMove(), targetPageIdex=', targetPageIdex);
currentPageNumber.value = targetPageIdex;
refresh();
}
async function refresh() {
if (process.client) {
const responseJson = await _crossCtl.doComm(listSource, listTarget, {
start: (currentPageNumber.value - 1) * pageSize.value,
length: pageSize.value,
});
if (responseJson['responseCode'] != 200) {
alert(responseJson['responseMessage']);
} else {
currentPageNumber.value = responseJson['currentPageNumber'];
totalPageCount.value = responseJson['totalPageCount'];
pageSize.value = parseInt(responseJson['pageSize']);
recordsTotal.value = responseJson['recordsTotal'];
listData.value = responseJson['data'];
}
}
}
refresh();
</script>

View File

@@ -0,0 +1,760 @@
<template>
<form @submit.prevent="doUpdate">
<div class="sm:flex sm:items-center">
<div class="sm:flex-auto">
<h1 class="text-xl font-semibold text-gray-900">
{{ newTitle }}
</h1>
<p class="mt-2 text-sm text-gray-700">
{{ newDescription }}
</p>
</div>
<div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">
<img
v-if="inPregressFlag"
width="32"
src="/loading-load-2.gif"
/>
</div>
</div>
<div class="mt-2"></div>
<div v-if="currentTarget == 'inquiry'">
<form action="#" class="relative">
<div
class="border border-gray-300 rounded-lg shadow-sm overflow-hidden focus-within:border-indigo-500 focus-within:ring-1 focus-within:ring-indigo-500"
>
<label for="title" class="sr-only">Title</label>
<input
id="title"
v-model="targetTitle"
disabled
type="text"
name="title"
class="block w-full border-0 pt-2.5 text-lg font-medium placeholder-gray-500 focus:ring-0"
placeholder="Title"
/>
<label for="description" class="sr-only">Description</label>
<textarea
id="description"
v-model="targetContent"
rows="8"
disabled
name="description"
class="block w-full border-0 py-0 resize-none placeholder-gray-500 focus:ring-0 sm:text-sm"
placeholder="Write a description..."
/>
<!-- Spacer element to match the height of the toolbar -->
<div aria-hidden="true">
<div class="py-2">
<div class="h-9" />
</div>
<div class="h-px" />
<div class="py-2">
<div class="py-px">
<div class="h-9" />
</div>
</div>
</div>
</div>
<div class="absolute bottom-0 inset-x-px">
<!-- Actions: These are just examples to demonstrate the concept, replace/wire these up however makes sense for your project. -->
<div
class="flex flex-nowrap justify-end py-2 px-2 space-x-2 sm:px-3"
>
<Listbox
v-model="labelled"
as="div"
class="flex-shrink-0"
>
<ListboxLabel class="sr-only">
Add a label
</ListboxLabel>
<div class="relative">
<ListboxButton
disabled
class="relative inline-flex items-center rounded-full py-2 px-2 bg-gray-50 text-sm font-medium text-gray-500 whitespace-nowrap hover:bg-gray-100 sm:px-3"
>
<TagIcon
:class="[
labelled.value === null
? 'text-gray-300'
: 'text-gray-500',
'flex-shrink-0 h-5 w-5 sm:-ml-1',
]"
aria-hidden="true"
/>
<span
:class="[
labelled.value === null
? ''
: 'text-gray-900',
'hidden truncate sm:ml-2 sm:block',
]"
>{{
labelled.value === null
? 'Label'
: labelled.name
}}</span
>
</ListboxButton>
<transition
leave-active-class="transition ease-in duration-100"
leave-from-class="opacity-100"
leave-to-class="opacity-0"
>
<ListboxOptions
class="absolute right-0 z-10 mt-1 w-52 bg-white shadow max-h-56 rounded-lg py-3 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm"
>
<ListboxOption
v-for="label in labels"
:key="label.value"
v-slot="{ active }"
as="template"
:value="label"
>
<li
:class="[
active
? 'bg-gray-100'
: 'bg-white',
'cursor-default select-none relative py-2 px-3',
]"
>
<div class="flex items-center">
<span
class="block font-medium truncate"
>
{{ label.name }}
</span>
</div>
</li>
</ListboxOption>
</ListboxOptions>
</transition>
</div>
</Listbox>
</div>
<base-attachment-ctl1
:attachments="targetAttachmentFrom"
:read-only-flag="true"
/>
</div>
</form>
<p class="mt-5 text-sm text-gray-700">답변을 작성 하세요.</p>
<div
class="border border-gray-300 rounded-lg shadow-sm overflow-hidden focus-within:border-indigo-500 focus-within:ring-1 focus-within:ring-indigo-500"
>
<label for="answer" class="sr-only">answer</label>
<textarea
id="answer"
v-model="targetAnswer"
:disabled="!(targetStatus == 0 || targetStatus == 1)"
rows="8"
name="answer"
class="m-1 mt-2 block w-full border-0 py-0 resize-none placeholder-gray-500 focus:ring-0 sm:text-sm"
placeholder=""
/>
</div>
<base-attachment-ctl1
:attachments="targetAttachmentTo"
:read-only-flag="false"
:update-attachments="updateAttachments"
/>
</div>
<div v-else>
<TabGroup v-slot="{ selectedIndex }">
<TabList class="flex items-center">
<Tab v-slot="{ selected }" as="template">
<button
:class="[
selected
? 'text-gray-900 bg-gray-100 hover:bg-gray-200'
: 'text-gray-500 hover:text-gray-900 bg-white hover:bg-gray-100',
'px-3 py-1.5 border border-transparent text-sm font-medium rounded-md',
]"
>
입력
</button>
</Tab>
<Tab v-slot="{ selected }" as="template">
<button
:class="[
selected
? 'text-gray-900 bg-gray-100 hover:bg-gray-200'
: 'text-gray-500 hover:text-gray-900 bg-white hover:bg-gray-100',
'ml-2 px-3 py-1.5 border border-transparent text-sm font-medium rounded-md',
]"
>
미리보기
</button>
</Tab>
<!-- These buttons are here simply as examples and don't actually do anything. -->
<div v-if="actionTarget == 'notice'">
<div
v-if="selectedIndex === 0"
class="ml-auto flex items-center space-x-5"
>
<Listbox
v-model="labelled"
as="div"
class="flex-shrink-0"
>
<ListboxLabel class="sr-only">
Add a label
</ListboxLabel>
<div class="relative">
<ListboxButton
class="relative inline-flex items-center rounded-full py-2 px-2 bg-gray-50 text-sm font-medium text-gray-500 whitespace-nowrap hover:bg-gray-100 sm:px-3"
>
<TagIcon
:class="[
labelled.value === null
? 'text-gray-300'
: 'text-gray-500',
'flex-shrink-0 h-5 w-5 sm:-ml-1',
]"
aria-hidden="true"
/>
<span
:class="[
labelled.value === null
? ''
: 'text-gray-900',
'hidden truncate sm:ml-2 sm:block',
]"
>{{
labelled.value === null
? '라벨'
: labelled.name
}}</span
>
</ListboxButton>
<transition
leave-active-class="transition ease-in duration-100"
leave-from-class="opacity-100"
leave-to-class="opacity-0"
>
<ListboxOptions
class="absolute right-0 z-10 mt-1 w-52 bg-white shadow max-h-56 rounded-lg py-3 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm"
>
<ListboxOption
v-for="label in labels"
:key="label.value"
v-slot="{ active }"
as="template"
:value="label"
>
<li
:class="[
active
? 'bg-gray-100'
: 'bg-white',
'cursor-default select-none relative py-2 px-3',
]"
>
<div
class="flex items-center"
>
<span
class="block font-medium truncate"
>
{{ label.name }}
</span>
</div>
</li>
</ListboxOption>
</ListboxOptions>
</transition>
</div>
</Listbox>
</div>
</div>
</TabList>
<TabPanels class="mt-2">
<TabPanel class="p-0.5 -m-0.5 rounded-lg">
<div
class="border border-gray-300 rounded-lg shadow-sm overflow-hidden focus-within:border-indigo-500 focus-within:ring-1 focus-within:ring-indigo-500"
>
<label for="title" class="sr-only">제목</label>
<input
id="title"
v-model="targetTitle"
type="text"
name="title"
class="block w-full border-0 pt-2.5 text-lg font-medium placeholder-gray-500 focus:ring-0"
placeholder="제목"
/>
<label for="content" class="sr-only">내용</label>
<textarea
id="content"
v-model="targetContent"
rows="20"
name="content"
class="block w-full border-0 py-0 resize-none placeholder-gray-500 focus:ring-0 sm:text-sm"
placeholder="내용..."
/>
</div>
</TabPanel>
<TabPanel class="p-0.5 -m-0.5 rounded-lg">
<div class="border-b">
<div
class="mx-px mt-px px-3 pt-2 pb-12 text-sm leading-5 text-gray-800"
>
<div v-if="currentTarget == 'notice'">
<BaseNoticeItem1 :item="previewItem" />
</div>
<div v-else>
<BaseFaqItem1 :item="previewItem" />
</div>
</div>
</div>
</TabPanel>
</TabPanels>
</TabGroup>
</div>
<div class="mt-2 flex justify-between">
<div>
<button
v-if="currentTarget != 'inquiry'"
type="button"
:class="
targetStatus == 0
? 'inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500'
: 'inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500'
"
@click="doToggle"
>
{{ targetStatus == 0 ? '삭제' : '복구' }}
</button>
</div>
<div>
<button
type="button"
class="bg-white py-2 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
@click="doCancel"
>
취소
</button>
<button
type="submit"
class="ml-3 inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
>
{{
targetStatus == 0 || targetStatus == 1 ? '저장' : '확인'
}}
</button>
</div>
</div>
</form>
</template>
<script setup>
import { Tab, TabGroup, TabList, TabPanel, TabPanels } from '@headlessui/vue';
import {
Listbox,
ListboxButton,
ListboxLabel,
ListboxOption,
ListboxOptions,
} from '@headlessui/vue';
import { TagIcon, PaperClipIcon } from '@heroicons/vue/24/solid';
const route = useRoute();
definePageMeta({
middleware: 'check-auth-admin',
});
let labels = [
{ name: '라벨 없음', value: null },
{ name: '공지', value: 'notice' },
{ name: '이벤트', value: 'event' },
// More items...
];
const labelled = ref(labels[0]);
const newTitle = ref('');
const newDescription = ref('');
const contentTitle = ref('');
const contentMessageGuide = ref('');
const currentTarget = ref('notice');
let actionTarget = 'notice';
const inPregressFlag = ref(false);
const targetTitle = ref('');
const targetContent = ref('');
const targetAttachmentFrom = ref([]);
const targetAnswer = ref('');
const targetAttachmentTo = ref([]);
const targetStatus = ref(0);
const previewItem = ref({ title: '', detail: '', created: '' });
let targetCreated = '';
function updateAttachments(newAttachments) {
console.log('newAttachments=', newAttachments);
targetAttachmentTo.value = newAttachments;
}
watch(targetTitle, (newValue, oldValue) => {
previewItem.value =
actionTarget == 'notice'
? {
hero: route.params.hero,
title: targetTitle.value,
detail: targetContent.value,
flags: labelled.value['value']
? JSON.stringify([labelled.value['value']])
: JSON.stringify([]),
status: targetStatus.value,
created: targetCreated,
}
: {
hero: route.params.hero,
question: targetTitle.value,
answer: targetContent.value,
status: targetStatus.value,
created: targetCreated,
};
});
watch(targetContent, (newValue, oldValue) => {
previewItem.value =
actionTarget == 'notice'
? {
hero: route.params.hero,
title: targetTitle.value,
detail: targetContent.value,
flags: labelled.value['value']
? JSON.stringify([labelled.value['value']])
: JSON.stringify([]),
status: targetStatus.value,
created: targetCreated,
}
: {
hero: route.params.hero,
question: targetTitle.value,
answer: targetContent.value,
status: targetStatus.value,
created: targetCreated,
};
});
watch(labelled, (newValue, oldValue) => {
previewItem.value =
actionTarget == 'notice'
? {
hero: route.params.hero,
title: targetTitle.value,
detail: targetContent.value,
flags: labelled.value['value']
? JSON.stringify([labelled.value['value']])
: JSON.stringify([]),
status: targetStatus.value,
created: targetCreated,
}
: {
hero: route.params.hero,
question: targetTitle.value,
answer: targetContent.value,
status: targetStatus.value,
created: targetCreated,
};
});
async function doToggle() {
if (targetStatus.value == 0) {
const responseJson = await _crossCtl.doComm('delete', actionTarget, {
hero: route.params.hero,
});
console.log('responseJson=', responseJson);
if (responseJson['responseMessage'] == 'ok') {
targetStatus.value = 4;
alert('ok');
} else {
alert(responseJson['responseMessage']);
}
} else {
targetStatus.value = 0;
/*
const responseJson = await _crossCtl.doComm(
'update',
actionTarget,
actionTarget == 'notice'
? {
hero: route.params.hero,
title: targetTitle.value,
detail: targetContent.value,
flags: labelled.value['value']
? JSON.stringify([labelled.value['value']])
: JSON.stringify([]),
status: targetStatus.value,
created: targetCreated,
}
: {
hero: route.params.hero,
question: targetTitle.value,
answer: targetContent.value,
attachmentTo: targetAttachmentTo.value,
status: targetStatus.value,
created: targetCreated,
}
);
*/
const responseJson = await _crossCtl.doComm(
'update',
actionTarget == 'inquiry' ? 'inquiry:admin' : actionTarget,
actionTarget == 'notice'
? {
hero: route.params.hero,
title: targetTitle.value,
detail: targetContent.value,
flags: labelled.value['value']
? JSON.stringify([labelled.value['value']])
: JSON.stringify([]),
status: targetStatus.value,
}
: actionTarget == 'faq'
? {
hero: route.params.hero,
question: targetTitle.value,
answer: targetContent.value,
status: targetStatus.value,
}
: {
hero: route.params.hero,
answer: targetAnswer.value,
attachmentTo: targetAttachmentTo.value,
memo: '',
status: 2,
}
);
console.log('responseJson=', responseJson);
if (responseJson['responseMessage'] == 'ok') {
targetStatus.value = 0;
alert('ok');
} else {
alert(responseJson['responseMessage']);
}
}
}
console.log('huk route.params.target=', route.params.target);
if (route.params.target instanceof Array) {
if (route.params.target.length != 1) {
throwError('$404');
} else {
if (
route.params.target[0] != 'notice' &&
route.params.target[0] != 'faq' &&
route.params.target[0] != 'inquiry'
) {
throwError('$404');
} else {
currentTarget.value = route.params.target[0];
actionTarget = route.params.target[0];
switch (route.params.target[0]) {
case 'notice':
newTitle.value = '공지 수정';
newDescription.value =
'본문 html태그는 변환되어 저장되고 표시되므로 미리보기를 통해 의도한 대로 보여지는지 미리 확인해 주세요.';
contentTitle.value = '공지 제목';
contentMessageGuide.value = '공지 내용';
break;
case 'faq':
newTitle.value = 'FAQ 수정';
newDescription.value =
'본문 html태그는 변환되어 저장되고 표시되므로 미리보기를 통해 의도한 대로 보여지는지 미리 확인해 주세요.';
contentTitle.value = '질문';
contentMessageGuide.value = '답변';
break;
case 'inquiry':
newTitle.value = '1:1 문의 처리';
newDescription.value =
'1:1 문의에 답을 입력하면 상태가 즉시 답변 완료로 변하지만, 내용은 추가 수정할 있습니다.';
contentTitle.value = '질문';
contentMessageGuide.value = '답변';
labels = [
{ name: '라벨 없음', value: null },
{ name: '사이트 이용', value: 'site' },
{ name: 'API 문의', value: 'api' },
{ name: '기타', value: 'etc' },
// More items...
];
break;
}
console.log('route.params=', route.params);
const responseJson = await _crossCtl.doComm(
'select',
currentTarget.value,
{
hero: route.params.hero,
}
);
console.log('huk responseJson = ', responseJson);
if (responseJson['responseCode'] == 200) {
console.log(responseJson['data']);
if (actionTarget == 'notice') {
targetTitle.value = responseJson['data'][0]['title'];
targetContent.value = responseJson['data'][0]['detail'];
const tmpFlags =
responseJson['data'][0]['flags'] != null
? responseJson['data'][0]['flags']
: '[]';
const flags = JSON.parse(tmpFlags);
for (let i = 0; i < flags.length; i++) {
const flag = flags[i];
for (let j = 0; j < labels.length; j++) {
if (flag == labels[j]['value']) {
labelled.value = labels[j];
}
}
}
} else if (actionTarget == 'inquiry') {
targetTitle.value = responseJson['data'][0]['title'];
targetContent.value = responseJson['data'][0]['question'];
targetAttachmentFrom.value = JSON.parse(
responseJson['data'][0]['attachment_from']
);
targetAnswer.value = responseJson['data'][0]['answer'];
targetAttachmentTo.value = JSON.parse(
responseJson['data'][0]['attachment_to']
);
const tmpFlags =
responseJson['data'][0]['flags'] != null
? responseJson['data'][0]['flags']
: '[]';
const flags = JSON.parse(tmpFlags);
for (let i = 0; i < flags.length; i++) {
const flag = flags[i];
for (let j = 0; j < labels.length; j++) {
if (flag == labels[j]['value']) {
labelled.value = labels[j];
}
}
}
} else {
targetTitle.value = responseJson['data'][0]['question'];
targetContent.value = responseJson['data'][0]['answer'];
}
targetCreated = responseJson['data'][0]['created'];
targetStatus.value = responseJson['data'][0]['status'];
} else {
alert(responseJson['responseMessage']);
}
}
}
} else {
throwError('$404');
}
const router = useRouter();
async function doCancel() {
if (inPregressFlag.value == true) {
alert('이전 동작이 아직 진행중입니다.');
return;
}
router.back();
}
async function doUpdate() {
if (inPregressFlag.value == true) {
alert('이전 동작이 아직 진행중입니다.');
return;
}
if (targetTitle.value == '' || targetContent.value == '') {
alert('내용을 입력하셔야 합니다. ');
return;
}
if (
actionTarget == 'inquiry' &&
(targetAnswer.value == '' || targetAnswer.value == null)
) {
alert('답변 내용을 입력하셔야 합니다. ');
return;
}
console.log('huk actionTarget = ', actionTarget);
console.log('huk targetAnswer.value = ', targetAnswer.value);
if (targetStatus.value == 2) {
router.back();
return;
}
inPregressFlag.value = true;
const responseJson = await _crossCtl.doComm(
'update',
actionTarget == 'inquiry' ? 'inquiry:admin' : actionTarget,
actionTarget == 'notice'
? {
hero: route.params.hero,
title: targetTitle.value,
detail: targetContent.value,
flags: labelled.value['value']
? JSON.stringify([labelled.value['value']])
: JSON.stringify([]),
status: targetStatus.value,
}
: actionTarget == 'faq'
? {
hero: route.params.hero,
question: targetTitle.value,
answer: targetContent.value,
status: targetStatus.value,
}
: {
hero: route.params.hero,
answer: targetAnswer.value,
attachmentTo: targetAttachmentTo.value,
memo: '',
status: 2,
}
);
inPregressFlag.value = false;
if (responseJson['responseMessage'] == 'ok') {
alert('ok');
router.back();
} else {
alert('오류 : ' + responseJson['responseMessage']);
}
}
</script>

View File

@@ -0,0 +1,543 @@
<!-- This example requires Tailwind CSS v2.0+ -->
<template>
<div class="pb-8 px-4 sm:px-6 lg:px-8">
<br />
<div class="sm:flex sm:items-center">
<div class="sm:flex-auto">
<h1 class="text-xl font-semibold text-gray-900">
{{ pageTitle }}
</h1>
<p class="mt-2 text-sm text-gray-700">
{{ pageDescription }}
</p>
</div>
<div v-if="currentTarget == 'inquiry'" class="ml-3">
<select
id="targetLevel"
v-model="targetLevel"
name="targetLevel"
class="block w-full rounded-md border-gray-300 py-2 pl-3 pr-10 text-base focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 sm:text-sm"
@change="onChangeLevel($event)"
>
<option value="all">전체</option>
<option value="wait">대기중</option>
<option value="done">답변완료</option>
</select>
</div>
<div class="mt-4 sm:mt-0 sm:ml-0 sm:flex-none">
<div
v-if="currentTarget == 'inquiry'"
class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none"
>
<label for="mobile-search-candidate" class="sr-only"
>Search</label
>
<label for="desktop-search-candidate" class="sr-only"
>Search</label
>
<div class="flex rounded-md shadow-sm">
<div class="relative flex-grow focus-within:z-10">
<div
class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"
>
<MagnifyingGlassCircleIcon
class="h-5 w-5 text-gray-400"
aria-hidden="true"
/>
</div>
<input
id="mobile-search-candidate"
v-model="searchKeyword"
type="text"
name="mobile-search-candidate"
class="focus:ring-indigo-500 focus:border-indigo-500 block w-full rounded-none rounded-l-md pl-10 sm:hidden border-gray-300"
placeholder=""
@keydown.enter.prevent="onEnterHandler()"
/>
<input
id="desktop-search-candidate"
v-model="searchKeyword"
type="text"
name="desktop-search-candidate"
class="hidden focus:ring-indigo-500 focus:border-indigo-500 w-full rounded-none rounded-l-md pl-10 sm:block sm:text-sm border-gray-300"
placeholder=""
@keydown.enter.prevent="onEnterHandler()"
/>
</div>
<button
type="button"
class="-ml-px relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-r-md text-gray-700 bg-gray-50 hover:bg-gray-100 focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500"
@click="doAction('search', searchKeyword)"
>
<span class="ml-2">검색</span>
</button>
</div>
</div>
<button
v-if="currentTarget != 'inquiry'"
type="button"
class="inline-flex mr-3 items-center justify-center rounded-md border border-transparent bg-red-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 sm:w-auto"
@click="$router.push(deletedListPath)"
>
삭제 항목 리스트
</button>
<button
v-if="currentTarget == 'notice' || currentTarget == 'faq'"
type="button"
class="inline-flex items-center justify-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 sm:w-auto"
@click="makeNewOne"
>
항목 작성
</button>
</div>
</div>
<BaseList1
:headings="listHeadings"
:actions="listActions"
:keys="listKeys"
:data="listData"
:action-key="actionKey"
:column-filter="columnFilter"
:do-action="doAction"
/>
<BasePagination1
:total-page-count="totalPageCount"
:current-page-number="currentPageNumber"
:page-size="pageSize"
:records-total="recordsTotal"
:page-move="pageMove"
/>
</div>
</template>
<script setup lang="ts">
import {
ChevronDownIcon,
MagnifyingGlassCircleIcon,
} from '@heroicons/vue/24/solid';
import { hueRotate } from 'tailwindcss/defaultTheme';
const route = useRoute();
definePageMeta({
middleware: 'check-auth-admin',
});
function onEnterHandler() {
doAction('search', searchKeyword.value);
}
const targetLevel = ref('all');
function onChangeLevel(e) {
console.log('targetLevel.value=', targetLevel.value);
listTarget = 'admin:inquiry:' + targetLevel.value;
refresh();
}
const inquiryListOptionTags = ['대기중', '검토중', '답변완료', '삭제'];
const inquiryListOption = ref(0);
const searchKeyword = ref('');
const currentTarget = ref('notice');
const pageTitle = ref('제목');
const pageDescription = ref('설명');
const listActions = ref(['상세보기']);
const actionKey = ref('serial');
const listKeys = ref(['serial', 'uid', 'name', 'domain', 'email', 'role']);
const listHeadings = ref([]);
const doActionTargetName = 'admin-support-target-edit';
let listSource = 'list';
let listTarget = 'admin:users:level:all';
let deletedListPath = '/admin/key/deleted';
let makeNewTargetPath = 'admin-support-notice-new';
if (route.params.target instanceof Array) {
if (route.params.target.length != 1) {
throwError('$404');
} else {
if (
route.params.target[0] != 'notice' &&
route.params.target[0] != 'faq' &&
route.params.target[0] != 'inquiry'
) {
throwError('$404');
} else {
currentTarget.value = route.params.target[0];
switch (route.params.target[0]) {
case 'notice':
pageTitle.value = '공지사항';
pageDescription.value =
'공지사항을 작성하거나 수정, 삭제 합니다.';
listHeadings.value = [
{
title: '일련번호',
class: 'py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6',
key: 'serial',
hiddenInfo: {
headClass: 'font-normal lg:hidden',
dts: [],
dds: [],
},
subClass:
'w-full max-w-0 py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:w-auto sm:max-w-none sm:pl-6',
},
{
title: '제목',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 lg:table-cell',
key: 'title',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 lg:table-cell',
},
{
title: '상태',
class: 'px-3 py-3.5 text-left text-sm font-semibold text-gray-900',
key: 'status',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass: 'px-3 py-4 text-sm text-gray-500',
},
{
title: '수정일',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell',
key: 'updated',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 sm:table-cell',
},
{
title: '작성일',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell',
key: 'created',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 sm:table-cell',
},
];
listActions.value = ['상세보기'];
actionKey.value = 'serial';
listKeys.value = [
'serial',
'title',
'status',
'updated',
'created',
];
makeNewTargetPath = '/admin/support/notice/new';
listSource = 'list';
listTarget = 'notice:active';
deletedListPath =
'/admin/support/' + route.params.target[0] + '/deleted';
break;
case 'faq':
pageTitle.value = '자주 묻는 질문';
pageDescription.value =
'FAQ를 작성하거나 수정, 삭제 합니다.';
listHeadings.value = [
{
title: '일련번호',
class: 'py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6',
key: 'serial',
hiddenInfo: {
headClass: 'font-normal lg:hidden',
dts: [],
dds: [],
},
subClass:
'w-full max-w-0 py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:w-auto sm:max-w-none sm:pl-6',
},
{
title: '질문',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 lg:table-cell',
key: 'question',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 lg:table-cell',
},
{
title: '상태',
class: 'px-3 py-3.5 text-left text-sm font-semibold text-gray-900',
key: 'status',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass: 'px-3 py-4 text-sm text-gray-500',
},
{
title: '수정일',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell',
key: 'updated',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 sm:table-cell',
},
{
title: '작성일',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell',
key: 'created',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 sm:table-cell',
},
];
listActions.value = ['상세보기'];
actionKey.value = 'serial';
listKeys.value = [
'serial',
'question',
'status',
'updated',
'created',
];
makeNewTargetPath = '/admin/support/faq/new';
listSource = 'list';
listTarget = 'faq:active';
deletedListPath =
'/admin/support/' + route.params.target[0] + '/deleted';
break;
case 'inquiry':
pageTitle.value = '1:1 문의';
pageDescription.value =
'응답하지 않은 1:1 문의 내용을 보고 회신합니다.';
listHeadings.value = [
{
title: '일련번호',
class: 'py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6',
key: 'serial',
hiddenInfo: {
headClass: 'font-normal lg:hidden',
dts: [],
dds: [],
},
subClass:
'w-full max-w-0 py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:w-auto sm:max-w-none sm:pl-6',
},
{
title: '아이디',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 lg:table-cell',
key: 'name',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 lg:table-cell',
},
{
title: '제목',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 lg:table-cell',
key: 'title',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 lg:table-cell',
},
{
title: '상태',
class: 'px-3 py-3.5 text-left text-sm font-semibold text-gray-900',
key: 'status',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass: 'px-3 py-4 text-sm text-gray-500',
},
{
title: '수정일',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell',
key: 'updated',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 sm:table-cell',
},
{
title: '작성일',
class: 'hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell',
key: 'created',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass:
'hidden px-3 py-4 text-sm text-gray-500 sm:table-cell',
},
];
listActions.value = ['상세보기'];
actionKey.value = 'serial';
listKeys.value = [
'serial',
'name',
'title',
'status',
'updated',
'created',
];
makeNewTargetPath = '/admin/support/inquiry/new';
listSource = 'list';
listTarget = 'admin:inquiry:all';
deletedListPath =
'/admin/support/' + route.params.target[0] + '/deleted';
break;
}
}
}
} else {
throwError('$404');
}
const listData = ref([]);
const totalPageCount = ref(0);
const currentPageNumber = ref(1);
const pageSize = ref(10);
const recordsTotal = ref(0);
// const order = [{ column: 'serial', dir: 'desc' }];
// const columns = { serial: { data: 'serial' } };
const { $dayjs } = useNuxtApp();
function columnFilter(key, val) {
// console.log("columnFilter(), key = ", key, ", val = ", val);
if (key == 'updated' || key == 'created') {
// return $dayjs(val).format('YY/MM/DD A h:mm:ss');
return $dayjs(val).format('YY/MM/DD');
} else if (key == 'status') {
if (currentTarget.value == 'inquiry') {
return inquiryListOptionTags[val];
} else {
return val;
}
} else {
return val;
}
}
const router = useRouter();
function doAction(tag, target) {
console.log('on doAction(), tag=', tag, ', target=', target);
if (tag == 'search') {
currentPageNumber.value = 1;
refresh();
} else {
navigateTo('/admin/support/' + currentTarget.value + '/edit/' + target);
}
/*
router.push({
name: doActionTargetName,
params: { hero: target, target: [currentTarget.value] },
});
*/
}
function makeNewOne() {
/*
router.push({
path: makeNewTargetPath,
params: {},
});
*/
navigateTo({ path: makeNewTargetPath, params: {} });
}
function pageMove(targetPageIdex) {
console.log('on pageMove(), targetPageIdex=', targetPageIdex);
currentPageNumber.value = targetPageIdex;
refresh();
}
async function refresh() {
if (process.client) {
const responseJson = await _crossCtl.doComm(listSource, listTarget, {
hero: searchKeyword.value,
start: (currentPageNumber.value - 1) * pageSize.value,
length: pageSize.value,
});
if (responseJson['responseCode'] != 200) {
alert(responseJson['responseMessage']);
} else {
currentPageNumber.value = responseJson['currentPageNumber'];
totalPageCount.value = responseJson['totalPageCount'];
pageSize.value = parseInt(responseJson['pageSize']);
recordsTotal.value = responseJson['recordsTotal'];
listData.value = responseJson['data'];
}
}
}
refresh();
</script>

View File

@@ -0,0 +1,409 @@
<!--
This example requires Tailwind CSS v2.0+
This example requires some changes to your config:
```
// tailwind.config.js
module.exports = {
// ...
plugins: [
// ...
require('@tailwindcss/forms'),
],
}
```
-->
<template>
<form @submit.prevent="doCreate">
<div class="sm:flex sm:items-center">
<div class="sm:flex-auto">
<h1 class="text-xl font-semibold text-gray-900">
{{ newTitle }}
</h1>
<p class="mt-2 text-sm text-gray-700">
{{ newDescription }}
</p>
</div>
<div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">
<img
v-if="inPregressFlag"
width="32"
src="/loading-load-2.gif"
/>
</div>
</div>
<div class="mt-2"></div>
<TabGroup v-slot="{ selectedIndex }">
<TabList class="flex items-center">
<Tab v-slot="{ selected }" as="template">
<button
:class="[
selected
? 'text-gray-900 bg-gray-100 hover:bg-gray-200'
: 'text-gray-500 hover:text-gray-900 bg-white hover:bg-gray-100',
'px-3 py-1.5 border border-transparent text-sm font-medium rounded-md',
]"
>
입력
</button>
</Tab>
<Tab v-slot="{ selected }" as="template">
<button
:class="[
selected
? 'text-gray-900 bg-gray-100 hover:bg-gray-200'
: 'text-gray-500 hover:text-gray-900 bg-white hover:bg-gray-100',
'ml-2 px-3 py-1.5 border border-transparent text-sm font-medium rounded-md',
]"
>
미리보기
</button>
</Tab>
<!-- These buttons are here simply as examples and don't actually do anything. -->
<div
v-if="selectedIndex === 0"
class="ml-auto flex items-center space-x-5"
>
<div v-if="currentTarget == 'notice'">
<Listbox
v-model="labelled"
as="div"
class="flex-shrink-0"
>
<ListboxLabel class="sr-only">
Add a label
</ListboxLabel>
<div class="relative">
<ListboxButton
class="relative inline-flex items-center rounded-full py-2 px-2 bg-gray-50 text-sm font-medium text-gray-500 whitespace-nowrap hover:bg-gray-100 sm:px-3"
>
<TagIcon
:class="[
labelled.value === null
? 'text-gray-300'
: 'text-gray-500',
'flex-shrink-0 h-5 w-5 sm:-ml-1',
]"
aria-hidden="true"
/>
<span
:class="[
labelled.value === null
? ''
: 'text-gray-900',
'hidden truncate sm:ml-2 sm:block',
]"
>{{
labelled.value === null
? '라벨'
: labelled.name
}}</span
>
</ListboxButton>
<transition
leave-active-class="transition ease-in duration-100"
leave-from-class="opacity-100"
leave-to-class="opacity-0"
>
<ListboxOptions
class="absolute right-0 z-10 mt-1 w-52 bg-white shadow max-h-56 rounded-lg py-3 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm"
>
<ListboxOption
v-for="label in labels"
:key="label.value"
v-slot="{ active }"
as="template"
:value="label"
>
<li
:class="[
active
? 'bg-gray-100'
: 'bg-white',
'cursor-default select-none relative py-2 px-3',
]"
>
<div class="flex items-center">
<span
class="block font-medium truncate"
>
{{ label.name }}
</span>
</div>
</li>
</ListboxOption>
</ListboxOptions>
</transition>
</div>
</Listbox>
</div>
</div>
</TabList>
<TabPanels class="mt-2">
<TabPanel class="p-0.5 -m-0.5 rounded-lg">
<div
class="border border-gray-300 rounded-lg shadow-sm overflow-hidden focus-within:border-indigo-500 focus-within:ring-1 focus-within:ring-indigo-500"
>
<label for="title" class="sr-only">제목</label>
<input
id="title"
v-model="targetTitle"
type="text"
name="title"
class="block w-full border-0 pt-2.5 text-lg font-medium placeholder-gray-500 focus:ring-0"
placeholder="제목"
/>
<label for="content" class="sr-only">내용</label>
<textarea
id="content"
v-model="targetContent"
rows="20"
name="content"
class="block w-full border-0 py-0 resize-none placeholder-gray-500 focus:ring-0 sm:text-sm"
placeholder="내용..."
/>
</div>
</TabPanel>
<TabPanel class="p-0.5 -m-0.5 rounded-lg">
<div class="border-b">
<div
class="mx-px mt-px px-3 pt-2 pb-12 text-sm leading-5 text-gray-800"
>
<div v-if="currentTarget == 'notice'">
<BaseNoticeItem1 :item="previewItem" />
</div>
<div v-else>
<BaseFaqItem1 :item="previewItem" />
</div>
</div>
</div>
</TabPanel>
</TabPanels>
</TabGroup>
<div class="mt-2 flex justify-end">
<button
type="button"
class="bg-white py-2 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
@click="doCancel"
>
취소
</button>
<button
type="submit"
class="ml-3 inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
>
저장
</button>
</div>
</form>
</template>
<script setup>
import { Tab, TabGroup, TabList, TabPanel, TabPanels } from '@headlessui/vue';
import {
Listbox,
ListboxButton,
ListboxLabel,
ListboxOption,
ListboxOptions,
} from '@headlessui/vue';
import { TagIcon } from '@heroicons/vue/24/solid';
const route = useRoute();
definePageMeta({
middleware: 'check-auth-admin',
});
const labels = [
{ name: '라벨 없음', value: null },
{ name: '공지', value: 'notice' },
{ name: '이벤트', value: 'event' },
// More items...
];
const labelled = ref(labels[0]);
const newTitle = ref('');
const newDescription = ref('');
const contentTitle = ref('');
const contentMessageGuide = ref('');
const currentTarget = ref('notice');
let actionTarget = 'notice';
const inPregressFlag = ref(false);
const targetTitle = ref('');
const targetContent = ref('');
const targetStatus = ref(0);
const today = new Date();
const targetCreated = today.toISOString();
// console.log('targetCreated=', targetCreated);
const previewItem = ref({ title: '', detail: '', created: targetCreated });
watch(targetTitle, (newValue, oldValue) => {
previewItem.value =
actionTarget == 'notice'
? {
hero: route.params.hero,
title: targetTitle.value,
detail: targetContent.value,
flags: labelled.value['value']
? JSON.stringify([labelled.value['value']])
: JSON.stringify([]),
status: targetStatus.value,
created: targetCreated,
}
: {
hero: route.params.hero,
question: targetTitle.value,
answer: targetContent.value,
status: targetStatus.value,
created: targetCreated,
};
});
watch(targetContent, (newValue, oldValue) => {
previewItem.value =
actionTarget == 'notice'
? {
hero: route.params.hero,
title: targetTitle.value,
detail: targetContent.value,
flags: labelled.value['value']
? JSON.stringify([labelled.value['value']])
: JSON.stringify([]),
status: targetStatus.value,
created: targetCreated,
}
: {
hero: route.params.hero,
question: targetTitle.value,
answer: targetContent.value,
status: targetStatus.value,
created: targetCreated,
};
});
watch(labelled, (newValue, oldValue) => {
previewItem.value =
actionTarget == 'notice'
? {
hero: route.params.hero,
title: targetTitle.value,
detail: targetContent.value,
flags: labelled.value['value']
? JSON.stringify([labelled.value['value']])
: JSON.stringify([]),
status: targetStatus.value,
created: targetCreated,
}
: {
hero: route.params.hero,
question: targetTitle.value,
answer: targetContent.value,
status: targetStatus.value,
created: targetCreated,
};
});
if (route.params.target instanceof Array) {
if (route.params.target.length != 1) {
throwError('$404');
} else {
if (
route.params.target[0] != 'notice' &&
route.params.target[0] != 'faq'
) {
throwError('$404');
} else {
currentTarget.value = route.params.target[0];
actionTarget = route.params.target[0];
switch (route.params.target[0]) {
case 'notice':
newTitle.value = ' 공지 작성';
newDescription.value =
'본문 html태그는 변환되어 저장되고 표시되므로 미리보기를 통해 의도한 대로 보여지는지 미리 확인해 주세요.';
contentTitle.value = '공지 제목';
contentMessageGuide.value = '공지 내용';
break;
case 'faq':
newTitle.value = ' FAQ 작성';
newDescription.value =
'본문 html태그는 변환되어 저장되고 표시되므로 미리보기를 통해 의도한 대로 보여지는지 미리 확인해 주세요.';
contentTitle.value = '질문';
contentMessageGuide.value = '답변';
break;
}
}
}
} else {
throwError('$404');
}
const router = useRouter();
async function doCancel() {
if (inPregressFlag.value == true) {
alert('이전 동작이 아직 진행중입니다.');
return;
}
router.back();
}
async function doCreate() {
if (inPregressFlag.value == true) {
alert('이전 동작이 아직 진행중입니다.');
return;
}
if (targetTitle.value == '' || targetContent.value == '') {
alert('내용을 입력하셔야 합니다. ');
return;
}
inPregressFlag.value = true;
const responseJson = await _crossCtl.doComm(
'insert',
actionTarget,
actionTarget == 'notice'
? {
hero: route.params.hero,
title: targetTitle.value,
detail: targetContent.value,
flags: labelled.value['value']
? JSON.stringify([labelled.value['value']])
: JSON.stringify([]),
status: targetStatus.value,
created: targetCreated,
}
: {
hero: route.params.hero,
question: targetTitle.value,
answer: targetContent.value,
status: targetStatus.value,
created: targetCreated,
}
);
inPregressFlag.value = false;
if (responseJson['responseMessage'] == 'ok') {
alert('ok');
} else {
alert('오류 : ' + responseJson['responseMessage']);
}
}
</script>

View File

@@ -0,0 +1,58 @@
<!-- This example requires Tailwind CSS v2.0+ -->
<template>
<div class="bg-white">
<div class="max-w-7xl mx-auto py-16 px-4 sm:py-24 sm:px-6 lg:px-8">
<div class="text-center">
<h2
class="text-base font-semibold text-indigo-600 tracking-wide uppercase"
>
어드민 / 고객 지원
</h2>
<p
class="mt-1 text-4xl font-extrabold text-gray-900 sm:text-5xl sm:tracking-tight lg:text-6xl"
>
고객 지원 기능 리스트
</p>
<p class="max-w-xl mt-5 mx-auto text-xl text-gray-500">
어드민이 사용할 있는 고개 지원 기능 리스트
</p>
<br />
있는 페이지 :
<a
href="javascript:void(0)"
@click="$router.push('/admin/support/notice/list')"
>
공지 리스트
</a>
,
<a
href="javascript:void(0)"
@click="$router.push('/admin/support/faq/list')"
>
자주 묻는 질문 리스트
</a>
,
<a
href="javascript:void(0)"
@click="$router.push('/admin/support/inquiry/list')"
>
1:1 문의 리스트
</a>
,
<a href="javascript:void(0)" @click="$router.back()">
이전 페이지
</a>
,
<a href="javascript:void(0)" @click="$router.push('/')"> </a>
</div>
</div>
</div>
</template>
<script setup lang="ts">
definePageMeta({
middleware: ['check-auth-admin'],
});
</script>