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,504 @@
<template>
<div>
<!-- Page head goes here -->
<div class="px-4 py-5 sm:px-6">
<div
class="flex justify-between items-center flex-wrap sm:flex-nowrap"
>
<div class="">
<h3 class="text-lg leading-6 font-medium text-gray-900">
{{ pageTitle }}
</h3>
<p class="mt-1 text-sm text-gray-500">
{{ pageDescription }}
</p>
</div>
<div class="flex-shrink-0">
<button
v-for="(headingAction, index) in headingActions"
:key="headingAction"
type="button"
:class="index > 0 ? 'ml-3' : ''"
class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-3 py-2 text-sm font-medium leading-4 text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2"
@click="doHeadingAction(headingAction)"
>
{{ headingAction }}
</button>
</div>
</div>
</div>
<div class="px-4 sm:px-6">
<!-- Content goes here -->
<div class="">
<div
class="mt-6 grid grid-cols-1 gap-y-6 gap-x-4 sm:grid-cols-6"
>
<div class="sm:col-span-1">
<label
for="boardId"
class="block text-sm font-medium text-gray-700"
>
게시판 아이디
</label>
<div class="mt-1">
<input
id="boardId"
v-model="boardId"
type="text"
name="boardId"
class="shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md"
/>
</div>
</div>
<div class="sm:col-span-5">
<label
for="title"
class="block text-sm font-medium text-gray-700"
>
게시판 제목
</label>
<div class="mt-1">
<input
id="title"
v-model="title"
type="text"
name="title"
class="shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md"
/>
</div>
</div>
<div class="col-span-6">
<label
for="description"
class="block text-sm font-medium text-gray-700"
>
게시판 설명
</label>
<div class="mt-1">
<textarea
id="description"
v-model="description"
name="description"
rows="3"
style="resize: none"
class="shadow-sm focus:ring-indigo-500 focus:border-indigo-500 mt-1 block w-full sm:text-sm border border-gray-300 rounded-md"
placeholder="게시판에 대한 간단한 설명을 입력하세요."
/>
</div>
<p class="flex mt-2 text-sm text-gray-500">
<QuestionMarkCircleIcon
class="mr-1 flex-shrink-0 h-5 w-5 text-gray-400 group-hover:text-gray-500"
aria-hidden="true"
/>
사용자들에게 표시되는 내용이니 신중하게 입력하세요.
빈칸으로 그냥 수도 있습니다.
</p>
</div>
<div class="sm:col-span-3">
<label
for="readLevelMin"
class="block text-sm font-medium text-gray-700"
>
읽기제한
</label>
<div class="mt-1">
<select
id="readLevelMin"
v-model="readLevelMin"
name="readLevelMin"
class="shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md"
>
<option value="5">관리자 이상</option>
<option value="4">자격 사용자 이상</option>
<option value="0">로그인 사용자 이상</option>
<option value="-1">익명 사용자 이상</option>
</select>
</div>
</div>
<div class="sm:col-span-3">
<label
for="writeLevelMin"
class="block text-sm font-medium text-gray-700"
>
쓰기제한
</label>
<div class="mt-1">
<select
id="writeLevelMin"
v-model="writeLevelMin"
name="writeLevelMin"
class="shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md"
>
<option value="5">관리자 이상</option>
<option value="4">자격 사용자 이상</option>
<option value="0">로그인 사용자 이상</option>
</select>
</div>
</div>
<div class="sm:col-span-6">
<fieldset>
<legend class="sr-only">기타 옵션</legend>
<div
class="block text-sm font-medium text-gray-700"
aria-hidden="true"
>
기타 옵션
</div>
<div class="mt-4 space-y-4">
<div class="relative flex items-start">
<div class="flex h-5 items-center">
<input
id="commentEnabled"
v-model="commentEnabled"
name="commentEnabled"
type="checkbox"
class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
/>
</div>
<div class="ml-3 text-sm">
<label
for="commentEnabled"
class="font-medium text-gray-700"
>댓글 기능</label
>
<p class="text-gray-500">
쓰기 권한이 있는 사용자들은 댓글을
보고 있고, 읽기 권한이 있는
사용자들은 있습니다.
</p>
</div>
</div>
<div class="relative flex items-start">
<div class="flex h-5 items-center">
<input
id="attachmentEnabled"
v-model="attachmentEnabled"
name="attachmentEnabled"
type="checkbox"
class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
/>
</div>
<div class="ml-3 text-sm">
<label
for="attachmentEnabled"
class="font-medium text-gray-700"
>파일 첨부</label
>
<p class="text-gray-500">
쓰기 권한이 있는 사용자들은 파일을
첨부할 있습니다.
</p>
</div>
</div>
<div class="relative flex items-start">
<div class="flex h-5 items-center">
<input
id="agoEnabled"
v-model="agoEnabled"
name="agoEnabled"
type="checkbox"
class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
/>
</div>
<div class="ml-3 text-sm">
<label
for="agoEnabled"
class="font-medium text-gray-700"
>작성일 축약 표시</label
>
<p class="text-gray-500">
작성일을 날짜와 시간 모두 표시하지
않고 짧게 표시합니다.
</p>
</div>
</div>
</div>
</fieldset>
</div>
<div class="col-span-6">
<label
for="memo"
class="block text-sm font-medium text-gray-700"
>
관리자 메모
</label>
<div class="mt-1">
<textarea
id="memo"
v-model="memo"
name="memo"
rows="3"
style="resize: none"
class="shadow-sm focus:ring-indigo-500 focus:border-indigo-500 mt-1 block w-full sm:text-sm border border-gray-300 rounded-md"
placeholder=""
/>
</div>
<p class="flex mt-2 text-sm text-gray-500">
<QuestionMarkCircleIcon
class="mr-1 flex-shrink-0 h-5 w-5 text-gray-400 group-hover:text-gray-500"
aria-hidden="true"
/>
게시판에 대해서 관리 목적상 필요한 간단한 메모를
저장할 있습니다. 관리자에게만 표시됩니다.
</p>
</div>
</div>
</div>
</div>
<div class="max-w-7xl mx-auto sm:px-4 lg:px-4">
<!-- Footer Buttons goes here -->
<div class="mt-5 flex justify-between items-center flex-wrap">
<div class="ml-4 mt-4">
<button
v-if="currnetMode != 'new'"
class="ml-3 inline-flex items-center rounded-md border border-transparent bg-red-600 px-3 py-2 text-sm font-medium leading-4 text-white shadow-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2"
@click="doFooterAction(status == 0 ? '삭제' : '복구')"
>
{{ status == 0 ? '삭제' : '복구' }}
</button>
</div>
<div class="ml-4 mt-4 flex-shrink-0">
<button
class="inline-flex items-center rounded-md border border-transparent bg-indigo-100 px-3 py-2 text-sm font-medium leading-4 text-indigo-700 hover:bg-indigo-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2"
@click="doFooterAction('닫기')"
>
{{ '닫기' }}
</button>
<button
class="ml-3 inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-3 py-2 text-sm font-medium leading-4 text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2"
@click="doFooterAction('저장')"
>
{{ '저장' }}
</button>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { QuestionMarkCircleIcon } from '@heroicons/vue/24/solid';
definePageMeta({
middleware: 'check-auth-admin',
});
const router = useRouter();
const pageTitle = '새로운 게시판 생성';
const pageDescription = '새로운 게시판 생성 정보를 입력하세요.';
// 해당 페이지 우측 상단에 표시될 액션 버튼들
const headingActions = [];
const bid = ref('');
const boardId = ref('');
const title = ref('');
const description = ref('');
const readLevelMin = ref(5);
const writeLevelMin = ref(5);
const commentEnabled = ref(false);
const attachmentEnabled = ref(false);
const agoEnabled = ref(false);
const memo = ref('');
const status = ref(0);
function doHeadingAction(tag) {
console.log('on doHeadingAction(), tag=', tag);
switch (tag) {
default:
alert('unhandled heading action. tag = ' + tag);
}
}
function doFooterAction(tag) {
console.log('111 on doFooterAction(), tag=', tag);
switch (tag) {
case '저장':
updateContent();
break;
case '닫기':
router.back();
break;
case '삭제':
deleteContent();
break;
case '복구':
reviveContent();
break;
default:
alert('unhandled footer action. tag = ' + tag);
}
}
async function deleteContent() {
const responseJson = await _crossCtl.doComm('delete', 'board:info', {
hero: bid.value,
});
if (responseJson['responseCode'] == 200) {
status.value = 4;
alert(responseJson['responseMessage']);
} else {
// router.back();
alert(responseJson['responseMessage']);
}
}
function reviveContent() {
status.value = 0;
updateContent();
}
async function updateContent() {
if (boardId.value.trim() == '') {
alert('게시판 아이디를 입력해 주세요.');
return;
}
if (title.value.trim() == '') {
alert('게시판 제목을 입력해 주세요.');
return;
}
const responseJson = await _crossCtl.doComm(
bid.value == '' ? 'insert' : 'update',
'board:info',
bid.value == ''
? {
boardId: boardId.value,
title: title.value,
description: description.value,
readLevelMin: readLevelMin.value,
writeLevelMin: writeLevelMin.value,
commentEnabled: commentEnabled.value,
attachmentEnabled: attachmentEnabled.value,
agoEnabled: agoEnabled.value,
memo: memo.value,
}
: {
hero: bid.value,
boardId: boardId.value,
title: title.value,
description: description.value,
readLevelMin: readLevelMin.value,
writeLevelMin: writeLevelMin.value,
commentEnabled: commentEnabled.value,
attachmentEnabled: attachmentEnabled.value,
agoEnabled: agoEnabled.value,
memo: memo.value,
status: status.value,
}
);
console.log('huk responseJson = ', responseJson);
if (responseJson['responseCode'] != 200) {
if (responseJson['responseMessage'].startsWith('ER_DUP_ENTRY: ')) {
alert('게시판 아이디가 이미 존재하고 있습니다.');
} else {
alert(responseJson['responseMessage']);
}
} else {
// router.back();
alert(responseJson['responseMessage']);
}
}
const route = useRoute();
const currnetMode = ref('');
if (route.params.mode instanceof Array) {
console.log('huk 1');
if (route.params.mode.length != 1) {
console.log('huk 2');
throwError('$404');
} else {
console.log('huk 3');
currnetMode.value = route.params.mode[0];
switch (currnetMode.value) {
case 'new':
case 'edit':
console.log('huk 4');
break;
default:
throwError('$404');
console.log('huk 5');
}
}
} else {
if (route.params.mode == '' && route.params._bid == 'new') {
currnetMode.value = 'new';
} else {
throwError('$404');
}
}
console.log('huk 7');
if (currnetMode.value == '') {
console.log('missing params...');
} else {
console.log('mode = ', currnetMode.value);
if (currnetMode.value == 'edit') {
const responseJson = await _crossCtl.doComm(
'select',
'board:info:all',
{
hero: route.params._bid,
}
);
console.log('responseJson=', responseJson);
if (responseJson['responseCode'] == 200) {
if (responseJson['data'].length != 1) {
alert(
'게시판 아이디가 잘못되었습니다. 이전 화면으로 돌아 갑니다.'
);
navigateTo('/admin/board/list');
} else {
const targetData = responseJson['data'][0];
bid.value = targetData['bid'];
boardId.value = targetData['id'];
title.value = targetData['title'];
description.value = targetData['description'];
readLevelMin.value = targetData['read_level_min'];
writeLevelMin.value = targetData['write_level_min'];
commentEnabled.value = targetData['comment_enabled'] == 1;
attachmentEnabled.value = targetData['attachment_enabled'] == 1;
agoEnabled.value = targetData['ago_enabled'] == 1;
memo.value = targetData['memo'];
status.value = targetData['status'];
}
} else {
alert(responseJson['responseMessage']);
}
}
}
// const targetBoardInfo = await _crossCtl.getBoardInfo(route);
// console.log('huk targetBoardInfo = ', targetBoardInfo);
console.log('huk params = ', route.params);
</script>

View File

@@ -0,0 +1,233 @@
<template>
<div>
<!-- Page head goes here -->
<div class="px-3 py-5">
<div
class="-ml-4 -mt-4 flex justify-between items-center flex-wrap sm:flex-nowrap"
>
<div class="ml-4 mt-4">
<h3 class="text-lg leading-6 font-medium text-gray-900">
{{ pageTitle }}
</h3>
<p class="mt-1 text-sm text-gray-500">
{{ pageDescription }}
</p>
</div>
<div class="ml-4 mt-4 flex-shrink-0">
<button
v-for="(headingAction, index) in headingActions"
:key="headingAction"
type="button"
:class="index > 0 ? 'ml-3' : ''"
class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-3 py-2 text-sm font-medium leading-4 text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2"
@click="doHeadingAction(headingAction)"
>
{{ headingAction }}
</button>
</div>
</div>
</div>
<div class="max-w mx-auto px-3">
<!-- Content goes here -->
<BaseTable2
:headings="listHeadings"
:actions="listActions"
: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>
</div>
</template>
<script setup lang="ts">
definePageMeta({
middleware: 'check-auth-user',
});
const route = useRoute();
const listMode = ref(route.query.mode ? route.query.mode : '');
console.log('listMode.value=', listMode.value);
const pageTitle = ref(
listMode.value == 'trashcan'
? '게시판 관리 - 삭제 게시판 리스트'
: '게시판 관리 - 리스트'
);
const pageDescription = ref('게시판 관리 리스트 페이지 입니다.');
// 해당 페이지 우측 상단에 표시될 액션 버튼들
const headingActions = ['게시판 생성', '리스트 모드'];
// 리스트 쓰는 경에만 해당. 안되는 경우 모두 지울것.
const listSource = 'list';
const listTarget = ref('');
const listActions = ['보기', '수정'];
const actionKey = 'id';
const listHeadings = [
{
title: '아이디',
widthRatio: '10',
key: 'id',
},
{
title: '제목',
widthRatio: '25',
key: 'title',
},
{
title: '설명',
widthRatio: '40',
key: 'description',
},
{
title: '권한',
widthRatio: '10',
key: 'level_min',
},
{
title: '수정일',
widthRatio: '15',
key: 'updated',
},
];
const listData = ref([]);
const totalPageCount = ref(1);
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('YYYY/MM/DD A h:mm:ss');
// return $dayjs(val).format('YY/MM/DD');
} else if (key == 'level_min')
switch (val) {
case -1:
return '익명 사용자 이상';
break;
case 0:
return '로그인 사용자 이상';
break;
case 4:
return '확인 사용자 이상';
break;
case 5:
return '관리자 이상';
break;
default:
return val;
break;
}
else {
return val;
}
}
const router = useRouter();
async function doHeadingAction(tag) {
console.log('on doHeadingAction(), tag=', tag);
switch (tag) {
case '게시판 생성':
navigateTo('/admin/board/new');
break;
case '리스트 모드':
console.log('listMode.value=', '[' + listMode.value + ']');
if (listMode.value == 'trashcan') {
console.log('huk 1');
pageTitle.value = '게시판 관리 - 리스트';
await navigateTo('/admin/board/list', { replace: true });
listMode.value = '';
} else {
console.log('huk 2');
pageTitle.value = '게시판 관리 - 삭제 리스트';
await navigateTo('/admin/board/list?mode=trashcan', {
replace: true,
});
listMode.value = 'trashcan';
}
pageMove(1);
break;
default:
alert('unhandled heading action. tag = ' + tag);
}
// alert('headingAction : ' + tag);
}
function doAction(tag, target) {
console.log('on doAction(), tag=', tag, ', target=', target);
// alert('doAction : ' + tag + ', target = ' + target);
switch (tag) {
case '보기':
navigateTo('/board/' + target + '/list');
break;
case '수정':
navigateTo('/admin/board/edit/' + target);
break;
}
}
function pageMove(targetPageIdex) {
// console.log('on pageMove(), targetPageIdex=', targetPageIdex);
currentPageNumber.value = targetPageIdex;
refresh();
}
async function refresh() {
const responseJson = await _crossCtl.doComm(
listSource,
listMode.value == 'trashcan'
? 'admin:board:info:deactivated'
: 'admin:board:info:active',
{
start: (currentPageNumber.value - 1) * pageSize.value,
length: pageSize.value,
}
);
if (responseJson['responseCode'] != 200) {
alert(responseJson['responseMessage']);
} else {
console.log('responseJson=', responseJson);
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,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>

View File

@@ -0,0 +1,816 @@
<!-- This example requires Tailwind CSS v2.0+ -->
<template>
<div class="divide-y divide-gray-200">
<form class="lg:col-span-9" @submit.prevent="doUpdateInfo">
<!-- Profile section -->
<div class="py-6 px-4 sm:p-6 lg:pb-8">
<div class="sm:flex sm:items-center">
<div class="sm:flex-auto">
<h2 class="text-lg leading-6 font-medium text-gray-900">
사용자 정보 확인, 변경
</h2>
<p class="mt-1 text-sm text-gray-500">
일부 정보는 다른 사용자들에게 보여질 있으니
신중하게 입력해 주세요.
</p>
</div>
<div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">
<button
type="button"
class="mr-2 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="
navigateTo(
'/admin/statistics/byterm/word?uid=' + hero
)
"
>
단어 통계
</button>
<button
type="button"
class="mr-2 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="
navigateTo(
'/admin/statistics/byterm/usage?uid=' + hero
)
"
>
사용 통계
</button>
<button
type="button"
class="mr-2 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="navigateTo('/admin/key/list?uid=' + hero)"
>
보유
</button>
<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="doHistory"
>
유저 로그
</button>
</div>
</div>
<div class="mt-6 grid grid-cols-12 gap-6">
<div class="col-span-12 sm:col-span-6">
<label
for="email"
class="block text-sm font-medium text-gray-700"
>이메일</label
>
<input
id="email"
v-model="email"
disabled
type="text"
name="email"
autocomplete="email"
class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-sky-500 focus:border-sky-500 sm:text-sm"
/>
</div>
<div class="col-span-12 sm:col-span-6">
<label
for="email"
class="block text-sm font-medium text-gray-700"
>가입일</label
>
<input
id="created"
v-model="created"
disabled
type="text"
name="created"
autocomplete="created"
class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-sky-500 focus:border-sky-500 sm:text-sm"
/>
</div>
</div>
<div class="mt-6 flex flex-col lg:flex-row">
<div class="flex-grow space-y-6">
<div>
<label
for="username"
class="block text-sm font-medium text-gray-700"
>
사용자 이름
</label>
<div class="mt-1 rounded-md shadow-sm flex">
<input
id="username"
v-model="displayName"
type="text"
name="username"
autocomplete="username"
class="focus:ring-sky-500 focus:border-sky-500 flex-grow block w-full min-w-0 rounded-none rounded-r-md sm:text-sm border-gray-300"
/>
</div>
</div>
<div>
<label
for="phone"
class="block text-sm font-medium text-gray-700"
>
전화번호
</label>
<div class="mt-1 rounded-md shadow-sm flex">
<input
id="phone"
v-model="phone"
type="text"
name="phone"
autocomplete="phone"
class="focus:ring-sky-500 focus:border-sky-500 flex-grow block w-full min-w-0 rounded-none rounded-r-md sm:text-sm border-gray-300"
/>
</div>
</div>
<div>
<label
for="about"
class="block text-sm font-medium text-gray-700"
>
간단한 소개
</label>
<div class="mt-1">
<textarea
id="about"
v-model="memo"
name="about"
rows="3"
class="shadow-sm focus:ring-sky-500 focus:border-sky-500 mt-1 block w-full sm:text-sm border border-gray-300 rounded-md"
/>
</div>
<p class="mt-2 text-sm text-gray-500">
관리자나 다른 사용자가 당신을 식별할 있도록
간단한 소개를 입력해 주세요.
</p>
</div>
<div>
<label
class="block text-sm font-medium text-gray-700"
>
프로필 사진
</label>
<div class="mt-2 flex items-center space-x-5">
<span
v-if="photoUrl == ''"
class="inline-block h-12 w-12 rounded-full overflow-hidden bg-gray-100"
>
<svg
class="h-full w-full text-gray-300"
fill="currentColor"
viewBox="0 0 24 24"
>
<path
d="M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z"
></path>
</svg>
</span>
<img
v-else
class="inline-block h-12 w-12 rounded-full border"
:src="photoUrl"
alt=""
/>
</div>
<div class="col-span-2 sm:col-span-2 pt-3">
<div class="mt-1 flex rounded-md shadow-sm">
<div
class="relative flex items-stretch flex-grow focus-within:z-10"
>
<input
id="photoUrl"
v-model="photoUrl"
type="text"
name="photoUrl"
class="focus:ring-indigo-500 focus:border-indigo-500 block w-full rounded-none rounded-l-md sm:text-sm border-gray-300"
placeholder="http://"
/>
</div>
</div>
<p class="mt-2 text-sm text-gray-500">
프로필로 사용하실 이미지의 주소를
입력하세요.
</p>
</div>
</div>
<div>
<div
class="mt-2 flex justify-center px-6 pt-5 pb-6 border-2 border-gray-300 border-dashed rounded-md"
@dragover.prevent
@dragenter.prevent
@drop.prevent="
filesChange(
'upload-file',
$event.dataTransfer.files
)
"
>
<div class="space-y-1 text-center">
<svg
class="mx-auto h-12 w-12 text-gray-400"
stroke="currentColor"
fill="none"
viewBox="0 0 48 48"
aria-hidden="true"
>
<path
d="M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
></path>
</svg>
<div class="flex text-sm text-gray-600">
<label
for="file-upload"
class="relative cursor-pointer bg-white rounded-md font-medium text-indigo-600 hover:text-indigo-500 focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-indigo-500"
>
<span
><a
href="javascript:void(0)"
@click="
$refs.input_file.click()
"
>여기</a
></span
>
<input
ref="input_file"
type="file"
name="upload-file"
accept=".jpg,.jpeg,.png"
hidden
@change="
filesChange(
$event.target.name,
$event.target.files
)
"
/>
</label>
<p class="pl-1">
눌러 업로드 하시거나 마우스로
이곳에 끌어 놓아 주세요.
</p>
</div>
<p class="text-xs text-gray-500">
PNG, JPG 최대 1MB
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Privacy section -->
<div class="pt-0">
<div class="mt-4 py-4 px-4 flex justify-end sm:px-6">
<button
type="button"
class="bg-white border border-gray-300 rounded-md shadow-sm py-2 px-4 inline-flex justify-center text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-sky-500"
@click="doCancel"
>
취소
</button>
<button
type="submit"
class="ml-5 bg-sky-700 border border-transparent rounded-md shadow-sm py-2 px-4 inline-flex justify-center text-sm font-medium text-white hover:bg-sky-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-sky-500"
>
저장
</button>
</div>
</div>
</form>
<form class="lg:col-span-9" @submit.prevent="doUpdateLevel">
<div class="py-6 px-4 sm:p-6 lg:pb-8">
<div>
<h2 class="text-lg leading-6 font-medium text-gray-900">
자격 변경
</h2>
<p class="mt-1 text-sm text-gray-500">
사용자의 자격을 변경합니다.
</p>
</div>
<RadioGroup v-model="selectedMailingLists">
<div
class="mt-4 grid grid-cols-1 gap-y-6 sm:grid-cols-4 sm:gap-x-4"
>
<RadioGroupOption
v-for="mailingList in mailingLists"
:key="mailingList.level"
v-slot="{ checked, active }"
as="template"
:value="mailingList"
>
<div
:class="[
checked
? 'border-transparent'
: 'border-gray-300',
active
? 'border-indigo-500 ring-2 ring-indigo-500'
: '',
'relative bg-white border rounded-lg shadow-sm p-4 flex cursor-pointer focus:outline-none',
]"
>
<span class="flex-1 flex">
<span class="flex flex-col">
<RadioGroupLabel
as="span"
class="block text-sm font-medium text-gray-900"
>
{{ mailingList.title }}
</RadioGroupLabel>
<RadioGroupDescription
as="span"
class="mt-1 flex items-center text-sm text-gray-500"
>
{{ mailingList.description }}
</RadioGroupDescription>
<RadioGroupDescription
as="span"
class="mt-6 text-sm font-medium text-gray-900"
>
{{ mailingList.users }}
</RadioGroupDescription>
</span>
</span>
<CheckCircleIcon
:class="[
!checked ? 'invisible' : '',
'h-5 w-5 text-indigo-600',
]"
aria-hidden="true"
/>
<span
:class="[
active ? 'border' : 'border-2',
checked
? 'border-indigo-500'
: 'border-transparent',
'absolute -inset-px rounded-lg pointer-events-none',
]"
aria-hidden="true"
/>
</div>
</RadioGroupOption>
</div>
</RadioGroup>
</div>
<!-- Privacy section -->
<div class="pt-0">
<div class="mt-4 py-4 px-4 flex justify-end sm:px-6">
<button
type="submit"
class="ml-5 bg-sky-700 border border-transparent rounded-md shadow-sm py-2 px-4 inline-flex justify-center text-sm font-medium text-white hover:bg-sky-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-sky-500"
>
현재 자격 저장
</button>
</div>
</div>
</form>
<form class="lg:col-span-9" @submit.prevent="doUpdateLimitCount">
<div class="py-6 px-4 sm:p-6 lg:pb-8">
<div>
<h2 class="text-lg leading-6 font-medium text-gray-900">
API 갯수 제한
</h2>
<p class="mt-1 text-sm text-gray-500">
쵀대 몇개의 API 키를 생성할 있는지를 설정합니다.
</p>
</div>
<div class="mt-6 grid grid-cols-12 gap-6">
<div class="col-span-12 sm:col-span-6">
<label
for="limitCount"
class="block text-sm font-medium text-gray-700"
>최대 API 갯수 제한</label
>
<input
id="limitCount"
v-model="limitCount"
type="number"
name="limitCount"
autocomplete="limitCount"
class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-sky-500 focus:border-sky-500 sm:text-sm"
/>
</div>
</div>
</div>
<!-- Privacy section -->
<div class="pt-0">
<div class="mt-4 py-4 px-4 flex justify-end sm:px-6">
<button
type="submit"
class="ml-5 bg-sky-700 border border-transparent rounded-md shadow-sm py-2 px-4 inline-flex justify-center text-sm font-medium text-white hover:bg-sky-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-sky-500"
>
제한 숫자 저장
</button>
</div>
</div>
</form>
<form class="lg:col-span-9" @submit.prevent="doUpdatePassword">
<div class="py-6 px-4 sm:p-6 lg:pb-8">
<div>
<h2 class="text-lg leading-6 font-medium text-gray-900">
비밀번호 변경
</h2>
<p class="mt-1 text-sm text-gray-500">
새로운 비밀번호를 두번 정확하게 입력해 주셔야 합니다.
</p>
</div>
<div class="mt-6 grid grid-cols-12 gap-6">
<div class="col-span-12 sm:col-span-6">
<label
for="password"
class="block text-sm font-medium text-gray-700"
>새로운 비밀번호</label
>
<input
id="password"
v-model="password"
type="password"
name="password"
autocomplete="password"
class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-sky-500 focus:border-sky-500 sm:text-sm"
/>
</div>
<div class="col-span-12 sm:col-span-6">
<label
for="password2"
class="block text-sm font-medium text-gray-700"
>비밀번호 확인</label
>
<input
id="password2"
v-model="password2"
type="password"
name="password2"
autocomplete="password2"
class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-sky-500 focus:border-sky-500 sm:text-sm"
/>
</div>
</div>
</div>
<!-- Privacy section -->
<div class="pt-0">
<div class="mt-4 py-4 px-4 flex justify-end sm:px-6">
<button
type="submit"
class="ml-5 bg-sky-700 border border-transparent rounded-md shadow-sm py-2 px-4 inline-flex justify-center text-sm font-medium text-white hover:bg-sky-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-sky-500"
>
비밀번호 저장
</button>
</div>
</div>
</form>
<form class="lg:col-span-9" @submit.prevent="doWithdrawal">
<div class="py-6 px-4 sm:p-6 lg:pb-8">
<div>
<h2 class="text-lg leading-6 font-medium text-gray-900">
회원 탈퇴 처리
</h2>
<p class="mt-1 text-sm text-gray-500">
탈퇴 처리를 하시면 계정은 즉시 탈퇴처리 되며 일정기간
동일한 이메일로 재가입 없습니다.
</p>
</div>
</div>
<!-- Privacy section -->
<div class="pt-0">
<div class="mt-4 py-4 px-4 flex justify-end sm:px-6">
<button
type="submit"
class="ml-5 bg-sky-700 border border-transparent rounded-md shadow-sm py-2 px-4 inline-flex justify-center text-sm font-medium text-white hover:bg-sky-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-sky-500"
>
탈퇴 처리
</button>
</div>
</div>
</form>
</div>
</template>
<script setup lang="ts">
import {
RadioGroup,
RadioGroupDescription,
RadioGroupLabel,
RadioGroupOption,
} from '@headlessui/vue';
import { CheckCircleIcon } from '@heroicons/vue/24/solid/index.js';
definePageMeta({
middleware: 'check-auth-admin',
});
/*
const mailingLists = [
{
level: 0,
title: '일반 회원',
description: '서비스에 가입한 상태이나 아무런 권한이 없습니다.',
users: '표기 : user',
},
{
level: 5,
title: '어드민',
description: '모든 기능을 사용할 수 있는 전체 서비스 관리자입니다.',
users: '표기 : admin',
},
];
*/
const mailingLists = [
{
level: 0,
title: '일반 회원',
description: '서비스에 가입한 상태이나 아무런 권한이 없습니다.',
users: '표기 : user',
},
{
level: 3,
title: '회원사 운영자',
description: '사이트 가입 후 어드민이 승인한 사용자입니다.',
users: '표기 : op',
},
{
level: 4,
title: '수퍼 운영자',
description: '필터 단어 추가 권한이 부여되는 운영자 입니다.',
users: '표기 : super',
},
{
level: 5,
title: '어드민',
description: '모든 기능을 사용할 수 있는 전체 서비스 관리자입니다.',
users: '표기 : admin',
},
];
const selectedMailingLists = ref(mailingLists[0]);
const router = useRouter();
const route = useRoute();
const uid = ref('');
const email = ref('');
const displayName = ref('');
const photoUrl = ref('');
const phone = ref('');
const memo = ref('');
const created = ref('');
const password = ref('');
const password2 = ref('');
const limitCount = ref(5);
// email: '1@1', displayName: '1@1', phone: '', memo: ''
let userInfo = {};
function doHistory() {
navigateTo(
'/admin/user/' + route.params.uid + '/history/' + displayName.value
);
/*
router.push({
name: 'admin-user-history',
params: { hero: uid.value, name: displayName.value },
});
*/
}
async function doUpdateLimitCount() {
if (isNaN(limitCount.value)) {
alert('숫자만 입력할 수 있습니다. ');
return false;
} else if (
limitCount.value < 0 ||
limitCount.value > Number.MAX_SAFE_INTEGER
) {
alert(
'입력 가능 범위 내에서 선택해 주세요. 0 ~ ' +
Number.MAX_SAFE_INTEGER
);
return false;
}
const responseJson = await _crossCtl.doComm('update', 'admin:limitCount', {
limitCount: limitCount.value,
});
console.log('responseJson=', responseJson);
if (responseJson['responseMessage'] == 'ok') {
alert('ok');
} else {
alert(responseJson['responseMessage']);
}
}
async function doUpdateInfo() {
const responseJson = await _crossCtl.doComm('update', 'admin:profile', {
hero: hero,
displayName: displayName.value,
photoUrl: photoUrl.value,
infos: {
email: email.value,
phone: phone.value,
memo: memo.value,
},
});
console.log('responseJson=', responseJson);
if (responseJson['responseMessage'] == 'ok') {
alert('ok');
} else {
alert(responseJson['responseMessage']);
}
}
async function doUpdateLevel() {
const responseJson = await _crossCtl.doComm('update', 'admin:level', {
hero: hero,
level: selectedMailingLists.value['level'],
});
console.log('responseJson=', responseJson);
if (responseJson['responseMessage'] == 'ok') {
alert('ok');
} else {
alert(responseJson['responseMessage']);
}
}
async function doUpdatePassword() {
if (password.value == '') {
alert('변경할 비밀번호는 빈칸이면 안됩니다.');
} else if (password.value != password2.value) {
alert('변경할 비밀번호가 확인 입력과 일치하지 않습니다.');
} else {
const responseJson = await _crossCtl.doComm(
'update',
'admin:password',
{
hero: hero,
password_new: password.value,
password_again: password2.value,
}
);
console.log('responseJson=', responseJson);
if (responseJson['responseMessage'] == 'ok') {
alert('ok');
} else {
alert(responseJson['responseMessage']);
}
}
}
async function doCancel() {
router.back();
}
async function doWithdrawal() {
if (window.confirm('이 회원의 탈퇴 처리를 하시겠습니까?')) {
const responseJson = await _crossCtl.doComm(
'update',
'admin:withdrawal',
{
hero: hero,
}
);
console.log('responseJson=', responseJson);
if (responseJson['responseMessage'] == 'ok') {
alert('ok');
router.back();
} else {
alert(responseJson['responseMessage']);
}
}
}
async function filesChange(fieldName, fileList) {
// handle file changes
const formData = new FormData();
if (!fileList.length) return;
// append the files to FormData
Array.from(Array(fileList.length).keys()).map((x) => {
formData.append(fieldName, fileList[x], fileList[x].name);
});
// save it
console.log('formData=', formData);
formData.append('target', 'just');
const responseJson = await _crossCtl.doUpload('just', formData);
console.log('responseJson=', responseJson);
if (responseJson['responseCode'] == 200) {
photoUrl.value =
_crossCtl.config['API_BASE_URL'].replace('/api/', '') +
responseJson['files'][0]['localUrl'];
} else {
alert(responseJson['responseMessage']);
}
}
const hero = route.params.uid as string;
console.log('hero=', hero);
const responseJson = await _crossCtl.doComm('select', 'admin:user:byid', {
hero: hero,
});
console.log('responseJson=', responseJson);
const { $customFormat } = useNuxtApp();
if (responseJson['responseMessage'] == 'ok') {
userInfo = responseJson['data'][0];
const tmpUserInfo = JSON.parse(userInfo['infos']);
limitCount.value = userInfo['limit_count'];
if (tmpUserInfo != null) {
uid.value = hero;
email.value = tmpUserInfo['email'];
displayName.value = userInfo['display_name'];
photoUrl.value = userInfo['photo_url'];
phone.value = tmpUserInfo['phone'];
memo.value = tmpUserInfo['memo'];
created.value = $customFormat(userInfo['created']);
} else {
email.value = 'NaN';
displayName.value = userInfo['display_name'];
photoUrl.value = userInfo['photo_url'];
phone.value = 'NaN';
memo.value = 'NaN';
}
switch (userInfo['user_level']) {
/*
case 0:
case 1:
case 2:
selectedMailingLists.value = mailingLists[0];
break;
case 3:
selectedMailingLists.value = mailingLists[0];
break;
case 4:
selectedMailingLists.value = mailingLists[0];
break;
case 5:
selectedMailingLists.value = mailingLists[1];
break;
*/
case 0:
case 1:
case 2:
selectedMailingLists.value = mailingLists[0];
break;
case 3:
selectedMailingLists.value = mailingLists[1];
break;
case 4:
selectedMailingLists.value = mailingLists[2];
break;
case 5:
selectedMailingLists.value = mailingLists[3];
break;
}
console.log('selectedMailingLists.value=', selectedMailingLists.value);
} else {
alert(responseJson['responseMessage']);
}
</script>

View File

@@ -0,0 +1,266 @@
<!-- 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">
사용자 로그 보기
</h1>
<p class="mt-2 text-sm text-gray-700">
전체 사용자 로그를 보거나 특정 사용자 로그만을 검색해
있습니다.
</p>
</div>
<!--
<div 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>
<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 class="p-0 rounded-bl-2xl rounded-br-2xl md:px-0">
<a
href="javascript:void(0)"
class="text-base font-medium text-indigo-700 hover:text-indigo-600"
@click="$router.back()"
>&larr;이전 화면으로<span aria-hidden="true"> </span
></a>
</div>
</div>
</template>
<script setup lang="ts">
import {
ChevronDownIcon,
MagnifyingGlassCircleIcon,
} from '@heroicons/vue/24/solid';
import consolaGlobalInstance from 'consola';
const { $dayjs } = useNuxtApp();
const router = useRouter();
definePageMeta({
middleware: 'check-auth-admin',
});
const route = useRoute();
console.log('route.params=', route.params);
const targetName = route.params.hero;
const hero = route.params.uid;
console.log('targetName=', targetName);
console.log('hero=', hero);
let listTarget = 'log:user:active';
const listHeadings = [
{
title: '누가',
class: 'py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6',
key: 'uid',
hiddenInfo: {
headClass: '',
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: 'created',
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 sm:table-cell',
key: 'tag',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass: 'hidden px-3 py-4 text-sm text-gray-500 sm:table-cell',
},
];
const listActions = ['상세보기'];
const actionKey = 'serial';
const listKeys = [
'serial',
'raw',
'level',
'comment',
'status',
'updated',
'created',
];
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' } };
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 == 'uid') {
return '' + targetName + '';
} else if (key == 'status') {
let statusTag = '정상';
switch (val) {
case 0:
statusTag = '정상등록';
break;
case 4:
statusTag = '삭제됨';
break;
default:
statusTag = val;
}
return statusTag;
} else if (key == 'level') {
let levelTag = 'mid';
switch (val) {
case 10:
levelTag = 'high';
break;
case 50:
levelTag = 'mid';
break;
case 100:
levelTag = 'low';
break;
default:
levelTag = val;
}
return levelTag;
} else {
return val;
}
}
function doAction(tag, target) {
console.log('on doAction(), tag=', tag, ', target=', target);
if (tag == '상세보기') {
navigateTo('/admin/user/' + hero + '/history/detail/' + target);
} else if (tag == 'search') {
console.log('search for ', target);
if (target == '') {
listTarget = 'log:user:active';
} else {
listTarget = 'log:user';
// hero = target;
}
refresh();
}
}
function pageMove(targetPageIdex) {
console.log('on pageMove(), targetPageIdex=', targetPageIdex);
currentPageNumber.value = targetPageIdex;
refresh();
}
async function refresh() {
const responseJson = await _crossCtl.doComm('list', listTarget, {
start: (currentPageNumber.value - 1) * pageSize.value,
length: pageSize.value,
hero: hero,
});
console.log('listTarget=', listTarget);
console.log('hero=', hero);
console.log('responseJson=', responseJson);
currentPageNumber.value = responseJson['currentPageNumber'];
totalPageCount.value = responseJson['totalPageCount'];
pageSize.value = parseInt(responseJson['pageSize']);
recordsTotal.value = responseJson['recordsTotal'];
listData.value = responseJson['data'];
}
if (hero != undefined) {
doAction('search', hero);
} else {
refresh();
}
</script>

View File

@@ -0,0 +1,232 @@
<!-- This example requires Tailwind CSS v2.0+ -->
<template>
<div class="divide-y divide-gray-200">
<form class="lg:col-span-9">
<!-- Profile section -->
<div class="py-6 px-4 sm:p-6 lg:pb-8">
<div class="sm:flex sm:items-center">
<div class="sm:flex-auto">
<h2 class="text-lg leading-6 font-medium text-gray-900">
로그 상세 보기
</h2>
<p class="mt-1 text-sm text-gray-500"></p>
</div>
<div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none"></div>
</div>
<div class="mt-6 grid grid-cols-12 gap-6">
<div class="col-span-12 sm:col-span-6">
<label
for="email"
class="block text-sm font-medium text-gray-700"
>이메일</label
>
<input
id="email"
v-model="email"
disabled
type="text"
name="email"
autocomplete="email"
class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-sky-500 focus:border-sky-500 sm:text-sm"
/>
</div>
<div class="col-span-12 sm:col-span-6"></div>
</div>
<div class="mt-6 flex flex-col lg:flex-row">
<div class="flex-grow space-y-6">
<div>
<label
for="username"
class="block text-sm font-medium text-gray-700"
>
사용자 이름
</label>
<div class="mt-1 rounded-md shadow-sm flex">
<input
id="username"
v-model="displayName"
disabled
type="text"
name="username"
autocomplete="username"
class="focus:ring-sky-500 focus:border-sky-500 flex-grow block w-full min-w-0 rounded-none rounded-r-md sm:text-sm border-gray-300"
/>
</div>
</div>
<div>
<label
for="phone"
class="block text-sm font-medium text-gray-700"
>
전화번호
</label>
<div class="mt-1 rounded-md shadow-sm flex">
<input
id="phone"
v-model="phone"
disabled
type="text"
name="phone"
autocomplete="phone"
class="focus:ring-sky-500 focus:border-sky-500 flex-grow block w-full min-w-0 rounded-none rounded-r-md sm:text-sm border-gray-300"
/>
</div>
</div>
<div>
<label
for="about"
class="block text-sm font-medium text-gray-700"
>
간단한 소개
</label>
<div class="mt-1">
<textarea
id="about"
v-model="memo"
disabled
name="about"
rows="3"
class="shadow-sm focus:ring-sky-500 focus:border-sky-500 mt-1 block w-full sm:text-sm border border-gray-300 rounded-md"
/>
</div>
<p class="mt-2 text-sm text-gray-500">
로그 참고 사항으로 수정할 없습니다.
</p>
</div>
</div>
</div>
<div class="mt-6 grid grid-cols-12 gap-6">
<div class="col-span-12 sm:col-span-6">
<label
for="email"
class="block text-sm font-medium text-gray-700"
>로그 태그</label
>
<input
id="logTag"
v-model="logTag"
disabled
type="text"
name="logTag"
autocomplete="logTag"
class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-sky-500 focus:border-sky-500 sm:text-sm"
/>
</div>
<div class="col-span-12 sm:col-span-6"></div>
</div>
<div class="mt-6">
<div>
<label
for="about"
class="block text-sm font-medium text-gray-700"
>
부가 정보
</label>
<div class="mt-1">
<vue-json-pretty
class="bg-white shadow-sm focus:ring-sky-500 focus:border-sky-500 mt-1 block w-full sm:text-sm border border-gray-300 rounded-md"
:path="'root'"
:data="logMemo"
>
</vue-json-pretty>
</div>
<p class="mt-2 text-sm text-gray-500"></p>
</div>
</div>
</div>
<!-- Privacy section -->
<div class="pt-0">
<div class="mt-4 py-4 px-4 flex justify-end sm:px-6">
<button
type="button"
class="bg-white border border-gray-300 rounded-md shadow-sm py-2 px-4 inline-flex justify-center text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-sky-500"
@click="doCancel"
>
이전 화면으로
</button>
</div>
</div>
</form>
</div>
</template>
<script setup lang="ts">
definePageMeta({
middleware: 'check-auth-admin',
});
const router = useRouter();
const route = useRoute();
const email = ref('');
const displayName = ref('');
const photoUrl = ref('');
const phone = ref('');
const memo = ref('');
const logTag = ref('');
const logMemo = ref('');
let logInfo = {};
let userInfo = {};
async function doCancel() {
router.back();
}
console.log('route.params=', route.params);
const hero = route.params.hero;
const uid = route.params.uid;
console.log('hero=', hero);
let responseJson = await _crossCtl.doComm('select', 'admin:user:byid', {
hero: uid,
});
console.log('responseJson=', responseJson);
if (responseJson['responseMessage'] == 'ok') {
userInfo = responseJson['data'][0];
const tmpUserInfo = _utils.safeJSON(userInfo['infos']);
if (tmpUserInfo != null) {
email.value = tmpUserInfo['email'];
displayName.value = userInfo['display_name'];
photoUrl.value = userInfo['photo_url'];
phone.value = tmpUserInfo['phone'];
memo.value = tmpUserInfo['memo'];
} else {
email.value = 'NaN';
displayName.value = userInfo['display_name'];
photoUrl.value = userInfo['photo_url'];
phone.value = 'NaN';
memo.value = 'NaN';
}
responseJson = await _crossCtl.doComm('select', 'log:user', {
hero: hero,
});
console.log('responseJson=', responseJson);
if (responseJson['responseMessage'] == 'ok') {
logInfo = responseJson['data'][0];
const tmpLogMemo = _utils.safeJSON(logInfo['memo']);
console.log('logInfo = ', logInfo);
console.log('tmpLogMemo = ', tmpLogMemo);
logTag.value = logInfo['tag'];
logMemo.value = tmpLogMemo;
} else {
alert(responseJson['responseMessage']);
}
} else {
alert(responseJson['responseMessage']);
}
</script>

View File

@@ -0,0 +1,156 @@
<!-- 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">
사용자 리스트
</h1>
<p class="mt-2 text-sm text-gray-700">
전체 등록 사용자 리스트를 확인할 있습니다.
</p>
</div>
<div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none"></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">
const router = useRouter();
definePageMeta({
middleware: 'check-auth-admin',
});
const listHeadings = [
{
title: '이름',
class: 'py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6',
key: 'name',
hiddenInfo: {
headClass: 'font-normal lg:hidden',
dts: [
{ class: 'sr-only', title: '소속' },
{ class: 'sr-only sm:hidden', title: '이메일' },
],
dds: [
{ class: 'mt-1 truncate text-gray-700', key: 'domain' },
{
class: 'mt-1 truncate text-gray-500 sm:hidden',
key: 'email',
},
],
},
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: 'domain',
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 sm:table-cell',
key: 'email',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass: 'hidden px-3 py-4 text-sm text-gray-500 sm:table-cell',
},
{
title: '역할',
class: 'px-3 py-3.5 text-left text-sm font-semibold text-gray-900',
key: 'role',
hiddenInfo: {
headClass: '',
dts: [],
dds: [],
},
subClass: 'px-3 py-4 text-sm text-gray-500',
},
];
const listActions = ['상세보기'];
const actionKey = 'uid';
const listKeys = ['serial', 'uid', 'name', 'domain', 'email', 'role'];
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 {
return val;
}
}
function doAction(tag, target) {
console.log('on doAction(), tag=', tag, ', target=', target);
navigateTo('/admin/user/' + target + '/edit');
}
function pageMove(targetPageIdex) {
console.log('on pageMove(), targetPageIdex=', targetPageIdex);
currentPageNumber.value = targetPageIdex;
refresh();
}
async function refresh() {
if (process.client) {
const responseJson = await _crossCtl.doComm(
'list',
'admin:users:level:all',
{
start: (currentPageNumber.value - 1) * pageSize.value,
length: pageSize.value,
}
);
console.log('responseJson=', responseJson);
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,298 @@
<!-- This example requires Tailwind CSS v2.0+ -->
<template>
<div class="divide-y divide-gray-200">
<form class="lg:col-span-9" @submit.prevent="doUpdate">
<!-- Profile section -->
<div class="py-6 px-4 sm:p-6 lg:pb-8">
<div class="sm:flex sm:items-center">
<div class="sm:flex-auto">
<h2 class="text-lg leading-6 font-medium text-gray-900">
가입 허가 항목 수정
</h2>
<p class="mt-1 text-sm text-gray-500">
이미 가입된 사용자에게는 적용되지 않으며, 항목이
저장된 상태에서 가입시에만 적용됩니다.
</p>
</div>
<div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none"></div>
</div>
<div class="mt-6 grid grid-cols-12 gap-6">
<div class="col-span-12 sm:col-span-6">
<label
for="uid"
class="block text-sm font-medium text-gray-700"
>이메일</label
>
<input
id="uid"
v-model="uid"
disabled
type="text"
name="uid"
autocomplete="uid"
class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-sky-500 focus:border-sky-500 sm:text-sm"
/>
</div>
<div class="col-span-12 sm:col-span-6">
<label
for="uid"
class="block text-sm font-medium text-gray-700"
>생성일</label
>
<input
id="created"
v-model="created"
disabled
type="text"
name="created"
autocomplete="created"
class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-sky-500 focus:border-sky-500 sm:text-sm"
/>
</div>
</div>
<div class="mt-6 flex flex-col lg:flex-row">
<div class="flex-grow space-y-6">
<div>
<label
for="memo"
class="block text-sm font-medium text-gray-700"
>
운영자 메모
</label>
<div class="mt-1">
<textarea
id="memo"
v-model="memo"
name="memo"
rows="3"
class="shadow-sm focus:ring-sky-500 focus:border-sky-500 mt-1 block w-full sm:text-sm border border-gray-300 rounded-md"
/>
</div>
<p class="mt-2 text-sm text-gray-500">
관리자에게만 보여지는 메모 항목 입니다. 관리
편의를 위한 내용을 기입해 주세요.
</p>
</div>
</div>
</div>
<div class="mt-6 flex flex-col lg:flex-row">
<div class="flex-grow space-y-6">
<div>
<label
for="level"
class="block text-sm font-medium text-gray-700"
>
자격 설정
</label>
<div class="mt-1">
<RadioGroup v-model="selectedUserLevelInfo">
<div
class="mt-4 grid grid-cols-1 gap-y-6 sm:grid-cols-4 sm:gap-x-4"
>
<RadioGroupOption
v-for="userLevel in userLevels"
:key="userLevel.level"
v-slot="{ checked, active }"
as="template"
:value="userLevel"
>
<div
:class="[
checked
? 'border-transparent'
: 'border-gray-300',
active
? 'border-indigo-500 ring-2 ring-indigo-500'
: '',
'relative bg-white border rounded-lg shadow-sm p-4 flex cursor-pointer focus:outline-none',
]"
>
<span class="flex-1 flex">
<span class="flex flex-col">
<RadioGroupLabel
as="span"
class="block text-sm font-medium text-gray-900"
>
{{
userLevel.title
}}
</RadioGroupLabel>
<RadioGroupDescription
as="span"
class="mt-1 flex items-center text-sm text-gray-500"
>
{{
userLevel.description
}}
</RadioGroupDescription>
<RadioGroupDescription
as="span"
class="mt-6 text-sm font-medium text-gray-900"
>
{{
userLevel.users
}}
</RadioGroupDescription>
</span>
</span>
<CheckCircleIcon
:class="[
!checked
? 'invisible'
: '',
'h-5 w-5 text-indigo-600',
]"
aria-hidden="true"
/>
<span
:class="[
active
? 'border'
: 'border-2',
checked
? 'border-indigo-500'
: 'border-transparent',
'absolute -inset-px rounded-lg pointer-events-none',
]"
aria-hidden="true"
/>
</div>
</RadioGroupOption>
</div>
</RadioGroup>
</div>
<p class="mt-2 text-sm text-gray-500">
해당 계정이 가입하면 자동으로 보여될 사용자
자격을 설정합니다.
</p>
</div>
</div>
</div>
</div>
<!-- Privacy section -->
<div class="pt-0">
<div class="mt-4 py-4 px-4 flex justify-end sm:px-6">
<button
type="button"
class="bg-white border border-gray-300 rounded-md shadow-sm py-2 px-4 inline-flex justify-center text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-sky-500"
@click="doCancel"
>
닫기
</button>
<button
type="button"
class="ml-5 bg-red-700 border border-transparent rounded-md shadow-sm py-2 px-4 inline-flex justify-center text-sm font-medium text-white hover:bg-red-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500"
@click="doToggle"
>
{{ status == 0 ? '삭제' : '복구' }}
</button>
<button
type="submit"
class="ml-5 bg-sky-700 border border-transparent rounded-md shadow-sm py-2 px-4 inline-flex justify-center text-sm font-medium text-white hover:bg-sky-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-sky-500"
>
저장
</button>
</div>
</div>
</form>
</div>
</template>
<script setup lang="ts">
import {
RadioGroup,
RadioGroupDescription,
RadioGroupLabel,
RadioGroupOption,
} from '@headlessui/vue';
import { CheckCircleIcon } from '@heroicons/vue/24/solid/index.js';
import { stat } from 'fs/promises';
definePageMeta({
middleware: 'check-auth-admin',
});
const userLevels = _crossCtl.siteConfig.userLevels;
const selectedUserLevelInfo = ref(_crossCtl.siteConfig.userLevels[0]);
const router = useRouter();
const route = useRoute();
const serial = ref(0);
const uid = ref('');
const level = ref(0);
const memo = ref('');
const status = ref(0);
const created = ref('');
// email: '1@1', displayName: '1@1', phone: '', memo: ''
let userInfo = {};
function doToggle() {
status.value = status.value == 0 ? 4 : 0;
doUpdate();
}
async function doUpdate() {
const responseJson = await _crossCtl.doComm('update', 'admin:white', {
hero: serial.value,
uid: uid.value,
level: selectedUserLevelInfo.value['level'],
memo: memo.value,
status: status.value,
});
console.log('responseJson=', responseJson);
if (responseJson['responseMessage'] == 'ok') {
alert('ok');
} else {
alert(responseJson['responseMessage']);
}
}
async function doCancel() {
router.back();
}
const hero = route.params.hero as string;
console.log('hero=', hero);
const responseJson = await _crossCtl.doComm('select', 'admin:white', {
hero: hero,
});
console.log('responseJson=', responseJson);
const { $customFormat } = useNuxtApp();
if (responseJson['responseMessage'] == 'ok') {
userInfo = responseJson['data'][0];
serial.value = userInfo['serial'];
uid.value = userInfo['uid'];
level.value = userInfo['level'];
memo.value = userInfo['memo'];
status.value = userInfo['status'];
created.value = $customFormat(userInfo['created']);
for (let i = 0; i < _crossCtl.siteConfig.userLevels.length; i++) {
const tmpLevelInfo = _crossCtl.siteConfig.userLevels[i];
if (tmpLevelInfo.level == level.value) {
selectedUserLevelInfo.value = tmpLevelInfo;
break;
}
}
console.log('selectedUserLevelInfo.value=', selectedUserLevelInfo.value);
} else {
alert(responseJson['responseMessage']);
}
</script>

View File

@@ -0,0 +1,154 @@
<!-- 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">
가입 허가 리스트
</h1>
<p class="mt-2 text-sm text-gray-700">
가입 사전 허가 리스트를 확인할 있습니다.
</p>
</div>
<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="navigateTo('/admin/user/white/new')"
>
계정 추가
</button>
</div>
</div>
<BaseTable2
: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">
const router = useRouter();
definePageMeta({
middleware: 'check-auth-admin',
});
const listHeadings = [
{
title: '아이디',
widthRatio: '100',
key: 'uid',
},
{
title: '역할',
widthRatio: '',
key: 'level',
},
{
title: '상태',
widthRatio: '',
key: 'status',
},
{
title: '생성일',
widthRatio: '',
key: 'created',
},
];
const listActions = ['상세보기'];
const actionKey = 'uid';
const listKeys = ['serial', 'uid', 'name', 'domain', 'email', 'role'];
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');
}
if (key == 'status') {
if (val == 0) {
return '정상';
} else if (val == 4) {
return '삭제';
} else {
return 'unknown(' + val + ')';
}
// return $dayjs(val).format('YY/MM/DD');
}
if (key == 'level') {
switch (val) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
return _crossCtl.siteConfig.userLevelInfo[val]['title'];
break;
default:
return 'unknown(' + val + ')';
}
} else {
return val;
}
}
function doAction(tag, target) {
console.log('on doAction(), tag=', tag, ', target=', target);
navigateTo('/admin/user/white/edit/' + target);
}
function pageMove(targetPageIdex) {
console.log('on pageMove(), targetPageIdex=', targetPageIdex);
currentPageNumber.value = targetPageIdex;
refresh();
}
async function refresh() {
if (process.client) {
const responseJson = await _crossCtl.doComm('list', 'admin:white', {
start: (currentPageNumber.value - 1) * pageSize.value,
length: pageSize.value,
});
console.log('responseJson=', responseJson);
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,244 @@
<!-- This example requires Tailwind CSS v2.0+ -->
<template>
<div class="divide-y divide-gray-200">
<form class="lg:col-span-9" @submit.prevent="doInsert">
<!-- Profile section -->
<div class="py-6 px-4 sm:p-6 lg:pb-8">
<div class="sm:flex sm:items-center">
<div class="sm:flex-auto">
<h2 class="text-lg leading-6 font-medium text-gray-900">
가입 허가 항목 생성
</h2>
<p class="mt-1 text-sm text-gray-500">
이미 가입된 사용자에게는 적용되지 않으며, 항목이
저장된 상태 이후 가입시에만 적용됩니다.
</p>
</div>
<div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none"></div>
</div>
<div class="mt-6 grid grid-cols-12 gap-6">
<div class="col-span-12 sm:col-span-6">
<label
for="uid"
class="block text-sm font-medium text-gray-700"
>이메일</label
>
<input
id="uid"
v-model="uid"
type="text"
name="uid"
autocomplete="uid"
class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-sky-500 focus:border-sky-500 sm:text-sm"
/>
</div>
</div>
<div class="mt-6 flex flex-col lg:flex-row">
<div class="flex-grow space-y-6">
<div>
<label
for="memo"
class="block text-sm font-medium text-gray-700"
>
운영자 메모
</label>
<div class="mt-1">
<textarea
id="memo"
v-model="memo"
name="memo"
rows="3"
class="shadow-sm focus:ring-sky-500 focus:border-sky-500 mt-1 block w-full sm:text-sm border border-gray-300 rounded-md"
/>
</div>
<p class="mt-2 text-sm text-gray-500">
관리자에게만 보여지는 메모 항목 입니다. 관리
편의를 위한 내용을 기입해 주세요.
</p>
</div>
</div>
</div>
<div class="mt-6 flex flex-col lg:flex-row">
<div class="flex-grow space-y-6">
<div>
<label
for="level"
class="block text-sm font-medium text-gray-700"
>
자격 설정
</label>
<div class="mt-1">
<RadioGroup v-model="selectedUserLevelInfo">
<div
class="mt-4 grid grid-cols-1 gap-y-6 sm:grid-cols-4 sm:gap-x-4"
>
<RadioGroupOption
v-for="userLevel in userLevels"
:key="userLevel.level"
v-slot="{ checked, active }"
as="template"
:value="userLevel"
>
<div
:class="[
checked
? 'border-transparent'
: 'border-gray-300',
active
? 'border-indigo-500 ring-2 ring-indigo-500'
: '',
'relative bg-white border rounded-lg shadow-sm p-4 flex cursor-pointer focus:outline-none',
]"
>
<span class="flex-1 flex">
<span class="flex flex-col">
<RadioGroupLabel
as="span"
class="block text-sm font-medium text-gray-900"
>
{{
userLevel.title
}}
</RadioGroupLabel>
<RadioGroupDescription
as="span"
class="mt-1 flex items-center text-sm text-gray-500"
>
{{
userLevel.description
}}
</RadioGroupDescription>
<RadioGroupDescription
as="span"
class="mt-6 text-sm font-medium text-gray-900"
>
{{
userLevel.users
}}
</RadioGroupDescription>
</span>
</span>
<CheckCircleIcon
:class="[
!checked
? 'invisible'
: '',
'h-5 w-5 text-indigo-600',
]"
aria-hidden="true"
/>
<span
:class="[
active
? 'border'
: 'border-2',
checked
? 'border-indigo-500'
: 'border-transparent',
'absolute -inset-px rounded-lg pointer-events-none',
]"
aria-hidden="true"
/>
</div>
</RadioGroupOption>
</div>
</RadioGroup>
</div>
<p class="mt-2 text-sm text-gray-500">
해당 계정이 가입하면 자동으로 보여될 사용자
자격을 설정합니다.
</p>
</div>
</div>
</div>
</div>
<!-- Privacy section -->
<div class="pt-0">
<div class="mt-4 py-4 px-4 flex justify-end sm:px-6">
<button
type="button"
class="bg-white border border-gray-300 rounded-md shadow-sm py-2 px-4 inline-flex justify-center text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-sky-500"
@click="doCancel"
>
취소
</button>
<button
type="submit"
class="ml-5 bg-sky-700 border border-transparent rounded-md shadow-sm py-2 px-4 inline-flex justify-center text-sm font-medium text-white hover:bg-sky-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-sky-500"
>
저장
</button>
</div>
</div>
</form>
</div>
</template>
<script setup lang="ts">
import {
RadioGroup,
RadioGroupDescription,
RadioGroupLabel,
RadioGroupOption,
} from '@headlessui/vue';
import { CheckCircleIcon } from '@heroicons/vue/24/solid/index.js';
definePageMeta({
middleware: 'check-auth-admin',
});
const userLevels = _crossCtl.siteConfig.userLevels;
const selectedUserLevelInfo = ref(_crossCtl.siteConfig.userLevels[0]);
const router = useRouter();
const uid = ref('');
const level = ref(3);
const memo = ref('');
// email: '1@1', displayName: '1@1', phone: '', memo: ''
for (let i = 0; i < _crossCtl.siteConfig.userLevels.length; i++) {
const tmpLevelInfo = _crossCtl.siteConfig.userLevels[i];
if (tmpLevelInfo.level == level.value) {
selectedUserLevelInfo.value = tmpLevelInfo;
break;
}
}
async function doInsert() {
const tmpUID = uid.value;
console.log('tmpUID = ', tmpUID);
if (tmpUID.trim() == '') {
alert('이메일 주소를 아이디로 입력해 주세요.');
return;
}
const responseJson = await _crossCtl.doComm('insert', 'admin:white', {
uid: uid.value,
level: selectedUserLevelInfo.value['level'],
memo: memo.value,
});
console.log('responseJson=', responseJson);
if (responseJson['responseMessage'] == 'ok') {
alert('ok');
router.back();
} else {
if (responseJson['responseMessage'].startsWith('ER_DUP_ENTRY:')) {
alert('이미 동일 아이디가 설정되어 있습니다.');
} else {
alert(responseJson['responseMessage']);
}
}
}
async function doCancel() {
router.back();
}
</script>