consumer模块完成度95%,优化安卓端界面和小程序测试3
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<view class="cart-page">
|
||||
<!-- 智能顶部导航栏 - 与消息页保持一致 -->
|
||||
<view class="smart-navbar" :style="{ paddingTop: statusBarHeight + 'px' }">
|
||||
<view class="nav-container">
|
||||
<view class="nav-container" :style="{ paddingRight: navBarRight + 'px' }">
|
||||
<text class="nav-title">购物车</text>
|
||||
<view class="nav-actions">
|
||||
<view class="action-btn" @click="toggleManageMode">
|
||||
@@ -245,6 +245,20 @@ const statusBarHeight = ref(0)
|
||||
const isManageMode = ref(false)
|
||||
const updatingItems = ref<Set<string>>(new Set()) // Track items being updated to prevent race conditions
|
||||
|
||||
// 小程序胶囊按钮信息类型
|
||||
type CapsuleButtonInfo = {
|
||||
left: number,
|
||||
top: number,
|
||||
right: number,
|
||||
bottom: number,
|
||||
width: number,
|
||||
height: number
|
||||
}
|
||||
|
||||
// 小程序胶囊按钮信息
|
||||
const capsuleButtonInfo = ref<CapsuleButtonInfo | null>(null)
|
||||
const navBarRight = ref(0) // 导航栏右侧预留空间
|
||||
|
||||
// 计算属性
|
||||
const cartGroups = computed<CartGroup[]>(() => {
|
||||
console.log('[cartGroups] 计算购物车分组, cartItems count:', cartItems.value.length)
|
||||
@@ -326,6 +340,27 @@ const toggleManageMode = () => {
|
||||
const initPage = () => {
|
||||
const systemInfo = uni.getSystemInfoSync()
|
||||
statusBarHeight.value = systemInfo.statusBarHeight ?? 0
|
||||
|
||||
// 获取小程序胶囊按钮信息
|
||||
// #ifdef MP-WEIXIN
|
||||
try {
|
||||
const menuButton = uni.getMenuButtonBoundingClientRect()
|
||||
if (menuButton != null) {
|
||||
capsuleButtonInfo.value = {
|
||||
left: menuButton.left,
|
||||
top: menuButton.top,
|
||||
right: menuButton.right,
|
||||
bottom: menuButton.bottom,
|
||||
width: menuButton.width,
|
||||
height: menuButton.height
|
||||
}
|
||||
navBarRight.value = (systemInfo.screenWidth - menuButton.left) + 10
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('获取胶囊按钮信息失败', e)
|
||||
navBarRight.value = 90
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 生命周期
|
||||
@@ -863,7 +898,7 @@ const navigateToProduct = (product: any) => {
|
||||
const name = productJson.getString('name') ?? ''
|
||||
paramsArr.push('name=' + encodeURIComponent(name))
|
||||
|
||||
const image = productJson.getString('image') ?? '/static/product1.jpg'
|
||||
const image = productJson.getString('image') ?? '/static/images/default-product.png'
|
||||
paramsArr.push('image=' + encodeURIComponent(image))
|
||||
|
||||
const url = `/pages/mall/consumer/product-detail?${paramsArr.join('&')}`
|
||||
|
||||
Reference in New Issue
Block a user