village.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <FlexCol gap="gap.lg" padding="space.md">
  3. <BackgroundBox
  4. v-for="(item, index) in villageRankListLoader.content.value"
  5. :key="item.id"
  6. backgroundImage="https://xy.wenlvti.net/app_static/images/village/BoxLong.png"
  7. :backgroundCutBorder="[10,10,10,10]"
  8. :backgroundCutBorderSize="[10,10,10,10]"
  9. >
  10. <Touchable
  11. direction="row"
  12. justify="space-between"
  13. align="center"
  14. gap="gap.md"
  15. :padding="[25,25]"
  16. @click="handleGoDetails(item)"
  17. >
  18. <FlexRow align="center" gap="gap.lg">
  19. <BackgroundBox
  20. backgroundImage="https://xy.wenlvti.net/app_static/images/village/ImageBlessingCount.png"
  21. width="60rpx"
  22. height="60rpx"
  23. center
  24. >
  25. <Text :text="index + 1" fontConfig="h4" color="white" />
  26. </BackgroundBox>
  27. <Image
  28. :src="item.image"
  29. width="170rpx"
  30. height="120rpx"
  31. mode="aspectFill"
  32. radius="radius.md"
  33. />
  34. <Text :text="item.title" fontConfig="contentText" />
  35. </FlexRow>
  36. <FlexRow center gap="gap.md">
  37. <BackgroundBox
  38. backgroundImage="https://xy.wenlvti.net/app_static/images/village/TagNormal.png"
  39. :backgroundCutBorder="[10,10,10,10]"
  40. :backgroundCutBorderSize="[10,10,10,10]"
  41. :padding="[15,10]"
  42. center
  43. direction="row"
  44. gap="gap.md"
  45. width="100"
  46. >
  47. <Image src="https://xy.wenlvti.net/app_static/images/village/IconLight.png" width="30rpx" height="30rpx" mode="aspectFill" />
  48. <Text :text="item.points" fontConfig="contentText" />
  49. </BackgroundBox>
  50. </FlexRow>
  51. </Touchable>
  52. </BackgroundBox>
  53. </FlexCol>
  54. </template>
  55. <script setup lang="ts">
  56. import { useSimpleDataLoader } from '@/components/composeabe/loader/SimpleDataLoader';
  57. import { useLoadQuerys } from '@/components/composeabe/LoadQuerys';
  58. import { useVillageStore } from '@/store/village';
  59. import { navTo } from '@/components/utils/PageAction';
  60. import FlexCol from '@/components/layout/FlexCol.vue';
  61. import LightVillageApi from '@/api/light/LightVillageApi';
  62. import BackgroundBox from '@/components/display/block/BackgroundBox.vue';
  63. import Text from '@/components/basic/Text.vue';
  64. import Image from '@/components/basic/Image.vue';
  65. import FlexRow from '@/components/layout/FlexRow.vue';
  66. import Touchable from '@/components/feedback/Touchable.vue';
  67. import { waitTimeOut } from '@imengyu/imengyu-utils';
  68. const { querys } = useLoadQuerys({
  69. regionId: 0,
  70. }, () => {
  71. villageRankListLoader.reload();
  72. });
  73. const villageRankListLoader = useSimpleDataLoader(async () => {
  74. const res = await LightVillageApi.getVillageRankList({
  75. region_id: querys.value.regionId || undefined,
  76. num: 30
  77. });
  78. return res.map((item, i) => ({
  79. image: item.image ?? '',
  80. title: item.name,
  81. rank: i + 1,
  82. id: item.id,
  83. points: item.points,
  84. }));
  85. });
  86. const villageStore = useVillageStore();
  87. async function handleGoDetails(item: { id: number }) {
  88. const details = await LightVillageApi.getVillageDetails(item.id);
  89. villageStore.setCurrentVillage(details);
  90. await waitTimeOut(100);
  91. navTo('/pages/home/village/index');
  92. }
  93. </script>