VillageUserRankList.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <Empty v-if="list.length === 0" description="暂无排名数据" />
  3. <FlexRow align="flex-end">
  4. <FlexCol
  5. v-for="(item) in list"
  6. position="relative"
  7. :key="item.title"
  8. :width="item.rank == 1 ? '35%' : '32.5%'"
  9. :height="item.rank == 1 ? 380 : 320"
  10. :innerStyle="{
  11. backgroundSize: '100% auto',
  12. backgroundRepeat: 'no-repeat',
  13. backgroundPosition: 'center',
  14. backgroundImage: `url('https://xy.wenlvti.net/app_static/images/home/Rank${item.rank}.png')`
  15. }"
  16. overflow="hidden"
  17. >
  18. <FlexCol
  19. position="absolute"
  20. :left="15"
  21. :right="15"
  22. :bottom="item.rank == 1 ? 66 : 40"
  23. center
  24. >
  25. <Avatar :url="item.image" :size="item.rank == 1 ? 100 : 90" mode="aspectFill" radius="radius.md" />
  26. <Height :height="item.rank == 1 ? 15 : 10" />
  27. <Text fontConfig="h4" :text="item.title" color="white" />
  28. <Text fontConfig="h2" :text="item.score" :color="scoreColors[item.rank - 1]" />
  29. </FlexCol>
  30. </FlexCol>
  31. </FlexRow>
  32. </template>
  33. <script setup lang="ts">
  34. import Text from '@/components/basic/Text.vue';
  35. import Avatar from '@/components/display/Avatar.vue';
  36. import Empty from '@/components/feedback/Empty.vue';
  37. import FlexCol from '@/components/layout/FlexCol.vue';
  38. import FlexRow from '@/components/layout/FlexRow.vue';
  39. import Height from '@/components/layout/space/Height.vue';
  40. const scoreColors = [
  41. '#cb8833',
  42. '#7788b9',
  43. '#cd7853',
  44. ]
  45. withDefaults(defineProps<{
  46. list?: {
  47. image: string;
  48. title: string;
  49. rank: number;
  50. score: number;
  51. }[];
  52. }>(), {
  53. list: () => [
  54. {
  55. image: 'https://mncdn.wenlvti.net/app_static/minnan/images/test/ImageTest2.png',
  56. title: '用户2',
  57. rank: 2,
  58. score: 90,
  59. },
  60. {
  61. image: 'https://mncdn.wenlvti.net/app_static/minnan/images/test/ImageTest1.png',
  62. title: '用户1',
  63. rank: 1,
  64. score: 100,
  65. },
  66. {
  67. image: 'https://mncdn.wenlvti.net/app_static/minnan/images/test/ImageTest3.png',
  68. title: '用户3',
  69. rank: 3,
  70. score: 80,
  71. },
  72. ],
  73. });
  74. </script>