|
|
@@ -5,7 +5,7 @@
|
|
|
<BackgroundBox
|
|
|
color1="#eecaa0"
|
|
|
color2="white"
|
|
|
- color2Position="45%"
|
|
|
+ color2Position="85%"
|
|
|
color3="white"
|
|
|
radius="radius.lg"
|
|
|
direction="column"
|
|
|
@@ -19,47 +19,79 @@
|
|
|
<Text :text="villageInfoLoader.content.value?.title" fontConfig="primaryTitle" />
|
|
|
<Text :text="villageInfoLoader.content.value?.address" fontConfig="contentText" />
|
|
|
</FlexCol>
|
|
|
- <FlexCol gap="gap.md">
|
|
|
- <Button icon="https://xy.wenlvti.net/app_static/images/village/IconUser.png" radius="radius.lgr" :padding="[10, 30]" backgroundColor="white">申请管理者</Button>
|
|
|
- <Text :text="`${villageInfoLoader.content.value?.applyCount} 个乡源果可申请`" fontConfig="secondText" />
|
|
|
- </FlexCol>
|
|
|
+ <FlexRow center gap="gap.lg">
|
|
|
+ <Button
|
|
|
+ icon="https://xy.wenlvti.net/app_static/images/village/IconJoin.png"
|
|
|
+ radius="radius.lgr"
|
|
|
+ @click="isFollowed ? onUnFollow() : onFollow()"
|
|
|
+ >
|
|
|
+ {{ isFollowed ? '已关注' : '关注' }}
|
|
|
+ </Button>
|
|
|
+ <Button
|
|
|
+ icon="https://xy.wenlvti.net/app_static/images/village/IconFollow.png"
|
|
|
+ radius="radius.lgr"
|
|
|
+ @click="handleGoJoin()"
|
|
|
+ >
|
|
|
+ {{ isJoined ? '已加入' : '加入' }}
|
|
|
+ </Button>
|
|
|
+ </FlexRow>
|
|
|
</FlexRow>
|
|
|
+
|
|
|
+ <!-- 状态与申请 -->
|
|
|
+ <Construction text="没有接口,数据不正确">
|
|
|
+ <FlexRow
|
|
|
+ backgroundColor="background.tertiary"
|
|
|
+ radius="radius.md"
|
|
|
+ padding="space.md"
|
|
|
+ justify="space-between"
|
|
|
+ >
|
|
|
+ <FlexCol gap="gap.md">
|
|
|
+ <Text :text="`${villageInfoLoader.content.value?.applyCount} 个乡源果可申请`" fontConfig="secondText" />
|
|
|
+ <Text :text="`存储空间内存:${villageInfoLoader.content.value?.sizeText}`" fontConfig="secondText" />
|
|
|
+ </FlexCol>
|
|
|
+ <FlexCol gap="gap.md">
|
|
|
+ <Button icon="https://xy.wenlvti.net/app_static/images/village/IconUser.png" radius="radius.lgr" :padding="[10, 30]" backgroundColor="white">申请管理者</Button>
|
|
|
+ </FlexCol>
|
|
|
+ </FlexRow>
|
|
|
+ </Construction>
|
|
|
|
|
|
<!-- 图片 -->
|
|
|
- <FlexRow v-if="villageInfoLoader.content.value" justify="space-between">
|
|
|
- <Image
|
|
|
- v-for="index of 3"
|
|
|
- :key="index"
|
|
|
- :src="villageInfoLoader.content.value.images[index - 1]"
|
|
|
- radius="radius.md"
|
|
|
- :width="200"
|
|
|
- :height="140"
|
|
|
- mode="aspectFill"
|
|
|
- defaultImage=""
|
|
|
- touchable
|
|
|
- >
|
|
|
- <template #empty>
|
|
|
- <Touchable
|
|
|
- direction="column"
|
|
|
- position="absolute"
|
|
|
- inset="0"
|
|
|
- center
|
|
|
- backgroundColor="background.primary"
|
|
|
- >
|
|
|
- <Icon name="add" size="fontSize.md" />
|
|
|
- <Text text="上传封面" fontConfig="secondText" />
|
|
|
- </Touchable>
|
|
|
- </template>
|
|
|
- <FlexCol
|
|
|
- v-if="index === 3 && villageInfoLoader.content.value.images.length > 3"
|
|
|
- position="absolute" inset="0"
|
|
|
- center
|
|
|
- backgroundColor="mask.default"
|
|
|
+ <Construction text="没有接口">
|
|
|
+ <FlexRow v-if="villageInfoLoader.content.value" justify="space-between">
|
|
|
+ <Image
|
|
|
+ v-for="index of 3"
|
|
|
+ :key="index"
|
|
|
+ :src="villageInfoLoader.content.value.images[index - 1]"
|
|
|
+ radius="radius.md"
|
|
|
+ :width="200"
|
|
|
+ :height="140"
|
|
|
+ mode="aspectFill"
|
|
|
+ defaultImage=""
|
|
|
+ touchable
|
|
|
>
|
|
|
- <Text :text="`+${villageInfoLoader.content.value.images.length - 3}`" fontSize="fontSize.lg" color="white" />
|
|
|
- </FlexCol>
|
|
|
- </Image>
|
|
|
- </FlexRow>
|
|
|
+ <template #empty>
|
|
|
+ <Touchable
|
|
|
+ direction="column"
|
|
|
+ position="absolute"
|
|
|
+ inset="0"
|
|
|
+ center
|
|
|
+ backgroundColor="background.primary"
|
|
|
+ >
|
|
|
+ <Icon name="add" size="fontSize.md" />
|
|
|
+ <Text text="上传封面" fontConfig="secondText" />
|
|
|
+ </Touchable>
|
|
|
+ </template>
|
|
|
+ <FlexCol
|
|
|
+ v-if="index === 3 && villageInfoLoader.content.value.images.length > 3"
|
|
|
+ position="absolute" inset="0"
|
|
|
+ center
|
|
|
+ backgroundColor="mask.default"
|
|
|
+ >
|
|
|
+ <Text :text="`+${villageInfoLoader.content.value.images.length - 3}`" fontSize="fontSize.lg" color="white" />
|
|
|
+ </FlexCol>
|
|
|
+ </Image>
|
|
|
+ </FlexRow>
|
|
|
+ </Construction>
|
|
|
|
|
|
<!-- 地址 -->
|
|
|
<FlexRow align="center" gap="gap.sm">
|
|
|
@@ -74,56 +106,46 @@
|
|
|
}"
|
|
|
/>
|
|
|
|
|
|
- <FlexRow center gap="gap.lg">
|
|
|
- <Button
|
|
|
- icon="https://xy.wenlvti.net/app_static/images/village/IconJoin.png"
|
|
|
- radius="radius.lgr"
|
|
|
- size="large"
|
|
|
- :innerStyle="{ flexBasis: '25%' }"
|
|
|
- @click="isFollowed ? onUnFollow() : onFollow()"
|
|
|
- >
|
|
|
- {{ isFollowed ? '已关注' : '关注' }}
|
|
|
- </Button>
|
|
|
- <Button
|
|
|
- icon="https://xy.wenlvti.net/app_static/images/village/IconFollow.png"
|
|
|
- size="large"
|
|
|
- radius="radius.lgr"
|
|
|
- :innerStyle="{ flexBasis: '25%' }"
|
|
|
- >
|
|
|
- 加入
|
|
|
- </Button>
|
|
|
- </FlexRow>
|
|
|
-
|
|
|
- <FlexRow justify="space-between" align="center">
|
|
|
- <FlexRow center gap="gap.lg" flexBasis="50%">
|
|
|
- <Text text="村社排名" fontConfig="contentText" />
|
|
|
- <Text text="No." fontConfig="lightTitle" />
|
|
|
- <Text :text="villageInfoLoader.content.value?.rankText" fontConfig="primaryTitle" />
|
|
|
+ <Construction text="没有接口,数据不正确">
|
|
|
+ <FlexRow justify="space-between" align="center">
|
|
|
+ <FlexRow center gap="gap.lg" flexBasis="50%">
|
|
|
+ <Text text="村社排名" fontConfig="contentText" />
|
|
|
+ <Text text="No." fontConfig="lightTitle" />
|
|
|
+ <Text :text="villageInfoLoader.content.value?.rankText" fontConfig="primaryTitle" />
|
|
|
+ </FlexRow>
|
|
|
+ <FlexRow center gap="gap.lg" flexBasis="50%">
|
|
|
+ <Text text="村社等级" fontConfig="contentText" />
|
|
|
+ <Text :text="villageInfoLoader.content.value?.levelText" fontConfig="primaryTitle" />
|
|
|
+ </FlexRow>
|
|
|
</FlexRow>
|
|
|
- <FlexRow center gap="gap.lg" flexBasis="50%">
|
|
|
- <Text text="村社等级" fontConfig="contentText" />
|
|
|
- <Text :text="villageInfoLoader.content.value?.levelText" fontConfig="primaryTitle" />
|
|
|
- </FlexRow>
|
|
|
- </FlexRow>
|
|
|
|
|
|
- <FlexRow backgroundColor="background.tertiary" radius="radius.md" :padding="[30, 20]">
|
|
|
- <FlexCol center gap="gap.sm" flexBasis="25%">
|
|
|
- <Text text="乡源光" fontConfig="secondText" />
|
|
|
- <Text :text="villageInfoLoader.content.value?.light" fontConfig="importantTitle" />
|
|
|
- </FlexCol>
|
|
|
- <Divider type="vertical" />
|
|
|
- <FlexCol center gap="gap.sm" flexBasis="25%">
|
|
|
- <Text text="乡源人数" fontConfig="contentText" />
|
|
|
- <Text :text="villageInfoLoader.content.value?.memberCount" fontConfig="importantTitle" />
|
|
|
- </FlexCol>
|
|
|
- <Divider type="vertical" />
|
|
|
- <FlexCol center gap="gap.sm" flexBasis="25%">
|
|
|
- <Text text="关注人数" fontConfig="contentText" />
|
|
|
- <Text :text="villageInfoLoader.content.value?.followerCount" fontConfig="importantTitle" />
|
|
|
- </FlexCol>
|
|
|
- <Divider type="vertical" />
|
|
|
- <Button :padding="0" type="text" size="small" textColor="text.title" text="新手上路" rightIcon="arrow-right" />
|
|
|
- </FlexRow>
|
|
|
+ <FlexRow backgroundColor="background.tertiary" radius="radius.md" :padding="[30, 20]">
|
|
|
+ <FlexCol center gap="gap.sm" flexBasis="25%">
|
|
|
+ <Text text="乡源光" fontConfig="secondText" />
|
|
|
+ <Text :text="villageInfoLoader.content.value?.light" fontConfig="importantTitle" />
|
|
|
+ </FlexCol>
|
|
|
+ <Divider type="vertical" />
|
|
|
+ <FlexCol center gap="gap.sm" flexBasis="25%">
|
|
|
+ <Text text="乡源人数" fontConfig="contentText" />
|
|
|
+ <Text :text="villageInfoLoader.content.value?.memberCount" fontConfig="importantTitle" />
|
|
|
+ </FlexCol>
|
|
|
+ <Divider type="vertical" />
|
|
|
+ <FlexCol center gap="gap.sm" flexBasis="25%">
|
|
|
+ <Text text="关注人数" fontConfig="contentText" />
|
|
|
+ <Text :text="villageInfoLoader.content.value?.followerCount" fontConfig="importantTitle" />
|
|
|
+ </FlexCol>
|
|
|
+ <Divider type="vertical" />
|
|
|
+ <Button
|
|
|
+ :padding="0"
|
|
|
+ type="text"
|
|
|
+ size="small"
|
|
|
+ textColor="text.title"
|
|
|
+ text="新手上路"
|
|
|
+ rightIcon="arrow-right"
|
|
|
+ @click="handleGoNew()"
|
|
|
+ />
|
|
|
+ </FlexRow>
|
|
|
+ </Construction>
|
|
|
</BackgroundBox>
|
|
|
|
|
|
<!-- 排行榜 -->
|
|
|
@@ -143,7 +165,8 @@
|
|
|
:padding="[15, 20]"
|
|
|
:innerStyle="{ marginRight: '20rpx' }"
|
|
|
>
|
|
|
- <Text text="120乡源果兑换" fontConfig="contentText" color="white" />
|
|
|
+ <Icon name="https://xy.wenlvti.net/app_static/images/village/IconHistory.png" :size="30" />
|
|
|
+ <Text text="共编村史" fontConfig="contentText" color="white" />
|
|
|
</BackgroundImageButton>
|
|
|
</template>
|
|
|
</HomeTitle>
|
|
|
@@ -161,7 +184,7 @@
|
|
|
<GridItem title="文艺活动" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeActivity.png" touchable @click="handleGoCollect('trip')" />
|
|
|
<GridItem title="非遗展示" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeShow.png" touchable @click="handleGoCollect('ich')" />
|
|
|
<GridItem title="民俗风采" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeFolkloreVibe.png" touchable @click="handleGoCollect('custom')" />
|
|
|
- <GridItem title="文化志愿者" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeVolunteer.png" touchable @click="toast('TODO')" />
|
|
|
+ <GridItem title="乡贤故事" icon="https://xy.wenlvti.net/app_static/images/village/IconGoods.png" touchable @click="toast('TODO')" />
|
|
|
</Grid>
|
|
|
</ProvideVar>
|
|
|
|
|
|
@@ -228,6 +251,8 @@ import { useSimplePageListLoader } from '@/components/composeabe/loader/SimplePa
|
|
|
import { useAuthStore } from '@/store/auth';
|
|
|
import { useSimpleDataLoader } from '@/components/composeabe/loader/SimpleDataLoader';
|
|
|
import { useVillageStore } from '@/store/village';
|
|
|
+import { useReqireLogin } from '@/common/composeabe/RequireLogin';
|
|
|
+import { useFollow } from '../composeabe/Follow';
|
|
|
import { confirm, toast } from '@/components/utils/DialogAction';
|
|
|
import { ArrayUtils } from '@imengyu/imengyu-utils';
|
|
|
import { navTo } from '@/components/utils/PageAction';
|
|
|
@@ -254,18 +279,22 @@ import IndexCommonImageItem from '@/common/components/parts/IndexCommonImageItem
|
|
|
import FollowVillageApi from '@/api/light/FollowVillageApi';
|
|
|
import LightVillageApi from '@/api/light/LightVillageApi';
|
|
|
import SimplePageListLoader from '@/components/loader/SimplePageListLoader.vue';
|
|
|
-import { useReqireLogin } from '@/common/composeabe/RequireLogin';
|
|
|
+import Construction from '@/common/components/Construction.vue';
|
|
|
+import VillageApi from '@/api/inhert/VillageApi';
|
|
|
|
|
|
const authStore = useAuthStore();
|
|
|
const { requireLogin } = useReqireLogin();
|
|
|
const villageStore = useVillageStore();
|
|
|
+const { isFollowed, onFollow, onUnFollow } = useFollow();
|
|
|
const villageInfoLoader = useSimpleDataLoader(async () => {
|
|
|
const village = villageStore.currentVillage;
|
|
|
+ console.log(village);
|
|
|
return {
|
|
|
title: village?.name || '',
|
|
|
desc: village?.desc || '',
|
|
|
address: village?.address,
|
|
|
applyCount: village?.applyCount || 0,
|
|
|
+ sizeText: village?.sizeText || 0,
|
|
|
levelText: village?.levelText as string || '',
|
|
|
rankText: village?.rankText as string || '',
|
|
|
light: village?.light as number || 0,
|
|
|
@@ -277,12 +306,6 @@ const villageInfoLoader = useSimpleDataLoader(async () => {
|
|
|
};
|
|
|
});
|
|
|
|
|
|
-watch(() => villageStore.currentVillage, () => {
|
|
|
- villageInfoLoader.reload();
|
|
|
- recommendLoader.reload();
|
|
|
- villageUserRankListLoader.reload();
|
|
|
-}, { immediate: true });
|
|
|
-
|
|
|
const rankActiveTag = ref('乡源果');
|
|
|
const listActiveTag = ref('广场');
|
|
|
|
|
|
@@ -311,46 +334,26 @@ watch(rankActiveTag, () => {
|
|
|
villageUserRankListLoader.reload();
|
|
|
});
|
|
|
|
|
|
-const isFollowed = computed(() => {
|
|
|
- return villageStore.myFollowVillages.some(p => p.id === villageStore.currentVillage?.id);
|
|
|
+const meIsVolunteer = ref(false);
|
|
|
+const myJoinedVillagesLoader = useSimpleDataLoader(async () => {
|
|
|
+ try {
|
|
|
+ try {
|
|
|
+ await VillageApi.getVolunteerInfo();
|
|
|
+ meIsVolunteer.value = true;
|
|
|
+ } catch (error) {
|
|
|
+ meIsVolunteer.value = false;
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ return await VillageApi.getClaimedVallageList();
|
|
|
+ } catch (error) {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
});
|
|
|
+
|
|
|
const isJoined = computed(() => {
|
|
|
- return false;
|
|
|
+ return myJoinedVillagesLoader.content.value?.some(p => p.id === villageStore.currentVillage?.id) ?? false;
|
|
|
});
|
|
|
|
|
|
-async function onFollow() {
|
|
|
- if (!villageStore.currentVillage)
|
|
|
- return;
|
|
|
- requireLogin(async () => {
|
|
|
- try {
|
|
|
- await FollowVillageApi.followVillage(villageStore.currentVillage!.id);
|
|
|
- villageStore.myFollowVillages.push(villageStore.currentVillage!);
|
|
|
- toast('关注成功');
|
|
|
- } catch {
|
|
|
- toast('关注失败');
|
|
|
- }
|
|
|
- }, '登录后才能关注村庄哦');
|
|
|
-}
|
|
|
-function onUnFollow() {
|
|
|
- if (!villageStore.currentVillage) return;
|
|
|
- confirm({
|
|
|
- title: '取消关注',
|
|
|
- content: '确定取消关注该村庄吗?',
|
|
|
- confirmText: '取消关注',
|
|
|
- cancelText: '取消',
|
|
|
- }).then(async (res) => {
|
|
|
- if (res) {
|
|
|
- try {
|
|
|
- await FollowVillageApi.unfollowVillage(villageStore.currentVillage!.id);
|
|
|
- villageStore.myFollowVillages = villageStore.myFollowVillages.filter(p => p.id !== villageStore.currentVillage!.id);
|
|
|
- toast('取消关注成功');
|
|
|
- } catch {
|
|
|
- toast('取消关注失败');
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
const recommendLoader = useSimplePageListLoader(20, async (page, pageSize) => {
|
|
|
return await LightVillageApi.getMessages(page, pageSize, {
|
|
|
villageId: villageStore.currentVillage?.id ?? undefined,
|
|
|
@@ -361,6 +364,18 @@ watch(listActiveTag, () => {
|
|
|
recommendLoader.reload();
|
|
|
});
|
|
|
|
|
|
+function handleGoJoin() {
|
|
|
+ if (isJoined.value)
|
|
|
+ return;
|
|
|
+ navTo('/pages/home/light/submit', {
|
|
|
+ villageId: villageStore.currentVillage?.id ?? undefined,
|
|
|
+ unit: (villageStore.currentVillage?.city as string) + (villageStore.currentVillage?.district as string) + (villageStore.currentVillage?.township as string),
|
|
|
+ regionId: villageStore.currentVillage?.region ?? undefined,
|
|
|
+ });
|
|
|
+}
|
|
|
+function handleGoNew() {
|
|
|
+ navTo('/pages/home/light/help/new');
|
|
|
+}
|
|
|
function handleGoCollect(taskName: string) {
|
|
|
navTo('/pages/dig/forms/task', {
|
|
|
villageId: villageStore.currentVillage?.id ?? undefined,
|
|
|
@@ -391,4 +406,10 @@ function handleGoPost(id: number) {
|
|
|
id: id,
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+watch(() => villageStore.currentVillage, () => {
|
|
|
+ villageInfoLoader.reload();
|
|
|
+ recommendLoader.reload();
|
|
|
+ villageUserRankListLoader.reload();
|
|
|
+}, { immediate: true });
|
|
|
</script>
|