index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <FlexCol>
  3. <Image
  4. mode="aspectFill"
  5. src="https://mn.wenlvti.net/app_static/xiangyuan/images/index-banner.jpg"
  6. width="100%"
  7. />
  8. <FlexCol :padding="30">
  9. <SubTitle title="我的村社" />
  10. <RequireLogin unLoginMessage="登录后查看我认领的村社">
  11. <SimplePageContentLoader
  12. :loader="villageListLoader"
  13. :showEmpty="villageListLoader.content.value?.length == 0"
  14. :emptyView="{
  15. text: '你还没有认领的村社,请联系管理员认领',
  16. button: false,
  17. }"
  18. >
  19. <FlexCol :gap="10">
  20. <FlexRow
  21. v-for="item in villageListLoader.content.value"
  22. :key="item.id"
  23. backgroundColor="white"
  24. :radius="20"
  25. :padding="20"
  26. justify="space-between"
  27. >
  28. <FlexRow align="center" :gap="20">
  29. <Image
  30. mode="aspectFill"
  31. :src="item.image"
  32. round
  33. :width="80"
  34. :height="80"
  35. />
  36. <H3>{{ item.villageName }}</H3>
  37. </FlexRow>
  38. <ButtonGroup direction="row" align="center" :gap="0">
  39. <BubbleBox :items="[
  40. {
  41. icon: 'edit-filling',
  42. text: '管理',
  43. onClick: () => goManagePage(item),
  44. },
  45. {
  46. icon: 'browse',
  47. text: '预览',
  48. onClick: () => goPreviewDigPage(item),
  49. },
  50. ]">
  51. <Button v-if="authStore.isAdmin" icon="edit-filling" size="small">管理</Button>
  52. </BubbleBox>
  53. <BubbleBox :items="[
  54. {
  55. icon: 'edit-filling',
  56. text: '采编',
  57. onClick: () => goSubmitDigPage(item),
  58. },
  59. {
  60. icon: 'browse',
  61. text: '我的投稿',
  62. onClick: () => goMyDigPage(item),
  63. },
  64. ]">
  65. <Button type="primary" size="small" icon="edit-filling">采编</Button>
  66. </BubbleBox>
  67. </ButtonGroup>
  68. </FlexRow>
  69. </FlexCol>
  70. </SimplePageContentLoader>
  71. </RequireLogin>
  72. <Height :height="20" />
  73. <SubTitle title="我的贡献" />
  74. <RequireLogin unLoginMessage="登录后贡献,加入排行榜">
  75. <FlexRow backgroundColor="white" :radius="20" :padding="[40,20]">
  76. <FlexCol :flex="1" :gap="10" center>
  77. <Text :fontSize="60" fontFamily="Rockwell" color="primary">{{ volunteerInfoLoader.content.value?.points || 0 }}</Text>
  78. <Text>文化积分</Text>
  79. </FlexCol>
  80. <FlexCol :flex="1" :gap="10" center>
  81. <Text :fontSize="60" fontFamily="Rockwell" color="primary">Lv.{{ volunteerInfoLoader.content.value?.level || 1 }}</Text>
  82. <Text>等级</Text>
  83. </FlexCol>
  84. </FlexRow>
  85. </RequireLogin>
  86. </FlexCol>
  87. </FlexCol>
  88. </template>
  89. <script setup lang="ts">
  90. import { navTo } from '@/components/utils/PageAction';
  91. import { useAuthStore } from '@/store/auth';
  92. import { useCollectStore } from '@/store/collect';
  93. import { useSimpleDataLoader } from '@/common/composeabe/SimpleDataLoader';
  94. import VillageApi, { VillageListItem } from '@/api/inhert/VillageApi';
  95. import RequireLogin from '@/common/components/RequireLogin.vue';
  96. import SimplePageContentLoader from '@/common/components/SimplePageContentLoader.vue';
  97. import Button from '@/components/basic/Button.vue';
  98. import Image from '@/components/basic/Image.vue';
  99. import SubTitle from '@/components/display/title/SubTitle.vue';
  100. import FlexCol from '@/components/layout/FlexCol.vue';
  101. import FlexRow from '@/components/layout/FlexRow.vue';
  102. import H3 from '@/components/typography/H3.vue';
  103. import Text from '@/components/basic/Text.vue';
  104. import Height from '@/components/layout/space/Height.vue';
  105. import ButtonGroup from '@/components/basic/ButtonGroup.vue';
  106. import BubbleBox from '@/components/feedback/BubbleBox.vue';
  107. const authStore = useAuthStore();
  108. const collectStore = useCollectStore();
  109. const villageListLoader = useSimpleDataLoader(async () => await VillageApi.getClaimedVallageList(), true);
  110. const volunteerInfoLoader = useSimpleDataLoader(async () => await VillageApi.getVolunteerInfo(), true);
  111. const rankListLoader = useSimpleDataLoader(async () => await VillageApi.getVolunteerRanklist(), true);
  112. function goSubmitDigPage(item: VillageListItem) {
  113. navTo('./dig/details', {
  114. name: item.villageName,
  115. villageId: item.villageId,
  116. villageVolunteerId: item.villageVolunteerId,
  117. points: volunteerInfoLoader.content.value?.points,
  118. level: volunteerInfoLoader.content.value?.level,
  119. })
  120. }
  121. function goManagePage(item: VillageListItem) {
  122. navTo('./dig/admin', {
  123. id: item.villageId,
  124. name: item.villageName,
  125. villageId: item.villageId,
  126. villageVolunteerId: item.villageVolunteerId,
  127. points: volunteerInfoLoader.content.value?.points,
  128. level: volunteerInfoLoader.content.value?.level,
  129. })
  130. }
  131. function goMyDigPage(item: VillageListItem) {
  132. navTo('./dig/forms/submits', {
  133. villageName: item.villageName,
  134. villageId: item.villageId,
  135. villageVolunteerId: item.villageVolunteerId,
  136. })
  137. }
  138. function goPreviewDigPage(item: VillageListItem) {
  139. navTo('./dig/admin/preview', {
  140. villageName: item.villageName,
  141. villageId: item.villageId,
  142. villageVolunteerId: item.villageVolunteerId,
  143. })
  144. }
  145. </script>