可信代码库-个人中心个人邀请历史记录接口对接

This commit is contained in:
付民康
2025-04-02 15:02:22 +08:00
parent 172f7fbfd5
commit d95d03f0bd
4 changed files with 132 additions and 1 deletions

View File

@@ -296,3 +296,33 @@ export const alertIsSubscribe = (data): Promise<any> => {
})
);
};
// 获取邀请历史
export function getInviteHistoryData(): catchRt<any> {
return reqCatchV2(() =>
request(
{
url: `/api/v1/group/member/invite/accept/history`,
method: 'get'
},
{
customError: true
}
)
);
}
// 删除个人邀请历史记录
export function acceptHistoryDelete(params): catchRt<any> {
return reqCatchV2(() =>
request(
{
url: '/api/v1/group/member/invite/accept/history/delete',
method: 'post',
data: params
},
{
customError: true
}
)
);
}

View File

@@ -0,0 +1,97 @@
<template>
<div class="invitation-notice-container">
<Card simple class="jyh-card mt-3">
<div class="mt-3">
<d-table class="jyh-table jyh-table-2" :header-bg="true" :data="noticeTableData">
<d-column field="content" header="邀请内容" show-overflow-tooltip></d-column>
<d-column field="createTime" header="邀请时间" width="200" show-overflow-tooltip></d-column>
<d-column field="createUser" header="邀请人" width="180" show-overflow-tooltip></d-column>
<d-column header="操作" width="150">
<template #default="scope">
<d-button variant="text" color="primary" class="mr-2" @click="handleAccept(scope.row, 1)">
接收
</d-button>
<d-button variant="text" color="primary" @click="handleAccept(scope.row, -1)"> 拒绝 </d-button>
</template>
</d-column>
<template #empty>
<NoData />
</template>
</d-table>
<div class="invitation-pagination" v-if="noticeTableData.length > 0">
<d-pagination
style="display: inline-flex"
:total="pager.total"
v-model:pageSize="pager.pageSize"
v-model:pageIndex="pager.pageIndex"
:can-view-total="true"
:can-change-page-size="true"
:can-jump-page="true"
:max-items="5"
/>
</div>
</div>
</Card>
</div>
</template>
<script setup lang="ts">
import { acceptHistoryDelete, acceptInvite, getInviteHistoryData } from '@/api/jyh';
import { ref, shallowReactive } from 'vue';
import NoData from '@/components/NoData/NoData.vue';
import { Message } from 'vue-devui';
import dayjs from 'dayjs';
import { useAccountStore } from '@/stores/user';
const account = useAccountStore();
const noticeTableData = ref([]);
const pager = shallowReactive({
total: 0,
pageIndex: 1,
pageSize: 10,
pageSizeOptions: [10, 20, 30, 40, 50]
});
const queryInviteListData = async () => {
const data = await getInviteHistoryData();
console.log(data);
if (!data?.data?.data?.data) {
pager.total = 0;
return;
}
noticeTableData.value = data.data.data.data.map((item) => {
return {
...item,
content: `尊敬的用户,您好!为更好地整合资源、协同开发,现诚邀您加入组织【${item.name}】。`,
createTime: dayjs(item.createTime).format('YYYY-MM-DD HH:mm:ss')
};
});
pager.total = data.data.data.data.length;
};
queryInviteListData();
const handleAccept = async (row, type) => {
const data = await acceptHistoryDelete({
id: row.id,
// status: type
});
if (data?.data?.data?.data) {
Message({
type: 'success',
message: '成功删除'
});
await account.checkIsLogin();
queryInviteListData();
} else {
Message({
type: 'error',
message: '请求失败'
});
}
};
</script>
<style lang="scss" scoped>
.invitation-pagination {
padding: 12px 0;
text-align: right;
}
</style>

View File

@@ -39,6 +39,7 @@
import { acceptInvite, getInviteListData } from '@/api/jyh';
import { ref, shallowReactive } from 'vue';
import NoData from '@/components/NoData/NoData.vue';
import InvitationHistoryList from './InvitationHistoryList.vue';
import { Message } from 'vue-devui';
import dayjs from 'dayjs';
import { useAccountStore } from '@/stores/user';

View File

@@ -4,10 +4,12 @@
<d-tab id="personalBasic" title="基本信息"></d-tab>
<d-tab id="organizationManage" title="组织管理"></d-tab>
<d-tab id="invitation" title="邀请通知"></d-tab>
<d-tab id="invitationHistory" title="邀请历史"></d-tab>
</d-tabs>
<PersonalBasic v-if="selectTab === 'personalBasic'" />
<OrganizationManage v-if="selectTab === 'organizationManage'" />
<InvitationNoticeList v-if="selectTab === 'invitation'" />
<InvitationNoticeList v-if="selectTab === 'invitationHistory'" />
</div>
</template>
@@ -15,7 +17,8 @@
import { ref } from 'vue';
import PersonalBasic from '../PersonalBasic.vue';
import OrganizationManage from '../OrganizationManage/OrganizationManage.vue';
import InvitationNoticeList from '../Detail/InvitationNoticeList.vue';
import InvitationNoticeList from './InvitationNotice/InvitationNoticeList.vue';
import InvitationHistoryList from './InvitationNotice/InvitationHistoryList.vue';
const selectTab = ref('personalBasic');
</script>