<template>
|
<div>
|
<a-spin :spinning="loading" class="p-1" style="height: 100%;">
|
<PageIndex :pageList="pageList" :mailType="1" :pageData="pageData" > </PageIndex>
|
</a-spin>
|
</div>
|
</template>
|
|
<script lang="ts" setup>
|
name: 'Inbox';
|
import { ref, onMounted, computed, provide } from 'vue';
|
import PageIndex from '@/views/email/components/ListPage/list.vue';
|
import { useRoute } from 'vue-router';
|
|
const route = useRoute();
|
// 获取当前完整 URL
|
const routerId = computed(() => {
|
try {
|
const url = window.location.href;
|
if (!url) {
|
throw new Error('Invalid URL');
|
}
|
const basePart = url.split('?')[1];
|
console.log(basePart, 'basePart');
|
return basePart;
|
} catch (error) {
|
console.error('Error processing URL:', error);
|
// 返回默认值或空字符串
|
return '';
|
}
|
});
|
import { getMailListApi } from '@/api/email/userList';
|
const pageList = ref([]);
|
const loading = ref(false);
|
const pageData = ref({
|
page: 1,
|
limit: 20,
|
total: 0,
|
});
|
function getDataList(page:1) {
|
loading.value = true;
|
getMailListApi({ mail: routerId.value, mailType: 1,page })
|
.then((res) => {
|
loading.value = false;
|
if (res.code == 0) {
|
pageList.value = res.data.list;
|
pageData.value.total = res.data.total;
|
}
|
})
|
.catch(() => {
|
loading.value = false;
|
});
|
}
|
|
|
provide('getDataList', getDataList);
|
onMounted(() => {
|
getDataList();
|
});
|
</script>
|
<style scoped lang="less"></style>
|