Sanakey
5 天以前 2af71bcf522c485ea005184c977986374a7dcc4a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<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: 'Drafts';
  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 { receiveApi, 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) {
    getMailListApi({ mail: routerId.value, mailType: 0, 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>