Browse Source

feat: 好友审核模块

master
wangxiang 2 years ago
parent
commit
f14dddb171
  1. 3
      src/api/platform/common/controller/pushConcernFan.ts
  2. 37
      src/views/common/push/pushFriendAudit/FriendAuditModal.vue
  3. 77
      src/views/common/push/pushFriendAudit/index.vue
  4. 132
      src/views/common/push/pushFriendAudit/userManage.data.ts

3
src/api/platform/common/controller/pushConcernFan.ts

@ -4,7 +4,6 @@ import { defHttp } from '/@/utils/http/axios'; @@ -4,7 +4,6 @@ import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/common_proxy/common/pushConcernFan/list',
get = '/common_proxy/common/pushConcernFan',
audit = '/common_proxy/common/pushConcernFan/audit',
add = '/common_proxy/common/pushConcernFan/save',
edit = '/common_proxy/common/pushConcernFan/update',
del = '/common_proxy/common/pushConcernFan/remove',
@ -19,5 +18,3 @@ export const editPushConcernFan = (params: Partial<PushConcernFan>) => defHttp.p @@ -19,5 +18,3 @@ export const editPushConcernFan = (params: Partial<PushConcernFan>) => defHttp.p
export const getPushConcernFan = (id: string) => defHttp.get<PushConcernFan>({ url: `${Api.get}/${id}` });
export const delPushConcernFan = (ids: string) => defHttp.delete({ url: `${Api.del}/${ids}` });
export const auditPushConcernFan = (ids: string) => defHttp.delete({ url: `${Api.audit}/${ids}` });

37
src/views/common/push/pushFriendAudit/UserManageModal.vue → src/views/common/push/pushFriendAudit/FriendAuditModal.vue

@ -3,31 +3,26 @@ @@ -3,31 +3,26 @@
v-bind="$attrs"
width="720px"
:showCancelBtn="false"
okText="同意"
okText="通过"
@register="registerModal"
@ok="handleSubmit"
>
<template #centerFooter>
<a-button danger type="primary" @click="handleReject">拒绝</a-button>
<a-button danger type="primary" @click="handleReject">驳回</a-button>
</template>
<BasicForm @register="registerForm"/>
</BasicModal>
</template>
<script lang="ts" setup>
/**
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致
* 采用vben-动态表格表单封装组件编写,采用 setup 写法
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved.
* author entfrm开发团队-王翔
*/
import { ref, unref } from 'vue';
import { BasicForm, useForm } from '/@/components/Form/index';
import { formSchema } from './userManage.data';
import { editPushUserManage, getPushUserManage, delPushUserManage } from '/@/api/platform/common/controller/pushUserManage';
import { formSchema } from '../pushConcern/concern.data';
import { getPushConcernFan, editPushConcernFan, delPushConcernFan } from '/@/api/platform/common/controller/pushConcernFan';
import { BasicModal, ModalProps, useModalInner } from '/@/components/Modal';
import {useMessage} from '/@/hooks/web/useMessage';
import { ref } from 'vue';
import { useMessage } from '/@/hooks/web/useMessage';
const { createMessage } = useMessage();
const id = ref<string>('');
const emit = defineEmits(['success', 'register']);
const [registerForm, { resetFields, setFieldsValue, validate, clearValidate, updateSchema, setProps }] = useForm({
labelWidth: 100,
@ -35,23 +30,25 @@ @@ -35,23 +30,25 @@
showActionButtonGroup: false,
baseColProps: { span: 24 }
});
const id = ref<string>('');
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data: WindowInnerData = { _tag: '' }) => {
//
await resetFields();
await clearValidate();
//
id.value = data.record?.id;
const props: Partial<ModalProps> = { confirmLoading: false };
props.title = '推送申请';
await setFieldsValue(await getPushUserManage(id.value));
// tag
props.title = '好友审核';
await setFieldsValue(await getPushConcernFan(id.value));
await setProps({ disabled: true });
// :
setModalProps(props);
});
async function handleReject() {
await delPushUserManage(id.value);
await delPushConcernFan(id.value);
closeModal();
createMessage.info('申请拒绝!');
createMessage.info('审核驳回!');
emit('success');
}
@ -60,9 +57,9 @@ @@ -60,9 +57,9 @@
const formData = await validate();
formData.status = '1';
setModalProps({ confirmLoading: true });
await editPushUserManage(formData);
await editPushConcernFan(formData);
closeModal();
createMessage.success('申请通过!');
createMessage.success('审核通过!');
emit('success');
} finally {
setModalProps({ confirmLoading: false });

77
src/views/common/push/pushFriendAudit/index.vue

@ -9,56 +9,49 @@ @@ -9,56 +9,49 @@
type="primary"
:disabled="state.multiple"
@click="handleDel()"
>拒绝</a-button>
>移除粉丝</a-button>
</template>
<template #action="{ record }">
<TableAction
:actions="[
{
label: '审核',
icon: 'fa6-regular:pen-to-square',
onClick: handleEdit.bind(null, record)
},
{
label: '删除',
icon: 'ant-design:delete-outlined',
color: 'error',
onClick: handleDel.bind(null, record)
}]"
/>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
label: '审核',
icon: 'fa6-regular:pen-to-square',
onClick: handleViewEdit.bind(null, record)
},
{
label: '驳回',
icon: 'ant-design:delete-outlined',
color: 'error',
onClick: handleDel.bind(null, record)
}]"
/>
</template>
</template>
</BasicTable>
<!--弹出窗体区域-->
<UserManageModal @register="registerModal" @success="handleRefreshTable"/>
<FriendAuditModal @register="registerModal" @success="handleRefreshTable"/>
</div>
</template>
<script lang="ts" setup>
/**
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致
* 采用vben-动态表格表单封装组件编写,采用 setup 写法
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved.
* author entfrm开发团队-王翔
*/
import { reactive, toRaw } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { listPushUserManage, delPushUserManage } from '/@/api/platform/common/controller/pushUserManage';
import { listPushConcernFan, delPushConcernFan } from '/@/api/platform/common/controller/pushConcernFan';
import { useModal } from '/@/components/Modal';
import UserManageModal from './UserManageModal.vue';
import { columns, searchFormSchema } from './userManage.data';
import FriendAuditModal from './FriendAuditModal.vue';
import { columns, searchFormSchema } from '../pushConcern/concern.data';
import { useMessage } from '/@/hooks/web/useMessage';
import {useUserStore} from '/@/store/modules/user';
import { useUserStore } from '/@/store/modules/user';
const userStore = useUserStore();
const userInfoStore = userStore.getUserInfo;
/** 类型规范统一声明定义区域 */
interface TableState {
single: boolean;
multiple: boolean;
}
/** 通用变量统一声明区域 */
const state = reactive<TableState>({
//
single: true,
@ -68,8 +61,8 @@ @@ -68,8 +61,8 @@
const { createConfirm, createMessage } = useMessage();
const [registerModal, { openModal }] = useModal();
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({
title: '推送列表',
api: listPushUserManage,
title: '审核列表',
api: listPushConcernFan,
rowKey: 'id',
columns,
formConfig: {
@ -90,12 +83,11 @@ @@ -90,12 +83,11 @@
width: 220,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
fixed: false
},
searchInfo: {
status: '0',
toUserId: userInfoStore.id
concernUserId: userInfoStore.id
},
handleSearchInfoFn: () => clearSelectedRowKeys()
});
@ -107,15 +99,10 @@ @@ -107,15 +99,10 @@
state.multiple = !rowSelection.length;
}
/** 新增按钮操作,行内新增与工具栏局域新增通用 */
function handleAdd() {
openModal(true,{ _tag: 'add' });
}
/** 编辑按钮操作,行内编辑 */
function handleEdit(record?: Recordable) {
/** 查看按钮操作,行内查看 */
function handleViewEdit(record?: Recordable) {
record = record || { id: getSelectRowKeys() };
openModal(true, { _tag: 'edit', record });
openModal(true, { _tag: 'view', record });
}
/** 删除按钮操作,行内删除 */
@ -124,10 +111,10 @@ @@ -124,10 +111,10 @@
createConfirm({
iconType: 'warning',
title: '警告',
content: `是否确认拒绝编号为${ids}的数据?`,
content: `是否确认移除编号为${ids}的数据?`,
onOk: async () => {
await delPushUserManage(ids);
createMessage.success('拒绝成功!');
await delPushConcernFan(ids);
createMessage.success('移除成功!');
handleRefreshTable();
}
});

132
src/views/common/push/pushFriendAudit/userManage.data.ts

@ -1,132 +0,0 @@ @@ -1,132 +0,0 @@
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
/** 表格列配置 */
export const columns: BasicColumn[] = [
{
title: '名称',
dataIndex: 'userName'
},
{
title: '是否播放声音',
dataIndex: 'playSound',
customRender: ({record}) => {
return ~~record?.playSound === 0 ? '是' : '否';
}
},
{
title: '是否震动',
dataIndex: 'playVibrate',
customRender: ({record}) => {
return ~~record?.playVibrate === 0 ? '是' : '否';
}
},
{
title: '是否闪光',
dataIndex: 'playLights',
customRender: ({record}) => {
return ~~record?.playLights === 0 ? '是' : '否';
}
},
{
title: '创建人',
dataIndex: 'createByName'
},
{
title: '创建时间',
dataIndex: 'createTime',
width: 200
}
];
/** 搜索表单配置 */
export const searchFormSchema: FormSchema[] = [
{
field: 'userName',
label: '名称',
component: 'Input',
componentProps: {
placeholder: '请输入名称',
},
colProps: { span: 6 }
}
];
/** 表单配置 */
export const formSchema: FormSchema[] = [
{
field: 'id',
label: 'ID',
component: 'Input',
show: false
},
{
field: 'toUserId',
label: '对方用户id',
component: 'Input',
show: false
},
{
field: 'fromUserId',
label: '发送方用户id',
component: 'Input',
show: false
},
{
field: 'userName',
label: '名称',
component: 'Input',
required: true,
componentProps: {
disabled: true
},
},
{
field: 'playSound',
label: '是否播放声音',
component: 'RadioGroup',
required: true,
defaultValue: '0',
componentProps: {
options: [
{ label: '是', value: '0' },
{ label: '否', value: '1' }
]
},
colProps: {
span: 12
}
},
{
field: 'playVibrate',
label: '是否震动',
component: 'RadioGroup',
required: true,
defaultValue: '0',
componentProps: {
options: [
{ label: '是', value: '0' },
{ label: '否', value: '1' }
]
},
colProps: {
span: 12
}
},
{
field: 'playLights',
label: '是否闪光',
component: 'RadioGroup',
required: true,
defaultValue: '0',
componentProps: {
options: [
{ label: '是', value: '0' },
{ label: '否', value: '1' }
]
},
colProps: {
span: 12
}
},
];
Loading…
Cancel
Save