회원리스트 페이지

This commit is contained in:
Yu Sung
2023-08-06 11:12:35 +09:00
parent c60930a566
commit 1d4bcd601d
5 changed files with 39 additions and 39 deletions

View File

@@ -68,7 +68,7 @@
</thead>
<tbody>
<tr
v-for="item in accounts"
v-for="item in memberList"
:key="item.id"
>
<td>{{ item.id }}</td>
@@ -206,7 +206,7 @@
import * as api from '@/api/member'
export default {
name: "AccountList",
name: "MemberList",
data() {
return {
@@ -214,8 +214,8 @@ export default {
page: 1,
total_page: 0,
search_word: '',
accounts: [],
account: null,
memberList: [],
member: null,
email: null,
nickname: null,
user_type: null,
@@ -224,7 +224,7 @@ export default {
},
async created() {
await this.getAccounts()
await this.getMemberList()
},
methods: {
@@ -238,23 +238,23 @@ export default {
async search() {
this.page = 1
await this.searchAccount()
await this.searchMember()
},
async searchAccount() {
async searchMember() {
if (this.search_word.length === 0) {
await this.getAccounts()
await this.getMemberList()
} else if (this.search_word.length < 2) {
this.notifyError('검색어를 2글자 이상 입력하세요.')
} else {
this.is_loading = true
try {
const res = await api.searchAccount(this.search_word, this.page)
const res = await api.searchMember(this.search_word, this.page)
if (res.status === 200 && res.data.success === true) {
const data = res.data.data
const total_page = Math.ceil(data.totalCount / 20)
this.accounts = data.items
this.memberList = data.items
if (total_page <= 0)
this.total_page = 1
@@ -275,21 +275,21 @@ export default {
async next() {
if (this.search_word.length < 2) {
this.search_word = ''
await this.getAccounts()
await this.getMemberList()
} else {
await this.searchAccount()
await this.searchMember()
}
},
async getAccounts() {
async getMemberList() {
this.is_loading = true
try {
const res = await api.getAccountList(this.page)
const res = await api.getMemberList(this.page)
if (res.status === 200 && res.data.success === true) {
const data = res.data.data
const total_page = Math.ceil(data.totalCount / 20)
this.accounts = data.items
this.memberList = data.items
if (total_page <= 0)
this.total_page = 1
@@ -306,23 +306,23 @@ export default {
}
},
showPopupDialog(account) {
this.account = account
showPopupDialog(member) {
this.member = member
if (account.userType === '일반회원') {
if (member.userType === '일반회원') {
this.user_type = 'USER'
} else if (account.userType === '요즘친구') {
} else if (member.userType === '요즘친구') {
this.user_type = 'CREATOR'
}
this.email = account.email
this.nickname = account.nickname
this.email = member.email
this.nickname = member.nickname
this.show_popup_dialog = true
},
cancel() {
this.account = null
this.member = null
this.email = null
this.nickname = null
this.user_type = null
@@ -333,20 +333,20 @@ export default {
this.is_loading = true
if (
(this.user_type === 'CREATOR' && this.account.userType === '요즘친구') ||
(this.user_type === 'USER' && this.account.userType === '일반회원')
(this.user_type === 'CREATOR' && this.member.userType === '요즘친구') ||
(this.user_type === 'USER' && this.member.userType === '일반회원')
) {
this.notifyError("변경사항이 없습니다.")
} else {
try {
const res = await api.updateAccount(this.account.id, this.user_type)
const res = await api.updateMember(this.member.id, this.user_type)
if (res.status === 200 && res.data.success === true) {
this.page = 1
this.total_page = 0
this.search_word = ''
this.accounts = []
await this.getAccounts()
this.memberList = []
await this.getMemberList()
} else {
this.notifyError(res.data.message || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
}