index.vue 6.0 KB

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