mirror of
https://github.com/TangSengDaoDao/TangSengDaoDaoManager
synced 2025-06-05 00:28:11 +00:00
feat: ✨新增群组接口调试
This commit is contained in:
parent
d023507ce9
commit
b0176c66fd
19
src/api/group.ts
Normal file
19
src/api/group.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import request from '@/utils/axios';
|
||||
|
||||
// 群列表
|
||||
export function groupListGet(params: any) {
|
||||
return request({
|
||||
url: '/manager/group/list',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
// 封禁群列表
|
||||
export function groupDisablelistGet(params: any) {
|
||||
return request({
|
||||
url: '/manager/group/disablelist',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
@ -8,3 +8,12 @@ export function userListGet(params: any) {
|
||||
params
|
||||
});
|
||||
}
|
||||
|
||||
// 封禁用户列表
|
||||
export function userDisablelistGet(params: any) {
|
||||
return request({
|
||||
url: '/manager/user/disablelist',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
|
@ -9,10 +9,10 @@
|
||||
<div class="flex items-center h-50px">
|
||||
<el-form inline>
|
||||
<el-form-item class="mb-0 !mr-16px">
|
||||
<el-input v-model="queryFrom.keyword" placeholder="uid/手机号/用户名" clearable />
|
||||
<el-input v-model="queryFrom.keyword" placeholder="群名称/群编号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item class="mb-0 !mr-0">
|
||||
<el-button type="primary" @click="getUserList">查询</el-button>
|
||||
<el-button type="primary" @click="getTableList">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
@ -66,32 +66,28 @@ meta:
|
||||
import { ElButton, ElSpace, ElAvatar } from 'element-plus';
|
||||
import { BU_DOU_CONFIG } from '@/config';
|
||||
// API 接口
|
||||
import { userListGet } from '@/api/user';
|
||||
import { groupDisablelistGet } from '@/api/group';
|
||||
/**
|
||||
* 表格
|
||||
*/
|
||||
const column = reactive([
|
||||
const column = reactive<Column.ColumnOptions[]>([
|
||||
{
|
||||
prop: 'name',
|
||||
label: '用户名',
|
||||
fixed: 'left',
|
||||
width: 140
|
||||
label: '群名称'
|
||||
},
|
||||
{
|
||||
prop: 'phone',
|
||||
label: '手机号',
|
||||
fixed: 'left',
|
||||
width: 120
|
||||
prop: 'group_no',
|
||||
label: '群编号'
|
||||
},
|
||||
{
|
||||
prop: 'avatar',
|
||||
label: '头像',
|
||||
label: '群头像',
|
||||
align: 'center',
|
||||
width: 80,
|
||||
width: 100,
|
||||
render: (scope: any) => {
|
||||
let img_url = '';
|
||||
if (scope.row['uid']) {
|
||||
img_url = `${BU_DOU_CONFIG.APP_URL}users/${scope.row['uid']}/avatar`;
|
||||
if (scope.row['group_no']) {
|
||||
img_url = `${BU_DOU_CONFIG.APP_URL}groups/${scope.row['group_no']}/avatar`;
|
||||
}
|
||||
return (
|
||||
<ElAvatar src={img_url} size={54}>
|
||||
@ -101,45 +97,29 @@ const column = reactive([
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'uid',
|
||||
label: '用户ID',
|
||||
minWidth: 300
|
||||
prop: 'member_count',
|
||||
label: '群人数'
|
||||
},
|
||||
{
|
||||
prop: 'short_no',
|
||||
label: '悟空号'
|
||||
},
|
||||
{
|
||||
prop: 'sex',
|
||||
label: '性别',
|
||||
width: 60,
|
||||
formatter(row: any) {
|
||||
return row.sex === 1 ? '男' : '女';
|
||||
}
|
||||
label: '群主名称'
|
||||
},
|
||||
{
|
||||
prop: 'register_time',
|
||||
label: '注册时间',
|
||||
width: 170
|
||||
},
|
||||
{
|
||||
prop: 'last_online_time',
|
||||
label: '封禁日期',
|
||||
width: 150
|
||||
label: '创建时间'
|
||||
},
|
||||
{
|
||||
prop: 'operation',
|
||||
label: '操作',
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
width: 180,
|
||||
width: 120,
|
||||
render: (scope: any) => {
|
||||
return (
|
||||
<ElSpace>
|
||||
<ElButton type="primary" onClick={() => aa(scope.row)}>
|
||||
发消息
|
||||
解禁
|
||||
</ElButton>
|
||||
<ElButton>更多</ElButton>
|
||||
</ElSpace>
|
||||
);
|
||||
}
|
||||
@ -157,9 +137,9 @@ const queryFrom = reactive({
|
||||
page_index: 1
|
||||
});
|
||||
|
||||
const getUserList = () => {
|
||||
const getTableList = () => {
|
||||
loadTable.value = true;
|
||||
userListGet(queryFrom).then((res: any) => {
|
||||
groupDisablelistGet(queryFrom).then((res: any) => {
|
||||
loadTable.value = false;
|
||||
tableData.value = res.list;
|
||||
total.value = res.count;
|
||||
@ -169,13 +149,13 @@ const getUserList = () => {
|
||||
// 分页page-size
|
||||
const onSizeChange = (size: number) => {
|
||||
queryFrom.page_size = size;
|
||||
getUserList();
|
||||
getTableList();
|
||||
};
|
||||
|
||||
// 分页page-size
|
||||
const onCurrentChange = (current: number) => {
|
||||
queryFrom.page_index = current;
|
||||
getUserList();
|
||||
getTableList();
|
||||
};
|
||||
|
||||
const aa = (a: any) => {
|
||||
@ -184,7 +164,7 @@ const aa = (a: any) => {
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getUserList();
|
||||
getTableList();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
<div class="flex items-center h-50px">
|
||||
<el-form inline>
|
||||
<el-form-item class="mb-0 !mr-16px">
|
||||
<el-input v-model="queryFrom.keyword" placeholder="uid/手机号/用户名" clearable />
|
||||
<el-input v-model="queryFrom.keyword" placeholder="群名称/群编号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item class="mb-0 !mr-0">
|
||||
<el-button type="primary" @click="getUserList">查询</el-button>
|
||||
@ -63,35 +63,35 @@ meta:
|
||||
</route>
|
||||
|
||||
<script lang="tsx" setup>
|
||||
import { ElButton, ElSpace, ElAvatar } from 'element-plus';
|
||||
import { ElButton, ElSpace, ElAvatar, ElDropdown, ElDropdownMenu, ElDropdownItem } from 'element-plus';
|
||||
import { BU_DOU_CONFIG } from '@/config';
|
||||
// API 接口
|
||||
import { userListGet } from '@/api/user';
|
||||
import { groupListGet } from '@/api/group';
|
||||
/**
|
||||
* 表格
|
||||
*/
|
||||
const column = reactive([
|
||||
const column = reactive<Column.ColumnOptions[]>([
|
||||
{
|
||||
prop: 'name',
|
||||
label: '用户名',
|
||||
label: '群名称',
|
||||
fixed: 'left',
|
||||
width: 140
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
prop: 'phone',
|
||||
label: '手机号',
|
||||
prop: 'group_no',
|
||||
label: '群编号',
|
||||
fixed: 'left',
|
||||
width: 120
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
prop: 'avatar',
|
||||
label: '头像',
|
||||
label: '群头像',
|
||||
align: 'center',
|
||||
width: 80,
|
||||
width: 100,
|
||||
render: (scope: any) => {
|
||||
let img_url = '';
|
||||
if (scope.row['uid']) {
|
||||
img_url = `${BU_DOU_CONFIG.APP_URL}users/${scope.row['uid']}/avatar`;
|
||||
if (scope.row['group_no']) {
|
||||
img_url = `${BU_DOU_CONFIG.APP_URL}groups/${scope.row['group_no']}/avatar`;
|
||||
}
|
||||
return (
|
||||
<ElAvatar src={img_url} size={54}>
|
||||
@ -101,31 +101,30 @@ const column = reactive([
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'uid',
|
||||
label: '用户ID',
|
||||
minWidth: 300
|
||||
},
|
||||
{
|
||||
prop: 'short_no',
|
||||
label: '悟空号'
|
||||
},
|
||||
{
|
||||
prop: 'sex',
|
||||
label: '性别',
|
||||
width: 60,
|
||||
prop: 'status',
|
||||
label: '群状态',
|
||||
width: 80,
|
||||
formatter(row: any) {
|
||||
return row.sex === 1 ? '男' : '女';
|
||||
return row.status === 1 ? '正常' : '封禁中';
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'register_time',
|
||||
label: '注册时间',
|
||||
width: 170
|
||||
prop: 'member_count',
|
||||
label: '群人数',
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
prop: 'last_online_time',
|
||||
label: '封禁日期',
|
||||
width: 150
|
||||
prop: 'create_name',
|
||||
label: '群主名称'
|
||||
},
|
||||
{
|
||||
prop: 'creator',
|
||||
label: '群主ID'
|
||||
},
|
||||
{
|
||||
prop: 'create_at',
|
||||
label: '创建时间',
|
||||
width: 180
|
||||
},
|
||||
{
|
||||
prop: 'operation',
|
||||
@ -139,7 +138,22 @@ const column = reactive([
|
||||
<ElButton type="primary" onClick={() => aa(scope.row)}>
|
||||
发消息
|
||||
</ElButton>
|
||||
<ElButton>更多</ElButton>
|
||||
<ElDropdown
|
||||
v-slots={{
|
||||
default: () => <ElButton>更多</ElButton>,
|
||||
dropdown: () => {
|
||||
return (
|
||||
<ElDropdownMenu>
|
||||
<ElDropdownItem onClick={() => bb(scope.row)}>群成员</ElDropdownItem>
|
||||
<ElDropdownItem>聊天记录</ElDropdownItem>
|
||||
<ElDropdownItem>黑名单成员</ElDropdownItem>
|
||||
<ElDropdownItem>{scope.row.forbidden === 1 ? '禁言中' : '禁言'}</ElDropdownItem>
|
||||
<ElDropdownItem>{scope.row.status === 1 ? '封禁' : '解禁'}</ElDropdownItem>
|
||||
</ElDropdownMenu>
|
||||
);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</ElSpace>
|
||||
);
|
||||
}
|
||||
@ -159,7 +173,7 @@ const queryFrom = reactive({
|
||||
|
||||
const getUserList = () => {
|
||||
loadTable.value = true;
|
||||
userListGet(queryFrom).then((res: any) => {
|
||||
groupListGet(queryFrom).then((res: any) => {
|
||||
loadTable.value = false;
|
||||
tableData.value = res.list;
|
||||
total.value = res.count;
|
||||
@ -182,6 +196,10 @@ const aa = (a: any) => {
|
||||
console.log(a);
|
||||
};
|
||||
|
||||
const bb = (a: any) => {
|
||||
console.log(a);
|
||||
};
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getUserList();
|
||||
|
@ -66,7 +66,7 @@ meta:
|
||||
import { ElButton, ElSpace, ElAvatar } from 'element-plus';
|
||||
import { BU_DOU_CONFIG } from '@/config';
|
||||
// API 接口
|
||||
import { userListGet } from '@/api/user';
|
||||
import { userDisablelistGet } from '@/api/user';
|
||||
/**
|
||||
* 表格
|
||||
*/
|
||||
@ -123,7 +123,7 @@ const column = reactive([
|
||||
width: 170
|
||||
},
|
||||
{
|
||||
prop: 'last_online_time',
|
||||
prop: 'closure_time',
|
||||
label: '封禁日期',
|
||||
width: 150
|
||||
},
|
||||
@ -132,14 +132,13 @@ const column = reactive([
|
||||
label: '操作',
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
width: 180,
|
||||
width: 120,
|
||||
render: (scope: any) => {
|
||||
return (
|
||||
<ElSpace>
|
||||
<ElButton type="primary" onClick={() => aa(scope.row)}>
|
||||
发消息
|
||||
解禁
|
||||
</ElButton>
|
||||
<ElButton>更多</ElButton>
|
||||
</ElSpace>
|
||||
);
|
||||
}
|
||||
@ -159,7 +158,7 @@ const queryFrom = reactive({
|
||||
|
||||
const getUserList = () => {
|
||||
loadTable.value = true;
|
||||
userListGet(queryFrom).then((res: any) => {
|
||||
userDisablelistGet(queryFrom).then((res: any) => {
|
||||
loadTable.value = false;
|
||||
tableData.value = res.list;
|
||||
total.value = res.count;
|
||||
|
12
src/types/global.d.ts
vendored
12
src/types/global.d.ts
vendored
@ -78,3 +78,15 @@ type ObjToKeyValUnion<T> = {
|
||||
type ObjToKeyValArray<T> = {
|
||||
[K in keyof T]: [K, T[K]];
|
||||
}[keyof T];
|
||||
declare namespace Column {
|
||||
interface ColumnOptions {
|
||||
prop: string;
|
||||
label: string;
|
||||
fixed?: string;
|
||||
width?: number;
|
||||
minWidth?: number;
|
||||
align?: string;
|
||||
formatter?: (scope: any) => void;
|
||||
render?: (scope: any) => VNode;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user