标准化后台逻辑
This commit is contained in:
parent
cdd52dadcb
commit
c0f414b6c9
|
@ -48,24 +48,24 @@ export interface ListParams {
|
||||||
* @param data 获取列表
|
* @param data 获取列表
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function lists(params: ListParams) {
|
export function lists() {
|
||||||
return axios.post<jobuser>('/api/v1/jobuser/lists',params);
|
return axios.post<jobuser>('/admin/api/v1/jobuser/lists');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param id 拉黑
|
* @param id 封禁用户
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function getBlack(id: string) {
|
export function black(id: string) {
|
||||||
return axios.post<Black>('/api/v1/jobuser/getBlack', { id });
|
return axios.post<Black>('/admin/api/v1/jobuser/black', { id });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param id 洗白
|
* @param id 解禁用户
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function getOutBlack(id: string) {
|
export function OutBlack(id: string) {
|
||||||
return axios.post<Black>('/api/v1/jobuser/getOutBlack', { id });
|
return axios.post<Black>('/admin/api/v1/jobuser/outblack', { id });
|
||||||
}
|
}
|
|
@ -5,20 +5,20 @@
|
||||||
<a-card class="general-card" :title="$t('menu.jobuser.userlist')">
|
<a-card class="general-card" :title="$t('menu.jobuser.userlist')">
|
||||||
<a-table :data="data">
|
<a-table :data="data">
|
||||||
<template #columns>
|
<template #columns>
|
||||||
<a-table-column title="用户id" data-index="user_id"></a-table-column>
|
<a-table-column title="用户id" data-index="id"></a-table-column>
|
||||||
<a-table-column title="用户名称" data-index="username"></a-table-column>
|
<a-table-column title="用户名称" data-index="username"></a-table-column>
|
||||||
<a-table-column title="用户积分" data-index="money"></a-table-column>
|
<a-table-column title="用户积分" data-index="money"></a-table-column>
|
||||||
<a-table-column title="累计在线时长/分" data-index="time"></a-table-column>
|
<a-table-column title="累计在线时长/分" data-index="time"></a-table-column>
|
||||||
<a-table-column title="注册时间" data-index="time"></a-table-column>
|
<a-table-column title="注册时间" data-index="created_at"></a-table-column>
|
||||||
<a-table-column title="是否封禁" data-index="black"><template #cell="{ record }">
|
<a-table-column title="是否封禁" data-index="status"><template #cell="{ record }">
|
||||||
{{ record.black == 1 ? '是' : '否' }}
|
{{ record.status == 0 ? '是' : '否' }}
|
||||||
</template></a-table-column>
|
</template></a-table-column>
|
||||||
<a-table-column title="操作">
|
<a-table-column title="操作">
|
||||||
<template #cell="{ record }">
|
<template #cell="{ record }">
|
||||||
<!-- <a-button @click="create(record.id)">编辑</a-button> -->
|
<!-- <a-button @click="create(record.id)">编辑</a-button> -->
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-button v-show="record.black != 1" status="danger" @click="showConfirm(record.id)">封禁</a-button>
|
<a-button v-if="record.status == 1" status="danger" @click="showConfirm(record.id)">封禁</a-button>
|
||||||
<a-button v-show="record.black == 1" status="danger" @click="showConfirm(record.id)">解禁</a-button>
|
<a-button v-if="record.status == 0" status="danger" @click="showConfirm_out(record.id)">解禁</a-button>
|
||||||
<a-button @click="show_group(record.id)">查看团队</a-button>
|
<a-button @click="show_group(record.id)">查看团队</a-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
|
@ -38,13 +38,14 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, ref, reactive, watch, nextTick, onMounted } from 'vue';
|
import { computed, ref, reactive, watch, nextTick, onMounted } from 'vue';
|
||||||
import { lists, getBlack, ListParams } from '@/api/jobuser';
|
import { lists, black, ListParams,OutBlack } from '@/api/jobuser';
|
||||||
import { Modal } from '@arco-design/web-vue';
|
import { Modal } from '@arco-design/web-vue';
|
||||||
import { Message } from '@arco-design/web-vue';
|
import { Message } from '@arco-design/web-vue';
|
||||||
|
|
||||||
import showgroup from './components/showgroup.vue';
|
import showgroup from './components/showgroup.vue';
|
||||||
|
|
||||||
interface DataItem {
|
interface DataItem {
|
||||||
|
id: number;
|
||||||
username: string;
|
username: string;
|
||||||
password: string;
|
password: string;
|
||||||
time: Date;
|
time: Date;
|
||||||
|
@ -65,31 +66,46 @@ const showConfirm = (id: string) => {
|
||||||
title: '操作提醒',
|
title: '操作提醒',
|
||||||
content: '请确认是否要拉黑该用户',
|
content: '请确认是否要拉黑该用户',
|
||||||
onOk: () => handleBlock(id),
|
onOk: () => handleBlock(id),
|
||||||
onCancel: () => Message.info('取消操作'),
|
// onCancel: () => Message.info('取消操作'),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const showConfirm_out = (id: string) => {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '操作提醒',
|
||||||
|
content: '请确认是否要解禁该用户',
|
||||||
|
onOk: () => OutBlock(id),
|
||||||
|
// onCancel: () => Message.info('取消操作'),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const OutBlock = async (id: string) => {
|
||||||
|
const res = await OutBlack(id);
|
||||||
|
if (res.code == 200) {
|
||||||
|
getAll()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleBlock = async (id: string) => {
|
||||||
const handleBlock = (id: string) => {
|
const res = await black(id);
|
||||||
getBlack(id).then(res => {
|
if (res.code == 200) {
|
||||||
console.log(res.status)
|
|
||||||
if (res.status == 'success') {
|
|
||||||
getAll();
|
|
||||||
Message.success('拉黑成功')
|
Message.success('拉黑成功')
|
||||||
|
getAll()
|
||||||
} else {
|
} else {
|
||||||
Message.error('拉黑失败')
|
Message.error('拉黑失败')
|
||||||
}
|
}
|
||||||
})
|
|
||||||
};
|
};
|
||||||
const queryParams = ref({
|
const queryParams = ref({
|
||||||
black: null,
|
black: null,
|
||||||
username: null
|
username: null
|
||||||
});
|
});
|
||||||
const getAll = () => {
|
/**
|
||||||
lists(queryParams.value).then(res => {
|
* 获取所有的用户列表
|
||||||
|
*/
|
||||||
|
const getAll = async () => {
|
||||||
|
const res= await lists();
|
||||||
|
if(res.code==200){
|
||||||
data.value = res.data;
|
data.value = res.data;
|
||||||
})
|
}
|
||||||
};
|
};
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
getAll()
|
getAll()
|
||||||
|
|
Loading…
Reference in New Issue