VillageUserRankList.vue 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <Empty v-if="list.length === 0" description="暂无排名数据" />
  3. <FlexRow align="flex-end">
  4. <Touchable
  5. v-for="(item) in list"
  6. position="relative"
  7. :key="item.id"
  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. direction="column"
  17. overflow="hidden"
  18. @click="emit('goDetails', item)"
  19. >
  20. <FlexCol
  21. position="absolute"
  22. :left="15"
  23. :right="15"
  24. :bottom="item.rank == 1 ? 62 : 36"
  25. center
  26. >
  27. <Avatar
  28. :url="item.image" :size="item.rank == 1 ? 100 : 90" mode="aspectFill" radius="radius.md"
  29. defaultAvatar="https://xy.wenlvti.net/app_static/images/village/PlaceholderVolunteer.png"
  30. />
  31. <Height :height="item.rank == 1 ? 15 : 10" />
  32. <Text fontConfig="h4" :text="item.title" color="white" />
  33. <Text fontConfig="h2" :text="item.score" :color="scoreColors[item.rank - 1]" fontFamily="SongtiSCBlack" />
  34. </FlexCol>
  35. </Touchable>
  36. </FlexRow>
  37. </template>
  38. <script setup lang="ts">
  39. import Text from '@/components/basic/Text.vue';
  40. import Avatar from '@/components/display/Avatar.vue';
  41. import Empty from '@/components/feedback/Empty.vue';
  42. import Touchable from '@/components/feedback/Touchable.vue';
  43. import FlexCol from '@/components/layout/FlexCol.vue';
  44. import FlexRow from '@/components/layout/FlexRow.vue';
  45. import Height from '@/components/layout/space/Height.vue';
  46. const scoreColors = [
  47. '#cb8833',
  48. '#7788b9',
  49. '#cd7853',
  50. ]
  51. withDefaults(defineProps<{
  52. list?: {
  53. id: number;
  54. image: string;
  55. title: string;
  56. rank: number;
  57. score: number;
  58. }[];
  59. }>(), {
  60. list: () => [
  61. {
  62. id: 2,
  63. image: 'https://mncdn.wenlvti.net/app_static/minnan/images/test/ImageTest2.png',
  64. title: '用户2',
  65. rank: 2,
  66. score: 90,
  67. },
  68. {
  69. id: 1,
  70. image: 'https://mncdn.wenlvti.net/app_static/minnan/images/test/ImageTest1.png',
  71. title: '用户1',
  72. rank: 1,
  73. score: 100,
  74. },
  75. {
  76. id: 3,
  77. image: 'https://mncdn.wenlvti.net/app_static/minnan/images/test/ImageTest3.png',
  78. title: '用户3',
  79. rank: 3,
  80. score: 80,
  81. },
  82. ],
  83. });
  84. const emit = defineEmits<{
  85. (e: 'goDetails', item: {
  86. id: number;
  87. image: string;
  88. title: string;
  89. rank: number;
  90. score: number;
  91. }): void;
  92. }>();
  93. </script>