card.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. <template>
  2. <FlexCol :padding="[30,30,0,30]" gap="gap.lg">
  3. <!-- 卡片背景 -->
  4. <BackgroundBox
  5. color1="#eecaa0"
  6. color2="white"
  7. color2Position="85%"
  8. color3="white"
  9. radius="radius.lg"
  10. direction="column"
  11. :padding="[35,30]"
  12. gap="gap.lg"
  13. >
  14. <!-- 标题 -->
  15. <FlexRow justify="space-between" align="flex-end" width="100%">
  16. <FlexCol gap="gap.md">
  17. <Text :text="villageInfoLoader.content.value?.title" fontConfig="primaryTitle" />
  18. </FlexCol>
  19. <FlexRow center gap="gap.lg">
  20. <BubbleTip
  21. v-model:show="showFollowTip"
  22. content="关注我,方便下次进入"
  23. @contentClick="isFollowed ? undefined : onFollow()"
  24. @close="handleCloseFollowTip"
  25. >
  26. <Button
  27. icon="https://xy.wenlvti.net/app_static/images/village/IconJoin.png"
  28. radius="radius.lgr"
  29. @click="isFollowed ? onUnFollow() : onFollow()"
  30. >
  31. {{ isFollowed ? '已关注' : '关注' }}
  32. </Button>
  33. </BubbleTip>
  34. <Button
  35. icon="https://xy.wenlvti.net/app_static/images/village/IconFollow.png"
  36. radius="radius.lgr"
  37. @click="handleGoJoin()"
  38. >
  39. {{ isJoined ? '已加入' : '加入' }}
  40. </Button>
  41. </FlexRow>
  42. </FlexRow>
  43. <!-- 简介 -->
  44. <TextEllipsis
  45. fontConfig="secondText"
  46. :lines="2"
  47. :expandable="(villageInfoLoader.content.value?.desc as string || '').length > 80"
  48. :text="(villageInfoLoader.content.value?.desc as string) || '暂无简介,欢迎您来编写完善!'"
  49. />
  50. <!-- 状态与申请 -->
  51. <FlexRow
  52. backgroundColor="background.tertiary"
  53. radius="radius.md"
  54. padding="space.md"
  55. justify="space-between"
  56. >
  57. <FlexRow align="center">
  58. <FlexCol gap="gap.md">
  59. <Text :text="`${villageInfoLoader.content.value?.levelText || '默认级别'}`" fontConfig="secondText" />
  60. <Text :text="`存储空间内存:${villageInfoLoader.content.value?.sizeText || 0}`" fontConfig="secondText" />
  61. </FlexCol>
  62. </FlexRow>
  63. <FlexRow align="center" gap="gap.md">
  64. <IconButton icon="help-filling" @click="navTo('/pages/article/details', { id: 7021, modelId: 18, showRecommend: false })" />
  65. <Button
  66. icon="https://xy.wenlvti.net/app_static/images/village/IconUser.png"
  67. radius="radius.lgr"
  68. :padding="[10, 30]"
  69. backgroundColor="white"
  70. @click="upgradeRef?.show()"
  71. >
  72. 升级村社
  73. </Button>
  74. </FlexRow>
  75. </FlexRow>
  76. <!-- 图片 -->
  77. <VillageGallery
  78. v-if="villageInfoLoader.content.value"
  79. ref="villageGalleryRef"
  80. :villageId="villageStore.currentVillage?.id ?? 0"
  81. @goGallery="handleGoGallery"
  82. />
  83. <!-- 地址 -->
  84. <FlexRow justify="space-between" align="center">
  85. <FlexRow align="center" gap="gap.sm">
  86. <Icon name="https://xy.wenlvti.net/app_static/images/village/IconMap.png" size="fontSize.md" />
  87. <Text :text="villageInfoLoader.content.value?.address" fontConfig="contentText" />
  88. </FlexRow>
  89. <Button size="mini" icon="picture" text="村社相册" @click="handleGoGallery" />
  90. </FlexRow>
  91. <VillageMiniMap
  92. v-if="villageInfoLoader.content.value"
  93. :lonlat="{
  94. longitude: villageInfoLoader.content.value.longitude,
  95. latitude: villageInfoLoader.content.value.latitude
  96. }"
  97. :currentNoticeContent="currentNoticeContent"
  98. />
  99. <FlexRow justify="space-between" align="center">
  100. <FlexRow center gap="gap.lg" flexBasis="50%">
  101. <Text text="村社排名" fontConfig="contentText" />
  102. <Text text="No." fontConfig="lightTitle" />
  103. <Text :text="villageInfoLoader.content.value?.rankText" fontConfig="primaryTitle" />
  104. </FlexRow>
  105. <FlexRow center gap="gap.lg" flexBasis="50%">
  106. <Text text="村社等级" fontConfig="contentText" />
  107. <Text :text="`${villageInfoLoader.content.value?.level}级`" fontConfig="primaryTitle" />
  108. </FlexRow>
  109. </FlexRow>
  110. <FlexRow backgroundColor="background.tertiary" radius="radius.md" :padding="[30, 20]">
  111. <FlexCol center gap="gap.sm" flexBasis="25%">
  112. <Text text="乡源光" fontConfig="secondText" />
  113. <Text :text="villageInfoLoader.content.value?.light || '0'" fontConfig="importantTitle" />
  114. <Button type="text" size="mini" text="做任务" @click="navTo('/pages/home/village/task/index')" />
  115. </FlexCol>
  116. <Divider type="vertical" />
  117. <FlexCol center gap="gap.sm" flexBasis="25%">
  118. <Touchable direction="column" center @click="navTo('/pages/home/village/volunteer/list', { villageId: villageStore.currentVillage?.id ?? undefined })">
  119. <Text text="乡源人数" fontConfig="contentText" />
  120. <Text :text="villageInfoLoader.content.value?.memberCount|| '0'" fontConfig="importantTitle" />
  121. </Touchable>
  122. <WxButton openType="share">
  123. <Button type="text" size="mini" text="邀请加入" @click="navTo('/pages/home/village/task/index')" />
  124. </WxButton>
  125. </FlexCol>
  126. <Divider type="vertical" />
  127. <Touchable direction="column" center gap="gap.sm" flexBasis="25%" @click="navTo('/pages/home/village/volunteer/list', {
  128. villageId: villageStore.currentVillage?.id ?? undefined,
  129. })">
  130. <Text text="关注人数" fontConfig="contentText" />
  131. <Text :text="villageInfoLoader.content.value?.followerCount|| '0'" fontConfig="importantTitle" />
  132. <Height :size="36" />
  133. </Touchable>
  134. <Divider type="vertical" />
  135. <Button
  136. :padding="0"
  137. type="text"
  138. size="small"
  139. textColor="text.title"
  140. text="新手上路"
  141. rightIcon="arrow-right"
  142. @click="handleGoNew()"
  143. />
  144. </FlexRow>
  145. </BackgroundBox>
  146. <!-- 排行榜 -->
  147. <HomeTitle
  148. title="排行榜"
  149. showMore
  150. @moreClicked="navTo('/pages/home/village/rank/volunteer', {
  151. villageId: villageStore.currentVillage?.id ?? undefined,
  152. })"
  153. />
  154. <!-- <RoundTags v-model:active="rankActiveTag" :tags="['乡源果', '乡源光', '文化积分' ]" /> -->
  155. <VillageUserRankList
  156. :list="villageUserRankListLoader.content.value ?? []"
  157. :scoreSuffix="rankActiveTag"
  158. @goDetails="navTo('/pages/home/village/volunteer/detail', { id: $event.id })"
  159. />
  160. <!-- 魅力乡源 -->
  161. <HomeTitle title="魅力乡源" showMore @moreClicked="handleGoCollect()">
  162. <template #right>
  163. <FlexRow align="center" gap="gap.md">
  164. <Touchable
  165. :padding="[15, 20]"
  166. direction="row"
  167. center
  168. gap="gap.md"
  169. @click="handleGoDigManage()"
  170. >
  171. <Icon name="https://xy.wenlvti.net/app_static/images/village/IconLargeFolkloreVibe.png" :size="30" />
  172. <Text text="管理" fontConfig="contentText" />
  173. </Touchable>
  174. <Touchable
  175. :padding="[15, 20]"
  176. :innerStyle="{
  177. marginRight: '20rpx'
  178. }"
  179. borderStyle="solid"
  180. borderColor="border.secondary"
  181. borderWidth="1px"
  182. backgroundColor="background.quaternary"
  183. radius="radius.md"
  184. direction="row"
  185. center
  186. gap="gap.sm"
  187. @click="handleGoCollect()"
  188. >
  189. <Icon name="https://xy.wenlvti.net/app_static/images/village/IconHistory.png" :size="30" />
  190. <Text text="共编村史" fontConfig="contentText" />
  191. </Touchable>
  192. </FlexRow>
  193. </template>
  194. </HomeTitle>
  195. <ProvideVar :vars="{
  196. GridItemIconSize: 90,
  197. GridItemBackgroundColor: 'transparent',
  198. GridItemPaddingHorizontal: 0,
  199. GridItemPaddingVertical: 8,
  200. }">
  201. <Grid :borderGrid="false" :mainAxisCount="4">
  202. <GridItem title="村社概况" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeIntrod.png" touchable @click="handleGoCollect(11, '村社概况')" />
  203. <GridItem title="自然风光" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeEnvirounment.png" touchable @click="handleGoCollect(13, '自然风光')" />
  204. <GridItem title="历史沿革" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeHistory.png" touchable @click="handleGoCollect(2, '历史沿革')" />
  205. <GridItem title="特色产业" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeIndustry.png" touchable @click="handleGoCollect(9, '特色产业' )" />
  206. <GridItem title="文艺活动" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeActivity.png" touchable @click="handleGoCollect(12, '文艺活动')" />
  207. <GridItem title="非遗展示" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeShow.png" touchable @click="handleGoCollect(10, '非遗展示')" />
  208. <GridItem title="民俗风采" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeFolkloreVibe.png" touchable @click="handleGoCollect(8, '民俗风采')" />
  209. <GridItem title="历史人物" icon="https://xy.wenlvti.net/app_static/images/village/IconGoods.png" touchable @click="handleGoCollect(7, '历史人物')" />
  210. </Grid>
  211. </ProvideVar>
  212. <!-- 活力乡源 -->
  213. <HomeTitle title="活力乡源" />
  214. <ProvideVar :vars="{
  215. GridItemIconSize: 90,
  216. GridItemBackgroundColor: 'transparent',
  217. GridItemPaddingHorizontal: 0,
  218. GridItemPaddingVertical: 8,
  219. }">
  220. <Grid :borderGrid="false" :mainAxisCount="4">
  221. <GridItem title="乡源荣光" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeHornor.png" touchable @click="handleGoCollect(23, '乡源荣光')" />
  222. <GridItem title="乡源好物" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeGoods.png" touchable @click="navTo('/pages/home/village/goods/index', { villageId: villageStore.currentVillage?.id ?? undefined })" />
  223. <GridItem title="乡源树" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeTree.png" touchable @click="emit('goTree')" />
  224. <!-- <GridItem title="政贤连心" icon="https://xy.wenlvti.net/app_static/images/village/IconGovAffairs.png" touchable @click="navTo('/pages/home/village/gov/index')" /> -->
  225. <GridItem title="互动游戏" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeGame.png" touchable @click="navTo('/pages/home/village/games/index')" />
  226. </Grid>
  227. </ProvideVar>
  228. <!-- 文脉乡源 -->
  229. <HomeTitle title="文脉乡源">
  230. <template #right>
  231. <FlexRow align="center" gap="gap.md">
  232. <BubbleTip
  233. v-model:show="showManageTip"
  234. position="bottom"
  235. crossPosition="left"
  236. arrowOffsetX="-50rpx"
  237. content="村社贴图太乱?点这里整理"
  238. @contentClick="handleCloseManageTip(true)"
  239. @close="handleCloseManageTip(false)"
  240. >
  241. <Touchable
  242. :padding="[15, 20]"
  243. direction="row"
  244. center
  245. gap="gap.md"
  246. @click="handleGoOfficalManage()"
  247. >
  248. <Icon name="https://xy.wenlvti.net/app_static/images/village/IconLargeFolkloreVibe.png" :size="30" />
  249. <Text text="管理" fontConfig="contentText" />
  250. </Touchable>
  251. </BubbleTip>
  252. <Touchable
  253. :padding="[15, 20]"
  254. direction="row"
  255. center
  256. gap="gap.md"
  257. @click="handleGoPublish()"
  258. >
  259. <Icon name="https://xy.wenlvti.net/app_static/images/village/IconLargeHistory.png" :size="30" />
  260. <Text text="乡源AI帮你写" fontConfig="contentText" />
  261. </Touchable>
  262. </FlexRow>
  263. </template>
  264. </HomeTitle>
  265. <RoundTags v-model:active="listActiveTag" :tags="['广场', '老味道', '老手艺', '老物件', '老故事']" />
  266. </FlexCol>
  267. <OfficialAccountPublishWrap
  268. :topic="recommendTagName"
  269. @publishsuccess="onPublishSuccess"
  270. @empty="isOfficialEmpty=true"
  271. />
  272. <UpgradeDialog
  273. ref="upgradeRef"
  274. v-if="villageStore.currentVillage"
  275. :villageId="villageStore.currentVillage.id"
  276. />
  277. </template>
  278. <script setup lang="ts">
  279. import { computed, ref, watch } from 'vue';
  280. import { useUserTools } from '@/common/composeabe/UserTools';
  281. import { useOfficialAccount } from '../../composeabe/OfficialAccount';
  282. import { useAuthStore } from '@/store/auth';
  283. import { useSimpleDataLoader } from '@/components/composeabe/loader/SimpleDataLoader';
  284. import { useVillageStore } from '@/store/village';
  285. import { useRequireLogin } from '@/common/composeabe/RequireLogin';
  286. import { useFollow } from '../composeabe/Follow';
  287. import { ArrayUtils, assertNotNull, waitTimeOut } from '@imengyu/imengyu-utils';
  288. import { navTo } from '@/components/utils/PageAction';
  289. import HomeTitle from '@/common/components/parts/HomeTitle.vue';
  290. import Icon from '@/components/basic/Icon.vue';
  291. import Text from '@/components/basic/Text.vue';
  292. import BackgroundBox from '@/components/display/block/BackgroundBox.vue';
  293. import Touchable from '@/components/feedback/Touchable.vue';
  294. import FlexCol from '@/components/layout/FlexCol.vue';
  295. import FlexRow from '@/components/layout/FlexRow.vue';
  296. import VillageMiniMap from '../../components/VillageMiniMap.vue';
  297. import Divider from '@/components/display/Divider.vue';
  298. import RoundTags from '@/common/components/parts/RoundTags.vue';
  299. import VillageUserRankList from '../../components/VillageUserRankList.vue';
  300. import ProvideVar from '@/components/theme/ProvideVar.vue';
  301. import Grid from '@/components/layout/grid/Grid.vue';
  302. import GridItem from '@/components/layout/grid/GridItem.vue';
  303. import LightVillageApi from '@/api/light/LightVillageApi';
  304. import OfficialAccountPublishWrap from '@/common/components/OfficialAccountPublishWrap.vue';
  305. import UpgradeDialog from '../dialogs/UpgradeDialog.vue';
  306. import VillageGallery from '../components/VillageGallery.vue';
  307. import WxButton from '@/components/basic/WxButton.vue';
  308. import Height from '@/components/layout/space/Height.vue';
  309. import IconButton from '@/components/basic/IconButton.vue';
  310. import Button from '@/components/basic/Button.vue';
  311. import BubbleTip from '@/components/feedback/BubbleTip.vue';
  312. import MemoryTimeOut from '@/components/composeabe/MemoryTimeOut';
  313. import TextEllipsis from '@/components/display/TextEllipsis.vue';
  314. import { confirm, toast } from '@/components/dialog/CommonRoot';
  315. import { useGetNotice } from '../composeabe/GetNotice';
  316. import OfficialApi from '@/api/light/OfficialApi';
  317. const authStore = useAuthStore();
  318. const { getIsVolunteer } = useUserTools();
  319. const { requireLogin } = useRequireLogin();
  320. const { onPublishSuccess } = useOfficialAccount(() => {
  321. return {
  322. villageId: villageStore.currentVillage?.id ?? 0,
  323. userId: authStore.userId,
  324. tag: recommendTagName.value,
  325. };
  326. });
  327. const { isFollowed, onFollow, onUnFollow } = useFollow();
  328. const villageStore = useVillageStore();
  329. const { getIsJoinedVillage } = useUserTools();
  330. const isOfficialEmpty = ref(false);
  331. const isJoined = ref(false);
  332. const villageInfoLoader = useSimpleDataLoader(async () => {
  333. const village = villageStore.currentVillage;
  334. try {
  335. if (village)
  336. isJoined.value = await getIsJoinedVillage(village.id);
  337. } catch {
  338. isJoined.value = false;
  339. }
  340. handleShowFollowTip();
  341. isOfficialEmpty.value = false;
  342. setTimeout(() => {
  343. handleManageFollowTip();
  344. }, 3000);
  345. return {
  346. title: village?.name || '',
  347. desc: village?.desc || '',
  348. address: village?.address,
  349. sizeText: village?.storageLimit || 0,
  350. level: village?.level.toString() || '',
  351. levelText: village?.levelText || '',
  352. rankText: village?.rank.toString() || '',
  353. light: village?.light || 0,
  354. memberCount: village?.volunteerCount || 0,
  355. followerCount: village?.followCount || 0,
  356. images: village?.images || [],
  357. longitude: village?.longitude || 0,
  358. latitude: village?.latitude || 0,
  359. };
  360. });
  361. const emit = defineEmits<{
  362. (e: 'goTree'): void;
  363. (e: 'goJoin'): void;
  364. }>();
  365. const rankActiveTag = ref('文化积分');
  366. const listActiveTag = ref('广场');
  367. const villageUserRankListLoader = useSimpleDataLoader(async () => {
  368. const res = (await LightVillageApi.getVolunteerRankList({
  369. num: 3,
  370. village_id: villageStore.currentVillage?.id ?? undefined,
  371. }))
  372. .map((item, i) => ({
  373. id: item.id,
  374. image: item.image ?? '',
  375. title: item.name,
  376. rank: i + 1,
  377. score: item.points,
  378. }));
  379. if (res.length >= 3) {
  380. //移动第一名到中间
  381. const first = res[0];
  382. ArrayUtils.removeAt(res, 0);
  383. ArrayUtils.insert(res, 1, first);
  384. }
  385. return res
  386. });
  387. const showFollowTipTimeout = new MemoryTimeOut('FollowTip', 1000 * 3600);//1h
  388. const showFollowTip = ref(false);
  389. function handleShowFollowTip() {
  390. if (!isFollowed.value && showFollowTipTimeout.isTimeout()) {
  391. showFollowTip.value = true;
  392. }
  393. }
  394. function handleCloseFollowTip() {
  395. showFollowTipTimeout.recordTime();
  396. }
  397. const showManageTipTimeout = new MemoryTimeOut('VillageManageTip', 1000 * 3600 * 20);//30h
  398. const showManageTip = ref(false);
  399. function handleManageFollowTip() {
  400. if (showManageTipTimeout.isTimeout() && !isOfficialEmpty.value)
  401. showManageTip.value = true;
  402. }
  403. function handleCloseManageTip(goComp: boolean) {
  404. showManageTipTimeout.recordTime();
  405. }
  406. watch(rankActiveTag, () => {
  407. villageUserRankListLoader.reload();
  408. });
  409. const recommendTagName = computed(() => {
  410. return '亮乡源·' + villageInfoLoader.content.value?.title + '·' + listActiveTag.value;
  411. });
  412. function handleGoJoin() {
  413. if (isJoined.value)
  414. return;
  415. emit('goJoin');
  416. }
  417. function handleGoNew() {
  418. navTo('/pages/article/common/list', {
  419. modelId: 18,
  420. mainBodyColumnId: 356,
  421. title: '新手上路',
  422. });
  423. }
  424. function handleGoCollect(collectModuleId?: number, title?: string) {
  425. if (!collectModuleId) {
  426. navTo('/pages/dig/details', {
  427. villageId: villageStore.currentVillage?.id ?? undefined,
  428. name: villageInfoLoader.content.value?.title,
  429. });
  430. return;
  431. }
  432. navTo('/pages/dig/forms/list-ordinary', {
  433. villageId: villageStore.currentVillage?.id ?? undefined,
  434. collectModuleId: collectModuleId,
  435. title: title,
  436. });
  437. }
  438. function handleGoPublish() {
  439. requireLogin(async () => {
  440. navTo('/pages/home/chat/dependent/post/publish', {
  441. tag: recommendTagName.value,
  442. villageId: villageStore.currentVillage?.id ?? undefined,
  443. });
  444. }, '登录后以便发布文章使用更多功能哦!');
  445. }
  446. function handleGoGallery() {
  447. navTo('/pages/home/village/gallery/index', {
  448. villageId: villageStore.currentVillage?.id ?? 0 ,
  449. maxCount: villageStore.currentVillage?.imageLimit || 3,
  450. });
  451. }
  452. async function handleGoOfficalManage() {
  453. assertNotNull(villageStore.currentVillage?.id)
  454. const isAdmin = await OfficialApi.checkTopicRule(villageStore.currentVillage.id);
  455. if (!isAdmin) {
  456. const goUpgrade = await confirm({
  457. title: '提示',
  458. content: '您还不是管理员,无法管理贴图哦。您可以联系村社管理员将你添加为管理员,若当前村社暂无管理员,您可以点击“去升级”将您升级为管理员。',
  459. confirmText: '去升级',
  460. cancelText: '取消',
  461. });
  462. if (goUpgrade) {
  463. navTo('/pages/home/village/upgrade/my-upgrade-management', {
  464. villageId: villageStore.currentVillage.id,
  465. });
  466. }
  467. return;
  468. }
  469. navTo('/pages/home/village/post/management-list', {
  470. villageId: villageStore.currentVillage.id,
  471. topic: recommendTagName.value,
  472. });
  473. }
  474. async function handleGoDigManage() {
  475. assertNotNull(villageStore.currentVillage?.id)
  476. const isAdmin = (authStore.isAdmin || await OfficialApi.checkTopicRule(villageStore.currentVillage.id));
  477. if (!isAdmin) {
  478. const goUpgrade = await confirm({
  479. title: '提示',
  480. content: '您还不是管理员,您可以联系村社管理员将你添加为管理员,若当前村社暂无管理员,您可以点击“去升级”将您升级为管理员。',
  481. confirmText: '去升级',
  482. cancelText: '取消',
  483. });
  484. if (goUpgrade) {
  485. navTo('/pages/home/village/upgrade/my-upgrade-management', {
  486. villageId: villageStore.currentVillage.id,
  487. });
  488. }
  489. return;
  490. }
  491. navTo('/pages/dig/details', {
  492. name: villageStore.currentVillage.title,
  493. villageId: villageStore.currentVillage.id,
  494. });
  495. }
  496. const { currentNoticeContent, noticeListLoader } = useGetNotice(() => villageStore.currentVillage?.id || 0);
  497. const upgradeRef = ref<InstanceType<typeof UpgradeDialog>>();
  498. const villageGalleryRef = ref<InstanceType<typeof VillageGallery>>();
  499. watch(() => villageStore.currentVillage, async () => {
  500. await waitTimeOut(100);
  501. await villageInfoLoader.reload();
  502. await waitTimeOut(100);
  503. await villageUserRankListLoader.reload();
  504. await waitTimeOut(100);
  505. await noticeListLoader.reload();
  506. }, { immediate: true });
  507. defineExpose({
  508. onPageBack: (name: string, data: Record<string, unknown>) => {
  509. if (name === 'refreshVillageGrallery') {
  510. villageGalleryRef.value?.refresh();
  511. } else if (name === 'showVillageUpgrade') {
  512. upgradeRef.value?.show();
  513. } else if (name === 'refreshOfficialAccount') {
  514. const tag = listActiveTag.value;
  515. listActiveTag.value = '';
  516. setTimeout(() => listActiveTag.value = tag, 100);
  517. }
  518. },
  519. });
  520. </script>