|
@@ -1,9 +1,19 @@
|
|
|
<template>
|
|
<template>
|
|
|
<CommonTopBanner title="搜索">
|
|
<CommonTopBanner title="搜索">
|
|
|
<FlexCol padding="padding.md">
|
|
<FlexCol padding="padding.md">
|
|
|
- <SimplePageListLoader :loader="listLoader">
|
|
|
|
|
|
|
+ <SearchBar
|
|
|
|
|
+ v-model="searchKeywords"
|
|
|
|
|
+ leftIcon=""
|
|
|
|
|
+ searchState="show"
|
|
|
|
|
+ cancelState="hidden"
|
|
|
|
|
+ placeholder="搜索村社"
|
|
|
|
|
+ @search="listLoader.reload()"
|
|
|
|
|
+ />
|
|
|
|
|
+ <Height :height="20" />
|
|
|
|
|
+ <SimplePageListLoader :loader="listLoader" :emptyView="{
|
|
|
|
|
+ text: searchKeywords ? '暂无搜索结果,换个关键词试试吧!' : '请输入搜索关键词搜索村社',
|
|
|
|
|
+ }">
|
|
|
<FlexCol gap="gap.md">
|
|
<FlexCol gap="gap.md">
|
|
|
- <Empty v-if="listLoader.list.value.length === 0" description="暂无搜索结果,换个关键词试试吧" />
|
|
|
|
|
<FlexRow
|
|
<FlexRow
|
|
|
v-for="(item, i) in listLoader.list.value"
|
|
v-for="(item, i) in listLoader.list.value"
|
|
|
:key="i"
|
|
:key="i"
|
|
@@ -11,16 +21,17 @@
|
|
|
>
|
|
>
|
|
|
<ImageBlock3
|
|
<ImageBlock3
|
|
|
backgroundColor="transparent"
|
|
backgroundColor="transparent"
|
|
|
- :src="item.image"
|
|
|
|
|
|
|
+ :src="(item.image as '')"
|
|
|
defaultImage="https://xy.wenlvti.net/app_static/images/village/PlaceholderVillage.jpg"
|
|
defaultImage="https://xy.wenlvti.net/app_static/images/village/PlaceholderVillage.jpg"
|
|
|
:title="item.name"
|
|
:title="item.name"
|
|
|
- :desc="item.address"
|
|
|
|
|
|
|
+ :desc="item.mergerName || ''"
|
|
|
:imageRadius="15"
|
|
:imageRadius="15"
|
|
|
:imageWidth="200"
|
|
:imageWidth="200"
|
|
|
:imageHeight="140"
|
|
:imageHeight="140"
|
|
|
- @click="onGoDetails(item as VillageListItem)"
|
|
|
|
|
|
|
+ @click="onGoDetails(item)"
|
|
|
/>
|
|
/>
|
|
|
<FlexRow justify="flex-end" align="center" gap="gap.md" width="200rpx">
|
|
<FlexRow justify="flex-end" align="center" gap="gap.md" width="200rpx">
|
|
|
|
|
+ <Tag :text="item.isLight ? '已点亮' : '未点亮'" size="small" />
|
|
|
<Tag v-if="item.isFollow" text="已关注" size="small" />
|
|
<Tag v-if="item.isFollow" text="已关注" size="small" />
|
|
|
<Tag v-if="item.isJoined" text="已加入" size="small" type="primary" />
|
|
<Tag v-if="item.isJoined" text="已加入" size="small" type="primary" />
|
|
|
</FlexRow>
|
|
</FlexRow>
|
|
@@ -34,34 +45,54 @@
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import { useSimplePageListLoader } from '@/components/composeabe/loader/SimplePageListLoader';
|
|
import { useSimplePageListLoader } from '@/components/composeabe/loader/SimplePageListLoader';
|
|
|
import { useLoadQuerys } from '@/components/composeabe/LoadQuerys';
|
|
import { useLoadQuerys } from '@/components/composeabe/LoadQuerys';
|
|
|
|
|
+import { backAndCallOnPageBack, navTo } from '@/components/utils/PageAction';
|
|
|
import FlexCol from '@/components/layout/FlexCol.vue';
|
|
import FlexCol from '@/components/layout/FlexCol.vue';
|
|
|
import ImageBlock3 from '@/components/display/block/ImageBlock3.vue';
|
|
import ImageBlock3 from '@/components/display/block/ImageBlock3.vue';
|
|
|
-import LightVillageApi, { type VillageListItem } from '@/api/light/LightVillageApi';
|
|
|
|
|
|
|
+import LightVillageApi, { type VillageMapItem } from '@/api/light/LightVillageApi';
|
|
|
import SimplePageListLoader from '@/components/loader/SimplePageListLoader.vue';
|
|
import SimplePageListLoader from '@/components/loader/SimplePageListLoader.vue';
|
|
|
-import Empty from '@/components/feedback/Empty.vue';
|
|
|
|
|
import Tag from '@/components/display/Tag.vue';
|
|
import Tag from '@/components/display/Tag.vue';
|
|
|
import FlexRow from '@/components/layout/FlexRow.vue';
|
|
import FlexRow from '@/components/layout/FlexRow.vue';
|
|
|
import CommonTopBanner from '@/common/components/CommonTopBanner.vue';
|
|
import CommonTopBanner from '@/common/components/CommonTopBanner.vue';
|
|
|
-import { backAndCallOnPageBack } from '@/components/utils/PageAction';
|
|
|
|
|
|
|
+import SearchBar from '@/components/form/SearchBar.vue';
|
|
|
|
|
+import { ref } from 'vue';
|
|
|
|
|
+import Height from '@/components/layout/space/Height.vue';
|
|
|
|
|
|
|
|
const { querys } = useLoadQuerys({
|
|
const { querys } = useLoadQuerys({
|
|
|
searchValue: '',
|
|
searchValue: '',
|
|
|
cityCode: 0,
|
|
cityCode: 0,
|
|
|
}, () => {
|
|
}, () => {
|
|
|
|
|
+ searchKeywords.value = querys.value.searchValue;
|
|
|
listLoader.load();
|
|
listLoader.load();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+const searchKeywords = ref('');
|
|
|
|
|
+
|
|
|
const listLoader = useSimplePageListLoader(16, async (page, pageSize) => {
|
|
const listLoader = useSimplePageListLoader(16, async (page, pageSize) => {
|
|
|
- return await LightVillageApi.getVillageList({
|
|
|
|
|
- keyword: querys.value.searchValue,
|
|
|
|
|
- //areaCode: querys.value.cityCode,
|
|
|
|
|
- page,
|
|
|
|
|
- pageSize,
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ if (!searchKeywords.value)
|
|
|
|
|
+ return {
|
|
|
|
|
+ total: 0,
|
|
|
|
|
+ list: [],
|
|
|
|
|
+ };
|
|
|
|
|
+ const list = (await LightVillageApi.getMapVillage({
|
|
|
|
|
+ keywords: searchKeywords.value,
|
|
|
|
|
+ }));
|
|
|
|
|
+ return {
|
|
|
|
|
+ total: list.length,
|
|
|
|
|
+ list,
|
|
|
|
|
+ }
|
|
|
}, false);
|
|
}, false);
|
|
|
|
|
|
|
|
-function onGoDetails(item: VillageListItem) {
|
|
|
|
|
- backAndCallOnPageBack('goVillage', { id: item.id });
|
|
|
|
|
|
|
+function onGoDetails(item: VillageMapItem) {
|
|
|
|
|
+ if (!item.villageId)
|
|
|
|
|
+ navTo('/pages/home/light/create-village', {
|
|
|
|
|
+ villageName: item.name,
|
|
|
|
|
+ mergerName: item.mergerName || '',
|
|
|
|
|
+ areaCode: item.areaCode,
|
|
|
|
|
+ longitude: item.longitude,
|
|
|
|
|
+ latitude: item.latitude,
|
|
|
|
|
+ });
|
|
|
|
|
+ else
|
|
|
|
|
+ backAndCallOnPageBack('goVillage', { id: item.villageId });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|