Commit 5d9cd376 by 张立顺

Merge branch 'v1.4.0' into V5.8.2

2 parents fee0c673 037af353
...@@ -123,11 +123,27 @@ public class Agreement extends AuditingEntity implements Serializable { ...@@ -123,11 +123,27 @@ public class Agreement extends AuditingEntity implements Serializable {
FAPAI_PRIVACY, FAPAI_PRIVACY,
/**
* 优惠券协议 1
*/
COUPON_1, COUPON_1,
/**
* 优惠券协议 2
*/
COUPON_2, COUPON_2,
/**
* 优惠券协议 3
*/
COUPON_3, COUPON_3,
/**
* 优惠券协议 4
*/
COUPON_4, COUPON_4,
/**
* 优惠券协议 5
*/
COUPON_5, COUPON_5,
; ;
} }
......
...@@ -4,19 +4,9 @@ MODE = 'development' ...@@ -4,19 +4,9 @@ MODE = 'development'
# 发布路径 # 发布路径
PUBLISH_PATH = '/' PUBLISH_PATH = '/'
# 平台端请求路径 # 平台端请求路径(生产/回退默认;开发态改 src/config/activeDevApiEnv.ts)
# VITE_APP_API_BASE_URL = 'http://192.168.0.108:5001/rest/' VITE_APP_API_URL=https://aus.test.glsx.com.cn/app/api/
# VITE_APP_API_URL = 'http://localhost:6901/api/' VITE_APP_API_BASE_URL=https://aus.test.glsx.com.cn/app/
# VITE_APP_API_BASE_URL = 'http://localhost:6901/'
# VITE_APP_API_URL = 'https://aus.glsx.com.cn/app/api/'
# VITE_APP_API_BASE_URL = 'https://aus.glsx.com.cn/app/'
VITE_APP_API_URL = 'https://aus.test.glsx.com.cn/app/api/'
VITE_APP_API_BASE_URL = 'https://aus.test.glsx.com.cn/app/'
# VITE_APP_API_URL = 'http://192.168.1.125:6901/api/'
# VITE_APP_API_BASE_URL = 'http://192.168.1.125:6901/'
# 优惠券相关 CDN 图:`{BASE}/{文件名}`,与 dj-aus 小程序资源路径对齐 # 优惠券相关 CDN 图:`{BASE}/{文件名}`,与 dj-aus 小程序资源路径对齐
VITE_APP_COUPON_IMAGE_BASE_URL=https://img01.glsx.com.cn/weapp/resource/dj-aus/images/coupon VITE_APP_COUPON_IMAGE_BASE_URL=https://img01.glsx.com.cn/weapp/resource/dj-aus/images/coupon
......
...@@ -9,11 +9,11 @@ PUBLISH_PATH = '/' ...@@ -9,11 +9,11 @@ PUBLISH_PATH = '/'
# VITE_APP_API_URL = 'http://120.237.107.125:6911/api/' # VITE_APP_API_URL = 'http://120.237.107.125:6911/api/'
# VITE_APP_API_BASE_URL = 'http://120.237.107.125:6911/' # VITE_APP_API_BASE_URL = 'http://120.237.107.125:6911/'
# VITE_APP_API_URL = 'https://aus.glsx.com.cn/app/api/' VITE_APP_API_URL = 'https://aus.glsx.com.cn/app/api/'
# VITE_APP_API_BASE_URL = 'https://aus.glsx.com.cn/app/' VITE_APP_API_BASE_URL = 'https://aus.glsx.com.cn/app/'
VITE_APP_API_URL = 'https://aus.test.glsx.com.cn/app/api/' # VITE_APP_API_URL = 'https://aus.test.glsx.com.cn/app/api/'
VITE_APP_API_BASE_URL = 'https://aus.test.glsx.com.cn/app/' # VITE_APP_API_BASE_URL = 'https://aus.test.glsx.com.cn/app/'
VITE_APP_COUPON_IMAGE_BASE_URL=https://img01.glsx.com.cn/weapp/resource/dj-aus/images/coupon VITE_APP_COUPON_IMAGE_BASE_URL=https://img01.glsx.com.cn/weapp/resource/dj-aus/images/coupon
......
...@@ -52,7 +52,7 @@ const getLocationFn = () => { ...@@ -52,7 +52,7 @@ const getLocationFn = () => {
}, },
fail(err) { fail(err) {
console.error('获取位置失败', err); console.error('获取位置失败', err);
if (err.errMsg.indexOf('deny') !== -1) { if (err?.errMsg?.indexOf('deny') !== -1) {
uni.showModal({ uni.showModal({
title: '权限提示', title: '权限提示',
content: '您拒绝了位置权限,是否去设置中开启?', content: '您拒绝了位置权限,是否去设置中开启?',
......
export type CouponFacePresent =
| { mode: "wan"; wanMain: string }
| { mode: "yuan"; text: string };
/** 去掉小数点后无意义的尾随 0(如 9.00 → 9,9.50 → 9.5) */
function trimTrailingDotZeros(s: string): string {
let t = s;
if (t.endsWith(".00")) {
return t.slice(0, -3);
}
while (t.endsWith("0") && t.includes(".")) {
t = t.slice(0, -1);
}
return t.endsWith(".") ? t.slice(0, -1) : t;
}
/** 防抖到分再格式化为字符串,去掉无意义的尾随 0(如 9.00 → 9,9.50 → 9.5) */
function trimYuanDisplay(amount: number): string {
const centsSafe = Math.round(amount * 100) / 100;
return trimTrailingDotZeros(centsSafe.toFixed(2));
}
/**
* ≥10000:以「万」为单位,金额按元先向下截断到「分」再换算(与 /10000 四舍五入取整相比不误进位)。
* 例:9999999.99 元 → 999.99万,而非 round 后的 1000万。
*/
function formatWanMainFromAmount(amount: number): string {
const wanTruncToCent = Math.floor(amount / 100 + 1e-9) / 100;
return trimTrailingDotZeros(wanTruncToCent.toFixed(2));
}
/** 优惠券卡面左侧主数字语义:≥10000 用「万」展示(最多两位小数,截断非四舍五入);否则为元 */
export function getCouponFacePresent(amount: number): CouponFacePresent {
if (!Number.isFinite(amount) || amount <= 0) {
return { mode: "yuan", text: "0" };
}
if (amount >= 10000) {
const wanMain = formatWanMainFromAmount(amount);
return { mode: "wan", wanMain: wanMain || "0" };
}
return { mode: "yuan", text: trimYuanDisplay(amount) };
}
/** 金额紧凑文案(不带 ¥):过万为 「1万」「999.99万」;未满万只数字片段;不含汉字「元」 */
export function formatCouponMoneyCompact(amount: number): string {
const p = getCouponFacePresent(amount);
if (p.mode === "wan") return `${p.wanMain}万`;
return p.text;
}
/** 用于单行文案的金额段:过万为 「¥1万」;未满万只数字,不写「元」、不加 ¥ */
export function formatCouponCaptionWithMoneySymbol(amount: number): string {
const p = getCouponFacePresent(amount);
const compact = formatCouponMoneyCompact(amount);
if (p.mode === "wan") {
return `¥${compact}`;
}
return compact;
}
/** 支付明细行「−…」:过万 `-¥1万`,未满万 `−金额`(无 ¥、无「元」) */
export function formatCouponDeductionMinus(amount: number): string {
const p = getCouponFacePresent(amount);
const compact = formatCouponMoneyCompact(amount);
if (p.mode === "wan") {
return `-¥${compact}`;
}
return `-${compact}`;
}
const DENSE_SM = "coupon-face--sm";
const DENSE_XS = "coupon-face--xs";
/**
* 收窄容器内避免单行撑破:根据紧凑文案长度档位缩小字号。
* 绑定在左侧金额外层(与 mode 无关,统一看最终展示跨度)。
*/
export function couponFaceAmountDenseClass(amount: number): string {
const compact = formatCouponMoneyCompact(amount);
const digitLen = compact.replace(/\./g, "").replace("万", "").length;
if (compact.includes("万")) {
if (digitLen >= 5) return DENSE_XS;
if (digitLen >= 2) return DENSE_SM;
return "";
}
if (digitLen >= 6) return DENSE_XS;
if (digitLen >= 4) return DENSE_SM;
return "";
}
...@@ -15,9 +15,18 @@ ...@@ -15,9 +15,18 @@
<scroll-view scroll-y class="benefit-scroll" :show-scrollbar="true"> <scroll-view scroll-y class="benefit-scroll" :show-scrollbar="true">
<view v-for="item in payload.couponList" :key="item.couponId" class="coupon-ticket"> <view v-for="item in payload.couponList" :key="item.couponId" class="coupon-ticket">
<view class="coupon-ticket__amt"> <view class="coupon-ticket__amt" :class="couponFaceDenseClass(item.faceAmount)">
<text class="coupon-ticket__y">¥</text> <text class="coupon-ticket__y">¥</text>
<text class="coupon-ticket__num">{{ formatFaceThousands(item.faceAmount) }}</text> <template v-if="couponFacePresent(item.faceAmount).mode === 'wan'">
<text class="coupon-ticket__wan-num">{{
couponFacePresent(item.faceAmount).wanMain
}}</text>
<text class="coupon-ticket__wan-unit">万</text>
</template>
<template v-else>
<text class="coupon-ticket__num">{{
couponFacePresent(item.faceAmount).text }}</text>
</template>
</view> </view>
<view class="coupon-ticket__body"> <view class="coupon-ticket__body">
<view class="coupon-ticket__name">{{ item.templateName }}</view> <view class="coupon-ticket__name">{{ item.templateName }}</view>
...@@ -64,6 +73,11 @@ import { ...@@ -64,6 +73,11 @@ import {
trackCouponPopupClose, trackCouponPopupClose,
} from "@/common/eventTracking"; } from "@/common/eventTracking";
import { couponImageUrl } from "@/common/couponImageUrl"; import { couponImageUrl } from "@/common/couponImageUrl";
import {
couponFaceAmountDenseClass,
getCouponFacePresent,
type CouponFacePresent,
} from "@/common/couponFaceAmount";
/** CDN 文件名(基础域名见 `VITE_APP_COUPON_IMAGE_BASE_URL`);popupType===1 过户成功与其余类型各一张 */ /** CDN 文件名(基础域名见 `VITE_APP_COUPON_IMAGE_BASE_URL`);popupType===1 过户成功与其余类型各一张 */
const COUPON_HEADER_SUCCESS = "success.png"; const COUPON_HEADER_SUCCESS = "success.png";
...@@ -198,16 +212,12 @@ export default class CouponHomeBenefitPopup extends Vue { ...@@ -198,16 +212,12 @@ export default class CouponHomeBenefitPopup extends Vue {
return this.layoutVariant === "aggregateRewards" ? "一键收下" : "我知道了"; return this.layoutVariant === "aggregateRewards" ? "一键收下" : "我知道了";
} }
formatFaceThousands(n: number): string { couponFacePresent(amount: number): CouponFacePresent {
const x = Number(n); return getCouponFacePresent(amount);
if (!Number.isFinite(x)) { }
return "0";
} couponFaceDenseClass(amount: number): string {
return x.toLocaleString("zh-CN", { return couponFaceAmountDenseClass(amount);
useGrouping: true,
minimumFractionDigits: 0,
maximumFractionDigits: 2,
});
} }
formatValidEndDate(raw: string): string { formatValidEndDate(raw: string): string {
...@@ -455,8 +465,11 @@ export default class CouponHomeBenefitPopup extends Vue { ...@@ -455,8 +465,11 @@ export default class CouponHomeBenefitPopup extends Vue {
} }
.coupon-ticket__amt { .coupon-ticket__amt {
width: 76px; max-width: 72px;
height: 76px; width: 72px;
max-height: 72px;
aspect-ratio: 1;
box-sizing: border-box;
flex-shrink: 0; flex-shrink: 0;
background: #fff0f0; background: #fff0f0;
display: flex; display: flex;
...@@ -468,15 +481,60 @@ export default class CouponHomeBenefitPopup extends Vue { ...@@ -468,15 +481,60 @@ export default class CouponHomeBenefitPopup extends Vue {
margin-right: 6px; margin-right: 6px;
margin-bottom: 6px; margin-bottom: 6px;
margin-left: 6px; margin-left: 6px;
box-sizing: border-box; flex-wrap: nowrap;
min-width: 0;
} }
.coupon-ticket__y { .coupon-ticket__y {
font-family: "numberNor", sans-serif; font-family: "numberNor", sans-serif;
font-size: 20px; font-size: 14px;
font-weight: 700; font-weight: 600;
color: #ff5500; color: #ff5500;
line-height: 1.15; line-height: 1.15;
margin-right: 1px;
}
.coupon-ticket__wan-num {
font-family: "numberNor", sans-serif;
font-size: 22px;
font-weight: 700;
color: #ff5500;
line-height: 1.05;
}
.coupon-ticket__wan-unit {
font-family: "numberNor", sans-serif;
font-size: 16px;
font-weight: 700;
color: #ff5500;
line-height: 1.1;
margin-left: 1px;
}
.coupon-ticket__amt.coupon-face--sm .coupon-ticket__y {
font-size: 12px;
}
.coupon-ticket__amt.coupon-face--sm .coupon-ticket__wan-num,
.coupon-ticket__amt.coupon-face--sm .coupon-ticket__num {
font-size: 18px;
}
.coupon-ticket__amt.coupon-face--sm .coupon-ticket__wan-unit {
font-size: 14px;
}
.coupon-ticket__amt.coupon-face--xs .coupon-ticket__y {
font-size: 11px;
}
.coupon-ticket__amt.coupon-face--xs .coupon-ticket__wan-num,
.coupon-ticket__amt.coupon-face--xs .coupon-ticket__num {
font-size: 14px;
}
.coupon-ticket__amt.coupon-face--xs .coupon-ticket__wan-unit {
font-size: 12px;
} }
.coupon-ticket__num { .coupon-ticket__num {
...@@ -484,7 +542,7 @@ export default class CouponHomeBenefitPopup extends Vue { ...@@ -484,7 +542,7 @@ export default class CouponHomeBenefitPopup extends Vue {
font-size: 20px; font-size: 20px;
font-weight: 700; font-weight: 700;
color: #ff5500; color: #ff5500;
margin-left: 2px; margin-left: 1px;
line-height: 1.15; line-height: 1.15;
} }
......
import type { DevApiEnvKey } from "@/config/devApiEnvironments";
/**
* 开发态 API 环境:改下面这一行并保存,在微信开发者工具里编译/刷新即可。
* 无需改 `.env`、无需重启 `npm run dev:mp-weixin`。
*
* 可选值见 `devApiEnvironments.ts`:test | prod | local-125 | local-6901 | local-108
*/
// export const ACTIVE_DEV_API_ENV: DevApiEnvKey = "local-125";
export const ACTIVE_DEV_API_ENV: DevApiEnvKey = "test";
/** 各环境 URL 定义;切换请改 `activeDevApiEnv.ts` 中的 `ACTIVE_DEV_API_ENV` */
export type DevApiEnvKey = 'test' | 'prod' | 'local-125' | 'local-6901' | 'local-108';
export interface ApiEnvConfig {
apiUrl: string;
baseUrl: string;
label: string;
}
/** 开发态可切换的 API 预设(与 `.env.development` 历史注释块对齐) */
export const DEV_API_ENVIRONMENTS: Record<DevApiEnvKey, ApiEnvConfig> = {
test: {
label: '测试 aus.test',
apiUrl: 'https://aus.test.glsx.com.cn/app/api/',
baseUrl: 'https://aus.test.glsx.com.cn/app/',
},
prod: {
label: '生产 aus',
apiUrl: 'https://aus.glsx.com.cn/app/api/',
baseUrl: 'https://aus.glsx.com.cn/app/',
},
'local-125': {
label: '内网 192.168.1.125',
apiUrl: 'http://192.168.1.125:6901/api/',
baseUrl: 'http://192.168.1.125:6901/',
},
'local-6901': {
label: '本机 localhost:6901',
apiUrl: 'http://localhost:6901/api/',
baseUrl: 'http://localhost:6901/',
},
'local-108': {
label: '内网 192.168.0.108',
apiUrl: 'http://192.168.0.108:5001/rest/api/',
baseUrl: 'http://192.168.0.108:5001/rest/',
},
};
export const DEV_API_ENV_KEYS = Object.keys(DEV_API_ENVIRONMENTS) as DevApiEnvKey[];
export function isDevApiEnvKey(key: string): key is DevApiEnvKey {
return (DEV_API_ENV_KEYS as string[]).includes(key);
}
import {ACTIVE_DEV_API_ENV} from '@/config/activeDevApiEnv';
import {DEV_API_ENVIRONMENTS, type DevApiEnvKey} from '@/config/devApiEnvironments';
export interface ResolvedApiConfig {
apiUrl: string;
baseUrl: string;
devEnvKey?: DevApiEnvKey;
}
function trimEnvUrl(value: unknown): string {
return String(value ?? '').trim().replace(/^['"]|['"]$/g, '');
}
export function getEnvDefaultApiConfig(): Pick<ResolvedApiConfig, 'apiUrl' | 'baseUrl'> {
return {
apiUrl: trimEnvUrl(import.meta.env.VITE_APP_API_URL),
baseUrl: trimEnvUrl(import.meta.env.VITE_APP_API_BASE_URL),
};
}
/**
* 生产:仅用 `.env.production`。
* 开发:使用 `activeDevApiEnv.ts` 中的 `ACTIVE_DEV_API_ENV`。
*/
export function resolveApiConfig(): ResolvedApiConfig {
const defaults = getEnvDefaultApiConfig();
if (!import.meta.env.DEV) {
return defaults;
}
const preset = DEV_API_ENVIRONMENTS[ACTIVE_DEV_API_ENV];
return {
apiUrl: preset.apiUrl,
baseUrl: preset.baseUrl,
devEnvKey: ACTIVE_DEV_API_ENV,
};
}
/// <reference types="vite/client" /> /// <reference types="vite/client" />
interface ImportMetaEnv { interface ImportMetaEnv {
readonly VITE_APP_API_URL?: string;
readonly VITE_APP_API_BASE_URL?: string;
readonly VITE_APP_COUPON_IMAGE_BASE_URL?: string; readonly VITE_APP_COUPON_IMAGE_BASE_URL?: string;
/** 业务埋点 `POST`,默认相对 `VITE_APP_API_URL` 为 `eventTracking/batchSave` */ /** 业务埋点 `POST`,默认相对 `VITE_APP_API_URL` 为 `eventTracking/batchSave` */
readonly VITE_APP_EVENT_TRACKING_PATH?: string; readonly VITE_APP_EVENT_TRACKING_PATH?: string;
...@@ -21,6 +23,7 @@ declare module "@vue/runtime-core" { ...@@ -21,6 +23,7 @@ declare module "@vue/runtime-core" {
$filters: any; $filters: any;
$auth: AuthService; $auth: AuthService;
$apiUrl: string; $apiUrl: string;
$baseUrl: string;
$store: Store<any>; $store: Store<any>;
$goBack: () => void; $goBack: () => void;
axios: any; axios: any;
......
...@@ -15,6 +15,7 @@ import {CustomTokenInterceptor} from "@/common/CustomTokenInterceptor"; ...@@ -15,6 +15,7 @@ import {CustomTokenInterceptor} from "@/common/CustomTokenInterceptor";
import store from "@/store"; import store from "@/store";
import mpAdapter from 'axios-miniprogram-adapter' import mpAdapter from 'axios-miniprogram-adapter'
import {BurialPoint} from "@/common/BurialPoint"; import {BurialPoint} from "@/common/BurialPoint";
import {resolveApiConfig} from "@/config/resolveApiConfig";
/// <reference types="@dcloudio/types" /> // 引入 uni 类型 /// <reference types="@dcloudio/types" /> // 引入 uni 类型
...@@ -35,9 +36,10 @@ const systemI18n = { ...@@ -35,9 +36,10 @@ const systemI18n = {
dayjs.extend(duration); dayjs.extend(duration);
export function createApp() { export function createApp() {
let apiUrl = import.meta.env.VITE_APP_API_URL; const {apiUrl, baseUrl, devEnvKey} = resolveApiConfig();
let baseUrl = import.meta.env.VITE_APP_API_BASE_URL; if (import.meta.env.DEV) {
console.log('baseUrl', apiUrl); console.log('[dev] API', devEnvKey ?? 'env-default', apiUrl);
}
const authService: AuthService = new AuthService(); const authService: AuthService = new AuthService();
// authService.deleteAuthentication(); // authService.deleteAuthentication();
...@@ -114,6 +116,7 @@ export function createApp() { ...@@ -114,6 +116,7 @@ export function createApp() {
app.config.globalProperties.$store = store; app.config.globalProperties.$store = store;
app.config.globalProperties.$auth = authService; app.config.globalProperties.$auth = authService;
return { return {
app, app,
}; };
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
"quickapp": {}, "quickapp": {},
/* 小程序特有相关 */ /* 小程序特有相关 */
"mp-weixin": { "mp-weixin": {
// "appid": "wxa719209ed933d667", // "appid": "wxa719209ed933d667",
"appid": "wx568d02f6352efd49", "appid": "wx568d02f6352efd49",
"setting": { "setting": {
"urlCheck": false, "urlCheck": false,
...@@ -47,9 +47,7 @@ ...@@ -47,9 +47,7 @@
}, },
"usingComponents": true, "usingComponents": true,
"lazyCodeLoading": "requiredComponents", "lazyCodeLoading": "requiredComponents",
"requiredPrivateInfos": [ "requiredPrivateInfos": ["getLocation"],
"getLocation"
],
"permission": { "permission": {
"scope.userLocation": { "scope.userLocation": {
"desc": "用于获取当前所在城市信息" "desc": "用于获取当前所在城市信息"
......
# AuctionVehiclePage 朋友圈分享问题排查与修复总结
> 维护说明:本文档与 [`AuctionVehiclePage.vue`](./AuctionVehiclePage.vue) 同目录,记录车辆详情页「分享到朋友圈」相关问题的现象、根因、排查思路与最终方案。修改分享逻辑或单页模式适配时请先阅读本文。
## 1. 背景与现象
| 场景 | 表现 |
|------|------|
| 分享给微信好友 | 正常打开详情页 |
| 分享到朋友圈(真机) | 曾出现白屏、标题显示 `uni-app`、内容区域空白 |
| 朋友圈打开后底部 | 固定显示「前往小程序」——**这是微信单页模式的正常 UI,不是 bug** |
Short Link 示例:`#小程序://优加车拍/车辆详情/xxxxx`
中间段为**页面标题**(取自 `pages.json` 的 `navigationBarTitleText`),不是页面路径。
---
## 2. 根因分层(按排查顺序)
### 2.1 分享参数名错误(第一层)
- **问题**:`onShareTimeline` 曾使用 `query: id=xxx`,而页面 `onLoad` 只读取 `aucvehId`。
- **结果**:车辆 ID 丢失,`auctionVehicle` 无法加载,内容区空白。
- **修复**:`query` 改为 `aucvehId=${id}`;`onLoad` 兼容 `option.aucvehId || option.id`。
### 2.2 页面配置缺失
- **问题**:未配置 `enableShareTimeline`;全局 `navigationBarTitleText` 默认为 `uni-app`。
- **结果**:朋友圈单页模式顶部标题显示 `uni-app`;分享能力未正确开启。
- **修复**:见 [`pages.json`](../../pages.json) 中 `AuctionVehiclePage` 配置块。
### 2.3 微信单页模式限制(scene 1154 / 1179)
从朋友圈打开时进入**单页模式**,特点:
- 无登录态(`wx.login` 等不可用)
- 禁止跳转其他小程序页面
- 顶部/底部固定栏由微信渲染,不可自定义
- 页面内容与小程序内为同一路径,但交互受限
因此单页模式下应:**只读展示完整详情**,竞拍/跳转等引导用户点击「前往小程序」。
### 2.4 单页模式未识别(真机白屏 + API 400)
- **问题**:仅在 `created()` 内注册 `onLoad` 时,朋友圈**冷启动**可能错过首次 `onLoad`,`isSinglePageMode` 保持 `false`。
- **证据**:真机 vConsole 出现 `GET bid/getLastedBidByLoginAccount → 400`(单页无登录态却调用了需登录接口)。
- **修复**:
- 类字段初始化阶段**同步**调用 `detectSinglePageMode()`、`parseAucvehIdFromEnterOptions()`
- 单页模式下跳过 `loadBidInfo`、收藏数、优惠券等需登录逻辑
### 2.5 `@Hook('onLoad') onPageLoad` 误用(首页回归)
- **问题**:`@Hook('onLoad') onPageLoad()` 被 vue-facing-decorator 注册为方法名 `onPageLoad`,uni-app 只识别 **`onLoad`**。
- **结果**:首页 `navigateTo` 进入详情时 `aucvehId` 未写入,提示「页面参数缺失」。
- **修复**:在 `created()` 内使用 `@dcloudio/uni-app` 的 `onLoad` / `onShow` / `onUnload` composable 注册(与 `@Hook('onShareTimeline')` 可并存,因分享钩子方法名与微信一致)。
### 2.6 uni-app 构建缺陷(shadow-grey.png)
- **问题**:编译后 `vendor.js` 中 `wx.preloadAssets` 预加载 `shadow-grey.png` 失败(500)。
- **修复**:[`vite.config.ts`](../../vite.config.ts) 中 `fixUniShadowGreyPreload` 插件在 `closeBundle` 时 patch。
### 2.7 已废弃方案
| 方案 | 说明 |
|------|------|
| 主包中转页 `AuctionVehicleSharePage` | 用户要求详情页右上角直接分享,已放弃 |
| 轻量预览 `VehicleTimelinePreview` | 内容过少,已改为单页模式展示完整详情只读 UI;**组件已删除,勿再引用** |
| `App.vue` 中 `wx.preloadSubpackage` | 曾导致首页空白,已移除,改用 `pages.json` 的 `preloadRule` |
---
## 3. 排查思路(建议真机 vConsole)
1. **Network**
- 接口域名是否正确(测试 `aus.test.glsx.com.cn` / 生产 `aus.glsx.com.cn`)
- 是否误调 `bid/getLastedBidByLoginAccount` → 单页模式未生效
2. **场景值**
- `uni.getEnterOptionsSync().scene === 1154` 或 `1179` → 单页模式
- `wx.getApiCategory() === 'browseOnly'` → 补充判断
3. **模拟 vs 真机**
- 开发者工具「模拟朋友圈」通常在已运行小程序内切换场景,**时序与真机冷启动不同**
- **以真机朋友圈打开为准**
4. **编译报错 `VehicleTimelinePreview.wxml`**
- 源文件已删但 `dist` 或开发者工具缓存残留
- 清理 `dist/dev/mp-weixin`、`dist/build/mp-weixin` 后重新 `npm run build:mp-weixin`,并清除微信开发者工具缓存
5. **标题仍显示 uni-app**
- 检查 `pages.json` 全局及页面级 `navigationBarTitleText`
- 确认已上传最新体验版
---
## 4. 最终方案架构
```
详情页右上角分享
→ onShareTimeline({ query: 'aucvehId=xxx' })
→ 朋友圈冷启动 scene=1154
→ 类字段同步 detectSinglePageMode + parseAucvehId
→ 渲染完整详情(只读)
→ onShow 调用 loadData()
→ 隐藏 customNav / 竞拍栏 / 弹窗
→ 用户点击「前往小程序」→ 完整小程序内交互
首页 navigateTo
→ created() 内 onLoad composable
→ isSinglePageMode=false
→ 完整详情 + 竞拍功能
```
---
## 5. 涉及文件
| 文件 | 作用 |
|------|------|
| [`AuctionVehiclePage.vue`](./AuctionVehiclePage.vue) | 单页检测、分享钩子、只读布局、生命周期 |
| [`pages.json`](../../pages.json) | `enableShareTimeline`、`navigationBarTitleText`、`navigationBarFit`、`preloadRule` |
| [`vite.config.ts`](../../vite.config.ts) | shadow-grey preload 补丁 |
| [`App.vue`](../../App.vue) | 无 `preloadSubpackage`(已移除) |
---
## 6. 验证清单
- [ ] 首页 → 点击车辆 → 详情正常,可竞拍
- [ ] 详情 → 分享朋友圈 → 真机打开:完整详情只读,非白屏
- [ ] 真机 vConsole 无 `getLastedBidByLoginAccount` 400
- [ ] 点击「前往小程序」→ 完整详情可交互
- [ ] 重新 build 后无 `VehicleTimelinePreview` 编译错误
---
## 7. 注意事项(勿踩坑)
1. **朋友圈分享**必须用 `onShareTimeline` + **`query`**,参数名 **`aucvehId`**;好友分享用 `onShareAppMessage` + **`path`**。
2. **单页模式**不可用 `@Hook('onLoad') onPageLoad`,须用 composable 或方法名 literally 为 `onLoad`。
3. **`isSinglePageMode` 必须在类字段初始化时同步检测**,不能仅依赖 `created()` 内的 `onLoad`。
4. **单页模式**禁止 `navigateTo`,应 toast 引导「请前往小程序使用完整服务」。
5. **API 环境**:开发改 `src/config/activeDevApiEnv.ts`;体验版/构建改 `.env.production` 后重新编译。
6. 修改分享或单页逻辑后,务必**真机朋友圈**验证,不要仅依赖开发者工具模拟。
---
## 8. 变更历史(摘要)
| 阶段 | 改动 |
|------|------|
| 1 | 修复 `onShareTimeline` query 参数名 |
| 2 | pages.json 分享配置 + 单页 loading 兜底 |
| 3 | 同步单页检测 + 登录 API 守卫 |
| 4 | 恢复 composable 生命周期,修复首页参数缺失 |
| 5 | 单页模式展示完整详情只读 UI |
| 6 | 删除 VehicleTimelinePreview,清理 dist 编译残留 |
...@@ -57,8 +57,7 @@ ...@@ -57,8 +57,7 @@
<view class="recharge-footer"> <view class="recharge-footer">
<view class="warning-text" v-if="order.orderState==='CONTRACT_UNSIGNED'"> <view class="warning-text" v-if="order.orderState==='CONTRACT_UNSIGNED'">
<template v-if="getRemainingBreachContract(order)>0"> <template v-if="getRemainingBreachContract(order)>0">
<van-count-down class="red-count-down" :time="getRemainingBreachContract(order)" format="HH:mm:ss"/> <van-count-down class="red-count-down" :time="getRemainingBreachContract(order)" format="HH:mm:ss 后将违约"/>
后将违约
</template> </template>
<template v-else> <template v-else>
请尽快签署合同并付款 请尽快签署合同并付款
...@@ -67,8 +66,7 @@ ...@@ -67,8 +66,7 @@
<view class="warning-text" v-if="order.orderState==='UNPAID'"> <view class="warning-text" v-if="order.orderState==='UNPAID'">
<template v-if="getRemainingBreachContract(order)>0"> <template v-if="getRemainingBreachContract(order)>0">
<template v-if="order.auditState!=='UNAUDITED'"> <template v-if="order.auditState!=='UNAUDITED'">
<van-count-down class="red-count-down" :time="getRemainingBreachContract(order)" format="HH:mm:ss"/> <van-count-down class="red-count-down" :time="getRemainingBreachContract(order)" format="HH:mm:ss 后将违约"/>
后将违约
</template> </template>
<template v-else> <template v-else>
支付审核中 支付审核中
...@@ -421,8 +419,21 @@ export default class AuctionOrderPage extends PaginationComponent<AuctionOrder> ...@@ -421,8 +419,21 @@ export default class AuctionOrderPage extends PaginationComponent<AuctionOrder>
.warning-text { .warning-text {
display: flex; display: flex;
align-items: center;
flex: 1;
min-width: 0;
font-size: 26rpx; font-size: 26rpx;
color: #EE3040FF; color: #EE3040FF;
:deep(.red-count-down) {
display: inline-flex;
align-items: center;
}
:deep(.red-count-down .van-count-down) {
font-size: 26rpx;
line-height: 1.4;
}
} }
.exception-text { .exception-text {
......
...@@ -20,9 +20,17 @@ ...@@ -20,9 +20,17 @@
<view v-for="item in displayList" :key="item.couponId" class="coupon-card" <view v-for="item in displayList" :key="item.couponId" class="coupon-card"
:class="cardModifierClass(item.status)"> :class="cardModifierClass(item.status)">
<view class="coupon-card__main"> <view class="coupon-card__main">
<view class="coupon-card__amount"> <view class="coupon-card__amount" :class="couponFaceDenseClass(item.faceAmount)">
<text class="coupon-card__currency">¥</text> <text class="coupon-card__currency">¥</text>
<text class="coupon-card__amount-num">{{ formatFaceAmount(item.faceAmount) }}</text> <template v-if="couponFacePresent(item.faceAmount).mode === 'wan'">
<text class="coupon-card__wan-num">{{ couponFacePresent(item.faceAmount).wanMain
}}</text>
<text class="coupon-card__wan-unit">万</text>
</template>
<template v-else>
<text class="coupon-card__amount-num">{{ couponFacePresent(item.faceAmount).text
}}</text>
</template>
</view> </view>
<view class="coupon-card__body"> <view class="coupon-card__body">
<view class="coupon-card__body-stack"> <view class="coupon-card__body-stack">
...@@ -112,6 +120,11 @@ import { ...@@ -112,6 +120,11 @@ import {
import type { AxiosStatic } from "axios"; import type { AxiosStatic } from "axios";
import { trackCouponRuleClick } from "@/common/eventTracking"; import { trackCouponRuleClick } from "@/common/eventTracking";
import { couponImageUrl } from "@/common/couponImageUrl"; import { couponImageUrl } from "@/common/couponImageUrl";
import {
couponFaceAmountDenseClass,
getCouponFacePresent,
type CouponFacePresent,
} from "@/common/couponFaceAmount";
type CouponTabKey = "unused" | "verified" | "expired"; type CouponTabKey = "unused" | "verified" | "expired";
...@@ -305,10 +318,12 @@ export default class CouponPage extends Vue { ...@@ -305,10 +318,12 @@ export default class CouponPage extends Vue {
return "抵扣车款"; return "抵扣车款";
} }
formatFaceAmount(amount: number): string { couponFacePresent(amount: number): CouponFacePresent {
const f = this.$filters?.formatCouponMoney; return getCouponFacePresent(amount);
if (typeof f === "function") return f(amount); }
return String(amount);
couponFaceDenseClass(amount: number): string {
return couponFaceAmountDenseClass(amount);
} }
isInstructionExpanded(couponId: string): boolean { isInstructionExpanded(couponId: string): boolean {
...@@ -441,7 +456,6 @@ export default class CouponPage extends Vue { ...@@ -441,7 +456,6 @@ export default class CouponPage extends Vue {
} }
.coupon-card__main { .coupon-card__main {
--coupon-amount-size: 64px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: stretch; align-items: stretch;
...@@ -450,16 +464,19 @@ export default class CouponPage extends Vue { ...@@ -450,16 +464,19 @@ export default class CouponPage extends Vue {
} }
.coupon-card__amount { .coupon-card__amount {
width: var(--coupon-amount-size); width: 100%;
height: var(--coupon-amount-size); max-width: 72px;
min-height: var(--coupon-amount-size); max-height: 72px;
aspect-ratio: 1;
border-radius: 6px; border-radius: 6px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: nowrap;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-shrink: 0; flex-shrink: 0;
box-sizing: border-box; box-sizing: border-box;
min-width: 0;
} }
.coupon-card--unused .coupon-card__amount { .coupon-card--unused .coupon-card__amount {
...@@ -479,14 +496,20 @@ export default class CouponPage extends Vue { ...@@ -479,14 +496,20 @@ export default class CouponPage extends Vue {
} }
.coupon-card--unused .coupon-card__currency, .coupon-card--unused .coupon-card__currency,
.coupon-card--unused .coupon-card__amount-num { .coupon-card--unused .coupon-card__amount-num,
.coupon-card--unused .coupon-card__wan-num,
.coupon-card--unused .coupon-card__wan-unit {
color: #ff6b35; color: #ff6b35;
} }
.coupon-card--verified .coupon-card__currency, .coupon-card--verified .coupon-card__currency,
.coupon-card--verified .coupon-card__amount-num, .coupon-card--verified .coupon-card__amount-num,
.coupon-card--expired .coupon-card__currency, .coupon-card--expired .coupon-card__currency,
.coupon-card--expired .coupon-card__amount-num { .coupon-card--expired .coupon-card__amount-num,
.coupon-card--verified .coupon-card__wan-num,
.coupon-card--verified .coupon-card__wan-unit,
.coupon-card--expired .coupon-card__wan-num,
.coupon-card--expired .coupon-card__wan-unit {
color: #646566; color: #646566;
} }
...@@ -497,10 +520,51 @@ export default class CouponPage extends Vue { ...@@ -497,10 +520,51 @@ export default class CouponPage extends Vue {
line-height: 1; line-height: 1;
} }
.coupon-card__wan-num {
font-family: "numberNor", sans-serif;
font-size: 22px;
font-weight: 700;
line-height: 1;
}
.coupon-card__wan-unit {
font-family: "numberNor", sans-serif;
font-size: 16px;
font-weight: 700;
line-height: 1;
margin-left: 1px;
}
.coupon-card__amount.coupon-face--sm .coupon-card__currency {
font-size: 12px;
}
.coupon-card__amount.coupon-face--sm .coupon-card__amount-num,
.coupon-card__amount.coupon-face--sm .coupon-card__wan-num {
font-size: 18px;
}
.coupon-card__amount.coupon-face--sm .coupon-card__wan-unit {
font-size: 14px;
}
.coupon-card__amount.coupon-face--xs .coupon-card__currency {
font-size: 11px;
}
.coupon-card__amount.coupon-face--xs .coupon-card__amount-num,
.coupon-card__amount.coupon-face--xs .coupon-card__wan-num {
font-size: 14px;
}
.coupon-card__amount.coupon-face--xs .coupon-card__wan-unit {
font-size: 12px;
}
.coupon-card__body { .coupon-card__body {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
max-height: 64px; max-height: 72px;
min-height: 0; min-height: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
"subPackages": [ "subPackages": [
{ {
"root": "module/auction", "root": "module/auction",
"name": "auction",
"pages": [ "pages": [
{ {
"path": "AuctionSessionPage", "path": "AuctionSessionPage",
...@@ -70,9 +71,14 @@ ...@@ -70,9 +71,14 @@
} }
}, },
{ {
// 车辆详情:enableShareTimeline 开启朋友圈分享;navigationBarFit=float 适配单页模式顶栏
"path": "AuctionVehiclePage", "path": "AuctionVehiclePage",
"style": { "style": {
"navigationStyle": "custom", "navigationStyle": "custom",
"navigationBarTitleText": "车辆详情",
"navigationBarFit": "float",
"enableShareAppMessage": true,
"enableShareTimeline": true,
"disableScroll": false, "disableScroll": false,
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
...@@ -496,6 +502,16 @@ ...@@ -496,6 +502,16 @@
} }
] ]
}, },
"preloadRule": {
"pages/tabbar/HomePage": {
"network": "all",
"packages": ["auction"]
},
"pages/tabbar/AuctionPage": {
"network": "all",
"packages": ["auction"]
}
},
"easycom": { "easycom": {
"autoscan": true, "autoscan": true,
"custom": { "custom": {
...@@ -508,7 +524,7 @@ ...@@ -508,7 +524,7 @@
}, },
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app", "navigationBarTitleText": "优加车拍",
"navigationBarBackgroundColor": "#F8F9FB", "navigationBarBackgroundColor": "#F8F9FB",
"backgroundColor": "#ffffff", "backgroundColor": "#ffffff",
"usingComponents": { "usingComponents": {
......
import {defineConfig} from "vite"; import fs from 'node:fs';
import uni from "@dcloudio/vite-plugin-uni"; import path from 'node:path';
import vue from '@vitejs/plugin-vue'; import { fileURLToPath } from 'node:url';
import { defineConfig, type Plugin } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
function patchVendorShadowGrey(vendorPath: string): boolean {
if (!fs.existsSync(vendorPath)) {
return false;
}
const code = fs.readFileSync(vendorPath, 'utf8');
if (!code.includes('shadow-grey.png')) {
return false;
}
const patched = code.replace(
/wx\.preloadAssets\(\{data:\[\{type:"image",src:e\+"\/[^"]*shadow-grey\.png"\}\]\}\)/g,
'void 0 /* shadow-grey preload disabled */'
);
if (patched === code) {
return false;
}
fs.writeFileSync(vendorPath, patched);
return true;
}
/**
* 禁用 uni-app 编译产物中对 shadow-grey.png 的错误 preloadAssets 调用。
* 分包/朋友圈冷启动时该预加载会 500,可能导致页面异常;构建后 patch vendor.js,勿删此插件。
* @see src/module/auction/AuctionVehiclePage.share-timeline.md
*/
function fixUniShadowGreyPreload(): Plugin {
return {
name: 'fix-uni-shadow-grey-preload',
closeBundle() {
const distRoot = path.resolve(__dirname, 'dist');
for (const mode of ['dev', 'build'] as const) {
const vendorPath = path.join(distRoot, mode, 'mp-weixin', 'common', 'vendor.js');
if (patchVendorShadowGrey(vendorPath)) {
console.log(`[fix-uni-shadow-grey-preload] patched ${vendorPath}`);
}
}
},
};
}
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [uni()], plugins: [uni(), fixUniShadowGreyPreload()],
transpileDependencies: ['@dcloudio/uni-ui'], transpileDependencies: ['@dcloudio/uni-ui'],
}); });
...@@ -48,6 +48,7 @@ export class Agreement extends AuditingEntity { ...@@ -48,6 +48,7 @@ export class Agreement extends AuditingEntity {
* ACCOUNT 用户协议 * ACCOUNT 用户协议
* PRIVACY 隐私协议 * PRIVACY 隐私协议
* ABOUT_US 关于我们 * ABOUT_US 关于我们
* COUPON_1 ~ COUPON_5 优惠券协议(多档活动可分别配置)
*/ */
export type Agreement_AgreementKey = 'AUCTION'|'TRANSACTION'|'VIOLATION'|'CONTRACT'|'ACCOUNT'|'PRIVACY'|'ABOUT_US'|'FAPAI_ACCOUNT'|'FAPAI_PRIVACY'|'COUPON_1'|'COUPON_2'|'COUPON_3'|'COUPON_4'|'COUPON_5'; export type Agreement_AgreementKey = 'AUCTION'|'TRANSACTION'|'VIOLATION'|'CONTRACT'|'ACCOUNT'|'PRIVACY'|'ABOUT_US'|'FAPAI_ACCOUNT'|'FAPAI_PRIVACY'|'COUPON_1'|'COUPON_2'|'COUPON_3'|'COUPON_4'|'COUPON_5';
export const AGREEMENT_AGREEMENT_KEYS = ['AUCTION','TRANSACTION','VIOLATION','CONTRACT','ACCOUNT','PRIVACY','ABOUT_US', 'FAPAI_ACCOUNT', 'FAPAI_PRIVACY', 'COUPON_1', 'COUPON_2', 'COUPON_3', 'COUPON_4', 'COUPON_5']; export const AGREEMENT_AGREEMENT_KEYS = ['AUCTION','TRANSACTION','VIOLATION','CONTRACT','ACCOUNT','PRIVACY','ABOUT_US', 'FAPAI_ACCOUNT', 'FAPAI_PRIVACY', 'COUPON_1', 'COUPON_2', 'COUPON_3', 'COUPON_4', 'COUPON_5'];
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!