dig.vue 8.8 KB

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