feat: 选品广场购买结算返回原位
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
# Debug Session: app-map-markers-regression
|
||||
|
||||
- **Status**: [OPEN]
|
||||
- **Created**: 2026-09-07
|
||||
- **File Target**: pages/user/goods_details_store/index.vue
|
||||
- **Symptom**: 打包的 App 端「选择自提门店」页,地图瓦片 + 门店标点(大头针+气泡)都不展示;H5/Dev 端正常。
|
||||
|
||||
## Hypotheses(可证伪)
|
||||
|
||||
| # | 假设 | 预测(插桩后要看到什么) | 关键观察点 |
|
||||
|---|---|---|---|
|
||||
| H1 | **Canvas 同时指定了 CSS 类 + inline style 双重定位,App 端 CSS `.marker-canvas` 的 `position:absolute;left:0;top:0;transform:scale(0)` 覆盖 inline `position:absolute;left:-9999px`,导致画布跑到地图左上角可视区 but `scale(0)` → **canvas 尺寸按 CSS 类变成 0×0(因为 CSS class 宽高没写)→ GPU 丢帧/ `canvasToTempFilePath` 返回空** → `commitMarkerResult` 写入 fallbackFinal 为 `_www/static/icon/map.png`(裸相对路径)→ `buildMarkers.filter(m=>!!icon)` OK 但 **plus.map BitmapFactory 解析 `_www/static/icon/map.png` 失败(之前是靠 copyTo 沙箱 `file://` 才成功)** → 所有 marker 静默丢弃。 | `DBG_CANVAS_POS`:模板 L93 同时有 class="marker-canvas" 和 inline style 重复 position → plus 渲染层 CSS 覆盖 inline,导致 canvas 实际尺寸 0。 | 模板 L93 冲突;renderMarkerIcon successCb `resultPath` 空,fallbackFinal=`_www/static/icon/map.png`,buildMarkers 后 markers 数组长度=N 但原生端 render 失败。 |
|
||||
| H2 | **getFallbackStoreIcon 同步路径(L409-L426)所有分支都返回空**:冷启动 `plus.io.convertLocalFileSystemURL(MARKER_PIN_PNG_WWW)` 返回 undefined 或空串 → `_cachedFallbackStoreIcon` 永远空 → 异步 copyTo(L428+)是 Promise 但 renderMarkerIcon 同步就拿 fallbackIcon = '' → `fallbackFinal = getFinalFallback('') = MARKER_PIN_PNG_WWW = '_www/static/icon/map.png'` → 与 H1 同终点,BitmapFactory 不认。 | `DBG_FALLBACK_INIT`:getFallbackStoreIcon 同步返回 '' / MARKER_PIN_PNG_WWW,非 file:// 开头;copyTo 成功后 buildMarkers 二次触发后仍不生效(因为 tryFixIcon 把 file:// 路径再 normalize 一遍反而丢)。 | getFallbackStoreIcon() 返回值;copyTo 后 _cachedFallbackStoreIcon 的值;buildMarkers 最终 marker.iconPath 类型。 |
|
||||
| H3 | **buildMarkers 末尾 filter 把所有 marker 都剔了**:L777-L780 `return !!icon`,但 `tryFixIcon` 在 `plus` 存在时把所有合法路径都当非法处理返回 `safeFallback = MARKER_PIN_PNG_WWW = '_www/static/icon/map.png'`(H1/H2),或者 `state.markerIconMap[getMarkerKey(id,false)]` 在 prepareMarkerIcons 3 并发下被 acquireCanvasLock 超时(4s)强制释放,renderMarkerIcon 抛异常走 `top exception` 分支写入空串,被 filter 踢。 | `DBG_BUILD_FILTERED`:buildMarkers 输入 filteredStoreList.value.length 输出 0;或输出 >0 但每一项 iconPath 都不是 file:// 前缀。 | buildMarkers 入口 list 长度;map 后中间数组里每项 iconPath 字符串;最终 newMarkers 长度。 |
|
||||
| H4 | **`<map>` 标签 setting 驼峰没问题,但 plus 引擎在打包 release 构建时 `state.mapLatitude / state.mapLongitude` 初始值**(L134-L135 北京 39.9/116.4)被 tree-shaking 或 Vite 打包时 `reactive` 内数字丢失(非 0 但 NaN / Infinity)→ 原生地图中心错 + triggerMapRefresh 抖属性失败 → 瓦片白屏 + markers 数组存在但被挪到了无穷远。 | `DBG_MAP_COORDS`:onLoad 后 state.mapLatitude/state.mapLongitude/state.mapScale 的类型是 string 或 NaN,triggerMapRefresh `state.mapScale = 0` 后恢复失败。 | onLoad 时 state 初始值;triggerMapRefresh 两次 setTimeout 前后值;`Number.isNaN` / `typeof`。 |
|
||||
| H5 | **`callout.display='BYCLICK'` 在打包 App 版旧 plus 引擎上不识别**(只认 'ALWAYS'/'NEVER'),L774 设置 `BYCLICK` → 整个 markers 数组被原生端静默整个丢弃(符合 project_memory 硬约束)。 | `DBG_CALLOUT`:改为 'ALWAYS' 或 'NEVER' 后 markers 立刻出。 | buildMarkers 数组有内容但原生端一个都不画;替换后正常。 |
|
||||
|
||||
## Instrumentation Plan(不改业务逻辑,仅加 console.warn 前缀 DBG_)
|
||||
|
||||
1. **模板 L93**:确认 canvas class + inline 重复(`.marker-canvas` 里 `position:absolute;left:0;top:0;transform:scale(0)` vs inline `position:absolute;left:-9999px`)→ **先静态验证 H1(模板里已经写了双重 position:absolute)**
|
||||
2. **buildMarkers**(L748-L781):每 10 个店 `console.warn('[DBG_BUILD]', {inputLen:list.length, safeFallback, isStatic_safeFallback: isStaticRawPath(safeFallback), newMarkers_len: newMarkers.length, first_3_markers: newMarkers.slice(0,3).map(m=>({id:m.id, iconPathPrefix: (m.iconPath||'').slice(0,20), w:m.width, h:m.height, callout: m.callout?.display}))})`
|
||||
3. **getFallbackStoreIcon**(L408-L492):同步出口 & copyTo 出口各打 1 条:`[DBG_FALLBACK_SYNC] return=${v?.slice?.(0,30)}; [DBG_FALLBACK_COPY] copied=${v?.slice?.(0,50)}`
|
||||
4. **renderMarkerIcon** draw 结束:L627 successCb 和 L628 failCb 各 1 条:`[DBG_CANVAS_OK] key=${key} resultLen=${res?.tempFilePath?.length||0}, finalResultAfterResolve=${(resultPath||'').slice(0,40)}; [DBG_CANVAS_FAIL] key=${key}`
|
||||
5. **onLoad 初始 state**:L924 try 开头加 `[DBG_MAP_INIT] {lat: state.mapLatitude, lon: state.mapLongitude, t_lat: typeof state.mapLatitude, t_lon: typeof state.mapLongitude, nan: Number.isNaN(state.mapLatitude)}`
|
||||
|
||||
## Reproduce Steps(对用户)
|
||||
1. 打 release 包安装冷启动打开「选择自提门店」页;
|
||||
2. 停留 10s 以上,确保 copyTo + prepareMarkerIcons 3 并发全部跑;
|
||||
3. 连上 HBuilderX 控制台 / 或 Android Studio logcat 过滤 `[DBG_`,把日志贴给我。
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
"name" : "优购商城",
|
||||
"appid" : "__UNI__8B19741",
|
||||
"description" : "",
|
||||
"versionName" : "1.7.1",
|
||||
"versionCode" : 171,
|
||||
"versionName" : "1.7.3",
|
||||
"versionCode" : 173,
|
||||
"transformPx" : false,
|
||||
"app-plus" : {
|
||||
"privacy" : {
|
||||
|
||||
+29
-9
@@ -6,6 +6,7 @@
|
||||
:showLeftButton="false"
|
||||
>
|
||||
<view class="ai-store-page h100 flex-column">
|
||||
<view v-if="index === 0" class="page-bg page-bg--ai"></view>
|
||||
<view class="top-area" :class="{'top-area1': index === 1}">
|
||||
<view class="tab-header">
|
||||
<view
|
||||
@@ -40,7 +41,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<aistore_earnings_carousel v-if="index === 0" :pageSize="30" />
|
||||
<!-- <view class="m-t-16 m-b-8" v-if="timeRound.length && index === 0">
|
||||
<view class="m-t-16 m-b-8" v-if="timeRound.length && index === 0">
|
||||
<scroll-view scroll-x class="time-scroll">
|
||||
<view class="flex">
|
||||
<view
|
||||
@@ -54,7 +55,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view style="padding: 80rpx 0 120rpx" v-if="index === 1">
|
||||
<view style="position: relative">
|
||||
<view class="shop-summary-card">
|
||||
@@ -353,11 +354,12 @@
|
||||
status: mescroll?.params?.status,
|
||||
});
|
||||
} else {
|
||||
const id = selectedTimeId.value;
|
||||
res = await api.getSpuPage({
|
||||
pageNo: mescroll?.num || 1,
|
||||
pageSize: mescroll?.size || 10,
|
||||
keyWord: searchText.value,
|
||||
// timeId: selectedTimeId.value,
|
||||
...(id !== null && id !== undefined && id !== '' ? { timeId: id } : {}),
|
||||
...mescroll.params,
|
||||
});
|
||||
}
|
||||
@@ -472,16 +474,32 @@
|
||||
|
||||
.ai-store-page {
|
||||
min-height: 100vh;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.page-bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.page-bg--ai {
|
||||
background: url('/static/ai_bg.png') no-repeat center top;
|
||||
background-size: 100% auto;
|
||||
}
|
||||
|
||||
.top-area {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
padding: 0 24rpx 24rpx;
|
||||
background: url('/static/ai_bg.png') no-repeat center top;
|
||||
background-size: cover;
|
||||
// border-radius: 0 0 30rpx 30rpx;
|
||||
}
|
||||
.top-area1{
|
||||
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
background: #2556ec;
|
||||
}
|
||||
|
||||
@@ -560,8 +578,10 @@
|
||||
padding: 0 22rpx;
|
||||
border-radius: 28rpx;
|
||||
font-size: 28rpx;
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
// color: rgba(255, 255, 255, 0.85);
|
||||
color: #2556ec;
|
||||
background: rgba(255, 255, 255, 0.55);
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.01);
|
||||
}
|
||||
|
||||
.activeTime {
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
<template>
|
||||
<view class="earnings-carousel">
|
||||
<view class="earnings-header">
|
||||
<view class="earnings-header" @click="toggleCollapsed">
|
||||
<view class="earnings-title">
|
||||
<view class="earnings-title__icon">
|
||||
<image class="earnings-title__icon-img" src="/static/icon/medal.png" mode="aspectFit" />
|
||||
</view>
|
||||
<view class="earnings-title__text">销量风云榜</view>
|
||||
</view>
|
||||
<view class="earnings-collapse-icon" :class="{ collapsed: isCollapsed }">
|
||||
<text class="earnings-collapse-arrow">▾</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-show="!isCollapsed" class="earnings-content">
|
||||
<swiper
|
||||
class="earnings-swiper"
|
||||
:current="currentPageIndex"
|
||||
:autoplay="autoplay"
|
||||
:autoplay="autoplay && !isCollapsed"
|
||||
:interval="interval"
|
||||
:duration="duration"
|
||||
:circular="swiperPages.length > 1"
|
||||
@@ -44,6 +48,7 @@
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -72,11 +77,25 @@
|
||||
type: Number,
|
||||
default: 450,
|
||||
},
|
||||
defaultCollapsed: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const MAX_PAGES = 30;
|
||||
const DISPLAY_SIZE = 5;
|
||||
|
||||
const isCollapsed = ref(Boolean(props.defaultCollapsed));
|
||||
const toggleCollapsed = () => {
|
||||
isCollapsed.value = !isCollapsed.value;
|
||||
if (!isCollapsed.value) {
|
||||
schedulePrefetchNext(true);
|
||||
} else {
|
||||
clearPrefetch();
|
||||
}
|
||||
};
|
||||
|
||||
const currentPageIndex = ref(0);
|
||||
const total = ref(0);
|
||||
const pagesMap = ref({});
|
||||
@@ -263,7 +282,8 @@
|
||||
.earnings-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 6rpx 0;
|
||||
justify-content: space-between;
|
||||
padding: 0 6rpx 12rpx;
|
||||
}
|
||||
|
||||
.earnings-title {
|
||||
@@ -294,6 +314,28 @@
|
||||
color: #1d4ed8;
|
||||
}
|
||||
|
||||
.earnings-collapse-icon {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: transform 0.25s ease;
|
||||
&.collapsed {
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
.earnings-collapse-arrow {
|
||||
font-size: 36rpx;
|
||||
color: #1d4ed8;
|
||||
line-height: 1;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
|
||||
.earnings-content {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.earnings-swiper {
|
||||
height: 280rpx;
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@
|
||||
>{{ state.pickUpInfo.name }}
|
||||
<text class="phone">{{ state.pickUpInfo.phone }}</text>
|
||||
</view>
|
||||
<view class="line1">
|
||||
{{ state.pickUpInfo.district }}{{ ', ' + state.pickUpInfo.description }}
|
||||
<view class="line1 line2">
|
||||
{{ formatPickUpAddress(state.pickUpInfo) }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="addressCon" v-else>
|
||||
@@ -145,6 +145,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 格式化自提门店地址,优先使用 address 字段
|
||||
function formatPickUpAddress(info = {}) {
|
||||
const address = info?.address || '';
|
||||
if (address) return address;
|
||||
const district = info?.district || '';
|
||||
const description = info?.description || '';
|
||||
return `${district}${description ? `, ${description}` : ''}`.trim();
|
||||
}
|
||||
|
||||
// 收货方式切换
|
||||
const switchDeliveryType = (type) => {
|
||||
state.value.deliveryType = type;
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
});
|
||||
|
||||
const goAiStoreMyShopTab = () => {
|
||||
const url = '/pages/index/aiStore?tab=1';
|
||||
const url = '/pages/index/aiStore?tab=0';
|
||||
uni.redirectTo({
|
||||
url,
|
||||
fail: () => {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Reference in New Issue
Block a user