From 34b2ac37b87e4fbc79541d0e31991981785eb401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E5=96=B5=E5=92=AA?= <15233722133@163.com> Date: Tue, 8 Sep 2026 11:10:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=80=89=E5=93=81=E5=B9=BF=E5=9C=BA?= =?UTF-8?q?=E8=B4=AD=E4=B9=B0=E7=BB=93=E7=AE=97=E8=BF=94=E5=9B=9E=E5=8E=9F?= =?UTF-8?q?=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debug-app-map-markers-regression.md | 29 + manifest.json | 4 +- pages/index/aiStore.vue | 38 +- .../components/aistore_earnings_carousel.vue | 104 +- pages/order/addressSelection.vue | 13 +- pages/pay/result.vue | 2 +- pages/user/goods_details_store/index.vue | 1479 ++++++++++------- static/icon/map.png | Bin 0 -> 2407 bytes 8 files changed, 1039 insertions(+), 630 deletions(-) create mode 100644 debug-app-map-markers-regression.md create mode 100644 static/icon/map.png diff --git a/debug-app-map-markers-regression.md b/debug-app-map-markers-regression.md new file mode 100644 index 0000000..e5dcee2 --- /dev/null +++ b/debug-app-map-markers-regression.md @@ -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 | **`` 标签 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_`,把日志贴给我。 diff --git a/manifest.json b/manifest.json index cf08535..a7d146f 100644 --- a/manifest.json +++ b/manifest.json @@ -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" : { diff --git a/pages/index/aiStore.vue b/pages/index/aiStore.vue index 5f99fb8..56edc8f 100644 --- a/pages/index/aiStore.vue +++ b/pages/index/aiStore.vue @@ -6,6 +6,7 @@ :showLeftButton="false" > + - + @@ -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 { diff --git a/pages/index/components/aistore_earnings_carousel.vue b/pages/index/components/aistore_earnings_carousel.vue index b2ed96b..6be4c27 100644 --- a/pages/index/components/aistore_earnings_carousel.vue +++ b/pages/index/components/aistore_earnings_carousel.vue @@ -1,48 +1,53 @@ @@ -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; } diff --git a/pages/order/addressSelection.vue b/pages/order/addressSelection.vue index 5427802..be4dd30 100644 --- a/pages/order/addressSelection.vue +++ b/pages/order/addressSelection.vue @@ -62,8 +62,8 @@ >{{ state.pickUpInfo.name }} {{ state.pickUpInfo.phone }} - - {{ state.pickUpInfo.district }}{{ ', ' + state.pickUpInfo.description }} + + {{ formatPickUpAddress(state.pickUpInfo) }} @@ -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; diff --git a/pages/pay/result.vue b/pages/pay/result.vue index df765ef..8162782 100644 --- a/pages/pay/result.vue +++ b/pages/pay/result.vue @@ -122,7 +122,7 @@ }); const goAiStoreMyShopTab = () => { - const url = '/pages/index/aiStore?tab=1'; + const url = '/pages/index/aiStore?tab=0'; uni.redirectTo({ url, fail: () => { diff --git a/pages/user/goods_details_store/index.vue b/pages/user/goods_details_store/index.vue index 82ca5dc..8870e7c 100644 --- a/pages/user/goods_details_store/index.vue +++ b/pages/user/goods_details_store/index.vue @@ -13,27 +13,27 @@ /> - - + - - {{ selectedStore.name || '自提门店' }} - - 附近自提点 共{{ filteredStoreList.length }}家 - - + + #{{ index + 1 }} - {{ item.name }} - - {{ getStoreStatusText(item.status) }} - - - {{ formatDistance(item.distance) }} - - - {{ formatAddress(item) || '--' }} - - - - - 营业中 {{ formatBusinessHours(item) }} - - - - 导航 + + + {{ item.name }} 选择 + v-if="getStoreStatusText(item.status)" + class="store-status" + :class="`store-status--${getStoreStatusLevel(item.status)}`" + > + {{ getStoreStatusText(item.status) }} + + + {{ formatDistance(item.distance) }} + + + + {{ formatAddress(item) || '--' }} + + + + + 营业中 {{ formatBusinessHours(item) }} + + + + 导航 + 选择 + - + + + + diff --git a/static/icon/map.png b/static/icon/map.png new file mode 100644 index 0000000000000000000000000000000000000000..96d37e7f1656f443c4b265da5cb544d8683cc796 GIT binary patch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