index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <FlexCol>
  3. <FlexCol :padding="30">
  4. <HomeLargeTitle title="挖掘" />
  5. <Image
  6. mode="aspectFill"
  7. src="/static/images/dig/IntrodBanner.png"
  8. width="100%"
  9. :height="300"
  10. radius="20"
  11. :innerStyle="{
  12. border: '1px solid #fff',
  13. }"
  14. />
  15. <HomeTitle title="我的村社" />
  16. <RequireLogin unLoginMessage="欢迎您成为志愿者!在这之前您需要登录或者注册完善基础信息后才能投稿和查看我认领的村社哦">
  17. <Result
  18. v-if="notVolunteerError"
  19. status="warning"
  20. title="您还不是志愿者"
  21. subTitle="请联系管理员认领,或者绑定已有志愿者账号"
  22. >
  23. <FlexCol center>
  24. <Height :size="20" />
  25. <Button type="primary" text="绑定已有志愿者账号" @click="navTo('/pages/dig/sharereg/bind')" />
  26. </FlexCol>
  27. </Result>
  28. <SimplePageContentLoader
  29. v-else
  30. :loader="villageListLoader"
  31. :showEmpty="villageListLoader.content.value?.length == 0"
  32. :emptyView="{
  33. text: '你还没有认领的村社,请联系管理员认领',
  34. button: false,
  35. }"
  36. >
  37. <FlexCol :gap="10">
  38. <FlexRow
  39. v-for="item in villageListLoader.content.value"
  40. :key="item.id"
  41. :radius="20"
  42. :padding="20"
  43. align="center"
  44. justify="space-between"
  45. :innerStyle="{
  46. border: '1px solid #fff',
  47. }"
  48. >
  49. <FlexRow align="center" :gap="20">
  50. <Image
  51. mode="aspectFill"
  52. :src="item.image"
  53. round
  54. :width="80"
  55. :height="80"
  56. />
  57. <H3>{{ item.villageName }}</H3>
  58. </FlexRow>
  59. <ButtonGroup direction="row" align="center" :gap="0">
  60. <BubbleBox :items="[
  61. {
  62. icon: 'edit-filling',
  63. text: '管理',
  64. onClick: () => goManagePage(item),
  65. },
  66. {
  67. icon: 'edit-filling',
  68. text: '采编',
  69. onClick: () => goSubmitDigPage(item),
  70. },
  71. {
  72. icon: 'browse',
  73. text: '我的投稿',
  74. onClick: () => goMyDigPage(item),
  75. },
  76. ]">
  77. <Button v-if="authStore.isAdmin" icon="edit-filling" size="small">采编/管理</Button>
  78. </BubbleBox>
  79. <BubbleBox :items="[
  80. {
  81. icon: 'edit-filling',
  82. text: '采编',
  83. onClick: () => goSubmitDigPage(item),
  84. },
  85. {
  86. icon: 'browse',
  87. text: '我的投稿',
  88. onClick: () => goMyDigPage(item),
  89. },
  90. ]">
  91. <Button v-if="!authStore.isAdmin" icon="edit-filling" size="small">采编</Button>
  92. </BubbleBox>
  93. <Button type="primary" size="small" icon="edit-filling" @click="showOnlinePreviewDialog = true">线上展示</Button>
  94. </ButtonGroup>
  95. </FlexRow>
  96. </FlexCol>
  97. </SimplePageContentLoader>
  98. </RequireLogin>
  99. <Height :height="20" />
  100. <HomeTitle v-if="authStore.isLogged" title="我的贡献" />
  101. <FlexRow v-if="authStore.isLogged" backgroundColor="white" :radius="20" :padding="[40,20]">
  102. <FlexCol :flex="1" :gap="10" center>
  103. <Text :fontSize="60" fontFamily="Rockwell" color="primary">{{ volunteerInfoLoader.content.value?.points || 0 }}</Text>
  104. <Text>文化积分</Text>
  105. </FlexCol>
  106. <FlexCol :flex="1" :gap="10" center>
  107. <Text :fontSize="60" fontFamily="Rockwell" color="primary">Lv.{{ volunteerInfoLoader.content.value?.level || 1 }}</Text>
  108. <Text>等级</Text>
  109. </FlexCol>
  110. </FlexRow>
  111. </FlexCol>
  112. <Dialog
  113. v-model:show="showOnlinePreviewDialog"
  114. :showConfirm="false"
  115. >
  116. <FlexCol :padding="[40,20]" :gap="10" center>
  117. <Image src="https://mn.wenlvti.net/app_static/xiangyuan/images/home/UnOpenIcon.png" width="300" mode="widthFix" />
  118. <Text textAlign="center">尊敬的用户,您未开通线上村史的使用权限,开通后即可使用!</Text>
  119. <Button size="large" type="primary" @click="showOnlinePreviewDialog = false">去开通</Button>
  120. </FlexCol>
  121. </Dialog>
  122. </FlexCol>
  123. </template>
  124. <script setup lang="ts">
  125. import { ref, watch } from 'vue';
  126. import { navTo } from '@/components/utils/PageAction';
  127. import { useAuthStore } from '@/store/auth';
  128. import { useCollectStore } from '@/store/collect';
  129. import { useSimpleDataLoader } from '@/common/composeabe/SimpleDataLoader';
  130. import { checkIsNotVolunteerError } from './forms/bind';
  131. import VillageApi, { VillageListItem } from '@/api/inhert/VillageApi';
  132. import RequireLogin from '@/common/components/RequireLogin.vue';
  133. import SimplePageContentLoader from '@/common/components/SimplePageContentLoader.vue';
  134. import Button from '@/components/basic/Button.vue';
  135. import Image from '@/components/basic/Image.vue';
  136. import SubTitle from '@/components/display/title/SubTitle.vue';
  137. import FlexCol from '@/components/layout/FlexCol.vue';
  138. import FlexRow from '@/components/layout/FlexRow.vue';
  139. import H3 from '@/components/typography/H3.vue';
  140. import Text from '@/components/basic/Text.vue';
  141. import Height from '@/components/layout/space/Height.vue';
  142. import ButtonGroup from '@/components/basic/ButtonGroup.vue';
  143. import BubbleBox from '@/components/feedback/BubbleBox.vue';
  144. import Result from '@/components/feedback/Result.vue';
  145. import Dialog from '@/components/dialog/Dialog.vue';
  146. import HomeTitle from '@/common/components/parts/HomeTitle.vue';
  147. import HomeLargeTitle from '@/common/components/parts/HomeLargeTitle.vue';
  148. const showOnlinePreviewDialog = ref(false);
  149. const authStore = useAuthStore();
  150. const collectStore = useCollectStore();
  151. const notVolunteerError = ref(false);
  152. const villageListLoader = useSimpleDataLoader(async () => await VillageApi.getClaimedVallageList(), true);
  153. const volunteerInfoLoader = useSimpleDataLoader(async () => {
  154. try {
  155. const res = await VillageApi.getVolunteerInfo()
  156. notVolunteerError.value = false;
  157. return res;
  158. } catch (error) {
  159. notVolunteerError.value = checkIsNotVolunteerError(error);
  160. throw error;
  161. }
  162. }, true);
  163. const rankListLoader = useSimpleDataLoader(async () => await VillageApi.getVolunteerRanklist(), true);
  164. watch(() => authStore.isLogged, (newVal) => {
  165. if (newVal) {
  166. villageListLoader.loadData();
  167. volunteerInfoLoader.loadData();
  168. rankListLoader.loadData();
  169. }
  170. })
  171. function goSubmitDigPage(item: VillageListItem) {
  172. navTo('./dig/details', {
  173. name: item.villageName,
  174. villageId: item.villageId,
  175. villageVolunteerId: item.villageVolunteerId,
  176. points: volunteerInfoLoader.content.value?.points,
  177. level: volunteerInfoLoader.content.value?.level,
  178. })
  179. }
  180. function goManagePage(item: VillageListItem) {
  181. navTo('./dig/admin/index', {
  182. id: item.villageId,
  183. name: item.villageName,
  184. villageId: item.villageId,
  185. villageVolunteerId: item.villageVolunteerId,
  186. points: volunteerInfoLoader.content.value?.points,
  187. level: volunteerInfoLoader.content.value?.level,
  188. })
  189. }
  190. function goMyDigPage(item: VillageListItem) {
  191. navTo('./dig/forms/submits', {
  192. villageName: item.villageName,
  193. villageId: item.villageId,
  194. villageVolunteerId: item.villageVolunteerId,
  195. })
  196. }
  197. function goPreviewDigPage(item: VillageListItem) {
  198. navTo('./dig/admin/preview', {
  199. villageName: item.villageName,
  200. villageId: item.villageId,
  201. villageVolunteerId: item.villageVolunteerId,
  202. })
  203. }
  204. </script>