|
@@ -1,83 +1,102 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <FlexCol padding="space.md" gap="space.md">
|
|
|
|
|
- <Result v-if="error"
|
|
|
|
|
- :title="error"
|
|
|
|
|
- />
|
|
|
|
|
- <template v-else>
|
|
|
|
|
- <FlexRow justify="space-between" align="center" gap="space.sm">
|
|
|
|
|
- <SearchBar
|
|
|
|
|
- v-model="searchText"
|
|
|
|
|
- placeholder="搜一搜"
|
|
|
|
|
- :innerStyle="{ width: '280rpx' }"
|
|
|
|
|
- @search="search"
|
|
|
|
|
- />
|
|
|
|
|
- <picker @change="handleCatalogChange" :value="currentCatalogIndex" :range="currentCatalogList" range-key="name">
|
|
|
|
|
- <FlexRow align="center" border="primary" radius="radius.md" padding="padding.sm">
|
|
|
|
|
- <Text :text="(currentCatalog?.title || '未选择栏目')" :lines="1" :maxWidth="180" />
|
|
|
|
|
- <Icon icon="arrow-down" :size="40" />
|
|
|
|
|
|
|
+ <CommonTopBanner :title="currentTitle">
|
|
|
|
|
+ <FlexCol padding="space.md" gap="space.md">
|
|
|
|
|
+ <Result v-if="error"
|
|
|
|
|
+ :title="error"
|
|
|
|
|
+ />
|
|
|
|
|
+ <template v-else>
|
|
|
|
|
+ <FlexRow justify="space-between" align="center" gap="space.sm">
|
|
|
|
|
+ <FlexRow align="center" gap="space.sm" backgroundColor="white" radius="50">
|
|
|
|
|
+ <SearchBar
|
|
|
|
|
+ v-model="searchText"
|
|
|
|
|
+ placeholder="搜一搜"
|
|
|
|
|
+ :innerStyle="{ width: '280rpx' }"
|
|
|
|
|
+ @search="search"
|
|
|
|
|
+ />
|
|
|
|
|
+ <picker @change="handleCatalogChange" :value="currentCatalogIndex" :range="currentCatalogList" range-key="name">
|
|
|
|
|
+ <FlexRow center gap="space.md">
|
|
|
|
|
+ <Text :text="(currentCatalog?.title || '未选择栏目')" :lines="1" :maxWidth="180" />
|
|
|
|
|
+ <Icon icon="arrow-down" :size="40" />
|
|
|
|
|
+ </FlexRow>
|
|
|
|
|
+ </picker>
|
|
|
|
|
+ <Width :width="10" />
|
|
|
</FlexRow>
|
|
</FlexRow>
|
|
|
- </picker>
|
|
|
|
|
- <Button type="primary" @click="newData">+ 编写</Button>
|
|
|
|
|
- </FlexRow>
|
|
|
|
|
- <FlexCol
|
|
|
|
|
- v-if="!isJoined"
|
|
|
|
|
- center
|
|
|
|
|
- gap="gap.lg"
|
|
|
|
|
- border="primary"
|
|
|
|
|
- backgroundColor="background.tertiary"
|
|
|
|
|
- radius="radius.md"
|
|
|
|
|
- padding="padding.md"
|
|
|
|
|
- >
|
|
|
|
|
- <Image
|
|
|
|
|
- src="https://xy.wenlvti.net/app_static/images/village/PlaceholderVolunteer.png"
|
|
|
|
|
- mode="widthFix"
|
|
|
|
|
- :width="200"
|
|
|
|
|
- :height="200"
|
|
|
|
|
- />
|
|
|
|
|
- <Text>您还不是当前村社的志愿者</Text>
|
|
|
|
|
- <Text>欢迎注册,加入志愿者队伍,点亮村落</Text>
|
|
|
|
|
- <Button type="primary" @click="goJoin">去点亮村落</Button>
|
|
|
|
|
- </FlexCol>
|
|
|
|
|
- <Height :height="20" />
|
|
|
|
|
- <SimplePageListLoader :loader="listLoader" :noEmpty="true">
|
|
|
|
|
- <FlexCol :gap="20">
|
|
|
|
|
- <Touchable
|
|
|
|
|
- v-for="item in listLoader.list.value"
|
|
|
|
|
- :key="item.id"
|
|
|
|
|
- :gap="20"
|
|
|
|
|
- :padding="[15,20]"
|
|
|
|
|
- radius="radius.md"
|
|
|
|
|
- align="center"
|
|
|
|
|
- backgroundColor="white"
|
|
|
|
|
- direction="row"
|
|
|
|
|
- touchable
|
|
|
|
|
- @click="goDetail(item)"
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <BackgroundImageButton
|
|
|
|
|
+ backgroundImage="https://xy.wenlvti.net/app_static/images/village/ButtonPrimary.png"
|
|
|
|
|
+ :backgroundCutBorder="20"
|
|
|
|
|
+ :backgroundCutBorderSize="20"
|
|
|
|
|
+ :padding="[16, 40]"
|
|
|
|
|
+ @click="newData"
|
|
|
>
|
|
>
|
|
|
- <Image
|
|
|
|
|
- :src="item.image"
|
|
|
|
|
- :showFailed="false"
|
|
|
|
|
- :width="100"
|
|
|
|
|
- :height="100"
|
|
|
|
|
- radius="radius.sm"
|
|
|
|
|
- mode="aspectFill"
|
|
|
|
|
- round
|
|
|
|
|
- />
|
|
|
|
|
- <FlexCol>
|
|
|
|
|
- <H4 :size="36">{{ item.title }}</H4>
|
|
|
|
|
- <Text :size="23">{{ item.desc }}</Text>
|
|
|
|
|
- </FlexCol>
|
|
|
|
|
- </Touchable>
|
|
|
|
|
|
|
+ <Text text="+ 编写" />
|
|
|
|
|
+ </BackgroundImageButton>
|
|
|
|
|
+ </FlexRow>
|
|
|
|
|
+ <FlexCol
|
|
|
|
|
+ v-if="!isJoined"
|
|
|
|
|
+ center
|
|
|
|
|
+ gap="gap.lg"
|
|
|
|
|
+ border="primary"
|
|
|
|
|
+ backgroundColor="background.tertiary"
|
|
|
|
|
+ radius="radius.md"
|
|
|
|
|
+ padding="padding.md"
|
|
|
|
|
+ >
|
|
|
|
|
+ <Image
|
|
|
|
|
+ src="https://xy.wenlvti.net/app_static/images/village/PlaceholderVolunteer.png"
|
|
|
|
|
+ mode="widthFix"
|
|
|
|
|
+ :width="200"
|
|
|
|
|
+ :height="200"
|
|
|
|
|
+ />
|
|
|
|
|
+ <Text>您还不是当前村社的志愿者</Text>
|
|
|
|
|
+ <Text>欢迎注册,加入志愿者队伍,点亮村落</Text>
|
|
|
|
|
+ <Button type="primary" @click="goJoin">去点亮村落</Button>
|
|
|
</FlexCol>
|
|
</FlexCol>
|
|
|
- <template #empty>
|
|
|
|
|
- <Empty image="search" description="这里还没有数据,快来编写完善吧!">
|
|
|
|
|
- <Height :height="40" />
|
|
|
|
|
- <Button type="primary" :text="`+ 新增${subTitle}数据`" @click="newData" />
|
|
|
|
|
- </Empty>
|
|
|
|
|
- </template>
|
|
|
|
|
- </SimplePageListLoader>
|
|
|
|
|
- </template>
|
|
|
|
|
- <XBarSpace />
|
|
|
|
|
- </FlexCol>
|
|
|
|
|
|
|
+ <Height :height="5" />
|
|
|
|
|
+ <SimplePageListLoader :loader="listLoader" :noEmpty="true">
|
|
|
|
|
+ <FlexCol :gap="20">
|
|
|
|
|
+ <BackgroundBox
|
|
|
|
|
+ v-for="item in listLoader.list.value"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ direction="row"
|
|
|
|
|
+ backgroundImage="https://xy.wenlvti.net/app_static/images/village/BoxMid.png"
|
|
|
|
|
+ :backgroundCutBorder="30"
|
|
|
|
|
+ :backgroundCutBorderSize="30"
|
|
|
|
|
+ :padding="[16, 30]"
|
|
|
|
|
+ align="center"
|
|
|
|
|
+ >
|
|
|
|
|
+ <Touchable
|
|
|
|
|
+ :gap="20"
|
|
|
|
|
+ :padding="[15,20]"
|
|
|
|
|
+ touchable
|
|
|
|
|
+ flex="1"
|
|
|
|
|
+ @click="goDetail(item)"
|
|
|
|
|
+ >
|
|
|
|
|
+ <Image
|
|
|
|
|
+ :src="item.image"
|
|
|
|
|
+ :showFailed="false"
|
|
|
|
|
+ :width="100"
|
|
|
|
|
+ :height="100"
|
|
|
|
|
+ radius="radius.sm"
|
|
|
|
|
+ mode="aspectFill"
|
|
|
|
|
+ />
|
|
|
|
|
+ <FlexCol>
|
|
|
|
|
+ <H4 :size="36" fontFamily="SongtiSCBlack">{{ item.title }}</H4>
|
|
|
|
|
+ <Text :size="23">{{ item.desc }}</Text>
|
|
|
|
|
+ </FlexCol>
|
|
|
|
|
+ </Touchable>
|
|
|
|
|
+ </BackgroundBox>
|
|
|
|
|
+ </FlexCol>
|
|
|
|
|
+ <template #empty>
|
|
|
|
|
+ <Empty image="search" description="这里还没有数据,快来编写完善吧!">
|
|
|
|
|
+ <Height :height="40" />
|
|
|
|
|
+ <Button type="primary" :text="`+ 新增${subTitle}数据`" @click="newData" />
|
|
|
|
|
+ </Empty>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </SimplePageListLoader>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <XBarSpace />
|
|
|
|
|
+ </FlexCol>
|
|
|
|
|
+ </CommonTopBanner>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
@@ -92,7 +111,7 @@ import { useUserTools } from '@/common/composeabe/UserTools';
|
|
|
import { navTo } from '@/components/utils/PageAction';
|
|
import { navTo } from '@/components/utils/PageAction';
|
|
|
import { confirm, alert } from '@/components/utils/DialogAction';
|
|
import { confirm, alert } from '@/components/utils/DialogAction';
|
|
|
import SimplePageListLoader from '@/components/loader/SimplePageListLoader.vue';
|
|
import SimplePageListLoader from '@/components/loader/SimplePageListLoader.vue';
|
|
|
-import VillageInfoApi from '@/api/inhert/VillageInfoApi';
|
|
|
|
|
|
|
+import VillageInfoApi, { CommonInfoModel } from '@/api/inhert/VillageInfoApi';
|
|
|
import Image from '@/components/basic/Image.vue';
|
|
import Image from '@/components/basic/Image.vue';
|
|
|
import Empty from '@/components/feedback/Empty.vue';
|
|
import Empty from '@/components/feedback/Empty.vue';
|
|
|
import Button from '@/components/basic/Button.vue';
|
|
import Button from '@/components/basic/Button.vue';
|
|
@@ -108,6 +127,10 @@ import Result from '@/components/feedback/Result.vue';
|
|
|
import { CollectableModulesIdMap, getVillageInfoForm } from './forms';
|
|
import { CollectableModulesIdMap, getVillageInfoForm } from './forms';
|
|
|
import VillageApi, { type VillageCatalogListItem } from '@/api/inhert/VillageApi';
|
|
import VillageApi, { type VillageCatalogListItem } from '@/api/inhert/VillageApi';
|
|
|
import Icon from '@/components/basic/Icon.vue';
|
|
import Icon from '@/components/basic/Icon.vue';
|
|
|
|
|
+import CommonTopBanner from '@/common/components/CommonTopBanner.vue';
|
|
|
|
|
+import BackgroundBox from '@/components/display/block/BackgroundBox.vue';
|
|
|
|
|
+import BackgroundImageButton from '@/components/basic/BackgroundImageButton.vue';
|
|
|
|
|
+import Width from '@/components/layout/space/Width.vue';
|
|
|
|
|
|
|
|
const subTitle = ref('');
|
|
const subTitle = ref('');
|
|
|
const searchText = ref('');
|
|
const searchText = ref('');
|
|
@@ -135,16 +158,35 @@ const listLoader = useSimplePageListLoader<{
|
|
|
throw new Error("params.collectModuleId");
|
|
throw new Error("params.collectModuleId");
|
|
|
if (!params.villageId)
|
|
if (!params.villageId)
|
|
|
throw new Error("params.villageId");
|
|
throw new Error("params.villageId");
|
|
|
- let res = await VillageInfoApi.getList(
|
|
|
|
|
- params.collectModuleId,
|
|
|
|
|
- params.subKey ? params.subId : undefined,
|
|
|
|
|
- params.subKey,
|
|
|
|
|
- params.villageId,
|
|
|
|
|
- authStore.isAdmin && params.villageVolunteerId ? undefined : params.villageVolunteerId,
|
|
|
|
|
- currentCatalog.value?.id || 0,
|
|
|
|
|
- page,
|
|
|
|
|
- pageSize,
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ let res = [] as CommonInfoModel[];
|
|
|
|
|
+
|
|
|
|
|
+ if (params.collectModuleId === CollectableModulesIdMap['overview']) {
|
|
|
|
|
+ //村社概览特殊处理
|
|
|
|
|
+ const info = await VillageInfoApi.getInfoByVillageId(params.villageId);
|
|
|
|
|
+ const overviewId = info.myOverviewId || info.overviewId;
|
|
|
|
|
+ if (overviewId) {
|
|
|
|
|
+ res = [
|
|
|
|
|
+ new CommonInfoModel().setSelfValues({
|
|
|
|
|
+ id: info.myOverviewId || info.overviewId || 0,
|
|
|
|
|
+ title: info.title,
|
|
|
|
|
+ image: info.image,
|
|
|
|
|
+ villageVolunteerId: params.villageVolunteerId,
|
|
|
|
|
+ }),
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ res = await VillageInfoApi.getList(
|
|
|
|
|
+ params.collectModuleId,
|
|
|
|
|
+ params.subKey ? params.subId : undefined,
|
|
|
|
|
+ params.subKey,
|
|
|
|
|
+ params.villageId,
|
|
|
|
|
+ authStore.isAdmin && params.villageVolunteerId ? undefined : params.villageVolunteerId,
|
|
|
|
|
+ currentCatalog.value?.id || 0,
|
|
|
|
|
+ page,
|
|
|
|
|
+ pageSize,
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (searchText.value)
|
|
if (searchText.value)
|
|
|
res = res.filter((p) => p.title.includes(searchText.value));
|
|
res = res.filter((p) => p.title.includes(searchText.value));
|
|
|
const list = res.map((item) => {
|
|
const list = res.map((item) => {
|
|
@@ -187,24 +229,44 @@ function newData() {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
function goDetail(item: { id: number, villageVolunteerId: number }) {
|
|
function goDetail(item: { id: number, villageVolunteerId: number }) {
|
|
|
|
|
+
|
|
|
|
|
+ let goToFormDisplay = false;
|
|
|
|
|
+ let canEdit = false;
|
|
|
|
|
+
|
|
|
if (!authStore.isAdmin
|
|
if (!authStore.isAdmin
|
|
|
&& (!isJoined.value || item.villageVolunteerId !== volunteerInfo.value?.id)
|
|
&& (!isJoined.value || item.villageVolunteerId !== volunteerInfo.value?.id)
|
|
|
) {
|
|
) {
|
|
|
//非当前村社志愿者或者不是自己提交的文章,只能查看详情
|
|
//非当前村社志愿者或者不是自己提交的文章,只能查看详情
|
|
|
- navTo('/pages/home/discover/details', {
|
|
|
|
|
- villageId: querys.value.villageId,
|
|
|
|
|
- id: item.id,
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ //村社概览表单特殊处理
|
|
|
|
|
+ if ([
|
|
|
|
|
+ CollectableModulesIdMap['overview'],
|
|
|
|
|
+ CollectableModulesIdMap['environment'],
|
|
|
|
|
+ CollectableModulesIdMap['distribution'],
|
|
|
|
|
+ CollectableModulesIdMap['ich'],
|
|
|
|
|
+ CollectableModulesIdMap['relic'],
|
|
|
|
|
+ CollectableModulesIdMap['folkCulture'],
|
|
|
|
|
+ CollectableModulesIdMap['building'],
|
|
|
|
|
+ ].includes(currentLoadData.value.collectModuleId)) {
|
|
|
|
|
+ goToFormDisplay = true;
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
- navTo('common', {
|
|
|
|
|
|
|
+ goToFormDisplay = true;
|
|
|
|
|
+ canEdit = true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (goToFormDisplay) {
|
|
|
|
|
+ navTo('common', {
|
|
|
id: item.id,
|
|
id: item.id,
|
|
|
villageId: querys.value.villageId,
|
|
villageId: querys.value.villageId,
|
|
|
villageVolunteerId: querys.value.villageVolunteerId,
|
|
villageVolunteerId: querys.value.villageVolunteerId,
|
|
|
catalogId: currentCatalog.value?.id || 0,
|
|
catalogId: currentCatalog.value?.id || 0,
|
|
|
collectModuleId: currentLoadData.value.collectModuleId,
|
|
collectModuleId: currentLoadData.value.collectModuleId,
|
|
|
- subKey: currentLoadData.value.subKey,
|
|
|
|
|
- subId: currentLoadData.value.subId,
|
|
|
|
|
- subTitle: currentLoadData.value.subTitle,
|
|
|
|
|
|
|
+ isView: !canEdit,
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ navTo('/pages/home/discover/details', {
|
|
|
|
|
+ villageId: querys.value.villageId,
|
|
|
|
|
+ id: item.id,
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -217,6 +279,7 @@ function goJoin() {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const currentTitle = ref('');
|
|
|
const catalogs = ref<VillageCatalogListItem[]>([]);
|
|
const catalogs = ref<VillageCatalogListItem[]>([]);
|
|
|
const currentCatalogIndex = ref(0);
|
|
const currentCatalogIndex = ref(0);
|
|
|
const currentCatalogList = computed(() => {
|
|
const currentCatalogList = computed(() => {
|
|
@@ -238,8 +301,7 @@ const currentLoadData = ref({
|
|
|
|
|
|
|
|
function handleCatalogChange(e: any) {
|
|
function handleCatalogChange(e: any) {
|
|
|
currentCatalogIndex.value = e.detail.value;
|
|
currentCatalogIndex.value = e.detail.value;
|
|
|
- currentCatalog.value = catalogs.value[currentCatalogIndex.value];
|
|
|
|
|
- loadListCatalog(currentCatalog.value as VillageCatalogListItem);
|
|
|
|
|
|
|
+ loadListCatalog(catalogs.value[currentCatalogIndex.value] as VillageCatalogListItem);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function loadListCatalog(catalog: VillageCatalogListItem) {
|
|
function loadListCatalog(catalog: VillageCatalogListItem) {
|
|
@@ -267,7 +329,8 @@ function loadListCatalog(catalog: VillageCatalogListItem) {
|
|
|
villageId: querys.value.villageId,
|
|
villageId: querys.value.villageId,
|
|
|
villageVolunteerId: volunteerInfo.value?.id || 0,
|
|
villageVolunteerId: volunteerInfo.value?.id || 0,
|
|
|
}
|
|
}
|
|
|
- } catch {
|
|
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.error(e);
|
|
|
error.value = '任务不存在';
|
|
error.value = '任务不存在';
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -280,12 +343,10 @@ const { querys } = useLoadQuerys({
|
|
|
villageVolunteerId: 0,
|
|
villageVolunteerId: 0,
|
|
|
title: '',
|
|
title: '',
|
|
|
}, async (querys) => {
|
|
}, async (querys) => {
|
|
|
- isJoined.value = await getIsJoinedVillage(querys.villageId);
|
|
|
|
|
-
|
|
|
|
|
//普通用户进入预览模式
|
|
//普通用户进入预览模式
|
|
|
await getIsVolunteer();
|
|
await getIsVolunteer();
|
|
|
|
|
+ isJoined.value = await getIsJoinedVillage(querys.villageId);
|
|
|
|
|
|
|
|
- const catalogList = [] as VillageCatalogListItem[];
|
|
|
|
|
function pushCatalogWithCurrentCatalog(catalog: VillageCatalogListItem) {
|
|
function pushCatalogWithCurrentCatalog(catalog: VillageCatalogListItem) {
|
|
|
if (catalog.collectModuleId === querys.collectModuleId) {
|
|
if (catalog.collectModuleId === querys.collectModuleId) {
|
|
|
catalogs.value.push(catalog);
|
|
catalogs.value.push(catalog);
|
|
@@ -302,14 +363,12 @@ const { querys } = useLoadQuerys({
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
if (catalogs.value.length === 0) {
|
|
if (catalogs.value.length === 0) {
|
|
|
- error.value = '未找到指定的采集目录';
|
|
|
|
|
|
|
+ error.value = `本村暂未开通此栏目 (${querys.collectModuleId})`;
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
loadListCatalog(catalogs.value[0] as VillageCatalogListItem);
|
|
loadListCatalog(catalogs.value[0] as VillageCatalogListItem);
|
|
|
|
|
|
|
|
- if (querys.title) {
|
|
|
|
|
- uni.setNavigationBarTitle({ title: querys.title, })
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ currentTitle.value = querys.title || '共编村史';
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
onPullDownRefresh(() => {
|
|
onPullDownRefresh(() => {
|