Переглянути джерело

🎨 优化首页选择村社和地图定位问题

快乐的梦鱼 1 тиждень тому
батько
коміт
7cbb8c83b1

+ 1 - 1
src/common/config/ApiCofig.ts

@@ -10,7 +10,7 @@ export default {
   mainBodyId: 1,
   platformId: 330,
   amapServerKey: '8fd09264c33678141f609588c432df0e',
-  mapKey: 'LDXBZ-JIWWC-IXW2S-AUDZS-26VC2-GRBC4',
+  mapKey: 'QDOBZ-B6N6Q-2LL57-2QZVU-MPHA6-A3B2G',
   bugReport: {
     server: 'https://update-server1.imengyu.top/bug-submit',
     appId: 1,

+ 27 - 0
src/pages/home/composeabe/GetCurrentLocation.ts

@@ -2,6 +2,7 @@ import LightVillageApi from "@/api/light/LightVillageApi";
 import MapApi from "@/api/map/MapApi";
 import RegionApi from "@/api/map/RegionApi";
 import TenMapApi from "@/api/map/TenMapApi";
+import { alert, confirm } from "@/components/utils/DialogAction";
 import { useVillageStore } from "@/store/village";
 import { ref } from "vue";
 
@@ -22,9 +23,14 @@ export function useGetCurrentLocation(
 
   async function getCurrentExactLocation() {
     return new Promise((resolve, reject) => {
+      uni.showLoading({
+        title: '定位中',
+      });
       uni.getLocation({
         type: 'wgs84',
         success: async (res) => {
+          uni.hideLoading();
+          console.log('getCurrentExactLocation', res);
           currentLonlat.value = {
             longitude: res.longitude,
             latitude: res.latitude,
@@ -36,6 +42,27 @@ export function useGetCurrentLocation(
           resolve(currentLonlat.value);
         },
         fail: (err) => {
+          uni.hideLoading();
+          if (err.errMsg.includes('auth deny')) {
+            confirm({
+              title: '提示',
+              content: '您拒绝了定位权限,暂时无法获取您的当前位置,可以在设置中开启',
+              confirmText: '去开启',
+            }).then((confirmed) => {
+              if (confirmed) {
+                uni.openSetting({
+                  success: (res) => {
+                    if (res.authSetting['scope.userLocation']) {
+                      alert({
+                        title: '提示',
+                        content: '开启定位权限后即可获取当前位置',
+                      });
+                    }
+                  },
+                });
+              }
+            });
+          }
           reject(err);
         },
       });

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

@@ -202,7 +202,7 @@
       round
       size="80vh"
     >
-      <VillageMyFollow @handleGoVillageDetails="handleGoRecommendDetails" />
+      <VillageMyFollow @goDetails="handleGoVillageDetails" />
     </Popup>
 
     <PostIndex 

+ 22 - 1
src/pages/user/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <FlexCol :padding="[40,30,50,30]">
+  <FlexCol :padding="[40,30,50,30]" gap="gap.md">
     <HomeLargeTitle title="我的" />
     <Touchable 
       direction="row"
@@ -39,6 +39,25 @@
         <GridItem title="兑换商城" icon="https://xy.wenlvti.net/app_static/images/mine/IconShop.png" touchable @click="goStore" />
       </Grid>
     </ProvideVar>
+    
+    <BoxMid 
+      v-if="authStore.isLogged" 
+      :padding="[40,20]"
+      direction="row"
+    >
+      <FlexRow :flex="1" :gap="10" center>
+        <Text>我的乡源果: </Text>
+        <Text fontConfig="lightGoldTitle">{{ volunteerInfoLoader.content.value?.fruit || 0 }}</Text>
+      </FlexRow>
+      <FlexRow :flex="1" :gap="10" center>
+        <Touchable direction="row" align="center" :gap="10" @click="navTo('/pages/dig/about/point')">
+          <Text>文化积分:</Text>
+          <Icon icon="help-filling" color="primary" :size="40" />
+        </Touchable>
+        <Text fontConfig="lightGoldTitle">{{ volunteerInfoLoader.content.value?.points || 0 }}</Text>
+      </FlexRow>
+    </BoxMid>
+
     <ProvideVar :vars="{
       CellBackground: 'background.tertiary',
       CellBottomBorder: false,
@@ -72,6 +91,7 @@ import CellGroup from '@/components/basic/CellGroup.vue';
 import Cell from '@/components/basic/Cell.vue';
 import Image from '@/components/basic/Image.vue';
 import H4 from '@/components/typography/H4.vue';
+import Text from '@/components/basic/Text.vue';
 import Height from '@/components/layout/space/Height.vue';
 import Touchable from '@/components/feedback/Touchable.vue';
 import FlexCol from '@/components/layout/FlexCol.vue';
@@ -84,6 +104,7 @@ import HomeLargeTitle from '@/common/components/parts/HomeLargeTitle.vue';
 import ProvideVar from '@/components/theme/ProvideVar.vue';
 import Grid from '@/components/layout/grid/Grid.vue';
 import GridItem from '@/components/layout/grid/GridItem.vue';
+import BoxMid from '@/common/components/box/BoxMid.vue';
 
 const UserHead = 'https://mncdn.wenlvti.net/app_static/xiangyuan/images/user/avatar.png';