huangyinfeng
4 天以前 db42d08c39ae6129e2b95cd24c0d57c6769282e5
提交 | 用户 | age
db42d0 1 <template>
H 2   <div>
3     <a-spin :spinning="loading" class="p-1" style="height: 100%;">
4       <PageIndex :pageList="pageList" :mailType="1" :pageData="pageData" :isTabs="false"> </PageIndex>
5     </a-spin>
6   </div>
7 </template>
8
9 <script lang="ts" setup>
10   name: 'Inbox';
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 { getMailListApi } from '@/api/email/userList';
33   const pageList = ref([]);
34   const loading = ref(false);
35   const pageData = ref({
36     page: 1,
37     limit: 20,
38     total: 0,
39   });
40   function getDataList(page:1) {
41     loading.value = true;
42     getMailListApi({ mail: routerId.value, mailType: 1,page })
43       .then((res) => {
44         loading.value = false;
45         if (res.code == 0) {
46           pageList.value = res.data.list;
47           pageData.value.total = res.data.total;
48         }
49       })
50       .catch(() => {
51         loading.value = false;
52       });
53   }
54
55   
56   provide('getDataList', getDataList);
57   onMounted(() => {
58     getDataList();
59   });
60 </script>
61 <style scoped lang="less"></style>