817 lines
34 KiB
Vue
817 lines
34 KiB
Vue
<!-- 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>
|