Bladeren bron

Merge branch 'master' of http://47.100.2.119:3000/imengyu/xiangyuan-app

快乐的梦鱼 1 week geleden
bovenliggende
commit
e694cf5f5a

+ 0 - 23
package-lock.json

@@ -12746,29 +12746,6 @@
         "typedarray-to-buffer": "^3.1.5"
       }
     },
-    "node_modules/ws": {
-      "version": "8.18.1",
-      "resolved": "https://registry.npmmirror.com/ws/-/ws-8.18.1.tgz",
-      "integrity": "sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w==",
-      "license": "MIT",
-      "optional": true,
-      "peer": true,
-      "engines": {
-        "node": ">=10.0.0"
-      },
-      "peerDependencies": {
-        "bufferutil": "^4.0.1",
-        "utf-8-validate": ">=5.0.2"
-      },
-      "peerDependenciesMeta": {
-        "bufferutil": {
-          "optional": true
-        },
-        "utf-8-validate": {
-          "optional": true
-        }
-      }
-    },
     "node_modules/xhr": {
       "version": "2.6.0",
       "resolved": "https://registry.npmmirror.com/xhr/-/xhr-2.6.0.tgz",

+ 4 - 7
src/pages/home/components/VillageMiniMap.vue

@@ -52,19 +52,20 @@
 </template>
 
 <script setup lang="ts">
-import { computed, getCurrentInstance } from 'vue';
+import { computed } from 'vue';
 import { useTheme } from '@/components/theme/ThemeDefine';
 import NoticeBar from '@/components/display/NoticeBar.vue';
 import type { MapMarker } from '@/types/Map';
 import ImagesUrls from '@/common/config/ImagesUrls';
 import FlexCol from '@/components/layout/FlexCol.vue';
 import Text from '@/components/basic/Text.vue';
+import { isValidLonLat, type LonLat } from '../composeabe/LonLat';
 
 const emit = defineEmits(['getedCurrentLonlat']);
 const props = withDefaults(defineProps<{
   markers?: MapMarker[];
   currentNoticeContent?: string;
-  lonlat?: { longitude: number, latitude: number } | undefined;
+  lonlat?: LonLat| undefined;
 }>(), {
   currentNoticeContent: '目前厦门市已被点亮一个社区,刚刚小亮贡献了10个光源,让湖里区点亮了一个社区',
   lonlat: () => ({
@@ -74,11 +75,7 @@ const props = withDefaults(defineProps<{
 });
 
 const isValidLonlat = computed(() => {
-  return (
-    props.lonlat && props.lonlat.longitude && props.lonlat.latitude &&
-    !isNaN(props.lonlat.longitude) && !isNaN(props.lonlat.latitude) &&
-    props.lonlat.longitude > -180 && props.lonlat.longitude < 180 && props.lonlat.latitude > -90 && props.lonlat.latitude < 90
-  );
+  return (isValidLonLat(props.lonlat));
 });
 
 const themeContext = useTheme();

+ 14 - 0
src/pages/home/composeabe/LonLat.ts

@@ -0,0 +1,14 @@
+export interface LonLat {
+  longitude: number;
+  latitude: number;
+}
+
+export function isValidLonLat(lonLat: LonLat): boolean {
+  return (
+    lonLat.longitude !== undefined && lonLat.latitude !== undefined
+    && !(lonLat.longitude === lonLat.latitude && lonLat.latitude === 0)
+    && !isNaN(lonLat.longitude) && !isNaN(lonLat.latitude)
+    && lonLat.longitude >= 0 && lonLat.longitude <= 180
+    && lonLat.latitude >= 0 && lonLat.latitude <= 90
+  );
+}

+ 20 - 4
src/pages/home/light/create-village.vue

@@ -117,6 +117,7 @@ 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';
 
 const mapCtx = uni.createMapContext('prevMap');
 
@@ -157,10 +158,25 @@ async function asyncLoadData(item: CascaderItem) {
 function handlePickEnd(values: CascaderItem[]) {
   if (values.length > 0) {
     selectedRegion.value = values[values.length - 1].data;
-    currentLonLat.value = {
-      longitude: Number(selectedRegion.value!.longitude),
-      latitude: Number(selectedRegion.value!.latitude),
-    };
+    let i = values.length - 1;
+    for (; i >= 0; i--) {
+      const lonlat = {
+        longitude: Number(values[i].data.longitude),
+        latitude: Number(values[i].data.latitude),
+      };
+      if (isValidLonLat(lonlat)) {
+        currentLonLat.value = lonlat;
+        console.log('currentLonLat.value', currentLonLat.value);
+        break;
+      }
+    }
+    if (i !== values.length - 1) {
+      alert({
+        title: '提示',
+        content: '您的家乡暂时没有经纬度信息,麻烦您拖动地图至您的家乡准确位置',
+        confirmText: '好',
+      })
+    }
     mapCtx.moveToLocation({
       longitude: Number(currentLonLat.value.longitude),
       latitude: Number(currentLonLat.value.latitude),

+ 1 - 1
src/pages/home/village/rank/components/RankVillageItem.vue

@@ -43,7 +43,7 @@
           width="100"
         >
           <Image src="https://xy.wenlvti.net/app_static/images/village/IconLight.png" width="30rpx" height="30rpx" mode="aspectFill" />
-          <Text :text="points" fontConfig="contentText" />
+          <Text :text="points || 0" fontConfig="contentText" />
         </BackgroundBox>
       </FlexRow>
     </Touchable>

+ 2 - 2
src/pages/home/village/rank/village.vue

@@ -55,8 +55,8 @@ async function handleGoDetails(item: { id: number }) {
   const details = await LightVillageApi.getVillageDetails(item.id);
   villageStore.setCurrentVillage(details);
   await waitTimeOut(100);
-  backAndCallOnPageBack('villageRank', {
-    type: 'goVillage'
+  backAndCallOnPageBack('goVillage', {
+    id: item.id,
   })
 }
 </script>

+ 2 - 2
src/pages/home/village/volunteer/detail.vue

@@ -19,7 +19,7 @@
             <H3>{{ infoLoader.content.value.name }}</H3>
             <FlexRow align="center" gap="gap.md">
               <Text text="个人等级" fontConfig="contentText" />
-              <Tag :text="infoLoader.content.value.level + '级'" />
+              <Tag :text="(infoLoader.content.value.level || 0) + '级'" />
             </FlexRow>
             <FlexRow align="center" gap="gap.md">
               <Text text="加入村社" fontConfig="contentText" />
@@ -28,7 +28,7 @@
             <Divider />
             <FlexRow align="center" gap="gap.md">
               <Text text="志愿者文化积分" fontConfig="contentText" />
-              <Text :text="infoLoader.content.value.points" fontConfig="lightGoldTitle" />
+              <Text :text="infoLoader.content.value.points || 0" fontConfig="lightGoldTitle" />
             </FlexRow>
 
           </FlexCol>