hookehuyr

fix: 修复收藏按钮布局并统一微信API调用方式

- 使用flex布局替代硬编码padding来居中收藏图标
- 将Taro API调用统一改为wx原生API调用
1 <!-- 1 <!--
2 * @Date: 2025-06-28 10:33:00 2 * @Date: 2025-06-28 10:33:00
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-07-04 16:51:27 4 + * @LastEditTime: 2025-07-04 17:47:22
5 * @FilePath: /jgdl/src/pages/index/index.vue 5 * @FilePath: /jgdl/src/pages/index/index.vue
6 * @Description: 捡个电驴首页 6 * @Description: 捡个电驴首页
7 --> 7 -->
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
75 <view class="relative p-2"> 75 <view class="relative p-2">
76 <image :src="scooter.imageUrl" :alt="scooter.name" mode="aspectFill" 76 <image :src="scooter.imageUrl" :alt="scooter.name" mode="aspectFill"
77 class="w-full h-36 object-cover rounded-lg" /> 77 class="w-full h-36 object-cover rounded-lg" />
78 - <view class="absolute top-4 right-3 w-7 h-7 rounded-full bg-white bg-opacity-80" @tap.stop="() => toggleFavorite(scooter.id)" style="padding-top: 12rpx; padding-left: 10rpx;"> 78 + <view class="absolute top-4 right-3 w-7 h-7 rounded-full bg-white bg-opacity-80 flex items-center justify-center" @tap.stop="() => toggleFavorite(scooter.id)">
79 <Heart1 v-if="!favoriteIds.includes(scooter.id)" size="22" :color="'#9ca3af'" /> 79 <Heart1 v-if="!favoriteIds.includes(scooter.id)" size="22" :color="'#9ca3af'" />
80 <HeartFill v-else size="22" :color="'#ef4444'" /> 80 <HeartFill v-else size="22" :color="'#ef4444'" />
81 </view> 81 </view>
...@@ -342,8 +342,8 @@ useDidShow(() => { ...@@ -342,8 +342,8 @@ useDidShow(() => {
342 useReady(async () => { 342 useReady(async () => {
343 console.warn('index onReady') 343 console.warn('index onReady')
344 // 版本更新检查 344 // 版本更新检查
345 - if (!Taro.canIUse("getUpdateManager")) { 345 + if (!wx.canIUse("getUpdateManager")) {
346 - Taro.showModal({ 346 + wx.showModal({
347 title: "提示", 347 title: "提示",
348 content: "当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试", 348 content: "当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试",
349 showCancel: false, 349 showCancel: false,
...@@ -352,7 +352,7 @@ useReady(async () => { ...@@ -352,7 +352,7 @@ useReady(async () => {
352 } 352 }
353 353
354 // https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html 354 // https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html
355 - const updateManager = Taro.getUpdateManager(); 355 + const updateManager = wx.getUpdateManager();
356 356
357 updateManager.onCheckForUpdate((res) => { 357 updateManager.onCheckForUpdate((res) => {
358 // 请求完新版本信息的回调 358 // 请求完新版本信息的回调
......
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
97 <view class="relative p-2"> 97 <view class="relative p-2">
98 <image :src="scooter.imageUrl" :alt="scooter.name" mode="aspectFill" 98 <image :src="scooter.imageUrl" :alt="scooter.name" mode="aspectFill"
99 class="w-full h-36 object-cover rounded-lg" /> 99 class="w-full h-36 object-cover rounded-lg" />
100 - <view class="absolute top-4 right-3 w-7 h-7 rounded-full bg-white bg-opacity-80" @tap.stop="() => toggleFavorite(scooter.id)" style="padding-top: 12rpx; padding-left: 10rpx;"> 100 + <view class="absolute top-4 right-3 w-7 h-7 rounded-full bg-white bg-opacity-80 flex items-center justify-center" @tap.stop="() => toggleFavorite(scooter.id)">
101 <Heart1 v-if="!favoriteIds.includes(scooter.id)" size="20" color="#9ca3af" /> 101 <Heart1 v-if="!favoriteIds.includes(scooter.id)" size="20" color="#9ca3af" />
102 <HeartFill v-else size="20" color="#ef4444" /> 102 <HeartFill v-else size="20" color="#ef4444" />
103 </view> 103 </view>
......