Sfoglia il codice sorgente

fix(store): 修复地址获取失败时的错误提示

- 优化位置获取失败的错误处理,针对系统权限拒绝的情况提供更明确的提示信息
- 对于其他定位错误,显示具体的错误信息

feat(config): 更新试用环境API地址配置

- 启用新的试用环境地址 http://47.109.84.152:8081
- 注释掉旧的API地址配置

refactor(subPack-xsb): 优化分类组件加载状态处理

- 在商品加载时添加loading状态提示
- 临时注释掉loadmore组件以避免显示问题
- 调整加载状态的设置时机,确保用户体验

refactor(store-xsb): 优化店铺列表距离计算逻辑

- 修复店铺距离计算时可能因坐标为空导致的错误
- 为经纬度添加默认值,避免空值计算问题

chore(build): 添加异步导入类型文件到gitignore

- 在.gitignore中添加async-import.d.ts和async-component.d.ts
- 防止类型声明文件被意外提交到版本控制
zhangtao 1 settimana fa
parent
commit
355ee2ec6e

+ 3 - 0
.gitignore

@@ -9,6 +9,9 @@ bin-release/
 
 dist
 node_modules
+async-import.d.ts
+async-component.d.ts
+
 # Executables
 *.swf
 *.air

+ 2 - 2
src/config/index.ts

@@ -23,8 +23,8 @@ const mapEnvVersion = {
    */
   // trial: "http://192.168.1.166:8080/jeecg-boot",
   // trial: 'http://192.168.0.157:8080',
-  // trial: 'http://47.109.84.152:8081',
-  trial: 'https://smqjh.api.zswlgz.com',
+  trial: 'http://47.109.84.152:8081',
+  // trial: 'https://smqjh.api.zswlgz.com',
   /**
    * 正式版
    */

+ 6 - 2
src/store/address.ts

@@ -58,8 +58,12 @@ export const useAddressStore = defineStore('address', {
         },
         fail: (err) => {
           console.log(err, '获取位置失败')
-
-          uni.showToast({ title: `获取位置失败${err}`, icon: 'none' })
+          if (err.errMsg === 'getLocation:fail system permission denied') {
+            useGlobalToast().show('手机定位权限未打开,请手动在设置里面打开定位')
+          }
+          else {
+            useGlobalToast().show(`获取定位失败:${err.errMsg}`)
+          }
         },
       })
     },

+ 3 - 2
src/subPack-xsb/commonTab/components/classfiy.vue

@@ -213,6 +213,7 @@ onMounted(async () => {
     })
   }
   if (token.value) {
+    goodsLoading.value = 'loading'
     await getCartCategorList()
     if (cartList.value.length) {
       getCartBox()
@@ -529,7 +530,7 @@ function handlePay() {
                 </view>
               </view>
             </view>
-            <wd-loadmore :state="goodsLoading" :loading-props="{ color: '#9ED605', size: 20 }" />
+            <!-- <wd-loadmore :state="goodsLoading" :loading-props="{ color: '#9ED605', size: 20 }" /> -->
           </view>
 
           <wd-status-tip v-else image="content" tip="暂无内容" />
@@ -637,7 +638,7 @@ function handlePay() {
       <template #footer>
         <view class="box-border w-full flex items-center justify-between py20rpx">
           <view class="w-48%">
-            <wd-button plain hairline block @click="selectGoods = false">
+            <wd-button hairline plain block @click="selectGoods = false">
               取消
             </wd-button>
           </view>

+ 1 - 2
src/subPack-xsb/commonTab/index.vue

@@ -72,8 +72,6 @@ const loading = ref(true)
 async function getCategories() {
   const res = await Apis.xsb.categories({ data: { shopId: unref(SelectShopInfo).shopId, channelId: unref(userInfo).channelId || 1 } })
   commonCategoryData.value = res.data
-
-  loading.value = false
 }
 async function getCurrentImg() {
   const res = await Apis.xsb.appAdvertInfo({})
@@ -91,6 +89,7 @@ onMounted(async () => {
   getCurrentImg()
   // reload()
   getCategories()
+  loading.value = false
 })
 onShow(() => refresh())
 

+ 2 - 6
src/subPack-xsb/store-xsb/sys.ts

@@ -54,16 +54,12 @@ export const useSysXsbStore = defineStore('system-xsb', {
         Apis.xsb.shopList({}).then((res) => {
           this.xsbShopList = res.data
           const { Location } = storeToRefs(useAddressStore())
-          if (Location.value.latitude == null || Location.value.longitude == null) {
-            useAddressStore().getLocation()
-            return
-          }
           let minDistance = Infinity
           for (const shop of res.data) {
             if (shop.shopLat && shop.shopLng) {
               const distance = this.getDistance(
-                Location.value.latitude,
-                Location.value.longitude,
+                Location.value.latitude || 113.264435,
+                Location.value.longitude || 23.129163,
                 Number(shop.shopLat),
                 Number(shop.shopLng),
               )