Kaynağa Gözat

🎨 优化首页村社显示细节

快乐的梦鱼 2 hafta önce
ebeveyn
işleme
3752ab1130

+ 1 - 1
src/pages/dig/forms/list-ordinary.vue

@@ -188,7 +188,7 @@ function newData() {
   if (!canCollect.value) {
     confirm({ 
       title: '提示', 
-      content: "您还不是当前村社的志愿者,请先加入志愿者队伍", 
+      content: "您还不是当前村社的志愿者,无法采编信息,请先加入志愿者队伍", 
       confirmText: '去加入',
     }).then((res) => {
       if (res) {

+ 31 - 35
src/pages/home/components/LightMap.vue

@@ -118,7 +118,6 @@ const instance = getCurrentInstance();
 const mapCtx = uni.createMapContext('prevMap', instance);
 
 const selectedRegion = ref<number>();
-const nextNeedAutoFocus = ref(false);
 const villageData = new Map<number, VillageListItem>();
 
 const ready = ref(false);
@@ -131,6 +130,7 @@ const emit = defineEmits([
   'getCurrentLonlat',
   'update:isLightMode', 
   'update:lonlat',
+  'update:district',
   'selectVillage',
   'regionChanged',
   'lightVillage',
@@ -225,40 +225,38 @@ const mapLoader = useSimpleDataLoader<MapMarker[]>(async () => {
   );
   asyncAddMarkers(list);
 
-  if (nextNeedAutoFocus.value) {
-    if (res.length == 1) {
-      mapCtx.moveToLocation({
-        latitude: Number(list[0].latitude),
-        longitude: Number(list[0].longitude),
+  if (res.length == 1) {
+    mapCtx.moveToLocation({
+      latitude: Number(list[0].latitude),
+      longitude: Number(list[0].longitude),
+    });
+  } else if (res.length > 1) {
+    setTimeout(() => {
+      mapCtx.includePoints({
+        points: list.map(p => {
+          if (!p.longitude || !p.latitude) {
+            p.longitude = AppCofig.defaultLonLat[0];
+            p.latitude = AppCofig.defaultLonLat[1];
+          }
+          return {
+            latitude: p.latitude,
+            longitude: p.longitude,
+          }
+        }),
+        padding: [20, 20, 20, 20],
       });
-    } else if (res.length > 1) {
-      setTimeout(() => {
-        mapCtx.includePoints({
-          points: list.map(p => {
-            if (!p.longitude || !p.latitude) {
-              p.longitude = AppCofig.defaultLonLat[0];
-              p.latitude = AppCofig.defaultLonLat[1];
-            }
-            return {
-              latitude: p.latitude,
-              longitude: p.longitude,
-            }
-          }),
-          padding: [20, 20, 20, 20],
+    }, 200);
+  } else {
+    try {
+      const currentRegion = regionLoader.content.value?.find(p => p.id == selectedRegion.value);
+      if (currentRegion) {
+        mapCtx.moveToLocation({
+          latitude: Number(currentRegion.latitude),
+          longitude: Number(currentRegion.longitude),
         });
-      }, 200);
-    } else {
-      try {
-        const currentRegion = regionLoader.content.value?.find(p => p.id == selectedRegion.value);
-        if (currentRegion) {
-          mapCtx.moveToLocation({
-            latitude: Number(currentRegion.latitude),
-            longitude: Number(currentRegion.longitude),
-          });
-        }
-      } catch (error) {
-        console.error(error);
       }
+    } catch (error) {
+      console.error(error);
     }
   }
   ready.value = true;
@@ -303,8 +301,8 @@ function onMarkerTap(e: any) {
 }
 function onSelectedRegion(regionId: number) {
   selectedRegion.value = regionId;
-  nextNeedAutoFocus.value = true;
   mapLoader.reload();
+  emit('update:district', regionLoader.content.value?.find(p => p.id === regionId)?.name);
   emit('regionChanged', regionId);
 }
 function setCurrentRegion(regionAreaCode: number) {
@@ -332,7 +330,6 @@ function loadFirstRegion() {
 function showSearch() {
   if (searchKeyword.value) {
     searchKeyword.value = '';
-    nextNeedAutoFocus.value = true;
     mapLoader.reload();
   } else {
     searchDialogShow.value = true;
@@ -345,7 +342,6 @@ async function searchConfirm() {
     toast('请输入搜索关键词');
     return;
   }
-  nextNeedAutoFocus.value = true;
   await mapLoader.reload();
   if (mapLoader.content.value?.length === 0) {
     toast('未搜索到相关村社,换个关键词再试试吧');

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

@@ -60,7 +60,7 @@
         small
         :city="currentCity"
         :cityCode="currentCityCode"
-        :district="currentDistrict"
+        v-model:district="currentDistrict"
         :lonlat="currentLocation.currentLonlat.value"
         @getCurrentLonlat="currentLocation.getCurrentExactLocation"
         @selectVillage="handleGoVillageDetails"
@@ -281,8 +281,6 @@ const currentLocation = useGetCurrentLocation({
   onCityChanged: (city, code, district) => {
     currentCity.value = city;
     currentCityCode.value = code;
-    if (!district)
-      console.error('!')
     currentDistrict.value = district || '';
   },
 });

+ 1 - 1
src/pages/home/light/submit-volunteer.vue

@@ -31,7 +31,7 @@
           <BoxMid :padding="[45,35]">
             <FlexCol center :gap="20">
               <Icon name="smile-filling" :size="80" />
-              <Text text="您已经是志愿者,请完善以下信息认领当前村社" textAlign="center" fontConfig="contentSpeicalText" />
+              <Text text="感谢您为本村做出贡献,点亮村社!请完善以下信息认领当前村社,成为本村的志愿者" textAlign="center" fontConfig="contentSpeicalText" />
             </FlexCol>
           </BoxMid>
           <BoxMid :padding="10">

+ 8 - 4
src/pages/home/village/introd/card.vue

@@ -117,14 +117,14 @@
       <FlexRow backgroundColor="background.tertiary" radius="radius.md" :padding="[30, 20]">
         <FlexCol center gap="gap.sm" flexBasis="25%">
           <Text text="乡源光" fontConfig="secondText" />
-          <Text :text="villageInfoLoader.content.value?.light || 0" fontConfig="importantTitle" />
+          <Text :text="villageInfoLoader.content.value?.light || '0'" fontConfig="importantTitle" />
           <Button type="text" size="mini" text="做任务" @click="navTo('/pages/home/village/task/index')" />
         </FlexCol>
         <Divider type="vertical" />
         <FlexCol center gap="gap.sm" flexBasis="25%">
           <Touchable direction="column" center @click="navTo('/pages/home/village/volunteer/list', { villageId: villageStore.currentVillage?.id ?? undefined })">
             <Text text="乡源人数" fontConfig="contentText" />
-            <Text :text="villageInfoLoader.content.value?.memberCount|| 0" fontConfig="importantTitle" />
+            <Text :text="villageInfoLoader.content.value?.memberCount|| '0'" fontConfig="importantTitle" />
           </Touchable>
           <WxButton openType="share">
             <Button type="text" size="mini" text="邀请加入" @click="navTo('/pages/home/village/task/index')" />
@@ -135,7 +135,7 @@
           villageId: villageStore.currentVillage?.id ?? undefined,
         })">
           <Text text="关注人数" fontConfig="contentText" />
-          <Text :text="villageInfoLoader.content.value?.followerCount|| 0" fontConfig="importantTitle" />
+          <Text :text="villageInfoLoader.content.value?.followerCount|| '0'" fontConfig="importantTitle" />
           <Height :size="36" />
         </Touchable>
         <Divider type="vertical" />
@@ -242,7 +242,7 @@
               direction="row"
               center
               gap="gap.md"
-              @click="handleGoPublish()"
+              @click="handleGoOfficalManage()"
             >
               <Icon name="https://xy.wenlvti.net/app_static/images/village/IconLargeFolkloreVibe.png" :size="30" />
               <Text text="管理" fontConfig="contentText" />
@@ -311,6 +311,7 @@ import Button from '@/components/basic/Button.vue';
 import BubbleTip from '@/components/feedback/BubbleTip.vue';
 import MemoryTimeOut from '@/components/composeabe/MemoryTimeOut';
 import TextEllipsis from '@/components/display/TextEllipsis.vue';
+import { toast } from '@/components/dialog/CommonRoot';
 
 const authStore = useAuthStore();
 const { getIsVolunteer } = useUserTools();
@@ -457,6 +458,9 @@ function handleGoGallery() {
     maxCount: villageStore.currentVillage?.imageLimit || 3,
   });
 }
+function handleGoOfficalManage() {
+  toast('暂未开放,敬请期待');
+}
 
 const upgradeRef = ref<InstanceType<typeof UpgradeDialog>>();
 const villageGalleryRef = ref<InstanceType<typeof VillageGallery>>();