|
|
@@ -1,59 +1,75 @@
|
|
|
<template>
|
|
|
- <FlexCol padding="space.md" gap="space.md">
|
|
|
- <Result v-if="error"
|
|
|
- :title="error"
|
|
|
- />
|
|
|
- <template v-else>
|
|
|
- <FlexRow justify="space-between">
|
|
|
- <SearchBar
|
|
|
- v-model="searchText"
|
|
|
- placeholder="搜一搜"
|
|
|
- :innerStyle="{ width: querys.isView ? '600rpx' : '460rpx' }"
|
|
|
- @search="search"
|
|
|
- />
|
|
|
- <Button v-if="!querys.isView" type="primary" @click="newData">+ 编写</Button>
|
|
|
- </FlexRow>
|
|
|
- <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)"
|
|
|
+ <CommonTopBanner :title="subTitle">
|
|
|
+ <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: querys.isView ? '600rpx' : '460rpx' }"
|
|
|
+ @search="search"
|
|
|
+ />
|
|
|
+ <BackgroundImageButton
|
|
|
+ v-if="!querys.isView"
|
|
|
+ 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>
|
|
|
- </FlexCol>
|
|
|
- <template #empty>
|
|
|
- <Empty v-if="querys.isView" image="search" description="暂无数据,等待志愿者编写中..." />
|
|
|
- <Empty v-else image="search" description="这里还没有数据,快来编写完善吧!">
|
|
|
- <Height :height="40" />
|
|
|
- <Button type="primary" :text="`+ 新增${subTitle}数据`" @click="newData" />
|
|
|
- </Empty>
|
|
|
- </template>
|
|
|
- </SimplePageListLoader>
|
|
|
- </template>
|
|
|
- <XBarSpace />
|
|
|
- </FlexCol>
|
|
|
+ <Text text="+ 编写" />
|
|
|
+ </BackgroundImageButton>
|
|
|
+ </FlexRow>
|
|
|
+ <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">{{ item.title }}</H4>
|
|
|
+ <Text :size="23">{{ item.desc }}</Text>
|
|
|
+ </FlexCol>
|
|
|
+ </Touchable>
|
|
|
+ </BackgroundBox>
|
|
|
+ </FlexCol>
|
|
|
+ <template #empty>
|
|
|
+ <Empty v-if="querys.isView" image="search" description="暂无数据,等待志愿者编写中..." />
|
|
|
+ <Empty v-else image="search" description="这里还没有数据,快来编写完善吧!">
|
|
|
+ <Height :height="40" />
|
|
|
+ <Button type="primary" :text="`+ 新增${subTitle}数据`" @click="newData" />
|
|
|
+ </Empty>
|
|
|
+ </template>
|
|
|
+ </SimplePageListLoader>
|
|
|
+ </template>
|
|
|
+ <XBarSpace />
|
|
|
+ </FlexCol>
|
|
|
+ </CommonTopBanner>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
@@ -83,6 +99,9 @@ import XBarSpace from '@/components/layout/space/XBarSpace.vue';
|
|
|
import Result from '@/components/feedback/Result.vue';
|
|
|
import { CollectableModulesIdMap, getVillageInfoForm } from './forms';
|
|
|
import VillageApi from '@/api/inhert/VillageApi';
|
|
|
+import CommonTopBanner from '@/common/components/CommonTopBanner.vue';
|
|
|
+import BackgroundBox from '@/components/display/block/BackgroundBox.vue';
|
|
|
+import BackgroundImageButton from '@/components/basic/BackgroundImageButton.vue';
|
|
|
|
|
|
const subTitle = ref('');
|
|
|
const searchText = ref('');
|
|
|
@@ -115,7 +134,7 @@ const listLoader = useSimplePageListLoader<{
|
|
|
params.subKey ? params.subId : undefined,
|
|
|
params.subKey,
|
|
|
params.villageId,
|
|
|
- querys.value.isView && authStore.isAdmin && params.villageVolunteerId ? undefined : params.villageVolunteerId,
|
|
|
+ undefined,
|
|
|
querys.value.catalogId,
|
|
|
page,
|
|
|
pageSize,
|
|
|
@@ -166,27 +185,19 @@ function newData() {
|
|
|
});
|
|
|
}
|
|
|
function goDetail(item: { id: number, villageVolunteerId: number }) {
|
|
|
- if (!authStore.isAdmin
|
|
|
- && (!isJoined.value || item.villageVolunteerId !== volunteerInfo.value?.id)
|
|
|
- ) {
|
|
|
+ navTo('common', {
|
|
|
+ id: item.id,
|
|
|
+ villageId: querys.value.villageId,
|
|
|
+ villageVolunteerId: querys.value.villageVolunteerId,
|
|
|
+ catalogId: querys.value.catalogId,
|
|
|
+ collectModuleId: querys.value.collectModuleId,
|
|
|
+ subKey: querys.value.subKey,
|
|
|
+ subId: querys.value.subId,
|
|
|
+ subTitle: querys.value.subTitle,
|
|
|
//非当前村社志愿者或者不是自己提交的文章,只能查看详情
|
|
|
- navTo('/pages/home/discover/details', {
|
|
|
- villageId: querys.value.villageId,
|
|
|
- id: item.id,
|
|
|
- });
|
|
|
- } else {
|
|
|
- navTo('common', {
|
|
|
- id: item.id,
|
|
|
- villageId: querys.value.villageId,
|
|
|
- villageVolunteerId: querys.value.villageVolunteerId,
|
|
|
- catalogId: querys.value.catalogId,
|
|
|
- collectModuleId: querys.value.collectModuleId,
|
|
|
- subKey: querys.value.subKey,
|
|
|
- subId: querys.value.subId,
|
|
|
- subTitle: querys.value.subTitle,
|
|
|
- isView: querys.value.isView,
|
|
|
- });
|
|
|
- }
|
|
|
+ isView: querys.value.isView ? true : (!authStore.isAdmin
|
|
|
+ && (!isJoined.value || item.villageVolunteerId !== volunteerInfo.value?.id) ? true : false),
|
|
|
+ });
|
|
|
}
|
|
|
function search() {
|
|
|
listLoader.reload();
|
|
|
@@ -213,30 +224,10 @@ const { querys } = useLoadQuerys({
|
|
|
//普通用户进入预览模式
|
|
|
await getIsVolunteer();
|
|
|
|
|
|
- const catalogList = (await VillageApi.getCatalogList(
|
|
|
- querys.villageId,
|
|
|
- authStore.isAdmin ? undefined : querys.villageVolunteerId,
|
|
|
- ));
|
|
|
- console.log('catalogList', catalogList, 'find', querys.collectModuleId);
|
|
|
- const catalog = catalogList.find((p) => p.collectModuleId === querys.collectModuleId || p.childlist.find((c) => c.collectModuleId === querys.collectModuleId));
|
|
|
- if (!catalog) {
|
|
|
- error.value = '未找到采集目录';
|
|
|
- return;
|
|
|
- }
|
|
|
try {
|
|
|
const formDefine = getVillageInfoForm(querys.collectModuleId, -1);
|
|
|
- const goForm = [
|
|
|
- querys.collectModuleId,
|
|
|
- catalog.typeId ?? -1,
|
|
|
- formDefine?.[2].typeName,
|
|
|
- querys.collectModuleId === CollectableModulesIdMap['overview'] ? 'common' : undefined,
|
|
|
- catalog.title,
|
|
|
- catalog.id
|
|
|
- ] as TaskMenuDefGoForm;
|
|
|
- querys.subId = goForm[1];
|
|
|
- querys.subKey = goForm[2] || 'type';
|
|
|
- querys.subTitle = goForm[4] || querys.subTitle;
|
|
|
- querys.catalogId = goForm[5] || 0;
|
|
|
+ querys.subId = -1;
|
|
|
+ querys.subKey = formDefine?.[2].typeName || 'type';
|
|
|
querys.villageVolunteerId = volunteerInfo.value?.id || 0;
|
|
|
listLoader.load(false, {
|
|
|
villageId: querys.villageId,
|