|
@@ -15,6 +15,29 @@
|
|
|
@pickEnd="handlePickEnd"
|
|
@pickEnd="handlePickEnd"
|
|
|
/>
|
|
/>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
+ <template v-else-if="step === 'selectVillage'">
|
|
|
|
|
+ <FlexCol gap="gap.md" padding="padding.md" width="600rpx">
|
|
|
|
|
+ <BoxMid>
|
|
|
|
|
+ <Touchable direction="row" gap="gap.md"center @click="handleSkipSearch()">
|
|
|
|
|
+ <Image src="https://xy.wenlvti.net/app_static/images/home/volunteer/IconFollows.png" :radius="20" width="70" height="70" mode="aspectFill" />
|
|
|
|
|
+ <Text text="以下没有我的家乡" fontConfig="lightGoldTitle" />
|
|
|
|
|
+ </Touchable>
|
|
|
|
|
+ </BoxMid>
|
|
|
|
|
+ <BoxMid
|
|
|
|
|
+ v-for="(item, k) in searchedList"
|
|
|
|
|
+ :key="k"
|
|
|
|
|
+ justify="flex-start"
|
|
|
|
|
+ >
|
|
|
|
|
+ <Touchable direction="row" gap="gap.md"center @click="handleChooseSearchedVillage(item as VillageListItem)">
|
|
|
|
|
+ <Image :src="item.image" :radius="20" width="70" height="70" mode="aspectFill" />
|
|
|
|
|
+ <FlexCol gap="gap.md">
|
|
|
|
|
+ <Text :text="item.name" fontConfig="lightGoldTitle" />
|
|
|
|
|
+ <Text :text="item.address" fontConfig="secondText" />
|
|
|
|
|
+ </FlexCol>
|
|
|
|
|
+ </Touchable>
|
|
|
|
|
+ </BoxMid>
|
|
|
|
|
+ </FlexCol>
|
|
|
|
|
+ </template>
|
|
|
<template v-else-if="step === 'inputInfo'">
|
|
<template v-else-if="step === 'inputInfo'">
|
|
|
<Field v-model="currentVillageName" placeholder="请输入家乡名称,例如:大庆村" />
|
|
<Field v-model="currentVillageName" placeholder="请输入家乡名称,例如:大庆村" />
|
|
|
<Field
|
|
<Field
|
|
@@ -74,31 +97,6 @@
|
|
|
</template>
|
|
</template>
|
|
|
</FlexCol>
|
|
</FlexCol>
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- <CommonDialog v-model:show="showSearchedList" title="您要找的是不是以下村社?" :showDivider="false">
|
|
|
|
|
- <FlexCol gap="gap.md" padding="padding.md" width="600rpx">
|
|
|
|
|
- <BoxMid>
|
|
|
|
|
- <Touchable direction="row" gap="gap.md"center @click="handleConfirm(true)">
|
|
|
|
|
- <Image src="https://xy.wenlvti.net/app_static/images/home/volunteer/IconFollows.png" :radius="20" width="70" height="70" mode="aspectFill" />
|
|
|
|
|
- <Text text="以下没有我的家乡" fontConfig="lightGoldTitle" />
|
|
|
|
|
- </Touchable>
|
|
|
|
|
- </BoxMid>
|
|
|
|
|
- <BoxMid
|
|
|
|
|
- v-for="(item, k) in searchedList"
|
|
|
|
|
- :key="k"
|
|
|
|
|
- justify="flex-start"
|
|
|
|
|
- >
|
|
|
|
|
- <Touchable direction="row" gap="gap.md"center @click="handleChooseSearchedVillage(item as VillageListItem)">
|
|
|
|
|
- <Image :src="item.image" :radius="20" width="70" height="70" mode="aspectFill" />
|
|
|
|
|
- <FlexCol gap="gap.md">
|
|
|
|
|
- <Text :text="item.name" fontConfig="lightGoldTitle" />
|
|
|
|
|
- <Text :text="item.address" fontConfig="secondText" />
|
|
|
|
|
- </FlexCol>
|
|
|
|
|
- </Touchable>
|
|
|
|
|
- </BoxMid>
|
|
|
|
|
- </FlexCol>
|
|
|
|
|
- </CommonDialog>
|
|
|
|
|
-
|
|
|
|
|
</CommonTopBanner>
|
|
</CommonTopBanner>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -121,7 +119,6 @@ import Field from '@/components/form/Field.vue';
|
|
|
import LightVillageApi, { type VillageListItem } from '@/api/light/LightVillageApi';
|
|
import LightVillageApi, { type VillageListItem } from '@/api/light/LightVillageApi';
|
|
|
import RadioGroup from '@/components/form/RadioGroup.vue';
|
|
import RadioGroup from '@/components/form/RadioGroup.vue';
|
|
|
import Radio from '@/components/form/Radio.vue';
|
|
import Radio from '@/components/form/Radio.vue';
|
|
|
-import CommonDialog from '@/common/components/CommonDialog.vue';
|
|
|
|
|
import BoxMid from '@/common/components/box/BoxMid.vue';
|
|
import BoxMid from '@/common/components/box/BoxMid.vue';
|
|
|
import Touchable from '@/components/feedback/Touchable.vue';
|
|
import Touchable from '@/components/feedback/Touchable.vue';
|
|
|
import Image from '@/components/basic/Image.vue';
|
|
import Image from '@/components/basic/Image.vue';
|
|
@@ -162,7 +159,7 @@ const { querys } = useLoadQuerys({
|
|
|
|
|
|
|
|
const mapCtx = uni.createMapContext('prevMap');
|
|
const mapCtx = uni.createMapContext('prevMap');
|
|
|
|
|
|
|
|
-const step = ref<'selectArea'|'inputInfo'>('selectArea');
|
|
|
|
|
|
|
+const step = ref<'selectArea'|'selectVillage'|'inputInfo'>('selectArea');
|
|
|
const currentFromPreData = ref(false);
|
|
const currentFromPreData = ref(false);
|
|
|
const currentLonLat = ref({ longitude: 0, latitude: 0 });
|
|
const currentLonLat = ref({ longitude: 0, latitude: 0 });
|
|
|
const currentVillageName = ref('')
|
|
const currentVillageName = ref('')
|
|
@@ -170,9 +167,7 @@ const currentVillageDesc = ref('')
|
|
|
const currentVillageType = ref<number>(95);
|
|
const currentVillageType = ref<number>(95);
|
|
|
const currentAreaCode = ref(0);
|
|
const currentAreaCode = ref(0);
|
|
|
|
|
|
|
|
-const showSearchedList = ref(false);
|
|
|
|
|
const searchedList = ref<VillageListItem[]>([]);
|
|
const searchedList = ref<VillageListItem[]>([]);
|
|
|
-
|
|
|
|
|
const enableSatellite = ref(false);
|
|
const enableSatellite = ref(false);
|
|
|
const selectedValue = ref<(string | number)[]>([]);
|
|
const selectedValue = ref<(string | number)[]>([]);
|
|
|
const provinceList = ref<CascaderItem[]>([]);
|
|
const provinceList = ref<CascaderItem[]>([]);
|
|
@@ -231,7 +226,17 @@ async function handlePickEnd(values: CascaderItem[]) {
|
|
|
longitude: Number(currentLonLat.value.longitude),
|
|
longitude: Number(currentLonLat.value.longitude),
|
|
|
latitude: Number(currentLonLat.value.latitude),
|
|
latitude: Number(currentLonLat.value.latitude),
|
|
|
});
|
|
});
|
|
|
- step.value = 'inputInfo';
|
|
|
|
|
|
|
+ uni.showLoading();
|
|
|
|
|
+ step.value = 'selectVillage';
|
|
|
|
|
+ const searchRes = (await LightVillageApi.getVillageList({
|
|
|
|
|
+ areaCode: currentAreaCode.value,
|
|
|
|
|
+ page: 1,
|
|
|
|
|
+ pageSize: 10
|
|
|
|
|
+ })).list;
|
|
|
|
|
+ if (searchRes.length > 0) {
|
|
|
|
|
+ uni.hideLoading();
|
|
|
|
|
+ searchedList.value = searchRes;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
function handleRegionchange(e: any) {
|
|
function handleRegionchange(e: any) {
|
|
@@ -242,30 +247,17 @@ function handleRegionchange(e: any) {
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-async function handleConfirm(skipSearch?: boolean) {
|
|
|
|
|
|
|
+function handleSkipSearch() {
|
|
|
|
|
+ step.value = 'inputInfo';
|
|
|
|
|
+}
|
|
|
|
|
+async function handleConfirm() {
|
|
|
if (!currentVillageName.value) {
|
|
if (!currentVillageName.value) {
|
|
|
toast('请输入家乡名称');
|
|
toast('请输入家乡名称');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
uni.showLoading();
|
|
uni.showLoading();
|
|
|
try {
|
|
try {
|
|
|
- //先尝试搜索已有村社
|
|
|
|
|
- if (!skipSearch) {
|
|
|
|
|
- const searchRes = (await LightVillageApi.getVillageList({
|
|
|
|
|
- areaCode: currentAreaCode.value,
|
|
|
|
|
- keyword: currentVillageName.value.trim() || undefined,
|
|
|
|
|
- page: 1,
|
|
|
|
|
- pageSize: 10
|
|
|
|
|
- })).list;
|
|
|
|
|
- if (searchRes.length > 0) {
|
|
|
|
|
- uni.hideLoading();
|
|
|
|
|
- showSearchedList.value = true;
|
|
|
|
|
- searchedList.value = searchRes;
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- showSearchedList.value = false;
|
|
|
|
|
- //否则添加村社
|
|
|
|
|
|
|
+ //添加村社
|
|
|
const res = (await LightVillageApi.createVillage({
|
|
const res = (await LightVillageApi.createVillage({
|
|
|
name: currentVillageName.value,
|
|
name: currentVillageName.value,
|
|
|
desc: currentVillageDesc.value,
|
|
desc: currentVillageDesc.value,
|
|
@@ -273,19 +265,19 @@ async function handleConfirm(skipSearch?: boolean) {
|
|
|
latitude: String(currentLonLat.value.latitude),
|
|
latitude: String(currentLonLat.value.latitude),
|
|
|
area_code: currentAreaCode.value,
|
|
area_code: currentAreaCode.value,
|
|
|
village_type: currentVillageType.value,
|
|
village_type: currentVillageType.value,
|
|
|
- })).data;
|
|
|
|
|
|
|
+ }));
|
|
|
|
|
|
|
|
uni.hideLoading();
|
|
uni.hideLoading();
|
|
|
|
|
|
|
|
await alert({
|
|
await alert({
|
|
|
title: '提示',
|
|
title: '提示',
|
|
|
- content: '村社创建成功!快去成为志愿者吧',
|
|
|
|
|
|
|
+ content: '村社创建成功!快去为村社做贡献吧',
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
if (res)
|
|
if (res)
|
|
|
- backAndCallOnPageBack('joinVillage', {
|
|
|
|
|
- id: res.id,
|
|
|
|
|
- createdNew: true,
|
|
|
|
|
|
|
+ backAndCallOnPageBack('goVillage', {
|
|
|
|
|
+ id: res.requireData().id,
|
|
|
|
|
+ createdNew: !res.message.includes('已存在'),
|
|
|
reselectAddress: getReSelectAddress(),
|
|
reselectAddress: getReSelectAddress(),
|
|
|
});
|
|
});
|
|
|
|
|
|