可信代码库-个人中心个人邀请历史记录前端展示改造

This commit is contained in:
付民康
2025-04-02 16:45:12 +08:00
parent b1f1421e99
commit b3284674d7
4 changed files with 30 additions and 11 deletions

View File

@@ -302,7 +302,7 @@ export function getInviteHistoryData(): catchRt<any> {
return reqCatchV2(() =>
request(
{
url: `/api/v1/group/member/invite/accept/history`,
url: `/api/v1/group/member/invite/history`,
method: 'get'
},
{
@@ -316,7 +316,7 @@ export function acceptHistoryDelete(params): catchRt<any> {
return reqCatchV2(() =>
request(
{
url: '/api/v1/group/member/invite/accept/history/delete',
url: '/api/v1/group/member/invite/history/delete',
method: 'post',
data: params
},

View File

@@ -9,10 +9,7 @@
<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>
<d-button variant="text" color="primary" @click="handleDelete(scope.row)"> 删除 </d-button>
</template>
</d-column>
<template #empty>
@@ -38,7 +35,7 @@
<script setup lang="ts">
import { acceptHistoryDelete, acceptInvite, getInviteHistoryData } from '@/api/jyh';
import { ref, shallowReactive } from 'vue';
import { ref, shallowReactive,defineExpose } from 'vue';
import NoData from '@/components/NoData/NoData.vue';
import { Message } from 'vue-devui';
import dayjs from 'dayjs';
@@ -69,7 +66,7 @@ const queryInviteListData = async () => {
pager.total = data.data.data.data.length;
};
queryInviteListData();
const handleAccept = async (row, type) => {
const handleDelete = async (row) => {
const data = await acceptHistoryDelete({
id: row.id,
// status: type
@@ -88,6 +85,11 @@ const handleAccept = async (row, type) => {
});
}
};
// 暴露方法给父组件
defineExpose({
getList:queryInviteListData
})
</script>
<style lang="scss" scoped>

View File

@@ -38,7 +38,7 @@
<script setup lang="ts">
import { acceptInvite, getInviteListData } from '@/api/jyh';
import { ref, shallowReactive } from 'vue';
import { ref, shallowReactive,defineEmits } from 'vue';
import NoData from '@/components/NoData/NoData.vue';
import InvitationHistoryList from './InvitationHistoryList.vue';
import { Message } from 'vue-devui';
@@ -46,6 +46,8 @@ import dayjs from 'dayjs';
import { useAccountStore } from '@/stores/user';
const account = useAccountStore();
const emit = defineEmits(['refresh']);
const noticeTableData = ref([]);
const pager = shallowReactive({
total: 0,
@@ -89,6 +91,7 @@ const handleAccept = async (row, type) => {
}
await account.checkIsLogin();
queryInviteListData();
emit('refresh');
} else {
Message({
type: 'error',

View File

@@ -1,13 +1,27 @@
<template>
<div class="invitation-notice-container">
<InvitationNoticeList />
<InvitationHistoryList />
<InvitationNoticeList ref="noticeListRef" @refresh="refresh"/>
<InvitationHistoryList ref="historyListRef"/>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import InvitationHistoryList from './InvitationHistoryList.vue'
import InvitationNoticeList from './InvitationNoticeList.vue'
// 定义子组件的 ref
const noticeListRef = ref<InstanceType<typeof InvitationNoticeList> | null>(null)
const historyListRef = ref<InstanceType<typeof InvitationHistoryList> | null>(null)
// 刷新方法
const refresh = async () => {
try {
historyListRef.value?.getList()
} catch (error) {
console.error('刷新列表时出错:', error)
}
}
</script>
<style lang="scss" scoped>