index.vue 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <route lang="json">
  2. { "style": { "navigationBarTitleText": "主页数据", "navigationBarBackgroundColor": "#fff" } }
  3. </route>
  4. <script setup lang="ts">
  5. import SectionHeading from '@/components/section-heading.vue'
  6. import { getDesignerInfo, getBrowseHistories } from '../../../../core/libs/requests'
  7. import { useUserStore } from '../../../../store'
  8. import { storeToRefs } from 'pinia'
  9. import Card from '@/components/card.vue'
  10. import PageHelper from '@/components/page-helper.vue'
  11. import dayjs from 'dayjs'
  12. const userStore = useUserStore()
  13. const { userInfo } = storeToRefs(userStore)
  14. const { data, run: setData } = useRequest(() => getDesignerInfo(userInfo.value.userId))
  15. const info = computed(() => [
  16. { label: '分享', value: data.value?.shareCount || 0, unit: '次' },
  17. { label: '浏览', value: data.value?.viewCount || 0, unit: '次' },
  18. { label: '获客', value: data.value?.winCustomerCount || 0, unit: '人' },
  19. ])
  20. const tab = ref('分享')
  21. const tabs = ref([
  22. // { label: '分享明细', value: '分享' },
  23. { label: '浏览明细', value: '浏览' },
  24. // { label: '获客明细', value: '获客' },
  25. ])
  26. const current = ref('累计')
  27. const query = computed(() => ({}))
  28. onMounted(async () => {
  29. await setData()
  30. })
  31. </script>
  32. <template>
  33. <div class="flex-grow flex flex-col gap-5 px-3.5 py-6">
  34. <Card>
  35. <SectionHeading title="主页数据">
  36. <template #append>
  37. <div>
  38. <wd-segmented v-model:value="current" :options="['累计']"></wd-segmented>
  39. </div>
  40. </template>
  41. </SectionHeading>
  42. <div class="flex mt-7">
  43. <template v-for="(it, i) in info" :key="i">
  44. <div class="flex-1 flex flex-col items-center gap-2">
  45. <div class="flex items-end gap-0.5">
  46. <div class="text-black text-2xl font-medium font-['DIN'] leading-6">
  47. {{ it.value }}
  48. </div>
  49. <div class="text-[#333333] text-sm font-normal font-['PingFang_SC']">
  50. {{ it.unit }}
  51. </div>
  52. </div>
  53. <div class="text-black/40 text-xs font-normal font-['PingFang_SC'] leading-normal">
  54. {{ it.label }}
  55. </div>
  56. </div>
  57. </template>
  58. </div>
  59. </Card>
  60. <Card>
  61. <wd-tabs v-model="tab">
  62. <template v-for="(it, i) in tabs" :key="i">
  63. <wd-tab :title="it.label" :name="it.value"></wd-tab>
  64. </template>
  65. </wd-tabs>
  66. <PageHelper :request="getBrowseHistories" :query="query">
  67. <template #default="{ source }">
  68. <template v-for="(it, i) in source.list" :key="i">
  69. <div class="py-4">
  70. <div class="flex">
  71. <div
  72. class="flex-1 text-black text-sm font-normal font-['PingFang_SC'] leading-normal"
  73. >
  74. <!-- 银色飞行船 -->
  75. {{ it.creatorName }}
  76. </div>
  77. <div class="text-black/40 text-xs font-normal font-['PingFang SC'] leading-normal">
  78. 浏览时长:{{ (Number(it.duration) / 60).toFixed(2) }}分钟
  79. </div>
  80. </div>
  81. <div class="text-black/40 text-xs font-normal font-['PingFang SC'] leading-normal">
  82. 查看时间:
  83. <!-- 2024/04/01 14:52 -->
  84. {{ dayjs(it.createTime).format('YYYY/MM/DD HH:mm') }}
  85. </div>
  86. </div>
  87. <div v-if="i < source.list.length - 1" class="bg-[#f6f6f6] h-.25"></div>
  88. </template>
  89. </template>
  90. </PageHelper>
  91. </Card>
  92. </div>
  93. </template>