회원리스트 페이지
This commit is contained in:
parent
c60930a566
commit
1d4bcd601d
|
@ -8,16 +8,16 @@ async function login(email, password) {
|
|||
});
|
||||
}
|
||||
|
||||
async function getAccountList(page) {
|
||||
async function getMemberList(page) {
|
||||
return Vue.axios.get(
|
||||
"/admin/account/list?page=" + (page - 1) +
|
||||
"/admin/member/list?page=" + (page - 1) +
|
||||
"&size=20"
|
||||
)
|
||||
}
|
||||
|
||||
async function searchAccount(searchWord, page) {
|
||||
async function searchMember(searchWord, page) {
|
||||
return Vue.axios.get(
|
||||
"/admin/account/search?search_word=" + searchWord +
|
||||
"/admin/member/search?search_word=" + searchWord +
|
||||
"&page=" + (page - 1) +
|
||||
"&size=20"
|
||||
)
|
||||
|
@ -25,29 +25,29 @@ async function searchAccount(searchWord, page) {
|
|||
|
||||
async function getCreatorAccountList(page) {
|
||||
return Vue.axios.get(
|
||||
"/admin/account/creator/list?page=" + (page - 1) +
|
||||
"/admin/member/creator/list?page=" + (page - 1) +
|
||||
"&size=20"
|
||||
)
|
||||
}
|
||||
|
||||
async function searchCreatorAccount(searchWord, page) {
|
||||
return Vue.axios.get(
|
||||
"/admin/account/creator/search?search_word=" + searchWord +
|
||||
"/admin/member/creator/search?search_word=" + searchWord +
|
||||
"&page=" + (page - 1) +
|
||||
"&size=20"
|
||||
)
|
||||
}
|
||||
|
||||
async function updateAccount(id, user_type) {
|
||||
async function updateMember(id, user_type) {
|
||||
const request = {id, userType: user_type}
|
||||
return Vue.axios.put("/admin/account", request)
|
||||
return Vue.axios.put("/admin/member", request)
|
||||
}
|
||||
|
||||
export {
|
||||
login,
|
||||
getAccountList,
|
||||
searchAccount,
|
||||
getMemberList,
|
||||
searchMember,
|
||||
getCreatorAccountList,
|
||||
searchCreatorAccount,
|
||||
updateAccount
|
||||
updateMember
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ const routes = [
|
|||
{
|
||||
path: '/member/list',
|
||||
name: 'MemberList',
|
||||
component: () => import(/* webpackChunkName: "member" */ '../views/Account/MemberList.vue')
|
||||
component: () => import(/* webpackChunkName: "member" */ '../views/Member/./MemberList')
|
||||
},
|
||||
{
|
||||
path: '/creator/tags',
|
||||
|
|
|
@ -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 || '알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.')
|
||||
}
|
Loading…
Reference in New Issue