From 1e4b7107d1eb58c0c209ae838930c15f6619c119 Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期三, 22 四月 2026 09:24:36 +0800
Subject: [PATCH] 代码提交
---
small-program/pages/index/index.vue | 98 ++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 81 insertions(+), 17 deletions(-)
diff --git a/small-program/pages/index/index.vue b/small-program/pages/index/index.vue
index 1abd847..c045e6a 100644
--- a/small-program/pages/index/index.vue
+++ b/small-program/pages/index/index.vue
@@ -51,22 +51,29 @@
</view>
<view class="recommend-list">
- <view v-for="(item, index) in pointList" :key="index" class="point-card" @click="goStoragePage(item)">
- <view class="point-thumb">
- <image class="point-thumb-image" :src="item.coverImg" mode="widthFix"></image>
- </view>
- <view class="point-main">
- <view class="point-head">
- <text class="point-name">{{ item.name }}</text>
- <text class="point-distance">{{ item.distanceText }}</text>
+ <template v-if="pointList.length > 0">
+ <view v-for="(item, index) in pointList" :key="index" class="point-card" @click="goStoragePage(item)">
+ <view class="point-thumb">
+ <image class="point-thumb-image" :src="item.coverImg" mode="widthFix"></image>
</view>
- <view class="point-address">
- <image src="/static/icon/home_ic_location3@2x.png" mode="aspectFit"></image>
- <text>{{ item.address }}</text>
+ <view class="point-main">
+ <view class="point-head">
+ <text class="point-name">{{ item.name }}</text>
+ <text class="point-distance">{{ item.distanceText }}</text>
+ </view>
+ <view class="point-address">
+ <image src="/static/icon/home_ic_location3@2x.png" mode="aspectFit"></image>
+ <text>{{ item.address }}</text>
+ </view>
+ <text class="point-time">{{ item.shopHours }}</text>
</view>
- <text class="point-time">{{ item.shopHours }}</text>
</view>
- </view>
+ </template>
+ <template v-else>
+ <view class="no-data">
+ <image src="/static/image/default_nodata_white@2x.png" mode="widthFix"></image>
+ </view>
+ </template>
</view>
</view>
@@ -77,13 +84,19 @@
</view>
<view class="toast-btn" @click="handleLocation">寮�鍚畾浣�</view>
</view>
+ <custom-tabbar></custom-tabbar>
</view>
</template>
<script>
import { mapState } from 'vuex'
+ import amapFile from '@/utils/amap-wx.130.js'
+ import CustomTabbar from '@/components/custom-tabbar/custom-tabbar.vue'
export default {
+ components: {
+ CustomTabbar
+ },
computed: {
...mapState(['navHeight', 'statusbarHeight', 'address', 'latitude', 'cityId', 'longitude']),
currentAddress() {
@@ -145,10 +158,49 @@
})
},
handleLocation() {
- uni.showToast({
- title: '瀹氫綅鍔熻兘寰呮帴鍏�',
- icon: 'none'
- })
+ var that = this;
+ uni.openSetting({
+ success: (res) => {
+ if (res.authSetting['scope.userLocation']) {
+ that.positioning()
+ }
+ }
+ });
+ },
+ // 瀹氫綅
+ positioning() {
+ var that = this;
+ uni.getLocation({
+ type: 'gcj02',
+ highAccuracyExpireTime: 3000,
+ isHighAccuracy: true,
+ success: function (addr) {
+ const locParam = { latitude: addr.latitude, longitude: addr.longitude };
+ var myAmapFun = new amapFile.AMapWX({ key: 'f2e6c0bfcac14c27b4f0d6d0d5b9d7d' });
+ myAmapFun.getRegeo({
+ location: addr.longitude + ',' + addr.latitude,
+ success: async function(data) {
+ console.log(data, '==================鑾峰彇鍦板潃');
+ let info = data[0];
+ locParam.province = info.province;
+ locParam.city = info.city;
+ locParam.area = info.district;
+ locParam.street = info.street;
+ var ta = info.name || '鍦板潃鑾峰彇澶辫触';
+ locParam.address = ta
+ const resCity = await that.$u.api.getCityByName({ cityName: locParam.city })
+ if (resCity.code === 200) {
+ locParam.cityId = resCity.data.id
+ }
+ that.$store.commit('setPosition', locParam)
+ that.$isResolve()
+ },
+ fail: (err) => {
+ that.$isResolve()
+ }
+ });
+ }
+ });
},
goStoragePage() {
uni.navigateTo({
@@ -366,6 +418,18 @@
margin-top: 32rpx;
}
+ .no-data {
+ width: 100%;
+ margin-top: 80rpx;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ image {
+ width: 320rpx;
+ height: 320rpx;
+ }
+ }
+
.point-card {
display: flex;
gap: 18rpx;
--
Gitblit v1.9.3