|
|
@@ -10,10 +10,15 @@
|
|
|
<SearchBar
|
|
|
v-model="searchText"
|
|
|
placeholder="搜一搜"
|
|
|
- :innerStyle="{ width: '200rpx' }"
|
|
|
+ :innerStyle="{ width: currentCatalogList.length > 0 ? '200rpx' : '400rpx' }"
|
|
|
@search="search"
|
|
|
/>
|
|
|
- <picker @change="handleCatalogChange" :value="currentCatalogIndex" :range="currentCatalogList" range-key="name">
|
|
|
+ <picker
|
|
|
+ v-if="currentCatalogList.length > 0"
|
|
|
+ @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" />
|
|
|
@@ -67,10 +72,7 @@
|
|
|
</BackgroundBox>
|
|
|
</FlexCol>
|
|
|
<template #empty>
|
|
|
- <Empty image="search" description="这里还没有数据,快来编写完善吧!">
|
|
|
- <Height :height="40" />
|
|
|
- <Button type="primary" :text="`+ 新增${subTitle}数据`" @click="newData" />
|
|
|
- </Empty>
|
|
|
+ <Empty image="search" description="这里还没有数据,快来编写完善吧!" />
|
|
|
</template>
|
|
|
</SimplePageListLoader>
|
|
|
</template>
|
|
|
@@ -129,7 +131,6 @@ const listLoader = useSimplePageListLoader<{
|
|
|
villageVolunteerId: number,
|
|
|
}, {
|
|
|
villageId: number,
|
|
|
- villageVolunteerId: number,
|
|
|
collectModuleId: number,
|
|
|
subId: number,
|
|
|
subKey: string,
|
|
|
@@ -141,36 +142,37 @@ const listLoader = useSimplePageListLoader<{
|
|
|
if (!params.villageId)
|
|
|
throw new Error("params.villageId");
|
|
|
let res = [] as CommonInfoModel[];
|
|
|
+ let total = 0;
|
|
|
|
|
|
if (params.collectModuleId === CollectableModulesIdMap['overview']) {
|
|
|
//村社概览特殊处理
|
|
|
const info = await VillageInfoApi.getInfoByVillageId(params.villageId);
|
|
|
const overviewId = info.myOverviewId || info.overviewId;
|
|
|
if (overviewId) {
|
|
|
- res = [
|
|
|
+ res = page === 1 ? [
|
|
|
new CommonInfoModel().setSelfValues({
|
|
|
id: info.myOverviewId || info.overviewId || 0,
|
|
|
title: info.title,
|
|
|
image: info.image,
|
|
|
- villageVolunteerId: params.villageVolunteerId,
|
|
|
+ villageVolunteerId: volunteerInfo.value?.id || 0,
|
|
|
}),
|
|
|
- ];
|
|
|
+ ] : [];
|
|
|
+ total = 1;
|
|
|
}
|
|
|
} else {
|
|
|
- res = await VillageInfoApi.getList(
|
|
|
- params.collectModuleId,
|
|
|
- params.subKey ? params.subId : undefined,
|
|
|
- params.subKey,
|
|
|
- params.villageId,
|
|
|
- undefined,
|
|
|
- currentCatalog.value?.id || 0,
|
|
|
+ const info = (await VillageInfoApi.getList({
|
|
|
+ collectModuleId: params.collectModuleId,
|
|
|
+ subId: params.subKey ? params.subId : undefined,
|
|
|
+ subKey: params.subKey,
|
|
|
+ villageId: params.villageId,
|
|
|
+ catalogId: currentCatalog.value?.id || 0,
|
|
|
page,
|
|
|
pageSize,
|
|
|
- )
|
|
|
+ keywords: searchText.value,
|
|
|
+ }));
|
|
|
+ res = info.list;
|
|
|
+ total = info.total;
|
|
|
}
|
|
|
-
|
|
|
- if (searchText.value)
|
|
|
- res = res.filter((p) => p.title.includes(searchText.value));
|
|
|
const list = res.map((item) => {
|
|
|
return {
|
|
|
id: item.id,
|
|
|
@@ -184,7 +186,7 @@ const listLoader = useSimplePageListLoader<{
|
|
|
})
|
|
|
return {
|
|
|
list: list,
|
|
|
- total: list.length,
|
|
|
+ total: total,
|
|
|
};
|
|
|
}, false);
|
|
|
|
|
|
@@ -193,7 +195,7 @@ function newData() {
|
|
|
confirm({
|
|
|
title: '提示',
|
|
|
content: "您还不是当前村社的志愿者,请先加入志愿者队伍",
|
|
|
- confirmText: '去点亮',
|
|
|
+ confirmText: '去加入',
|
|
|
}).then((res) => {
|
|
|
if (res) {
|
|
|
goJoin();
|
|
|
@@ -204,7 +206,7 @@ function newData() {
|
|
|
navTo('common', {
|
|
|
id: -1,
|
|
|
villageId: querys.value.villageId,
|
|
|
- villageVolunteerId: querys.value.villageVolunteerId,
|
|
|
+ villageVolunteerId: volunteerInfo.value?.id || 0,
|
|
|
catalogId: currentCatalog.value?.id || 0,
|
|
|
collectModuleId: currentLoadData.value.collectModuleId,
|
|
|
subId: currentLoadData.value.subId,
|
|
|
@@ -242,7 +244,7 @@ function goDetail(item: { id: number, villageVolunteerId: number }) {
|
|
|
navTo('common', {
|
|
|
id: item.id,
|
|
|
villageId: querys.value.villageId,
|
|
|
- villageVolunteerId: querys.value.villageVolunteerId,
|
|
|
+ villageVolunteerId: volunteerInfo.value?.id || 0,
|
|
|
catalogId: currentCatalog.value?.id || 0,
|
|
|
collectModuleId: currentLoadData.value.collectModuleId,
|
|
|
isView: !canEdit,
|
|
|
@@ -322,11 +324,38 @@ function loadListCatalog(catalog: VillageCatalogListItem) {
|
|
|
}
|
|
|
listLoader.load(true, currentLoadData.value)
|
|
|
}
|
|
|
+function loadListNoCatalog() {
|
|
|
+ try {
|
|
|
+ const formDefine = getVillageInfoForm(querys.value.collectModuleId, -1);
|
|
|
+ const goForm = [
|
|
|
+ querys.value.collectModuleId,
|
|
|
+ -1,
|
|
|
+ formDefine?.[2].typeName,
|
|
|
+ querys.value.collectModuleId === CollectableModulesIdMap['overview'] ? 'common' : undefined,
|
|
|
+ querys.value.title,
|
|
|
+ undefined,
|
|
|
+ ] as TaskMenuDefGoForm;
|
|
|
+
|
|
|
+ currentLoadData.value = {
|
|
|
+ collectModuleId: querys.value.collectModuleId,
|
|
|
+ subId: goForm[1],
|
|
|
+ subKey: goForm[2] || 'type',
|
|
|
+ subTitle: goForm[4] || querys.value.title,
|
|
|
+ catalogId: goForm[5] || 0,
|
|
|
+ villageId: querys.value.villageId,
|
|
|
+ villageVolunteerId: volunteerInfo.value?.id || 0,
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.error(e);
|
|
|
+ error.value = '任务不存在';
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ listLoader.load(true, currentLoadData.value)
|
|
|
+}
|
|
|
|
|
|
const { querys } = useLoadQuerys({
|
|
|
collectModuleId: 0,
|
|
|
villageId: 0,
|
|
|
- villageVolunteerId: 0,
|
|
|
title: '',
|
|
|
}, async (querys) => {
|
|
|
//普通用户进入预览模式
|
|
|
@@ -343,17 +372,16 @@ const { querys } = useLoadQuerys({
|
|
|
}
|
|
|
(await VillageApi.getCatalogList(
|
|
|
querys.villageId,
|
|
|
- authStore.isAdmin ? undefined : querys.villageVolunteerId,
|
|
|
+ authStore.isAdmin ? undefined : volunteerInfo.value?.id || 0,
|
|
|
)).forEach((catalog) => {
|
|
|
pushCatalogWithCurrentCatalog(catalog);
|
|
|
});
|
|
|
|
|
|
if (catalogs.value.length === 0) {
|
|
|
- error.value = `本村暂未开通此栏目 (${querys.collectModuleId})`;
|
|
|
- return;
|
|
|
+ loadListNoCatalog();
|
|
|
+ } else {
|
|
|
+ loadListCatalog(catalogs.value[0] as VillageCatalogListItem);
|
|
|
}
|
|
|
- loadListCatalog(catalogs.value[0] as VillageCatalogListItem);
|
|
|
-
|
|
|
currentTitle.value = querys.title || '共编村史';
|
|
|
});
|
|
|
|