Ver código fonte

💊 修复点亮与村社概况编写问题

快乐的梦鱼 13 horas atrás
pai
commit
f913681c17

+ 15 - 14
src/api/map/AMapApi.ts

@@ -39,22 +39,23 @@ export class AMapApi extends AMapServerRequestModule<DataModel> {
       .then(res => transformArrayDataModel(Poi, res.data ?? [], ''))
       .catch(e => { throw e });
   }
-  regeo(lat: number, lng: number, querys?: QueryParams) {
-    return this.get(`/v3/geocode/regeo`, `查询经纬度(${lat}, ${lng})所属区县`, {
+  async regeo(lat: number, lng: number, querys?: QueryParams) {
+    const data = (await this.get<any>(`/v3/geocode/regeo`, `查询经纬度(${lat}, ${lng})所属区县`, {
       location: `${lng},${lat}`,
       ...querys,
-    })
-      .then(res => (res.data as any).regeocode.addressComponent as {
-        country: string,
-        province: string,
-        city: string,
-        district: string,
-        adcode: string,
-        township: string,
-        citycode: string,
-        towncode: string,
-      })
-      .catch(e => { throw e });
+    }));
+
+    console.log(data);
+    return data.raw.regeocode.addressComponent as {
+      country: string,
+      province: string,
+      city: string,
+      district: string,
+      adcode: string,
+      township: string,
+      citycode: string,
+      towncode: string,
+    }
   }
   regeoAddress(lat: number, lng: number, querys?: QueryParams) {
     return this.get(`/v3/geocode/regeo`, `查询经纬度(${lat}, ${lng})地址`, {

+ 1 - 0
src/api/system/ConfigurationApi.ts

@@ -22,6 +22,7 @@ export interface IConfigurationItem {
       url: string;
       width: number;
       height: number;
+      innerStyle?: Record<string, unknown>;
     };
     home: IBannerItem;
     dig: IBannerItem;

+ 1 - 0
src/components/form/CascaderField.vue

@@ -4,6 +4,7 @@
     @close="onCancel"
     :closeIcon="false"
     position="bottom"
+    size="60vh"
     closeable
   >
     <PopupTitle 

+ 4 - 4
src/pages/home/components/LightMap.vue

@@ -173,7 +173,7 @@ const mapLoader = useSimpleDataLoader<MapMarker[]>(async () => {
     areaCode: selectedRegion.value,
   }));
   if (searchKeyword.value) {
-    res = res.filter(p => p.villageName.includes(searchKeyword.value));
+    res = res.filter(p => p.name.includes(searchKeyword.value));
   }
   //如果为空则尝试获取子级
   hasResItems.value = res.length > 0;
@@ -267,7 +267,7 @@ const mapLoader = useSimpleDataLoader<MapMarker[]>(async () => {
   return list;
 }, false, false);
 
-const BATCH_SIZE = 50;
+const BATCH_SIZE = 25;
 
 async function asyncAddMarkers(list: MapMarker[]) {
   if (list.length <= BATCH_SIZE) {
@@ -284,7 +284,7 @@ async function asyncAddMarkers(list: MapMarker[]) {
       markers: batch,
     });
     if (i + BATCH_SIZE < list.length) {
-      await waitTimeOut(500);
+      await waitTimeOut(300);
     }
   }
 }
@@ -373,7 +373,7 @@ onMounted(async () => {
   mapCtx.initMarkerCluster({
     enableDefaultStyle: false,
     zoomOnClick: true,
-    gridSize: 40,
+    gridSize: 50,
   });
   mapCtx.on('markerClusterCreate', (e: { clusters: any[] }) => {
     const customClusters = e.clusters.map((cluster) => {

+ 1 - 0
src/pages/home/index.vue

@@ -21,6 +21,7 @@
             :src="appConfiguration?.banners.homeTitle.url"
             :width="appConfiguration?.banners.homeTitle.width || 140"
             :height="appConfiguration?.banners.homeTitle.height || 75"
+            :innerStyle="appConfiguration?.banners.homeTitle.innerStyle"
           />
           <Width :width="150" />
         </FlexRow>

+ 14 - 27
src/pages/home/light/create-village.vue

@@ -16,9 +16,6 @@
         />
       </template>
       <template v-else-if="step === 'inputInfo'">
-        <FlexRow center gap="gap.md">
-          <Text>请输入家乡名称,然后选择地图位置定位哦</Text>
-        </FlexRow>
         <Field v-model="currentVillageName" placeholder="请输入家乡名称,例如:大庆村" />
         <Field 
           v-model="currentVillageDesc" 
@@ -66,7 +63,8 @@
           >
           </map>
         </FlexCol>
-        <FlexRow justify="flex-end">
+        <FlexRow justify="space-between">
+          <Text text="如果地图定位不正确,请拖动准星至您的家乡准确位置" fontConfig="secondText" />
           <Button :text="'切换' + (enableSatellite ? '地图' : '卫星')" @click="enableSatellite = !enableSatellite" />
         </FlexRow>
         <FlexCol gap="gap.md">
@@ -108,6 +106,10 @@
 import { ref, onMounted } from 'vue';
 import { showError } from '@/common/composeabe/ErrorDisplay';
 import { toast, alert } from '@/components/dialog/CommonRoot';
+import { getCascaderItemByValue } from '@/components/form/CascaderUtils';
+import { isValidLonLat } from '../composeabe/LonLat';
+import { useLoadQuerys } from '@/components/composeabe/LoadQuerys';
+import { back, backAndCallOnPageBack } from '@/components/utils/PageAction';
 import FlexCol from '@/components/layout/FlexCol.vue';
 import FlexRow from '@/components/layout/FlexRow.vue';
 import Cascader, { type CascaderItem } from '@/components/form/Cascader.vue';
@@ -117,16 +119,13 @@ import Text from '@/components/basic/Text.vue';
 import Button from '@/components/basic/Button.vue';
 import Field from '@/components/form/Field.vue';
 import LightVillageApi, { type VillageListItem } from '@/api/light/LightVillageApi';
-import { back, backAndCallOnPageBack } from '@/components/utils/PageAction';
 import RadioGroup from '@/components/form/RadioGroup.vue';
 import Radio from '@/components/form/Radio.vue';
 import CommonDialog from '@/common/components/CommonDialog.vue';
 import BoxMid from '@/common/components/box/BoxMid.vue';
 import Touchable from '@/components/feedback/Touchable.vue';
 import Image from '@/components/basic/Image.vue';
-import { getCascaderItemByValue } from '@/components/form/CascaderUtils';
-import { isValidLonLat } from '../composeabe/LonLat';
-import { useLoadQuerys } from '@/components/composeabe/LoadQuerys';
+import AppCofig from '@/common/config/AppCofig';
 
 const { querys } = useLoadQuerys({
   villageName: '',
@@ -147,7 +146,12 @@ const { querys } = useLoadQuerys({
         content: '您的家乡暂时没有经纬度信息,麻烦您拖动地图至您的家乡准确位置',
         confirmText: '好',
       })
+      currentLonLat.value = {
+        longitude: AppCofig.defaultLonLat[0],
+        latitude: AppCofig.defaultLonLat[1],
+      }
     } else {
+      currentLonLat.value = query;
       mapCtx.moveToLocation({
         longitude: Number(query.longitude),
         latitude: Number(query.latitude),
@@ -214,25 +218,8 @@ async function handlePickEnd(values: CascaderItem[]) {
         break;
       }
     }
-
+    currentVillageName.value = values[selectedValue.value.length - 1].text;
     currentAreaCode.value = Number(selectedValue.value[selectedValue.value.length - 1]);
-    try {
-      const mapVillages = await LightVillageApi.getMapVillage({ areaCode: currentAreaCode.value });
-      const existingVillages = mapVillages.filter(v => v.villageId !== null);
-      if (existingVillages.length > 0) {
-        searchedList.value = existingVillages.map(v => ({
-          id: v.villageId!,
-          name: v.villageName || v.name,
-          image: '',
-          address: v.mergerName?.replace(/,/g, '') || '',
-        }) as unknown as VillageListItem);
-        showSearchedList.value = true;
-        return;
-      }
-    } catch (_) {
-      // 查询失败不阻塞流程,继续进入输入信息步骤
-    }
-
     if (i !== values.length - 1) {
       alert({
         title: '提示',
@@ -277,7 +264,7 @@ async function handleConfirm(skipSearch?: boolean) {
         return;
       }
     }
-
+    showSearchedList.value = false;
     //否则添加村社
     const res = (await LightVillageApi.createVillage({ 
       name: currentVillageName.value,

+ 55 - 52
src/pages/home/light/submit-map.vue

@@ -3,6 +3,9 @@ import { ref } from 'vue';
 import { useLoadQuerys } from '@/components/composeabe/LoadQuerys';
 import { useGetCurrentLocation } from '../composeabe/GetCurrentLocation';
 import { backAndCallOnPageBack, callPrevOnPageBack, navTo } from '@/components/utils/PageAction';
+import { confirm } from '@/components/utils/DialogAction';
+import type { RegionItem } from '@/api/map/RegionApi';
+import type { VillageMapItem } from '@/api/light/LightVillageApi';
 import AppCofig from '@/common/config/AppCofig';
 import LightMap from '../components/LightMap.vue';
 import FlexCol from '@/components/layout/FlexCol.vue';
@@ -16,9 +19,7 @@ import JoinDialog from '../village/dialogs/JoinDialog.vue';
 import CitySelect from '../components/CitySelect.vue';
 import Popup from '@/components/dialog/Popup.vue';
 import FrameButton from '@/common/components/FrameButton.vue';
-import type { RegionItem } from '@/api/map/RegionApi';
-import type { VillageMapItem } from '@/api/light/LightVillageApi';
-import { confirm } from '@/components/utils/DialogAction';
+import CommonRoot from '@/components/dialog/CommonRoot.vue';
 
 const { querys } = useLoadQuerys({
   latitude: AppCofig.defaultLonLat[1],
@@ -114,53 +115,55 @@ defineExpose({
 </script>
 
 <template>
-  <FlexCol position="absolute" :top="0" :left="0" :right="0" :zIndex="1000">
-    <StatusBarSpace />
-    <NavBar leftButton="back" />
-    <FlexRow center>
-      <BoxMid 
-        :innerStyle="{
-          width: '670rpx',
-        }"
-        direction="column"
-        align="center"
-        gap="gap.md"
-      > 
-        <FlexCol center>
-          <Image src="https://xy.wenlvti.net/app_static/images/home/BadgeNew.png" :width="220" mode="widthFix" />
-          <Text text="请选择您要点亮的村社" fontConfig="primaryTitle" />
-        </FlexCol>
-        <FlexRow gap="gap.md">
-          <FrameButton size="midium" icon="search" text="点击搜索" @click="lightMap?.showSearch()" />
-          <FrameButton size="midium" icon="home-filling" text="没有我的家乡?点这里建村" @click="navTo('/pages/home/light/create-village')" />
-        </FlexRow>
-      </BoxMid>
-    </FlexRow>
-  </FlexCol>
-  <JoinDialog
-    ref="joinDialog" 
-    :villageId="joinCurrentVillageId"
-    @finish="handleJoinFinish"
-  />
-  <LightMap 
-    ref="lightMap"
-    full
-    :city="currentCity"
-    :cityCode="currentCityCode"
-    :district="currentDistrict"
-    :lonlat="currentLocation.currentLonlat.value"
-    :isLightMode="true" 
-    @lightVillage="handleLightVillage"
-    @createVillage="handleCreateVillage"
-    @getCurrentLonlat="currentLocation.getCurrentExactLocation"
-    @changeCity="showCityPopup=true"
-  />   
-  <Popup 
-    v-model:show="showCityPopup" 
-    closeable
-    position="bottom"
-    size="60vh"
-  >
-    <CitySelect @selectCity="handleSelectCity" />
-  </Popup>
+  <CommonRoot>
+    <FlexCol position="absolute" :top="0" :left="0" :right="0" :zIndex="1000">
+      <StatusBarSpace />
+      <NavBar leftButton="back" />
+      <FlexRow center>
+        <BoxMid 
+          :innerStyle="{
+            width: '670rpx',
+          }"
+          direction="column"
+          align="center"
+          gap="gap.md"
+        > 
+          <FlexCol center>
+            <Image src="https://xy.wenlvti.net/app_static/images/home/BadgeNew.png" :width="220" mode="widthFix" />
+            <Text text="请选择您要点亮的村社" fontConfig="primaryTitle" />
+          </FlexCol>
+          <FlexRow gap="gap.md">
+            <FrameButton size="midium" icon="search" text="点击搜索" @click="lightMap?.showSearch()" />
+            <FrameButton size="midium" icon="home-filling" text="没有我的家乡?点这里建村" @click="navTo('/pages/home/light/create-village')" />
+          </FlexRow>
+        </BoxMid>
+      </FlexRow>
+    </FlexCol>
+    <JoinDialog
+      ref="joinDialog" 
+      :villageId="joinCurrentVillageId"
+      @finish="handleJoinFinish"
+    />
+    <LightMap 
+      ref="lightMap"
+      full
+      :city="currentCity"
+      :cityCode="currentCityCode"
+      :district="currentDistrict"
+      :lonlat="currentLocation.currentLonlat.value"
+      :isLightMode="true" 
+      @lightVillage="handleLightVillage"
+      @createVillage="handleCreateVillage"
+      @getCurrentLonlat="currentLocation.getCurrentExactLocation"
+      @changeCity="showCityPopup=true"
+    />   
+    <Popup 
+      v-model:show="showCityPopup" 
+      closeable
+      position="bottom"
+      size="60vh"
+    >
+      <CitySelect @selectCity="handleSelectCity" />
+    </Popup>
+  </CommonRoot>
 </template>

+ 1 - 1
src/pages/home/village/index.vue

@@ -174,7 +174,7 @@ onMounted(async () => {
     });
   }
   if (isDevEnv) {
-    tab.value = 'tree';
+    //tab.value = 'tree';
   }
   await waitTimeOut(1000);
 });