提交 | 用户 | age
|
ccfd07
|
1 |
<template> |
H |
2 |
<div> |
63d608
|
3 |
<a-spin :spinning="loading" class="p-1" style="height: 100%"> |
a9a03d
|
4 |
<PageIndex :pageList="pageList" :mailType="1" :pageData="pageData" :isDrafts='true'> </PageIndex> |
63d608
|
5 |
</a-spin> |
ccfd07
|
6 |
</div> |
H |
7 |
</template> |
|
8 |
|
|
9 |
<script lang="ts" setup> |
|
10 |
name: 'Drafts'; |
|
11 |
import { ref, onMounted, computed, provide } from 'vue'; |
|
12 |
import PageIndex from '@/views/email/components/ListPage/list.vue'; |
|
13 |
import { useRoute } from 'vue-router'; |
|
14 |
|
|
15 |
const route = useRoute(); |
|
16 |
// 获取当前完整 URL |
|
17 |
const routerId = computed(() => { |
|
18 |
try { |
|
19 |
const url = window.location.href; |
|
20 |
if (!url) { |
|
21 |
throw new Error('Invalid URL'); |
|
22 |
} |
|
23 |
const basePart = url.split('?')[1]; |
|
24 |
console.log(basePart, 'basePart'); |
|
25 |
return basePart; |
|
26 |
} catch (error) { |
|
27 |
console.error('Error processing URL:', error); |
|
28 |
// 返回默认值或空字符串 |
|
29 |
return ''; |
|
30 |
} |
|
31 |
}); |
|
32 |
import { receiveApi, getMailListApi } from '@/api/email/userList'; |
|
33 |
const pageList = ref([]); |
63d608
|
34 |
const loading = ref(false); |
H |
35 |
const pageData = ref({ |
|
36 |
page: 1, |
|
37 |
limit: 20, |
|
38 |
total: 0, |
|
39 |
}); |
|
40 |
function getDataList(page: 1) { |
|
41 |
getMailListApi({ mail: routerId.value, mailType: 0, page }) |
|
42 |
.then((res) => { |
|
43 |
loading.value = false; |
|
44 |
if (res.code == 0) { |
|
45 |
pageList.value = res.data.list; |
|
46 |
pageData.value.total = res.data.total; |
|
47 |
} |
|
48 |
}) |
|
49 |
.catch(() => { |
|
50 |
loading.value = false; |
|
51 |
}); |
ccfd07
|
52 |
} |
H |
53 |
provide('getDataList', getDataList); |
|
54 |
onMounted(() => { |
|
55 |
getDataList(); |
|
56 |
}); |
|
57 |
</script> |
|
58 |
<style scoped lang="less"></style> |