Sanakey
5 天以前 2af71bcf522c485ea005184c977986374a7dcc4a
提交 | 用户 | age
ccfd07 1 <template>
H 2   <div>
63d608 3     <a-spin :spinning="loading" class="p-1" style="height: 100%">
H 4       <PageIndex :pageList="pageList" :mailType="1" :pageData="pageData"> </PageIndex>
5     </a-spin>
ccfd07 6   </div>
H 7 </template>
8
9 <script lang="ts" setup>
10   name: 'Inbox';
11   import { ref, onMounted, computed, provide } from 'vue';
12   import PageIndex from './components/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   });
63d608 32   import { getHandleMailListApi } from '@/api/email/userList';
ccfd07 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     loading.value = true;
42
43     getHandleMailListApi({ page })
44       .then((res) => {
45         loading.value = false;
46         if (res.code == 0) {
47           pageList.value = res.data.list;
48           pageData.value.total = res.data.total;
49         }
50       })
51       .catch(() => {
52         loading.value = false;
53       });
ccfd07 54   }
H 55   provide('getDataList', getDataList);
56   onMounted(() => {
57     getDataList();
58   });
59 </script>
60 <style scoped lang="less"></style>