village.vue 3.9 KB

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