邀请列表接口接入
This commit is contained in:
@@ -8,26 +8,31 @@
|
||||
:header-bg="true"
|
||||
:data="noticeTableData"
|
||||
>
|
||||
<d-column field="content" header="邀请内容"></d-column>
|
||||
<d-column field="time" header="邀请时间" width="200"></d-column>
|
||||
<d-column field="creator" header="邀请人" width="180"></d-column>
|
||||
<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">
|
||||
<d-pagination
|
||||
@@ -47,21 +52,51 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { acceptInvite, getInviteListData } from '@/api/jyh';
|
||||
import { ref, shallowReactive } from 'vue';
|
||||
import NoData from "@/components/NoData/NoData.vue";
|
||||
import { Message } from 'vue-devui';
|
||||
|
||||
const noticeTableData = ref([
|
||||
{
|
||||
content: '当您订阅的软件有漏洞预警通知时,将以应用号的方式通知。可在首页查看或取消订阅!',
|
||||
time: '2025-03-15 17:29:30',
|
||||
creator: '132456798',
|
||||
}
|
||||
]);
|
||||
const noticeTableData = ref([]);
|
||||
const pager = shallowReactive({
|
||||
total: 1,
|
||||
total: 0,
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
pageSizeOptions: [10, 20, 30, 40, 50],
|
||||
});
|
||||
const queryInviteListData = async () => {
|
||||
const data = await getInviteListData();
|
||||
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}。`
|
||||
}
|
||||
});
|
||||
pager.total = data.data.data.data.length;
|
||||
};
|
||||
queryInviteListData();
|
||||
const handleAccept = async (row, type) => {
|
||||
const data = await acceptInvite({
|
||||
groupId: row.groupId,
|
||||
status: type,
|
||||
});
|
||||
if (data?.data?.data?.data) {
|
||||
Message({
|
||||
type,
|
||||
message: '成功接受',
|
||||
});
|
||||
} else {
|
||||
Message({
|
||||
type,
|
||||
message: '接受失败',
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user