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

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

View File

@@ -9,10 +9,7 @@
<d-column field="createUser" header="邀请人" width="180" show-overflow-tooltip></d-column> <d-column field="createUser" header="邀请人" width="180" show-overflow-tooltip></d-column>
<d-column header="操作" width="150"> <d-column header="操作" width="150">
<template #default="scope"> <template #default="scope">
<d-button variant="text" color="primary" class="mr-2" @click="handleAccept(scope.row, 1)"> <d-button variant="text" color="primary" @click="handleDelete(scope.row)"> 删除 </d-button>
接收
</d-button>
<d-button variant="text" color="primary" @click="handleAccept(scope.row, -1)"> 拒绝 </d-button>
</template> </template>
</d-column> </d-column>
<template #empty> <template #empty>
@@ -38,7 +35,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { acceptHistoryDelete, acceptInvite, getInviteHistoryData } from '@/api/jyh'; 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 NoData from '@/components/NoData/NoData.vue';
import { Message } from 'vue-devui'; import { Message } from 'vue-devui';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
@@ -69,7 +66,7 @@ const queryInviteListData = async () => {
pager.total = data.data.data.data.length; pager.total = data.data.data.data.length;
}; };
queryInviteListData(); queryInviteListData();
const handleAccept = async (row, type) => { const handleDelete = async (row) => {
const data = await acceptHistoryDelete({ const data = await acceptHistoryDelete({
id: row.id, id: row.id,
// status: type // status: type
@@ -88,6 +85,11 @@ const handleAccept = async (row, type) => {
}); });
} }
}; };
// 暴露方法给父组件
defineExpose({
getList:queryInviteListData
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

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

View File

@@ -1,13 +1,27 @@
<template> <template>
<div class="invitation-notice-container"> <div class="invitation-notice-container">
<InvitationNoticeList /> <InvitationNoticeList ref="noticeListRef" @refresh="refresh"/>
<InvitationHistoryList /> <InvitationHistoryList ref="historyListRef"/>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'
import InvitationHistoryList from './InvitationHistoryList.vue' import InvitationHistoryList from './InvitationHistoryList.vue'
import InvitationNoticeList from './InvitationNoticeList.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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>