20261127 #31

Merged
zzh merged 13 commits from test into master 2026-11-27 16:54:06 +08:00
17 changed files with 1641 additions and 398 deletions
Showing only changes of commit 40fe09b62f - Show all commits

View File

@ -1,5 +1,8 @@
import { axiosInstance } from '@/api/rbac'
import { assertBusinessOk, omsUrl, parseListPayload, unwrapData } from '@/api/oms/common'
import { resolveSalesProductCoverUrl } from '@/utils/salesProductCover'
export { resolveSalesProductCoverUrl } from '@/utils/salesProductCover'
/** 从 HTTP 响应体取出详情对象:标准 { code, data } 或根级直接返回实体 */
function extractSalesProductDetailFromBody(body: any): any {
@ -52,6 +55,26 @@ export async function getSalesProductDetail(id: number | string) {
return normalizeSalesProductDetailPayload(raw) ?? (raw && typeof raw === 'object' ? raw : undefined)
}
/** 上传官网线路封面图:multipart 经后端落库,返回 key + 同源预览 URL(非 COS 直传) */
export async function uploadSalesProductCover(
file: File,
): Promise<{ key: string; previewUrl: string }> {
const form = new FormData()
form.append('file', file)
const res = await axiosInstance.post(omsUrl('/channel/sales-product/upload-cover'), form, {
headers: { 'Content-Type': 'multipart/form-data' },
})
assertBusinessOk(res.data)
const data = unwrapData<any>(res.data)
const key = String(data?.key ?? data?.Key ?? data?.fileUrl ?? data?.FileUrl ?? '').trim()
const url = String(data?.url ?? data?.Url ?? '').trim()
if (!key) throw new Error('上传成功但未返回图片 key')
return {
key,
previewUrl: resolveSalesProductCoverUrl(url || key),
}
}
export async function createSalesProduct(body: Record<string, any>) {
const res = await axiosInstance.post(omsUrl('/channel/sales-product/create'), body)
assertBusinessOk(res.data)

View File

@ -308,13 +308,13 @@
subtractHeight: 60, // 为分页组件预留空间
});
// autoHeight=true:跟容器测高;false:只跟 tableConfig.height / setHeight,
// 避免切 Tab(display 变化)触发测高后把外部 setHeight 盖回初始值
watch(
height,
() => {
if (props.autoHeight) {
proOptions.height = height.value;
} else {
proOptions.height = props.tableConfig.height;
}
},
{
@ -323,6 +323,16 @@
}
);
watch(
() => props.tableConfig?.height,
(h) => {
if (!props.autoHeight && h != null && h !== '') {
proOptions.height = h;
}
},
{ immediate: true },
);
// 计算最大页码
const maxPage = computed(() => {
if (tablePage.total === 0 || tablePage.pageSize === 0) {

View File

@ -1428,9 +1428,8 @@ onUnmounted(() => {
scroll-behavior: smooth;
background: rgba(255, 255, 255, 0.94);
border-radius: 22px;
/* 单层短阴影 + 淡描边,避免多层发糊 */
border: 1px solid rgba(15, 23, 42, 0.06);
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
box-shadow: none;
.top-nav-logo {
position: relative;

View File

@ -6522,6 +6522,24 @@ export default {
'channel.salesProducts.form.weightCalculationRule': 'Weight rule',
'channel.salesProducts.form.weightRounding': 'Weight rounding',
'channel.salesProducts.form.productDescription': 'Product description',
'channel.salesProducts.form.coverImage': 'Site cover image',
'channel.salesProducts.form.coverImageTip':
'Used as the featured-lane card background on the website. Prefer landscape or near-square images. Without an image, the glass card style is used.',
'channel.salesProducts.form.coverImageUpload': 'Upload cover',
'channel.salesProducts.form.coverImageReplace': 'Replace cover',
'channel.salesProducts.form.coverImageClear': 'Clear',
'channel.salesProducts.form.coverImageHint': 'Drag or click · jpg / png / webp · cropped to 16:15',
'channel.salesProducts.form.coverImageDrop': 'Drop to upload',
'channel.salesProducts.form.coverImageUploading': 'Uploading…',
'channel.salesProducts.form.coverImageUploaded': 'Cover uploaded — save to apply',
'channel.salesProducts.form.coverImageUploadFailed': 'Cover upload failed',
'channel.salesProducts.form.coverImageType': 'Please choose an image file',
'channel.salesProducts.form.coverImageSize': 'Image must be ≤ 12MB',
'channel.salesProducts.form.coverImageCropTitle': 'Crop site cover',
'channel.salesProducts.form.coverImageCropHint':
'Drag to reposition, scroll or use the slider to zoom. Cropped to 16:15 for featured lane cards.',
'channel.salesProducts.form.coverImageCropOk': 'Crop & upload',
'channel.salesProducts.form.coverImageCropZoom': 'Zoom',
'channel.salesProducts.form.preStorageScript': 'Pre-storage script',
'channel.salesProducts.form.placeholder.input': 'Please enter',
'channel.salesProducts.form.placeholder.min': 'Min',

View File

@ -6527,6 +6527,24 @@ export default {
'channel.salesProducts.form.weightCalculationRule': '计重规则',
'channel.salesProducts.form.weightRounding': '计重进位',
'channel.salesProducts.form.productDescription': '产品说明',
'channel.salesProducts.form.coverImage': '官网封面图',
'channel.salesProducts.form.coverImageTip':
'用于官网精选线路卡片背景,建议横版或接近正方形图片;未上传时仍显示玻璃底样式。',
'channel.salesProducts.form.coverImageUpload': '上传封面',
'channel.salesProducts.form.coverImageReplace': '更换封面',
'channel.salesProducts.form.coverImageClear': '清除',
'channel.salesProducts.form.coverImageHint': '拖拽或点击上传 · jpg / png / webp · 按 16:15 裁剪',
'channel.salesProducts.form.coverImageDrop': '松开鼠标即可上传',
'channel.salesProducts.form.coverImageUploading': '上传中…',
'channel.salesProducts.form.coverImageUploaded': '封面已上传,保存后生效',
'channel.salesProducts.form.coverImageUploadFailed': '封面上传失败',
'channel.salesProducts.form.coverImageType': '请选择图片文件',
'channel.salesProducts.form.coverImageSize': '图片不能超过 12MB',
'channel.salesProducts.form.coverImageCropTitle': '裁剪官网封面',
'channel.salesProducts.form.coverImageCropHint':
'拖动调整位置,滚轮或滑杆缩放;将按 16:15 裁剪后上传,适配精选线路卡片。',
'channel.salesProducts.form.coverImageCropOk': '裁剪并上传',
'channel.salesProducts.form.coverImageCropZoom': '缩放',
'channel.salesProducts.form.preStorageScript': '落库前执行脚本',
'channel.salesProducts.form.placeholder.labelTemplate': '请选择标签模板(未选则用全局默认)',
'channel.salesProducts.form.placeholder.input': '请输入',

View File

@ -0,0 +1,29 @@
import { resolveOmsAssetUrl } from '@/api/oms/common'
/**
* 销售产品封面同源预览地址(与品牌 Logo 一致:不签发 COS 直链)。
* key 为 uploads/sales-product-cover/...;已是 /cover/file 路径则原样解析。
*/
export function resolveSalesProductCoverUrl(keyOrUrl?: string | null): string {
const raw = String(keyOrUrl ?? '').trim()
if (!raw) return ''
if (
raw.includes('/channel/sales-product/cover/file')
|| /^https?:\/\//i.test(raw)
|| raw.startsWith('data:')
|| raw.startsWith('blob:')
) {
return resolveOmsAssetUrl(raw)
}
const stamp =
raw.split('/').pop()?.replace(/\.[^.]+$/, '')
|| String(Math.abs(hashString(raw)))
const path = `/channel/sales-product/cover/file?key=${encodeURIComponent(raw)}&v=${encodeURIComponent(stamp)}`
return resolveOmsAssetUrl(path)
}
function hashString(s: string): number {
let h = 0
for (let i = 0; i < s.length; i++) h = (Math.imul(31, h) + s.charCodeAt(i)) | 0
return h
}

View File

@ -0,0 +1,291 @@
<template>
<a-modal
:visible="visible"
:title="title"
:width="560"
unmount-on-close
:ok-loading="exporting"
:ok-text="okText"
:cancel-text="cancelText"
@ok="confirmCrop"
@cancel="handleCancel"
@update:visible="(v: boolean) => emit('update:visible', v)"
>
<p class="cover-crop-hint">{{ hint }}</p>
<div
ref="viewportRef"
class="cover-crop-viewport"
@pointerdown="onPointerDown"
@pointermove="onPointerMove"
@pointerup="onPointerUp"
@pointercancel="onPointerUp"
@wheel.prevent="onWheel"
>
<div class="cover-crop-stage" :style="stageStyle">
<img
v-if="objectUrl"
ref="imgRef"
:src="objectUrl"
alt=""
class="cover-crop-img"
draggable="false"
@load="onImageLoad"
/>
</div>
<div class="cover-crop-frame" aria-hidden="true" />
</div>
<div class="cover-crop-zoom">
<span>{{ zoomLabel }}</span>
<a-slider
:model-value="zoom"
:min="100"
:max="260"
:step="1"
@change="onZoomChange"
/>
</div>
</a-modal>
</template>
<script lang="ts" setup>
import { computed, onBeforeUnmount, ref, watch } from 'vue';
const ASPECT = 16 / 15;
const OUT_W = 1280;
const OUT_H = Math.round(OUT_W / ASPECT);
const props = defineProps<{
visible: boolean;
file: File | null;
title: string;
hint: string;
okText: string;
cancelText: string;
zoomLabel: string;
}>();
const emit = defineEmits<{
cancel: [];
confirm: [file: File];
'update:visible': [v: boolean];
}>();
const viewportRef = ref<HTMLElement | null>(null);
const imgRef = ref<HTMLImageElement | null>(null);
const objectUrl = ref('');
const zoom = ref(100);
const offsetX = ref(0);
const offsetY = ref(0);
const naturalW = ref(0);
const naturalH = ref(0);
const frameW = ref(360);
const frameH = ref(360 / ASPECT);
const exporting = ref(false);
let dragging = false;
let dragStartX = 0;
let dragStartY = 0;
let originX = 0;
let originY = 0;
/** cover 铺满裁剪框所需的基础缩放 */
const coverScale = computed(() => {
if (!naturalW.value || !naturalH.value) return 1;
return Math.max(frameW.value / naturalW.value, frameH.value / naturalH.value);
});
const stageStyle = computed(() => {
const s = coverScale.value * (zoom.value / 100);
const w = naturalW.value * s;
const h = naturalH.value * s;
return {
width: `${w}px`,
height: `${h}px`,
transform: `translate(-50%, -50%) translate(${offsetX.value}px, ${offsetY.value}px)`,
};
});
function measureFrame() {
const vp = viewportRef.value;
if (!vp) return;
const rect = vp.getBoundingClientRect();
frameW.value = rect.width * 0.86;
frameH.value = frameW.value / ASPECT;
}
function revokeUrl() {
if (objectUrl.value) {
URL.revokeObjectURL(objectUrl.value);
objectUrl.value = '';
}
}
function handleCancel() {
emit('update:visible', false);
emit('cancel');
}
function resetPose() {
zoom.value = 100;
offsetX.value = 0;
offsetY.value = 0;
}
function onImageLoad() {
const img = imgRef.value;
if (!img) return;
naturalW.value = img.naturalWidth;
naturalH.value = img.naturalHeight;
measureFrame();
resetPose();
}
function onZoomChange(v: number | [number, number]) {
zoom.value = Array.isArray(v) ? v[0] : v;
}
function onPointerDown(e: PointerEvent) {
if (e.button !== 0) return;
dragging = true;
dragStartX = e.clientX;
dragStartY = e.clientY;
originX = offsetX.value;
originY = offsetY.value;
viewportRef.value?.setPointerCapture?.(e.pointerId);
}
function onPointerMove(e: PointerEvent) {
if (!dragging) return;
offsetX.value = originX + (e.clientX - dragStartX);
offsetY.value = originY + (e.clientY - dragStartY);
}
function onPointerUp() {
dragging = false;
}
function onWheel(e: WheelEvent) {
zoom.value = Math.min(260, Math.max(100, zoom.value + (e.deltaY > 0 ? -8 : 8)));
}
async function confirmCrop() {
const img = imgRef.value;
if (!img || !props.file || !naturalW.value) return;
exporting.value = true;
try {
measureFrame();
const s = coverScale.value * (zoom.value / 100);
const dispW = naturalW.value * s;
const dispH = naturalH.value * s;
// 裁剪框相对图片左上角
const srcX = (dispW / 2 - frameW.value / 2 - offsetX.value) / s;
const srcY = (dispH / 2 - frameH.value / 2 - offsetY.value) / s;
const srcW = frameW.value / s;
const srcH = frameH.value / s;
const canvas = document.createElement('canvas');
canvas.width = OUT_W;
canvas.height = OUT_H;
const ctx = canvas.getContext('2d');
if (!ctx) throw new Error('canvas');
ctx.fillStyle = '#0f172a';
ctx.fillRect(0, 0, OUT_W, OUT_H);
ctx.drawImage(img, srcX, srcY, srcW, srcH, 0, 0, OUT_W, OUT_H);
const blob = await new Promise<Blob | null>((resolve) =>
canvas.toBlob(resolve, 'image/jpeg', 0.88),
);
if (!blob) throw new Error('export');
const base = (props.file.name || 'cover').replace(/\.[^.]+$/, '');
emit('confirm', new File([blob], `${base}-cover.jpg`, { type: 'image/jpeg' }));
} finally {
exporting.value = false;
}
}
watch(
() => [props.visible, props.file] as const,
async ([vis, file]) => {
revokeUrl();
if (vis && file) {
objectUrl.value = URL.createObjectURL(file);
resetPose();
requestAnimationFrame(() => measureFrame());
}
},
{ immediate: true },
);
onBeforeUnmount(revokeUrl);
</script>
<style scoped lang="less">
.cover-crop-hint {
margin: 0 0 12px;
color: var(--color-text-3);
font-size: 13px;
line-height: 1.5;
}
.cover-crop-viewport {
position: relative;
width: 100%;
height: 320px;
border-radius: 12px;
overflow: hidden;
background: #0f172a;
cursor: grab;
user-select: none;
touch-action: none;
&:active {
cursor: grabbing;
}
}
.cover-crop-stage {
position: absolute;
top: 50%;
left: 50%;
will-change: transform;
}
.cover-crop-img {
display: block;
width: 100%;
height: 100%;
object-fit: fill;
pointer-events: none;
}
.cover-crop-frame {
position: absolute;
top: 50%;
left: 50%;
z-index: 2;
width: 86%;
aspect-ratio: 16 / 15;
transform: translate(-50%, -50%);
border: 2px solid rgba(255, 255, 255, 0.92);
border-radius: 10px;
box-shadow: 0 0 0 999px rgba(15, 23, 42, 0.48);
pointer-events: none;
}
.cover-crop-zoom {
display: flex;
align-items: center;
gap: 12px;
margin-top: 14px;
> span {
flex-shrink: 0;
color: var(--color-text-2);
font-size: 13px;
}
:deep(.arco-slider) {
flex: 1;
}
}
</style>

View File

@ -35,7 +35,9 @@
updateSalesProduct,
updateSalesProductCode,
updateSalesProductPrice,
uploadSalesProductCover,
} from '@/api/channel/salesProduct';
import { resolveSalesProductCoverUrl } from '@/utils/salesProductCover';
import { getLabelTemplateList } from '@/api/channel/labelTemplate';
import { isDiscountCostItem } from '@/constants/feeCostItems';
import { postForewarningServiceKpiAreaGetKpiAreas } from '@/api/channel/kpiArea';
@ -57,6 +59,7 @@
} from '@/utils/factorValueTagPreview';
import { IconPlus, IconDelete, IconSearch, IconEdit, IconDragArrow, IconQuestionCircleFill, IconQuestionCircle, IconSync } from '@arco-design/web-vue/es/icon';
import FormLabelWithPreview from './components/FormLabelWithPreview.vue';
import CoverImageCropModal from './components/CoverImageCropModal.vue';
import BillingConditionEditor from './components/BillingConditionEditor.vue';
import PreScriptEditor from '@/views/channel/serviceChannels/components/PreScriptEditor.vue';
import {
@ -212,9 +215,20 @@
weightCalculationRule: '',
weightRounding: '',
productDescription: '',
/** 官网封面图 object key */
coverImage: '',
preStorageScript: '',
});
const coverImageUploading = ref(false);
const coverImageInputRef = ref<HTMLInputElement | null>(null);
const coverCropVisible = ref(false);
const coverCropFile = ref<File | null>(null);
const coverImagePreviewUrl = computed(() =>
resolveSalesProductCoverUrl(formData.coverImage),
);
const customerGuideMarkdown = ref('');
const customerGuideSaving = ref(false);
const customerGuidePanelRef = ref<InstanceType<typeof MarkdownDocPanel> | null>(null);
@ -265,6 +279,7 @@
weightCalculationRule: string;
weightRounding: string;
productDescription: string;
coverImage: string;
preStorageScript: string;
};
@ -287,6 +302,7 @@
weightCalculationRule: formData.weightCalculationRule,
weightRounding: formData.weightRounding,
productDescription: formData.productDescription,
coverImage: formData.coverImage,
preStorageScript: formData.preStorageScript,
};
}
@ -1711,6 +1727,7 @@
weightCalculationRule: numStr(p.weightRuleId ?? p.WeightRuleId),
weightRounding: numStr(p.weightRoundingId ?? p.WeightRoundingId),
productDescription: p.productDescription ?? p.ProductDescription ?? '',
coverImage: String(p.coverImage ?? p.CoverImage ?? '').trim(),
preStorageScript: p.preStorageScript ?? p.PreStorageScript ?? '',
});
customerGuideMarkdown.value = p.customerGuideMarkdown ?? p.CustomerGuideMarkdown ?? '';
@ -1993,6 +2010,7 @@
weightRuleId: wrId ?? null,
weightRoundingId: roundingId ?? null,
productDescription: formData.productDescription,
coverImage: formData.coverImage || null,
preStorageScript: formData.preStorageScript,
isActive: toEnableStatus(isEnableStatusEnabled(prev.isActive ?? prev.IsActive)),
scheme: String(prev.scheme ?? prev.Scheme ?? 'costLowest'),
@ -2000,6 +2018,86 @@
resetConfigFormBaseline();
}
const coverImageDragOver = ref(false);
let coverImageDragDepth = 0;
function openCoverImagePicker() {
if (coverImageUploading.value) return;
coverImageInputRef.value?.click();
}
function clearCoverImage() {
formData.coverImage = '';
}
function acceptCoverImageFile(file: File | undefined | null) {
if (!file || coverImageUploading.value) return;
if (!file.type.startsWith('image/')) {
Message.warning(t('channel.salesProducts.form.coverImageType'));
return;
}
if (file.size > 12 * 1024 * 1024) {
Message.warning(t('channel.salesProducts.form.coverImageSize'));
return;
}
coverCropFile.value = file;
coverCropVisible.value = true;
}
function onCoverImageFileChange(event: Event) {
const input = event.target as HTMLInputElement;
const file = input.files?.[0];
input.value = '';
acceptCoverImageFile(file);
}
function onCoverImageDragEnter(e: DragEvent) {
e.preventDefault();
if (coverImageUploading.value) return;
coverImageDragDepth += 1;
coverImageDragOver.value = true;
}
function onCoverImageDragOver(e: DragEvent) {
e.preventDefault();
if (coverImageUploading.value) return;
coverImageDragOver.value = true;
}
function onCoverImageDragLeave() {
coverImageDragDepth = Math.max(0, coverImageDragDepth - 1);
if (coverImageDragDepth === 0) coverImageDragOver.value = false;
}
function onCoverImageDrop(e: DragEvent) {
e.preventDefault();
coverImageDragDepth = 0;
coverImageDragOver.value = false;
if (coverImageUploading.value) return;
const file = e.dataTransfer?.files?.[0];
acceptCoverImageFile(file);
}
function onCoverCropCancel() {
coverCropVisible.value = false;
coverCropFile.value = null;
}
async function onCoverCropConfirm(file: File) {
coverCropVisible.value = false;
coverCropFile.value = null;
coverImageUploading.value = true;
try {
const { key } = await uploadSalesProductCover(file);
formData.coverImage = key;
Message.success(t('channel.salesProducts.form.coverImageUploaded'));
} catch (e: any) {
Message.error(e?.message || t('channel.salesProducts.form.coverImageUploadFailed'));
} finally {
coverImageUploading.value = false;
}
}
async function persistSalesProductAllocation(pid: number) {
await saveSalesProductAllocation({
salesProductId: Number(pid),
@ -4544,18 +4642,37 @@
if (!force && Math.abs(h - priceListTableHeight.value) < 2) return;
priceListTableHeight.value = h;
// 只改高度,避免强制 recalculate 造成切产品卡顿
priceListTableRef.value?.setHeight?.(h);
const table = priceListTableRef.value;
table?.setHeight?.(h);
}
function syncPriceListTableHeight(force = false) {
const el = priceTableContainerRef.value;
if (!el) return;
// display:none 期间量到 0,不能写回,否则回来会被错误高度卡住
if (el.offsetParent === null && el.clientHeight === 0) return;
const h = Math.floor(el.clientHeight || el.getBoundingClientRect().height);
applyPriceListTableHeight(h, force);
}
/** 切回卖价后布局可能晚一拍,连补几次高度 */
function resyncPriceListTableAfterShow() {
const run = (force = true) => {
syncPriceListTableHeight(force);
const grid = priceListTableRef.value?.xGrid;
grid?.recalculate?.(true);
};
run(true);
requestAnimationFrame(() => {
run(true);
requestAnimationFrame(() => run(true));
});
setTimeout(() => run(true), 80);
}
function setupPriceListResizeObserver() {
if (priceListResizeObserver) return;
priceListResizeObserver?.disconnect();
priceListResizeObserver = null;
if (priceListHeightRaf) {
cancelAnimationFrame(priceListHeightRaf);
priceListHeightRaf = 0;
@ -4570,7 +4687,7 @@
});
});
priceListResizeObserver.observe(el);
nextTick(() => syncPriceListTableHeight(true));
nextTick(() => resyncPriceListTableAfterShow());
}
const priceColumns = computed(() => [
@ -4634,7 +4751,8 @@
},
]);
// 高度走 setHeight,数据走 reloadData,避免 computed 随 height/data 重建触发 TablePro 重绑
// 高度必须跟 priceListTableHeight 走:TablePro 在 autoHeight=false 时仍会用
// tableConfig.height 覆盖 setHeight(切 Tab 触发 useAutoHeight 重算时尤甚)
const priceListTableProps = computed(() => ({
columns: priceColumns.value,
showPager: false,
@ -4646,7 +4764,8 @@
autoHeight: false,
keepSource: true,
size: 'small',
tableConfig: { height: 400 },
height: priceListTableHeight.value,
tableConfig: { height: priceListTableHeight.value },
toolbarConfig: { setting: false, enabled: false },
rowConfig: { isHover: true, keyField: 'id' },
}));
@ -4672,17 +4791,16 @@
}
nextTick(() => {
setupPriceListResizeObserver();
syncPriceListTableHeight(true);
const grid = priceListTableRef.value?.xGrid;
const visible = grid?.getTableData?.()?.fullData;
// display:none 期间表格可能丢行,有缓存就补回去,避免切回看到空表
if (priceTableData.value.length > 0 && (!Array.isArray(visible) || visible.length === 0)) {
priceListTableRef.value?.reloadData?.(priceTableData.value);
}
grid?.recalculate?.(true);
resyncPriceListTableAfterShow();
});
},
{ immediate: true },
{ immediate: true, flush: 'post' },
);
</script>
@ -5585,7 +5703,7 @@
</div>
</div>
<!-- 第五行 -->
<!-- 入库前脚本 -->
<div class="form-row">
<div class="form-item full-width">
<PreScriptEditor
@ -5607,11 +5725,103 @@
</div>
</div>
<!-- 官网封面图(精选线路卡片背景)放最后 -->
<div class="form-row">
<div class="form-item full-width">
<label class="form-label label-with-tip">
{{ t('channel.salesProducts.form.coverImage') }}
<a-tooltip>
<template #content>
<div style="white-space: pre-line; max-width: 320px; line-height: 1.5;">
{{ t('channel.salesProducts.form.coverImageTip') }}
</div>
</template>
<icon-question-circle class="tip-icon" />
</a-tooltip>
</label>
<div class="cover-image-field">
<div
class="cover-image-card"
:class="{
'has-image': !!coverImagePreviewUrl,
'is-uploading': coverImageUploading,
'is-dragover': coverImageDragOver,
}"
@click="openCoverImagePicker"
@dragenter.prevent="onCoverImageDragEnter"
@dragover.prevent="onCoverImageDragOver"
@dragleave.prevent="onCoverImageDragLeave"
@drop.prevent="onCoverImageDrop"
>
<img
v-if="coverImagePreviewUrl"
:src="coverImagePreviewUrl"
alt=""
class="cover-image-preview"
/>
<div v-else class="cover-image-placeholder">
<span>{{
coverImageDragOver
? t('channel.salesProducts.form.coverImageDrop')
: t('channel.salesProducts.form.coverImageUpload')
}}</span>
<em>{{ t('channel.salesProducts.form.coverImageHint') }}</em>
</div>
<div v-if="coverImageUploading" class="cover-image-mask">
{{ t('channel.salesProducts.form.coverImageUploading') }}
</div>
<div
v-else-if="coverImageDragOver && coverImagePreviewUrl"
class="cover-image-mask is-drop"
>
{{ t('channel.salesProducts.form.coverImageDrop') }}
</div>
</div>
<div class="cover-image-actions">
<a-button size="small" :loading="coverImageUploading" @click="openCoverImagePicker">
{{
coverImagePreviewUrl
? t('channel.salesProducts.form.coverImageReplace')
: t('channel.salesProducts.form.coverImageUpload')
}}
</a-button>
<a-button
v-if="coverImagePreviewUrl"
size="small"
:disabled="coverImageUploading"
@click="clearCoverImage"
>
{{ t('channel.salesProducts.form.coverImageClear') }}
</a-button>
</div>
<input
ref="coverImageInputRef"
type="file"
accept="image/jpeg,image/png,image/webp,image/gif,image/bmp"
class="cover-image-input"
@change="onCoverImageFileChange"
/>
</div>
</div>
</div>
</div>
</div>
</template>
</div>
<CoverImageCropModal
v-model:visible="coverCropVisible"
:file="coverCropFile"
:title="t('channel.salesProducts.form.coverImageCropTitle')"
:hint="t('channel.salesProducts.form.coverImageCropHint')"
:ok-text="t('channel.salesProducts.form.coverImageCropOk')"
:cancel-text="t('common.cancel')"
:zoom-label="t('channel.salesProducts.form.coverImageCropZoom')"
@cancel="onCoverCropCancel"
@confirm="onCoverCropConfirm"
/>
<!-- 排货判断条件编辑 -->
<a-modal
v-model:visible="matchConditionModalVisible"
@ -6922,6 +7132,8 @@
.right-content.content-panel {
flex: 1;
min-width: 0;
min-height: 0;
background-color: var(--app-card-bg, #fff);
border-radius: 8px;
display: flex;
@ -6934,6 +7146,7 @@
}
.tabs-section {
flex-shrink: 0;
border-bottom: none;
padding: 10px 24px 4px;
display: flex;
@ -6950,6 +7163,7 @@
/* 贴合白面板,不做灰条+底边,避免拦腰切断感 */
.product-context-bar {
flex-shrink: 0;
display: flex;
flex-wrap: nowrap;
align-items: center;
@ -7029,7 +7243,8 @@
.form-section {
flex: 1;
padding: 24px;
min-height: 0;
padding: 24px;
overflow-y: auto;
}
@ -7125,6 +7340,7 @@
.price-section {
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
padding: 24px;
@ -7132,6 +7348,7 @@
}
.price-approval-banner {
flex-shrink: 0;
display: flex;
align-items: flex-start;
justify-content: space-between;
@ -7187,6 +7404,7 @@
}
.price-header {
flex-shrink: 0;
display: flex;
justify-content: space-between;
align-items: center;
@ -7232,15 +7450,21 @@
display: block;
width: 100%;
height: 100%;
:deep(.arco-spin-children) {
height: 100%;
}
}
.price-list-table-pro {
width: 100%;
height: 100%;
min-height: 0;
:deep(.table-pro),
:deep(.table-pro-surface) {
height: 100%;
min-height: 0;
}
:deep(.vxe-toolbar) {
@ -8666,6 +8890,100 @@
}
}
.cover-image-field {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 10px;
}
.cover-image-card {
position: relative;
width: min(280px, 100%);
aspect-ratio: 16 / 15;
border-radius: 12px;
border: 1px dashed var(--color-border-3);
background: var(--color-fill-1);
overflow: hidden;
cursor: pointer;
transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
&:hover {
border-color: rgb(var(--primary-6));
box-shadow: 0 0 0 2px rgba(var(--primary-6), 0.12);
}
&.has-image {
border-style: solid;
}
&.is-dragover {
border-style: dashed;
border-color: rgb(var(--primary-6));
background: color-mix(in srgb, rgb(var(--primary-6)) 8%, #fff);
box-shadow: 0 0 0 2px rgba(var(--primary-6), 0.18);
}
&.is-uploading {
pointer-events: none;
}
}
.cover-image-preview {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.cover-image-placeholder {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 6px;
width: 100%;
height: 100%;
padding: 12px;
color: var(--color-text-2);
font-size: 13px;
font-weight: 600;
text-align: center;
em {
font-style: normal;
font-size: 12px;
font-weight: 500;
color: var(--color-text-3);
}
}
.cover-image-mask {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
background: rgba(15, 23, 42, 0.45);
color: #fff;
font-size: 13px;
font-weight: 600;
&.is-drop {
background: color-mix(in srgb, rgb(var(--primary-6)) 72%, rgba(15, 23, 42, 0.55));
}
}
.cover-image-actions {
display: flex;
align-items: center;
gap: 8px;
}
.cover-image-input {
display: none;
}
// 响应式设计
@media (max-width: 768px) {
.sales-product-layout {

View File

@ -31,6 +31,7 @@
<SiteRunway :text="heroTitle" />
<h1 class="ai-welcome-title ai-welcome-title--sr">{{ heroTitle }}</h1>
</div>
<p class="ai-welcome-fullname">{{ brandCopy.navFullName }}</p>
<div class="ai-welcome__stack">
<div class="ai-welcome__command">
<div class="ai-ask">

View File

@ -9,13 +9,13 @@
<h3 class="ai-featured-routes__title">{{ copy.featuredRoutesTitle }}</h3>
</div>
<div class="ai-featured-routes__actions">
<div v-if="!loading && featured.length > pageSize" class="ai-featured-routes__nav">
<div v-if="!loading && featured.length > 1" class="ai-featured-routes__nav">
<button
type="button"
class="ai-featured-routes__nav-btn"
:aria-label="copy.featuredRoutesPrev"
:disabled="busy || !canPrev"
@click="scrollPage(-1)"
@click="step(-1)"
>
<span aria-hidden="true">‹</span>
</button>
@ -24,7 +24,7 @@
class="ai-featured-routes__nav-btn"
:aria-label="copy.featuredRoutesNext"
:disabled="busy || !canNext"
@click="scrollPage(1)"
@click="step(1)"
>
<span aria-hidden="true">›</span>
</button>
@ -43,82 +43,128 @@
<div
class="ai-featured-routes__rail"
@keydown="onKeydown"
@mouseenter="paused = true"
@mouseleave="paused = false"
@focusin="paused = true"
@focusout="onRailFocusOut"
>
<div
v-if="canPrev"
class="ai-featured-routes__fade ai-featured-routes__fade--left"
aria-hidden="true"
/>
<div
v-if="canNext || loading"
class="ai-featured-routes__fade ai-featured-routes__fade--right"
aria-hidden="true"
/>
<ul
ref="scrollerRef"
class="ai-featured-routes__scroller"
ref="stageRef"
class="ai-featured-routes__stage"
role="list"
tabindex="0"
:aria-label="copy.featuredRoutesTitle"
@scroll="onScroll"
@keydown="onKeydown"
@pointerdown="onPointerDown"
@pointermove="onPointerMove"
@pointerup="onPointerUp"
@pointercancel="onPointerUp"
>
<template v-if="loading">
<li v-for="n in 4" :key="'skel-' + n" class="ai-featured-routes__item">
<div
v-for="n in 7"
:key="'skel-' + n"
class="ai-featured-routes__item is-skel"
:style="coverStyle(n - 4)"
aria-hidden="true"
>
<div class="ai-featured-routes__skel" />
</li>
</div>
</template>
<template v-else>
<li
v-for="item in featured"
<div
v-for="(item, index) in featured"
:key="String(item.id)"
class="ai-featured-routes__item"
:class="{ 'is-active': index === activeIndex }"
role="listitem"
:style="coverStyle(circularOffset(index, activeIndex))"
>
<button
type="button"
class="ai-featured-routes__card"
:class="{ 'has-cover': routeHasRealCover(item) }"
:disabled="busy"
:tabindex="index === activeIndex ? 0 : -1"
:aria-current="index === activeIndex ? 'true' : undefined"
:aria-label="cardAria(item)"
@click="onCard(item)"
:style="cardBgStyle(item)"
@click="onCard(item, index)"
>
<span class="ai-featured-routes__card-top">
<span class="ai-featured-routes__dest">{{
routeCoverageLabel(item, lang)
}}</span>
<span
v-if="!routeHasRealCover(item)"
class="ai-featured-routes__dest"
>{{ routeCoverageLabel(item, lang) }}</span>
<span
v-else
class="ai-featured-routes__top-spacer"
aria-hidden="true"
/>
<span v-if="formatRouteTimeliness(item)" class="ai-featured-routes__eta">
{{ formatRouteTimeliness(item) }}
<em>{{ routesCopy.days }}</em>
</span>
</span>
<span class="ai-featured-routes__main">
<span class="ai-featured-routes__card-mid">
<strong class="ai-featured-routes__name">{{ item.productName }}</strong>
</span>
<span class="ai-featured-routes__card-foot">
<!-- 有封面:只留 1 个分组 chip;无封面:条款 + 分组 + 简述 -->
<span
v-if="item.tradeTerms || item.productGroupName || item.productGroup"
v-if="routeHasRealCover(item) && (item.productGroupName || item.productGroup)"
class="ai-featured-routes__meta"
>
<template v-if="item.tradeTerms">{{ item.tradeTerms }}</template>
<template
v-if="item.tradeTerms && (item.productGroupName || item.productGroup)"
>
·
<span class="ai-featured-routes__chip">{{
item.productGroupName || item.productGroup
}}</span>
</span>
<span
v-else-if="!routeHasRealCover(item) && (item.tradeTerms || item.productGroupName || item.productGroup)"
class="ai-featured-routes__meta"
>
<template v-if="item.tradeTerms">
<span class="ai-featured-routes__chip">{{ item.tradeTerms }}</span>
</template>
<template v-if="item.productGroupName || item.productGroup">
{{ item.productGroupName || item.productGroup }}
<span class="ai-featured-routes__chip">{{
item.productGroupName || item.productGroup
}}</span>
</template>
</span>
<p
v-if="item.productDescription && !routeHasRealCover(item)"
class="ai-featured-routes__desc"
>
{{ item.productDescription }}
</p>
</span>
<p
class="ai-featured-routes__desc"
:class="{ 'is-empty': !item.productDescription }"
>
{{ item.productDescription || '\u00a0' }}
</p>
</button>
</li>
</div>
</template>
</ul>
</div>
<div
v-if="!loading && featured.length > 1"
class="ai-featured-routes__dots"
role="tablist"
:aria-label="copy.featuredRoutesTitle"
>
<button
v-for="(item, index) in featured"
:key="'dot-' + String(item.id)"
type="button"
class="ai-featured-routes__dot"
:class="{ 'is-active': index === activeIndex }"
role="tab"
:aria-selected="index === activeIndex"
:aria-label="item.productName"
:disabled="busy"
@click="goTo(index)"
/>
</div>
</div>
</section>
</template>
@ -136,6 +182,9 @@
routeCoverageLabel,
type RouteItem,
} from './lib/portal-catalog';
import { resolveRouteCoverUrl, routeHasRealCover } from './lib/route-cover';
const AUTOPLAY_MS = 4500;
const props = defineProps<{
isZh: boolean;
@ -151,27 +200,103 @@
const copy = computed(() => (props.isZh ? WELCOME_COPY.zh : WELCOME_COPY.en));
const routesCopy = computed(() => ROUTES_COPY[lang.value]);
const PAGE_SIZE_FALLBACK = 4;
const loading = ref(true);
const featured = ref<RouteItem[]>([]);
const scrollerRef = ref<HTMLElement | null>(null);
const canPrev = ref(false);
const canNext = ref(false);
const pageSize = ref(PAGE_SIZE_FALLBACK);
const activeIndex = ref(0);
const stageRef = ref<HTMLElement | null>(null);
const reducedMotion = ref(false);
const paused = ref(false);
const stageWidth = ref(1100);
const cardWidth = ref(280);
const visible = computed(() => loading.value || featured.value.length > 0);
const canPrev = computed(() => featured.value.length > 1);
const canNext = computed(() => featured.value.length > 1);
function readPageSize() {
const el = scrollerRef.value?.closest('.ai-featured-routes') as HTMLElement | null;
if (!el) {
pageSize.value = PAGE_SIZE_FALLBACK;
return pageSize.value;
const sideSlots = computed(() => {
const w = Math.max(stageWidth.value, 320);
if (w >= 1100) return 3;
if (w >= 720) return 2;
return 2;
});
const reachPx = computed(() => {
const half = stageWidth.value / 2;
return Math.max(half - cardWidth.value * 0.1, cardWidth.value * 1.1);
});
const pitchPx = computed(() => {
const slots = sideSlots.value;
const compress = 0.72;
const denom = 1 + compress * Math.max(0, slots - 1);
return Math.max(reachPx.value / denom, cardWidth.value * 0.4);
});
function cardBgStyle(item: RouteItem) {
const url = resolveRouteCoverUrl(item);
return url ? { backgroundImage: `url(${url})` } : undefined;
}
/** 环形最短偏移:末张右侧接首张,首张左侧接末张 */
function circularOffset(index: number, active: number) {
const len = featured.value.length;
if (len <= 0) return 0;
let d = ((index - active) % len + len) % len;
if (d > len / 2) d -= len;
return d;
}
function coverStyle(offset: number) {
const abs = Math.abs(offset);
const sign = Math.sign(offset) || 0;
const flat = reducedMotion.value;
const slots = sideSlots.value;
const pitch = pitchPx.value;
const cw = cardWidth.value;
const compress = 0.72;
// 位移取整,避免亚像素缩放把文字糊掉
let x = 0;
if (abs > 0) {
x = Math.round(sign * (pitch + Math.max(0, abs - 1) * pitch * compress));
}
const raw = getComputedStyle(el).getPropertyValue('--ai-featured-visible').trim();
const n = Number.parseInt(raw, 10);
pageSize.value = Number.isFinite(n) && n > 0 ? n : PAGE_SIZE_FALLBACK;
return pageSize.value;
if (flat) {
return {
transform: `translate(-50%, -50%) translate3d(${x}px, 0, 0)`,
transformOrigin: '50% 50%',
zIndex: String(100 - abs),
opacity: abs > slots ? '0' : abs === 0 ? '1' : String(Math.max(0.55, 1 - abs * 0.16)),
pointerEvents: abs > slots ? ('none' as const) : ('auto' as const),
['--cover-dim' as string]: String(Math.min(0.4, abs * 0.14)),
};
}
const rotateY = abs === 0 ? 0 : sign * -58;
const xClear = abs === 0 ? 0 : Math.round(sign * cw * 0.16);
// 中心卡不做 scale / 少用 translateZ,否则字体会发糊
const z = abs === 0 ? 0 : -Math.round(abs * (cw * 0.55 + 20));
const opacity = abs > slots ? 0 : abs === 0 ? 1 : Math.max(0.5, 1 - abs * 0.1);
return {
transform:
abs === 0
? `translate(-50%, -50%) translate3d(0, 0, 0)`
: `translate(-50%, -50%) translate3d(${x + xClear}px, 0, ${z}px) rotateY(${rotateY}deg)`,
transformOrigin: '50% 50%',
zIndex: String(100 - abs),
opacity: String(opacity),
pointerEvents: abs > slots ? ('none' as const) : ('auto' as const),
['--cover-dim' as string]: String(abs === 0 ? 0 : Math.min(0.36, 0.1 + abs * 0.08)),
};
}
function measureStage() {
const el = stageRef.value;
if (!el) return;
stageWidth.value = Math.max(el.clientWidth, 320);
const card = el.querySelector('.ai-featured-routes__item') as HTMLElement | null;
if (card && card.offsetWidth > 40) cardWidth.value = card.offsetWidth;
}
function cardAria(item: RouteItem) {
@ -180,14 +305,32 @@
item.productName,
routeCoverageLabel(item, lang.value),
eta ? eta + ' ' + routesCopy.value.days : '',
item.productDescription,
copy.value.featuredRoutesAsk,
]
.filter(Boolean)
.join(',');
}
function onCard(item: RouteItem) {
function goTo(index: number) {
const len = featured.value.length;
if (len <= 0) return;
activeIndex.value = ((index % len) + len) % len;
bumpAutoplay();
}
function step(dir: -1 | 1) {
goTo(activeIndex.value + dir);
}
function onCard(item: RouteItem, index: number) {
if (suppressClick) {
suppressClick = false;
return;
}
if (index !== activeIndex.value) {
goTo(index);
return;
}
const destId = inferRouteDestIds(item).find((id) => id !== 'other') || 'all';
emit('ask', {
text: buildRouteAskText(item, destId, lang.value),
@ -195,67 +338,94 @@
});
}
function syncScrollState() {
const el = scrollerRef.value;
if (!el) {
canPrev.value = false;
canNext.value = false;
return;
}
const max = el.scrollWidth - el.clientWidth;
canPrev.value = el.scrollLeft > 4;
canNext.value = max > 4 && el.scrollLeft < max - 4;
}
function onScroll() {
syncScrollState();
}
/** 一整页:用第 N 张相对第 0 张的 offset,避免 gap/亚像素对不齐 */
function pageStepPx() {
const el = scrollerRef.value;
if (!el) return 0;
const size = readPageSize();
const items = el.querySelectorAll('.ai-featured-routes__item');
if (items.length > size) {
const first = items[0] as HTMLElement;
const pageFirst = items[size] as HTMLElement;
const delta = pageFirst.offsetLeft - first.offsetLeft;
if (delta > 0) return delta;
}
const item = items[0] as HTMLElement | undefined;
if (!item) return Math.round(el.clientWidth);
const styles = getComputedStyle(el);
const gap = parseFloat(styles.columnGap || styles.gap || '16') || 16;
return Math.round(size * (item.getBoundingClientRect().width + gap));
}
function scrollPage(dir: -1 | 1) {
const el = scrollerRef.value;
if (!el) return;
const step = pageStepPx();
if (!step) return;
const max = Math.max(0, el.scrollWidth - el.clientWidth);
const next = Math.min(max, Math.max(0, Math.round(el.scrollLeft + dir * step)));
el.scrollTo({ left: next, behavior: 'smooth' });
}
function onKeydown(event: KeyboardEvent) {
if (event.key === 'ArrowLeft') {
event.preventDefault();
scrollPage(-1);
step(-1);
} else if (event.key === 'ArrowRight') {
event.preventDefault();
scrollPage(1);
step(1);
} else if (event.key === 'Enter' || event.key === ' ') {
const item = featured.value[activeIndex.value];
if (!item || props.busy) return;
event.preventDefault();
onCard(item, activeIndex.value);
}
}
let ro: ResizeObserver | null = null;
function onRailFocusOut(event: FocusEvent) {
const root = event.currentTarget as HTMLElement | null;
const next = event.relatedTarget as Node | null;
if (root && next && root.contains(next)) return;
paused.value = false;
}
/* —— 拖拽 / 轻扫 —— */
let dragStartX = 0;
let dragDelta = 0;
let dragging = false;
let suppressClick = false;
let dragPointerId: number | null = null;
function onPointerDown(event: PointerEvent) {
if (loading.value || featured.value.length <= 1) return;
if (event.button !== 0 && event.pointerType === 'mouse') return;
dragging = true;
paused.value = true;
suppressClick = false;
dragDelta = 0;
dragStartX = event.clientX;
dragPointerId = event.pointerId;
stageRef.value?.setPointerCapture?.(event.pointerId);
}
function onPointerMove(event: PointerEvent) {
if (!dragging || dragPointerId !== event.pointerId) return;
dragDelta = event.clientX - dragStartX;
}
function onPointerUp(event: PointerEvent) {
if (!dragging || (dragPointerId !== null && dragPointerId !== event.pointerId)) return;
dragging = false;
dragPointerId = null;
const threshold = 48;
if (Math.abs(dragDelta) >= threshold) {
suppressClick = true;
if (dragDelta < 0) step(1);
else step(-1);
}
dragDelta = 0;
paused.value = false;
bumpAutoplay();
}
/* —— 自动轮播 —— */
let autoplayTimer: ReturnType<typeof setInterval> | null = null;
function stopAutoplay() {
if (autoplayTimer) {
clearInterval(autoplayTimer);
autoplayTimer = null;
}
}
function startAutoplay() {
stopAutoplay();
if (reducedMotion.value || loading.value || featured.value.length <= 1) return;
autoplayTimer = setInterval(() => {
if (paused.value || props.busy || dragging) return;
step(1);
}, AUTOPLAY_MS);
}
function bumpAutoplay() {
startAutoplay();
}
async function load() {
loading.value = true;
canPrev.value = false;
canNext.value = true;
activeIndex.value = 0;
stopAutoplay();
try {
const catalog = await fetchRoutesCatalog(lang.value);
featured.value = pickFeaturedRoutes(catalog, 10);
@ -264,16 +434,44 @@
} finally {
loading.value = false;
await nextTick();
syncScrollState();
const len = featured.value.length;
activeIndex.value = len > 0 ? Math.floor((len - 1) / 2) : 0;
measureStage();
startAutoplay();
}
}
let mq: MediaQueryList | null = null;
let ro: ResizeObserver | null = null;
function syncReducedMotion() {
reducedMotion.value = !!mq?.matches;
if (reducedMotion.value) stopAutoplay();
else startAutoplay();
}
onMounted(() => {
if (typeof window !== 'undefined' && window.matchMedia) {
mq = window.matchMedia('(prefers-reduced-motion: reduce)');
syncReducedMotion();
mq.addEventListener?.('change', syncReducedMotion);
}
void load();
});
onBeforeUnmount(() => {
mq?.removeEventListener?.('change', syncReducedMotion);
ro?.disconnect();
ro = null;
stopAutoplay();
});
watch(stageRef, (el) => {
ro?.disconnect();
ro = null;
if (!el || typeof ResizeObserver === 'undefined') return;
ro = new ResizeObserver(() => measureStage());
ro.observe(el);
measureStage();
});
watch(
@ -283,21 +481,8 @@
},
);
watch(scrollerRef, (el) => {
ro?.disconnect();
ro = null;
if (!el || typeof ResizeObserver === 'undefined') return;
ro = new ResizeObserver(() => {
readPageSize();
syncScrollState();
});
ro.observe(el);
readPageSize();
syncScrollState();
});
watch(featured, async () => {
await nextTick();
syncScrollState();
measureStage();
});
</script>

View File

@ -1,19 +1,6 @@
<template>
<header id="header" class="header d-flex align-items-center fixed-top">
<div class="container-fluid container-xl d-flex align-items-center justify-content-between">
<a
v-if="siteLogoSrc"
href="/"
class="logo d-flex align-items-center"
@click="$emit('home')"
>
<img :src="siteLogoSrc" :alt="`${brandCopy.navName} logo`" width="40" height="40" />
<span class="brand-lockup">
<h1>{{ brandCopy.navName }}</h1>
<small class="brand-fullname">{{ brandCopy.navFullName }}</small>
</span>
</a>
<button
type="button"
class="mobile-nav-toggle mobile-nav-show"
@ -51,14 +38,33 @@
:class="{
active: nav === item.id,
'is-active': nav === item.id,
'is-home': item.id === 'home',
'is-panel': isPanelItem(item.id) && panel === item.id,
}"
:aria-current="nav === item.id ? 'page' : undefined"
:aria-expanded="isPanelItem(item.id) ? panel === item.id : undefined"
:aria-haspopup="isPanelItem(item.id) ? 'dialog' : undefined"
@click.prevent="$emit('nav', item.id)"
:aria-label="item.id === 'home' ? `${brandCopy.navName} · ${isZh ? item.zh : item.en}` : undefined"
@click.prevent="onNavClick(item.id)"
>
<span class="site-nav-dock__icon" aria-hidden="true" v-html="item.icon"></span>
<span
v-if="item.id === 'home' && siteLogoSrc"
class="site-nav-dock__brand"
aria-hidden="true"
>
<img
:src="siteLogoSrc"
alt=""
width="30"
height="30"
/>
</span>
<span
v-else
class="site-nav-dock__icon"
aria-hidden="true"
v-html="item.icon"
></span>
<span class="site-nav-dock__label">{{ isZh ? item.zh : item.en }}</span>
</a>
</li>
@ -139,7 +145,7 @@
panel?: string | null;
}>();
defineEmits<{
const emit = defineEmits<{
home: [];
nav: [id: string];
'toggle-lang': [];
@ -152,6 +158,11 @@
return PANEL_IDS.has(id);
}
function onNavClick(id: string) {
if (id === 'home') emit('home');
emit('nav', id);
}
const router = useRouter();
const userStore = useUserStore();
const rbacUserStore = useRbacUserStore();

View File

@ -126,60 +126,73 @@
</div>
</div>
<template v-else>
<article v-for="item in pageItems" :key="String(item.id)" class="ai-route-card">
<div class="ai-route-card__head">
<div class="ai-route-card__titles">
<h4 class="ai-route-card__name">{{ item.productName }}</h4>
<span
v-if="item.productGroupName || item.productGroup"
class="ai-route-card__group"
>{{ item.productGroupName || item.productGroup }}</span>
<article
v-for="item in pageItems"
:key="String(item.id)"
class="ai-route-card"
:class="{ 'has-cover': routeHasRealCover(item) }"
>
<div
v-if="routeHasRealCover(item)"
class="ai-route-card__media"
:style="{ backgroundImage: `url(${resolveRouteCoverUrl(item)})` }"
aria-hidden="true"
/>
<div class="ai-route-card__body">
<div class="ai-route-card__head">
<div class="ai-route-card__titles">
<h4 class="ai-route-card__name">{{ item.productName }}</h4>
<span
v-if="item.productGroupName || item.productGroup"
class="ai-route-card__group"
>{{ item.productGroupName || item.productGroup }}</span>
</div>
<p v-if="formatRouteTimeliness(item)" class="ai-route-card__eta">
{{ formatRouteTimeliness(item) }} {{ copy.days }}
</p>
</div>
<p v-if="formatRouteTimeliness(item)" class="ai-route-card__eta">
{{ formatRouteTimeliness(item) }} {{ copy.days }}
<p class="ai-route-card__meta">
<span>{{ routeCoverageLabel(item, lang) }}</span>
<span v-if="item.tradeTerms"> · {{ item.tradeTerms }}</span>
<span v-if="item.tradeTerms === 'DDP'"> · {{ copy.ddpHint }}</span>
<span v-else-if="item.tradeTerms === 'DDU'"> · {{ copy.dduHint }}</span>
</p>
</div>
<p class="ai-route-card__meta">
<span>{{ routeCoverageLabel(item, lang) }}</span>
<span v-if="item.tradeTerms"> · {{ item.tradeTerms }}</span>
<span v-if="item.tradeTerms === 'DDP'"> · {{ copy.ddpHint }}</span>
<span v-else-if="item.tradeTerms === 'DDU'"> · {{ copy.dduHint }}</span>
</p>
<p v-if="item.productDescription" class="ai-route-card__desc">
{{ item.productDescription }}
</p>
<div class="ai-route-card__actions">
<a class="ai-route-card__reg" :href="officialLoginUrl(destLabel(destFilter, lang) || undefined)">
{{ copy.register }}
</a>
<button
type="button"
class="ai-route-card__ask"
:title="copy.ask"
:aria-label="copy.ask"
@click="askItem(item)"
>
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path
d="M4 14.5V12a8 8 0 0 1 16 0v2.5"
stroke="currentColor"
stroke-width="1.8"
stroke-linecap="round"
/>
<path
d="M4 14h2.8v5.2H4A1.6 1.6 0 0 1 2.4 17.6v-2A1.6 1.6 0 0 1 4 14z"
stroke="currentColor"
stroke-width="1.8"
stroke-linejoin="round"
/>
<path
d="M20 14h-2.8v5.2H20a1.6 1.6 0 0 0 1.6-1.6v-2A1.6 1.6 0 0 0 20 14z"
stroke="currentColor"
stroke-width="1.8"
stroke-linejoin="round"
/>
</svg>
</button>
<p v-if="item.productDescription" class="ai-route-card__desc">
{{ item.productDescription }}
</p>
<div class="ai-route-card__actions">
<a class="ai-route-card__reg" :href="officialLoginUrl(destLabel(destFilter, lang) || undefined)">
{{ copy.register }}
</a>
<button
type="button"
class="ai-route-card__ask"
:title="copy.ask"
:aria-label="copy.ask"
@click="askItem(item)"
>
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path
d="M4 14.5V12a8 8 0 0 1 16 0v2.5"
stroke="currentColor"
stroke-width="1.8"
stroke-linecap="round"
/>
<path
d="M4 14h2.8v5.2H4A1.6 1.6 0 0 1 2.4 17.6v-2A1.6 1.6 0 0 1 4 14z"
stroke="currentColor"
stroke-width="1.8"
stroke-linejoin="round"
/>
<path
d="M20 14h-2.8v5.2H20a1.6 1.6 0 0 0 1.6-1.6v-2A1.6 1.6 0 0 0 20 14z"
stroke="currentColor"
stroke-width="1.8"
stroke-linejoin="round"
/>
</svg>
</button>
</div>
</div>
</article>
</template>
@ -204,6 +217,7 @@
type RoutesCatalog,
type RouteItem,
} from './lib/portal-catalog';
import { resolveRouteCoverUrl, routeHasRealCover } from './lib/route-cover';
const props = defineProps<{
isZh: boolean;

View File

@ -6,7 +6,7 @@
<script lang="ts" setup>
/**
* 欢迎标题 canvas:保留逐字入场 / 斜切;颜色与站点主色统一,不再画跑道线。
* 欢迎标题 canvas:保留逐字入场 / 斜切;整行蓝→橙均分斜切。
*/
import { onMounted, onUnmounted, ref, watch } from 'vue';
import { isPortalIrisActive } from '@/utils/page-transition-flag';
@ -51,6 +51,14 @@
let cachedCharWidths: number[] = [];
let cachedChars: string[] = [];
let cachedLabel = '';
let brandColor = '#023e8a';
let accentColor = '#e96a26';
const syncThemeColors = () => {
const css = getComputedStyle(root);
brandColor = css.getPropertyValue('--ai-brand').trim() || '#023e8a';
accentColor = css.getPropertyValue('--ai-accent').trim() || '#e96a26';
};
const easeOutCubic = (t: number) => 1 - (1 - t) ** 3;
@ -88,9 +96,6 @@
}
const chars = cachedChars;
// 整行统一主题橙(--ai-accent)
const titleFill = 'rgba(233, 106, 38, 0.94)';
const shadowFill = 'rgba(18, 24, 32, 0.1)';
const letterGap = fontSize * 0.14;
const charWidths = cachedCharWidths;
const totalW =
@ -99,6 +104,7 @@
const yGlyph = fontSize * 0.02;
const shadowX = fontSize * 0.045;
const shadowY = fontSize * 0.11;
const shadowFill = 'rgba(18, 24, 32, 0.1)';
ctx.save();
ctx.translate(cx, cy);
@ -107,6 +113,16 @@
ctx.textBaseline = 'middle';
ctx.font = font;
// 整行左上蓝 → 右下橙均分斜切
const titleFill = ctx.createLinearGradient(
-totalW / 2,
-fontSize * 0.42,
totalW / 2,
fontSize * 0.42,
);
titleFill.addColorStop(0, brandColor);
titleFill.addColorStop(1, accentColor);
let cursor = -totalW / 2;
for (let i = 0; i < chars.length; i++) {
const ch = chars[i];
@ -172,6 +188,7 @@
};
const rebuild = () => {
syncThemeColors();
const rect = root.getBoundingClientRect();
const nextW = Math.max(1, Math.floor(rect.width));
const nextH = Math.max(1, Math.floor(rect.height));

View File

@ -1,4 +1,5 @@
import { resolveAdminApiPath } from '@/utils/adminApi';
import { resolveSalesProductCoverUrl } from '@/utils/salesProductCover';
import type { SiteLang } from './guide-services';
export const ROUTE_PAGE_SIZE = 12;
@ -83,6 +84,8 @@ export type RouteItem = {
maxTimeliness: number | null;
tradeTerms: string;
productDescription: string;
/** 官网封面图 URL(可空) */
coverImageUrl: string;
destRegions: string[];
coverageCountries: string[];
cargoTags: string[];
@ -198,6 +201,9 @@ export function normalizeRoutesCatalog(raw: unknown, lang: SiteLang): RoutesCata
.trim()
.toUpperCase(),
productDescription: String(item.productDescription ?? item.ProductDescription ?? '').trim(),
coverImageUrl: resolveSalesProductCoverUrl(
String(item.coverImageUrl ?? item.CoverImageUrl ?? item.coverImage ?? item.CoverImage ?? '').trim(),
),
destRegions: normalizeStringList(item.destRegions ?? item.DestRegions),
coverageCountries: normalizeStringList(item.coverageCountries ?? item.CoverageCountries).map((c) =>
c.toUpperCase(),
@ -247,6 +253,7 @@ export function pickFeaturedRoutes(catalog: RoutesCatalog | null, limit = 6): Ro
if (formatRouteTimeliness(item)) s += 3;
if (item.tradeTerms === 'DDP' || item.tradeTerms === 'DDU') s += 1;
if (item.productDescription) s += 1;
if (item.coverImageUrl) s += 2;
return s;
};
@ -315,10 +322,13 @@ export function itemMatchesDest(item: RouteItem, destId: string) {
export function formatRouteTimeliness(item: RouteItem) {
const min = item.minTimeliness;
const max = item.maxTimeliness;
if (min != null && max != null && min !== max) return min + '–' + max;
if (min != null && max != null) return String(min);
if (min != null) return String(min) + '+';
if (max != null) return '≤' + max;
// ≤0 当未配置,避免封面卡出现「0 天」
const hasMin = min != null && Number(min) > 0;
const hasMax = max != null && Number(max) > 0;
if (hasMin && hasMax && min !== max) return min + '–' + max;
if (hasMin && hasMax) return String(min);
if (hasMin) return String(min) + '+';
if (hasMax) return '≤' + max;
return '';
}

View File

@ -0,0 +1,10 @@
import type { RouteItem } from './portal-catalog';
export function routeHasRealCover(item: RouteItem): boolean {
return Boolean(item.coverImageUrl?.trim());
}
/** 仅返回运营上传的封面;无图时不走彩色渐变兜底 */
export function resolveRouteCoverUrl(item: RouteItem): string {
return item.coverImageUrl?.trim() || '';
}

View File

@ -220,6 +220,22 @@ body.command-home #navbar .site-nav-dock a {
display: none !important;
}
body.command-home .site-nav-dock__brand {
display: inline-flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
}
body.command-home .site-nav-dock__brand img {
display: block;
width: 32px;
height: 32px;
object-fit: contain;
}
body.command-home #navbar > ul {
gap: 8px;
}
@ -368,6 +384,39 @@ body.command-home #navbar .site-nav-dock a {
0 2px 6px rgba(15, 23, 42, 0.04);
}
/* 首页项:Logo,与其它菜单同宽同布局 */
body.command-home .site-nav-dock__brand {
display: inline-flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
width: 30px;
height: 30px;
}
body.command-home .site-nav-dock__brand img {
display: block;
width: 30px;
height: 30px;
object-fit: contain;
}
body.command-home #navbar .site-nav-dock__item.is-home {
gap: 0;
}
body.command-home #navbar .site-nav-dock__item.is-home .site-nav-dock__label {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
body.command-home .site-nav-dock__glass {
position: absolute;
inset: 0;
@ -522,15 +571,20 @@ body.command-home #navbar .site-nav-dock a {
}
body.command-home #navbar > ul > li.site-nav-tools {
height: 40px;
padding: 3px;
height: 36px;
padding: 2px;
overflow: hidden;
border: none;
border-radius: 20px;
border-radius: 18px;
background: transparent;
box-shadow:
0 8px 24px rgba(15, 23, 42, 0.08),
0 1px 4px rgba(15, 23, 42, 0.04);
opacity: 0.72;
box-shadow: none;
transition: opacity 0.2s ease;
}
body.command-home #navbar > ul > li.site-nav-tools:hover,
body.command-home #navbar > ul > li.site-nav-tools:focus-within {
opacity: 0.92;
}
body.command-home .site-nav-tools__glass {
@ -541,9 +595,9 @@ body.command-home #navbar .site-nav-dock a {
border-radius: inherit;
overflow: hidden;
pointer-events: none;
background: linear-gradient(180deg, rgba(255, 255, 255, 0.38) 0%, rgba(255, 255, 255, 0.16) 100%);
backdrop-filter: blur(32px) saturate(190%) brightness(1.08);
-webkit-backdrop-filter: blur(32px) saturate(190%) brightness(1.08);
background: linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.08) 100%);
backdrop-filter: blur(16px) saturate(140%);
-webkit-backdrop-filter: blur(16px) saturate(140%);
}
body.command-home .site-nav-tools__glass::before {
@ -564,7 +618,7 @@ body.command-home #navbar .site-nav-dock a {
}
body.command-home .site-nav-tools__glass {
box-shadow: inset 0 2px 8px rgba(15, 23, 42, 0.08);
box-shadow: inset 0 1px 4px rgba(15, 23, 42, 0.04);
}
body.command-home #navbar .site-nav-tools .site-nav-login,
@ -580,14 +634,15 @@ body.command-home #navbar .site-nav-dock a {
z-index: 1;
height: 100%;
min-height: 0;
padding: 0 10px;
padding: 0 9px;
border: none;
border-radius: 17px;
border-radius: 16px;
background: transparent;
backdrop-filter: none;
-webkit-backdrop-filter: none;
box-shadow: none;
font-size: 12px;
color: var(--ai-text-3);
font-size: 11.5px;
transition:
background 0.22s ease,
box-shadow 0.22s ease,
@ -599,11 +654,9 @@ body.command-home #navbar .site-nav-dock a {
body.command-home #navbar .site-nav-tools .language-toggle-link:hover,
body.command-home #navbar .site-nav-tools .language-toggle-link.active,
body.command-home #navbar .site-nav-tools .language-toggle-link.active:focus {
background: linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0.42) 100%);
box-shadow:
0 4px 16px rgba(15, 23, 42, 0.08),
inset 0 1px 0 rgba(255, 255, 255, 0.95),
inset 0 -1px 0 rgba(255, 255, 255, 0.2);
color: var(--ai-text-2);
background: rgba(255, 255, 255, 0.36);
box-shadow: none;
}
body.command-home #navbar .site-nav-tools .site-nav-avatar,
@ -645,21 +698,6 @@ body.command-home #navbar .site-nav-dock a {
}
}
body.command-home #header .logo img {
max-height: 48px;
}
body.command-home #header .logo h1,
body.command-home #header .brand-lockup h1 {
color: var(--ai-text-2);
opacity: 1;
font-size: 1.45rem;
}
body.command-home #header .brand-lockup .brand-fullname {
display: block;
color: var(--ai-text-3);
}
body.command-home .mobile-nav-show,
body.command-home .mobile-nav-hide {
@ -1792,11 +1830,12 @@ body.command-home #ai-advisor-shell {
.ai-route-card {
display: flex;
flex-direction: column;
gap: 8px;
flex-direction: row;
align-items: stretch;
gap: 0;
min-width: 0;
height: 180px;
padding: 14px 16px;
padding: 0;
border-radius: 16px;
border: none;
background: color-mix(in srgb, #fff 76%, #e6edf2);
@ -1804,6 +1843,40 @@ body.command-home #ai-advisor-shell {
overflow: hidden;
}
.ai-route-card__media {
flex: 0 0 118px;
width: 118px;
background-color: #e8eef2;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.ai-route-card:not(.has-cover) {
flex-direction: column;
}
.ai-route-card:not(.has-cover) .ai-route-card__body {
padding: 14px 16px;
}
.ai-route-card.has-cover .ai-route-card__body {
flex: 1 1 auto;
min-width: 0;
display: flex;
flex-direction: column;
gap: 8px;
padding: 14px 16px;
}
.ai-route-card__body {
flex: 1 1 auto;
min-width: 0;
display: flex;
flex-direction: column;
gap: 8px;
}
.ai-route-card__head {
display: flex;
align-items: flex-start;
@ -2262,6 +2335,7 @@ body.command-home #ai-advisor-shell {
.ai-welcome-plane,
.ai-welcome-title-wrap,
.ai-welcome-fullname,
.ai-composer-slot--welcome,
.ai-featured-routes,
.ai-intent-section,
@ -2277,6 +2351,10 @@ body.command-home #ai-advisor-shell {
animation-delay: 0.06s;
}
.ai-welcome-fullname {
animation-delay: 0.1s;
}
.ai-composer-slot--welcome {
animation-delay: 0.14s;
}
@ -2370,6 +2448,23 @@ body.command-home #navbar .site-nav-avatar:hover {
margin-top: 2px;
}
.ai-welcome-fullname {
position: relative;
z-index: 2;
margin: -6px 0 0;
padding: 0 16px;
color: var(--ai-text-3);
font-family: var(--ai-display-font, var(--font-primary, system-ui, sans-serif));
font-size: clamp(0.95rem, 1.35vw, 1.12rem);
font-weight: 500;
letter-spacing: 0.05em;
line-height: 1.25;
text-align: center;
opacity: 0.1;
pointer-events: none;
user-select: none;
}
/* canvas 标题的无障碍文案 */
.ai-welcome-title--sr {
position: absolute;
@ -2580,25 +2675,19 @@ body.command-home #ai-advisor-shell:not(:has(.ai-stage-tools)) .ai-composer-dock
overflow: visible;
}
/* 精选线路:一屏整 4 张均分,无 peek;多余线路整页翻
注意:--ai-featured-card-w 里的 100% 在 item 上解析 = scroller 内容盒宽度,
故横向 padding 只能放在 rail,公式里不能再减 head-pad(否则卡偏窄漏出第 5 张)。 */
/* 精选线路:竖版封面流(加宽、高度克制 + 大幅后仰 + 中心正对) */
.ai-featured-routes {
--ai-featured-gap: 0.65rem;
--ai-featured-visible: 4;
--ai-featured-card-h: 11.5rem;
--ai-featured-card-w: min(17.5rem, 42vw);
--ai-featured-card-h: min(17rem, 34vh);
--ai-featured-head-pad: var(--ai-home-rail-pad, 16px);
--ai-featured-fade-bg: var(--ai-bg, #f0f3f4);
/* -1px 吃掉亚像素取整,避免第 5 张露 1px */
--ai-featured-card-w: calc(
(100% - (var(--ai-featured-gap) * (var(--ai-featured-visible) - 1)) - 1px) /
var(--ai-featured-visible)
);
--ai-featured-stage-h: calc(var(--ai-featured-card-h) + 2.6rem);
--ai-featured-perspective: 980px;
--ai-featured-radius: 18px;
flex-shrink: 0;
min-width: 0;
margin-top: 0;
padding: 4px 0 0;
overflow: hidden;
overflow: visible;
}
.ai-featured-routes__head {
@ -2699,79 +2788,92 @@ body.command-home #ai-advisor-shell:not(:has(.ai-stage-tools)) .ai-composer-dock
box-sizing: border-box;
width: 100%;
min-width: 0;
/* 左右留白放在 rail,scroller 内容区 = 可用宽,卡宽公式才能刚好 4 张 */
padding: 0.25rem var(--ai-featured-head-pad) 0.5rem;
overflow: hidden;
padding: 0.2rem var(--ai-featured-head-pad) 0.1rem;
overflow: visible;
}
.ai-featured-routes__fade {
position: absolute;
top: 0.25rem;
bottom: 0.5rem;
z-index: 2;
width: 0.75rem;
pointer-events: none;
opacity: 0.4;
}
.ai-featured-routes__fade--left {
left: var(--ai-featured-head-pad);
background: linear-gradient(90deg, var(--ai-featured-fade-bg) 40%, transparent);
}
.ai-featured-routes__fade--right {
right: var(--ai-featured-head-pad);
background: linear-gradient(270deg, var(--ai-featured-fade-bg) 40%, transparent);
}
.ai-featured-routes__scroller {
display: flex;
align-items: stretch;
gap: var(--ai-featured-gap);
.ai-featured-routes__stage {
position: relative;
width: 100%;
height: var(--ai-featured-stage-h);
margin: 0;
padding: 0;
list-style: none;
overflow-x: hidden;
overflow-y: hidden;
scroll-snap-type: x mandatory;
scroll-padding-inline: 0;
scrollbar-width: none;
-webkit-overflow-scrolling: touch;
outline: none;
box-sizing: border-box;
perspective: var(--ai-featured-perspective);
perspective-origin: 50% 48%;
transform-style: preserve-3d;
touch-action: pan-y;
user-select: none;
-webkit-user-select: none;
cursor: grab;
}
.ai-featured-routes__scroller::-webkit-scrollbar {
display: none;
.ai-featured-routes__stage:active {
cursor: grabbing;
}
.ai-featured-routes__scroller:focus-visible {
.ai-featured-routes__stage:focus-visible {
box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ai-action) 35%, transparent);
border-radius: var(--ai-featured-radius);
}
.ai-featured-routes__item {
position: absolute;
top: 48%;
left: 50%;
box-sizing: border-box;
flex: 0 0 var(--ai-featured-card-w);
width: var(--ai-featured-card-w);
max-width: var(--ai-featured-card-w);
min-width: 0;
margin: 0;
padding: 0;
scroll-snap-align: start;
overflow: hidden;
transform-style: preserve-3d;
will-change: transform, opacity;
transition:
transform 0.66s cubic-bezier(0.32, 0.72, 0, 1),
opacity 0.45s ease;
overflow: visible;
/* 勿在此元素上用 filter:会打平 3D,侧卡后仰失效 */
}
.ai-featured-routes__item.is-active {
z-index: 60;
}
.ai-featured-routes__item.is-active .ai-featured-routes__card {
border-color: rgba(255, 255, 255, 0.95);
/* 只用 color,避免 background 简写冲掉封面 background-image / size */
background-color: #fff;
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 1),
0 18px 42px rgba(15, 23, 42, 0.14),
0 0 0 1px color-mix(in srgb, var(--ai-action) 14%, transparent);
}
.ai-featured-routes__item.is-active .ai-featured-routes__card.has-cover {
background-color: #1a2330;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.ai-featured-routes__item.is-active .ai-featured-routes__card::after {
opacity: 0;
}
.ai-featured-routes__skel {
width: 100%;
min-height: var(--ai-featured-card-h);
height: var(--ai-featured-card-h);
border-radius: 14px;
aspect-ratio: 16 / 15;
border-radius: var(--ai-featured-radius);
background: linear-gradient(
90deg,
rgba(255, 255, 255, 0.45) 0%,
rgba(255, 255, 255, 0.72) 50%,
rgba(255, 255, 255, 0.45) 100%
160deg,
rgba(255, 255, 255, 0.5) 0%,
rgba(255, 255, 255, 0.78) 48%,
rgba(255, 255, 255, 0.42) 100%
);
background-size: 200% 100%;
animation: ai-routes-shimmer 1.2s ease-in-out infinite;
@ -2783,32 +2885,37 @@ body.command-home #ai-advisor-shell:not(:has(.ai-stage-tools)) .ai-composer-dock
display: flex;
flex-direction: column;
align-items: stretch;
gap: 0.55rem;
justify-content: flex-start;
gap: 0;
box-sizing: border-box;
width: 100%;
aspect-ratio: 16 / 15;
min-width: 0;
min-height: var(--ai-featured-card-h);
height: var(--ai-featured-card-h);
margin: 0;
padding: 0.85rem 0.9rem 0.9rem;
border: 1px solid rgba(255, 255, 255, 0.66);
border-radius: 14px;
background: color-mix(in srgb, #fff 46%, transparent);
backdrop-filter: blur(14px) saturate(160%);
-webkit-backdrop-filter: blur(14px) saturate(160%);
padding: 1rem 1.1rem 1.05rem;
border: 1px solid rgba(255, 255, 255, 0.78);
border-radius: var(--ai-featured-radius);
/* 不用 backdrop-filter:3D 变换下会把字一起糊掉 */
background: color-mix(in srgb, #fff 88%, #e8eef2);
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.78),
0 1px 2px rgba(15, 23, 42, 0.04);
inset 0 1px 0 rgba(255, 255, 255, 0.95),
0 8px 22px rgba(15, 23, 42, 0.09);
color: inherit;
font: inherit;
text-align: left;
cursor: pointer;
overflow: hidden;
isolation: isolate;
backface-visibility: hidden;
-webkit-backface-visibility: hidden;
-webkit-font-smoothing: antialiased;
text-rendering: geometricPrecision;
transition:
background 0.18s ease,
border-color 0.18s ease,
box-shadow 0.18s ease;
background 0.22s ease,
border-color 0.22s ease,
box-shadow 0.22s ease;
-webkit-tap-highlight-color: transparent;
}
@ -2836,6 +2943,16 @@ body.command-home .ai-composer-slot--welcome .ai-composer {
}
.ai-featured-routes__card.has-cover {
justify-content: flex-end;
background-color: #1a2330;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
border-color: rgba(255, 255, 255, 0.28);
color: #fff;
}
.ai-featured-routes__card::before {
content: '';
position: absolute;
@ -2845,23 +2962,58 @@ body.command-home .ai-composer-slot--welcome .ai-composer {
pointer-events: none;
background: linear-gradient(
180deg,
rgba(255, 255, 255, 0.55) 0%,
rgba(255, 255, 255, 0.05) 40%,
transparent 62%
rgba(255, 255, 255, 0.62) 0%,
rgba(255, 255, 255, 0.12) 38%,
transparent 58%,
rgba(15, 23, 42, 0.04) 100%
);
}
/* 有封面:上部留照片,底部加重压暗保证叠字可读 */
.ai-featured-routes__card.has-cover::before {
background: linear-gradient(
180deg,
rgba(15, 23, 42, 0.12) 0%,
rgba(15, 23, 42, 0.08) 42%,
rgba(15, 23, 42, 0.55) 68%,
rgba(15, 23, 42, 0.88) 100%
);
}
/* 侧卡压暗蒙层 */
.ai-featured-routes__card::after {
content: '';
position: absolute;
inset: 0;
z-index: 2;
border-radius: inherit;
pointer-events: none;
background: rgba(15, 23, 42, var(--cover-dim, 0.28));
opacity: 1;
transition: opacity 0.35s ease, background 0.35s ease;
}
.ai-featured-routes__card > * {
position: relative;
z-index: 1;
}
/* 有封面时文字压过侧卡压暗层 */
.ai-featured-routes__card.has-cover > * {
z-index: 3;
}
.ai-featured-routes__card:hover {
background: color-mix(in srgb, #fff 64%, transparent);
border-color: rgba(255, 255, 255, 0.82);
background-color: color-mix(in srgb, #fff 66%, transparent);
border-color: rgba(255, 255, 255, 0.86);
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.88),
0 6px 18px rgba(15, 23, 42, 0.07);
inset 0 1px 0 rgba(255, 255, 255, 0.9),
0 10px 26px rgba(15, 23, 42, 0.1);
}
.ai-featured-routes__card.has-cover:hover {
background-color: #1a2330;
border-color: rgba(255, 255, 255, 0.4);
}
.ai-featured-routes__card:disabled {
@ -2869,31 +3021,61 @@ body.command-home .ai-composer-slot--welcome .ai-composer {
cursor: not-allowed;
}
/* 上:目的地 + 时效(横排);有封面时改为角标时效 */
.ai-featured-routes__card-top {
display: flex;
align-items: center;
flex-direction: row;
align-items: flex-start;
justify-content: space-between;
gap: 8px;
gap: 0.5rem;
min-width: 0;
flex-shrink: 0;
}
.ai-featured-routes__card.has-cover .ai-featured-routes__card-top {
position: absolute;
top: 0.85rem;
left: 0.9rem;
right: 0.9rem;
z-index: 3;
}
.ai-featured-routes__top-spacer {
flex: 1 1 auto;
min-width: 0;
}
.ai-featured-routes__dest {
min-width: 0;
flex: 1 1 auto;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding-top: 0.12rem;
font-size: 0.72rem;
font-weight: 650;
letter-spacing: 0.01em;
text-transform: none;
color: var(--ai-muted, #6a7380);
}
.ai-featured-routes__card.has-cover .ai-featured-routes__name,
.ai-featured-routes__card.has-cover .ai-featured-routes__desc {
color: #fff;
}
.ai-featured-routes__eta {
flex-shrink: 0;
font-size: 0.78rem;
font-weight: 750;
padding: 0.18rem 0.55rem;
border-radius: 999px;
background: color-mix(in srgb, var(--ai-action) 12%, #fff);
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ai-action) 14%, transparent);
font-size: 0.8rem;
font-weight: 780;
line-height: 1.2;
color: var(--ai-action);
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.ai-featured-routes__eta em {
@ -2904,42 +3086,110 @@ body.command-home .ai-composer-slot--welcome .ai-composer {
color: var(--ai-text-3, #6a7380);
}
.ai-featured-routes__main {
/* 中:产品名撑住视觉重心;有封面时贴底 */
.ai-featured-routes__card-mid {
display: flex;
flex-direction: column;
gap: 10px;
justify-content: center;
flex: 1 1 auto;
min-width: 0;
flex-shrink: 0;
min-height: 0;
margin-top: 0.55rem;
padding-bottom: 0.45rem;
}
.ai-featured-routes__card.has-cover .ai-featured-routes__card-mid {
flex: 0 0 auto;
justify-content: flex-end;
margin-top: 0;
padding-bottom: 0.15rem;
}
.ai-featured-routes__name {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-line-clamp: 3;
line-clamp: 3;
margin: 0;
min-width: 0;
min-height: calc(1.28em * 2);
overflow: hidden;
text-overflow: ellipsis;
white-space: normal;
font-size: 0.86rem;
font-weight: 780;
font-size: 1.08rem;
font-weight: 800;
line-height: 1.28;
letter-spacing: -0.01em;
letter-spacing: -0.02em;
color: var(--ai-action);
}
.ai-featured-routes__meta {
display: block;
.ai-featured-routes__card.has-cover .ai-featured-routes__name {
-webkit-line-clamp: 2;
line-clamp: 2;
text-shadow:
0 1px 2px rgba(0, 0, 0, 0.45),
0 6px 18px rgba(0, 0, 0, 0.35);
}
.ai-featured-routes__card.has-cover .ai-featured-routes__eta {
background: rgba(15, 23, 42, 0.42);
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
backdrop-filter: none;
color: #fff;
}
.ai-featured-routes__card.has-cover .ai-featured-routes__eta em {
color: rgba(255, 255, 255, 0.78);
}
.ai-featured-routes__card.has-cover .ai-featured-routes__card-foot {
border-top: none;
padding-top: 0.35rem;
}
.ai-featured-routes__card.has-cover .ai-featured-routes__chip {
background: rgba(255, 255, 255, 0.14);
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
color: rgba(255, 255, 255, 0.88);
}
/* 有封面时精简信息:不再展示长说明 */
.ai-featured-routes__card.has-cover .ai-featured-routes__desc {
display: none;
}
/* 下:条款 chip + 简述 */
.ai-featured-routes__card-foot {
display: flex;
flex-direction: column;
gap: 0.45rem;
min-width: 0;
min-height: 1.3em;
flex-shrink: 0;
padding-top: 0.7rem;
border-top: 1px solid color-mix(in srgb, var(--ai-text-3, #6a7380) 14%, transparent);
}
.ai-featured-routes__meta {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.35rem;
min-width: 0;
}
.ai-featured-routes__chip {
display: inline-flex;
align-items: center;
max-width: 100%;
padding: 0.12rem 0.45rem;
border-radius: 999px;
background: color-mix(in srgb, #fff 55%, transparent);
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ai-text-3, #6a7380) 16%, transparent);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 0.7rem;
font-weight: 600;
line-height: 1.3;
font-size: 0.68rem;
font-weight: 650;
line-height: 1.35;
color: var(--ai-text-3, #6a7380);
}
@ -2948,52 +3198,92 @@ body.command-home .ai-composer-slot--welcome .ai-composer {
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
margin: auto 0 0;
margin: 0;
min-width: 0;
min-height: calc(1.4em * 2);
max-height: calc(1.4em * 2);
overflow: hidden;
text-overflow: ellipsis;
word-break: break-word;
overflow-wrap: anywhere;
font-size: 0.7rem;
font-size: 0.72rem;
font-weight: 500;
line-height: 1.4;
color: color-mix(in srgb, var(--ai-text-3, #6a7380) 72%, #fff);
color: color-mix(in srgb, var(--ai-text-3, #6a7380) 82%, #fff);
}
.ai-featured-routes__desc.is-empty {
visibility: hidden;
/* 参考图:竖刻度指示条 */
.ai-featured-routes__dots {
position: relative;
z-index: 9;
display: flex;
align-items: flex-end;
justify-content: center;
gap: 5px;
margin: 0.05rem 0 0;
padding: 0.2rem 0 0.1rem;
}
.ai-featured-routes__dot {
width: 2px;
height: 10px;
margin: 0;
padding: 0;
border: 0;
border-radius: 1px;
background: color-mix(in srgb, var(--ai-text-3, #6a7380) 28%, transparent);
cursor: pointer;
transition:
height 0.28s cubic-bezier(0.32, 0.72, 0, 1),
background 0.22s ease,
opacity 0.22s ease;
-webkit-tap-highlight-color: transparent;
}
.ai-featured-routes__dot.is-active {
height: 16px;
background: var(--ai-action);
}
.ai-featured-routes__dot:disabled {
cursor: not-allowed;
opacity: 0.5;
}
@media (prefers-reduced-motion: reduce) {
.ai-featured-routes__scroller {
scroll-behavior: auto;
}
}
@media (min-width: 1200px) {
.ai-featured-routes {
--ai-featured-visible: 4;
.ai-featured-routes__item,
.ai-featured-routes__dot {
transition-duration: 0.01ms;
}
}
@media (max-width: 980px) {
.ai-featured-routes {
--ai-featured-visible: 3;
--ai-featured-card-w: min(15.5rem, 46vw);
--ai-featured-card-h: min(15.25rem, 32vh);
--ai-featured-perspective: 1050px;
}
}
@media (max-width: 720px) {
.ai-featured-routes {
--ai-featured-visible: 2;
--ai-featured-card-w: min(14rem, 58vw);
--ai-featured-card-h: min(14rem, 32vh);
--ai-featured-stage-h: calc(var(--ai-featured-card-h) + 2.3rem);
}
.ai-featured-routes__name {
font-size: 1rem;
-webkit-line-clamp: 2;
line-clamp: 2;
}
}
@media (max-width: 520px) {
.ai-featured-routes {
--ai-featured-visible: 1;
--ai-featured-card-h: 11rem;
--ai-featured-card-w: min(13.25rem, 72vw);
--ai-featured-card-h: min(13.25rem, 34vh);
--ai-featured-perspective: 900px;
--ai-featured-radius: 16px;
}
}
@ -3404,6 +3694,7 @@ body.command-home .ai-composer-slot--welcome .ai-composer {
.ai-welcome-plane,
.ai-welcome-plane img,
.ai-welcome-title-wrap,
.ai-welcome-fullname,
.ai-composer-slot--welcome,
.ai-featured-routes,
.ai-ask,
@ -3429,7 +3720,9 @@ body.command-home .ai-composer-slot--welcome .ai-composer {
}
body.command-home .ai-featured-routes {
--ai-featured-card-h: 10.75rem;
--ai-featured-card-w: min(16rem, 40vw);
--ai-featured-card-h: min(15.25rem, 30vh);
--ai-featured-stage-h: calc(var(--ai-featured-card-h) + 2.35rem);
}
@ -4921,10 +5214,19 @@ body.command-home * {
-webkit-backdrop-filter: none !important;
}
body.command-home .ai-featured-routes__card {
backdrop-filter: blur(14px) saturate(160%) !important;
-webkit-backdrop-filter: blur(14px) saturate(160%) !important;
background: color-mix(in srgb, #fff 46%, transparent) !important;
body.command-home .ai-featured-routes__card:not(.has-cover) {
backdrop-filter: none !important;
-webkit-backdrop-filter: none !important;
background: color-mix(in srgb, #fff 92%, #e8eef2) !important;
}
body.command-home .ai-featured-routes__card.has-cover {
backdrop-filter: none !important;
-webkit-backdrop-filter: none !important;
}
body.command-home .ai-featured-routes__item.is-active .ai-featured-routes__card:not(.has-cover) {
background: #fff !important;
}
body.command-home .ai-intent-ribbon__face {
@ -4948,12 +5250,16 @@ body.command-home .ai-welcome-plane img {
filter: none;
}
body.command-home .ai-featured-routes,
body.command-home .ai-intent-section,
body.command-home .ai-home-bottom {
/* 扇形封面流需要溢出可见;home-bottom / featured 勿 paint contain */
body.command-home .ai-intent-section {
contain: layout paint;
}
body.command-home .ai-home-bottom,
body.command-home .ai-featured-routes {
contain: layout;
}
body.command-home .ai-history-sidebar {
background: #f7f8fa;
}

View File

@ -55,48 +55,31 @@ body.command-home {
margin-right: 8px;
}
.header .logo h1 {
margin: 0;
color: var(--kc-secondary);
opacity: 1;
font-family: var(--font-primary);
font-size: 2.55rem;
font-weight: 400;
letter-spacing: -0.02em;
}
.brand-lockup {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
line-height: 1.05;
}
.brand-lockup h1 {
margin: 0;
color: var(--kc-secondary);
opacity: 1;
font-family: var(--font-primary);
font-size: 2.15rem;
font-weight: 400;
letter-spacing: -0.02em;
line-height: 1.15;
}
.brand-lockup .brand-fullname {
margin-top: 2px;
margin: 0;
color: var(--kc-secondary);
font-size: 0.68rem;
font-family: var(--font-primary);
font-size: 1.12rem;
font-weight: 500;
letter-spacing: 0.04em;
opacity: 0.85;
letter-spacing: 0.03em;
opacity: 0.9;
text-align: center;
white-space: nowrap;
}
@media (max-width: 991px) {
.brand-lockup .brand-fullname {
display: block;
max-width: min(52vw, 220px);
font-size: 0.58rem;
max-width: min(62vw, 280px);
font-size: 0.9rem;
letter-spacing: 0.02em;
white-space: nowrap;
overflow: hidden;