Commit b0aaf81e by liimin

优化视觉

1 parent 200c7e6c
Pipeline #435 for b0aaf81e failed in 0 seconds
{
"name": "@uj/web-shell",
"version": "1.0.2",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
......
......@@ -11,6 +11,7 @@ import { themeConfig } from '@/theme/themeConfig';
import { AccessProvider } from '@/access';
import { initSign, setUnauthorizedHandler, http } from '@/api';
import { DownloadCenterProvider } from '@uj/download-center';
import { installGlobalUnhandledRejectionHandler } from '@uj/ui';
import type { RemoteRequestFn } from '@uj/contracts';
import { loadRuntimeManifest } from './runtime-manifest';
import '@uj/design-tokens/tokens.css';
......@@ -22,6 +23,9 @@ import './theme/mfe.css';
// logout 会双清 uj_token 与 session 并把 loggedIn 置 false,RequireAuth 随即重定向。
setUnauthorizedHandler(() => useAppStore.getState().logout());
// 全应用未处理 promise rejection 兜底:async 调用漏 catch 时弹红色错误 toast。
installGlobalUnhandledRejectionHandler();
// 拉服务端公钥用于响应验签;失败仅告警,真正的阻断由调用方 ensureSignReady 判断。
void initSign().catch(() => {});
......
......@@ -2,19 +2,26 @@
* @Author: liimin 17653212@qq.com
* @Date: 2026-11-13 10:00:00
* @LastEditors: liimin 17653212@qq.com
* @LastEditTime: 2026-11-13 16:33:00
* @LastEditTime: 2026-11-15 12:25:00
* @FilePath: \uj-store\src\pages\Login\components\LoginCoverage.tsx
* @Description: 登录页左栏下半部分背景:门店覆盖点阵,纯装饰、无任何伪造数据。
* 作为 aside 下半部分的背景层(非小卡片):左淡(文字区可读)右深(原小方格处更聚焦),
* 以网点 + 枢纽连线 + 右侧聚焦光晕讲述「规模化门店网络」。
* 以「俯瞰 + 景深」呈现——画面是一张向远处地平线收敛的地面网络:
* - 透视投影:远点(深度 z→0)压向顶部地平线、横向收窄;近点( z→1)铺满底部、横向铺开;
* - 景深:近点更大/更亮/清晰,远点更小/更淡/带散景模糊(bokeh);
* - 叠加右深左淡(右侧原小方格处更聚焦),顶部渐隐融入墙面,并有两条极淡消失点引导线立住纵深。
* 实现:固定 600×340 横向 viewBox,CSS 用 width:100%/height:auto 由浏览器按比例算高度,
* 因此无论登录栏多宽多高都保持原始比例——不拉伸、不裁切、左右到边、贴底。
*/
import { useState } from 'react';
const W = 600;
const H = 400;
const PAD = 44;
const H = 340;
const HORIZON = 64; // 远处地平线 y(远点在此收敛)
const NEAR = H - 22; // 近处地面 y(近点铺到底部)
const Z_FAR = 0.12; // 最远深度
const VP = { x: W / 2, y: HORIZON - 14 }; // 消失点(略高于地平线)
// 固定种子伪随机:装饰用,保证每次渲染网点位置一致(非真实门店数据)
// 固定种子伪随机:装饰用,保证网点分布一致(非真实门店数据)
function makeRand(seed: number) {
let s = seed % 233280;
return () => {
......@@ -23,44 +30,110 @@ function makeRand(seed: number) {
};
}
const rand = makeRand(91);
const lerp = (a: number, b: number, t: number) => a + (b - a) * t;
const clamp = (v: number, lo: number, hi: number) => Math.max(lo, Math.min(hi, v));
type Dot = { x: number; y: number; r: number; hub: boolean; op: number };
const DOTS: Dot[] = Array.from({ length: 84 }, (_, i) => {
const x = PAD + rand() * (W - PAD * 2);
const y = PAD + rand() * (H - PAD * 2);
const hub = i % 9 === 0; // 0,9,18,... → 约 10 个枢纽
const r = hub ? 3.2 : 1.0 + rand() * 1.1;
// 左淡右深:x 越大、越靠右,网点越深、越聚焦
const t = x / W;
const op = (hub ? 0.16 : 0.08) + t * (hub ? 0.5 : 0.42);
return { x, y, r, hub, op };
// 世界坐标:z=深度(0远..1近),lx=横向(-1..1);投影到屏幕形成收敛透视
type WDot = { z: number; lx: number; hub: boolean; jx: number; jy: number };
const WDOTS: WDot[] = Array.from({ length: 92 }, (_, i) => ({
z: Z_FAR + rand() * (1 - Z_FAR),
lx: rand() * 2 - 1,
hub: i % 8 === 0,
jx: (rand() - 0.5) * 0.12,
jy: (rand() - 0.5) * 0.06,
}));
// 投影:世界坐标 → 屏幕坐标,含透视收敛
function project(d: WDot) {
const p = (d.z - Z_FAR) / (1 - Z_FAR); // 0 远 .. 1 近
const pp = Math.pow(p, 0.82); // 近处更向下铺开
const y = lerp(HORIZON, NEAR, pp) + d.jy * (NEAR - HORIZON);
const halfSpread = lerp(34, 296, pp); // 远处横向收窄、近处铺开
const x = W / 2 + (d.lx + d.jx) * halfSpread;
return { x, y, p };
}
interface PNode {
x: number;
y: number;
p: number;
r: number;
op: number;
hub: boolean;
}
const NODES: PNode[] = WDOTS.map((d) => {
const { x, y, p } = project(d);
const r = lerp(0.7, 2.7, p) * (d.hub ? 1.5 : 1);
const depthOp = lerp(0.14, 0.92, p); // 远处更淡
const xOp = 0.5 + (x / W) * 0.75; // 左侧更淡(右深左淡)
const op = clamp(depthOp * xOp + (d.hub ? 0.1 : 0), 0.07, 0.92);
return { x, y, p, r, op, hub: d.hub };
});
const HUBS = DOTS.filter((d) => d.hub);
// 枢纽连线:按序串成网络;每段透明度随中点 x(左淡右深)变化
// 枢纽连线:按屏幕 y 排序后相邻连成网(屏幕空间连线,端点各自带景深透明度)
const HUBS = NODES.filter((n) => n.hub).sort((a, b) => a.y - b.y);
const SEGMENTS = HUBS.slice(1).map((h, i) => {
const a = HUBS[i];
const midT = ((a.x + h.x) / 2) / W;
return { a, b: h, op: 0.1 + midT * 0.3 };
const midP = (a.p + h.p) / 2;
return { a, b: h, op: clamp(0.06 + midP * 0.34, 0.05, 0.55) };
});
// 单个活跃节点:位置在组件每次挂载时随机生成(见 LoginCoverage 内 useState),刷新/重进登录页都会重新随机
// 右上留白楔形区的点缀星点:只落在透视扇面右缘之外,填补空三角;极淡、静态为主、少数微闪
const srand = makeRand(47);
const STARS = Array.from({ length: 9 }, () => {
const sy = lerp(HORIZON + 8, 220, srand());
const pp = Math.pow(clamp((sy - HORIZON) / (NEAR - HORIZON), 0, 1), 1 / 0.82);
const edge = W / 2 + lerp(34, 296, pp); // 扇面在该高度处的右缘 x
const x = clamp(edge + srand() * (W - edge - 16), edge + 4, W - 8);
const depthDim = lerp(0.5, 1, (sy - HORIZON) / (220 - HORIZON)); // 越靠地平线越淡
const op = clamp((0.18 + (x / W) * 0.28) * depthDim, 0.14, 0.42);
return { x, y: sy, r: 0.6 + srand() * 0.8, op, tw: srand() < 0.35 };
});
// 景深分层(远→近):越远模糊越强
const LAYER_BLUR = ['url(#covBlurFar)', 'url(#covBlurMid)', undefined as string | undefined];
export function LoginCoverage() {
// 单个活跃节点:每次挂载随机生成位置(偏右侧较深区),刷新/重进登录页都会重新随机
const [pulse] = useState(() => ({
x: PAD + (W - PAD * 2) * (0.5 + Math.random() * 0.42),
y: PAD + Math.random() * (H - PAD * 2),
delay: 0,
}));
// 脉冲点:随机位置,每次挂载重新随机(刷新/重进登录页都变);偏向较深的右侧、且落在近-中景
const [pulse] = useState(() => {
const z = Z_FAR + (1 - Z_FAR) * (0.45 + Math.random() * 0.5);
const lx = 0.15 + Math.random() * 0.8; // 偏右
const { x, y } = project({ z, lx, hub: false, jx: 0, jy: 0 });
return { x, y };
});
const renderDot = (n: PNode, i: number) => {
const layer = n.p < 0.4 ? 0 : n.p < 0.72 ? 1 : 2;
const fill = n.hub ? '#CFDDFF' : '#9DBBFF';
if (n.hub) {
return (
<g key={i} filter={LAYER_BLUR[layer]}>
<circle cx={n.x} cy={n.y} r={n.r * 2.8} fill="url(#ujCovGlow)" />
<circle cx={n.x} cy={n.y} r={n.r} fill={fill} fillOpacity={Math.min(0.95, n.op + 0.15)} />
<circle cx={n.x} cy={n.y} r={n.r + 1.8} fill="none" stroke="#5B8DEF" strokeOpacity={Math.min(0.6, n.op)} strokeWidth={0.7} />
</g>
);
}
return (
<circle
key={i}
cx={n.x}
cy={n.y}
r={n.r}
fill={fill}
fillOpacity={n.op}
filter={LAYER_BLUR[layer]}
/>
);
};
return (
<div className="uj-login-coverage" aria-hidden="true">
<svg viewBox={`0 0 ${W} ${H}`} width="100%" height="100%" preserveAspectRatio="xMidYMax meet">
<svg viewBox={`0 0 ${W} ${H}`} width="100%" height="auto" preserveAspectRatio="xMidYMax meet">
<defs>
{/* 右侧聚焦光晕:原小方格处的「更深」基调,品牌蓝向心渐隐 */}
<radialGradient id="ujCovFocus" cx="50%" cy="50%" r="50%">
<stop offset="0%" stopColor="#3A6BF0" stopOpacity="0.3" />
<stop offset="0%" stopColor="#3A6BF0" stopOpacity="0.32" />
<stop offset="100%" stopColor="#3A6BF0" stopOpacity="0" />
</radialGradient>
{/* 枢纽光晕 */}
......@@ -68,50 +141,59 @@ export function LoginCoverage() {
<stop offset="0%" stopColor="#5B8DEF" stopOpacity="0.6" />
<stop offset="100%" stopColor="#5B8DEF" stopOpacity="0" />
</radialGradient>
{/* 近处地面受光:底部(近)微亮,强化俯瞰纵深 */}
<linearGradient id="ujCovGround" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stopColor="#0A1430" stopOpacity="0" />
<stop offset="100%" stopColor="#2A4A9E" stopOpacity="0.22" />
</linearGradient>
{/* 景深散景模糊:极轻,仅作纵深暗示,避免发糊 */}
<filter id="covBlurFar" x="-30%" y="-30%" width="160%" height="160%">
<feGaussianBlur stdDeviation="1.3" />
</filter>
<filter id="covBlurMid" x="-30%" y="-30%" width="160%" height="160%">
<feGaussianBlur stdDeviation="0.6" />
</filter>
</defs>
{/* 近处地面受光(最底) */}
<rect x={0} y={0} width={W} height={H} fill="url(#ujCovGround)" />
{/* 右侧聚焦区:让原小方格处颜色稍深 */}
<ellipse cx={W * 0.82} cy={H * 0.55} rx={W * 0.52} ry={H * 0.62} fill="url(#ujCovFocus)" />
{/* 极淡消失点引导线:从底部两角收向地平线消失点,立住俯瞰纵深;近清晰、远虚 */}
<g stroke="#7FA8F5" fill="none" strokeOpacity={0.1}>
<line x1={W * 0.04} y1={NEAR} x2={VP.x} y2={VP.y} strokeWidth={0.8} />
<line x1={W * 0.96} y1={NEAR} x2={VP.x} y2={VP.y} strokeWidth={0.8} />
<line x1={W * 0.32} y1={NEAR} x2={VP.x} y2={VP.y} strokeWidth={0.5} strokeOpacity={0.06} />
<line x1={W * 0.68} y1={NEAR} x2={VP.x} y2={VP.y} strokeWidth={0.5} strokeOpacity={0.06} />
</g>
{/* 枢纽连线 */}
<g fill="none" stroke="#5B8DEF" strokeWidth="0.8" strokeDasharray="2 3">
{/* 枢纽连线(远处更虚,给一层中等模糊) */}
<g fill="none" stroke="#5B8DEF" strokeWidth={0.8} strokeDasharray="2 3" filter="url(#covBlurMid)">
{SEGMENTS.map((s, i) => (
<line key={i} x1={s.a.x} y1={s.a.y} x2={s.b.x} y2={s.b.y} strokeOpacity={s.op} />
))}
</g>
{/* 网点:左淡右深 */}
{DOTS.map((d, i) =>
d.hub ? (
<g key={i}>
<circle cx={d.x} cy={d.y} r={d.r * 2.8} fill="url(#ujCovGlow)" />
<circle cx={d.x} cy={d.y} r={d.r} fill="#CFDDFF" fillOpacity={Math.min(0.85, d.op + 0.15)} />
<circle cx={d.x} cy={d.y} r={d.r + 1.8} fill="none" stroke="#5B8DEF" strokeOpacity={Math.min(0.6, d.op)} strokeWidth="0.7" />
</g>
) : (
<circle key={i} cx={d.x} cy={d.y} r={d.r} fill="#9DBBFF" fillOpacity={d.op} />
),
)}
{/* 单个活跃节点:光晕扩散(雷达 ping),鲜艳青绿突出于淡蓝网点 */}
<g>
<circle
cx={pulse.x}
cy={pulse.y}
r={2.8}
fill="#1FE0C8"
style={{ filter: 'drop-shadow(0 0 4px #1FE0C8)' }}
/>
{/* 网点:按景深分三层(远→近)渲染 */}
{NODES.map((n, i) => renderDot(n, i))}
{/* 右上空白楔形区的点缀星点:填补透视扇面右缘之外的留白,极淡、少数微闪 */}
{STARS.map((s, i) => (
<circle
className="uj-cov-pulse"
cx={pulse.x}
cy={pulse.y}
r={3}
fill="none"
stroke="#2DE2C4"
strokeWidth={1}
style={{ animationDelay: `${pulse.delay}s` }}
key={`star${i}`}
cx={s.x}
cy={s.y}
r={s.r}
fill="#AFC8FF"
fillOpacity={s.op}
className={s.tw ? 'uj-cov-star-tw' : undefined}
/>
))}
{/* 单个活跃节点:光晕扩散(雷达 ping),鲜艳青绿突出于淡蓝网点;始终清晰不受景深模糊 */}
<g>
<circle cx={pulse.x} cy={pulse.y} r={2.8} fill="#1FE0C8" style={{ filter: 'drop-shadow(0 0 4px #1FE0C8)' }} />
<circle className="uj-cov-pulse" cx={pulse.x} cy={pulse.y} r={3} fill="none" stroke="#2DE2C4" strokeWidth={1} style={{ animationDelay: '0s' }} />
</g>
</svg>
</div>
......
......@@ -115,16 +115,15 @@
left: 0;
right: 0;
bottom: 0;
height: 52%;
z-index: 0;
pointer-events: none;
/* 顶部渐隐,使点阵带自然融入上方墙面,不出现硬边 */
-webkit-mask-image: linear-gradient(to top, #000 58%, transparent 100%);
mask-image: linear-gradient(to top, #000 58%, transparent 100%);
-webkit-mask-image: linear-gradient(to top, #000 70%, transparent 100%);
mask-image: linear-gradient(to top, #000 70%, transparent 100%);
}
.uj-login-coverage svg {
display: block;
/* 等比完整显示(meet),禁止任何拉伸,保证网点/连线清晰不发糊 */
/* width:100% + height:auto:高度由 viewBox 宽高比(600×340)决定,永远不拉伸、不裁切、左右到边 */
shape-rendering: geometricPrecision;
}
/* 点阵中 1–2 个活跃节点的光晕扩散(雷达 ping),克制不抢戏;尊重 reduced-motion */
......@@ -152,6 +151,24 @@
opacity: 0;
}
}
/* 右上留白楔形区点缀星点的轻微闪烁,克制不抢戏;尊重 reduced-motion */
@keyframes cov-twinkle {
0%,
100% {
opacity: 0.45;
}
50% {
opacity: 0.95;
}
}
.uj-cov-star-tw {
animation: cov-twinkle 2.8s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
.uj-cov-star-tw {
animation: none;
}
}
/* ---- 底部主张区(主张标题) ---- */
/* margin-top:auto 把 brand+greet 顶到上方、hero+foot 整体下沉到底部,中部留白 */
.uj-login-hero {
......
{
"name": "@uj/web-points",
"version": "1.0.0.2",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
......
......@@ -2,12 +2,16 @@ import { StrictMode } from 'react';
import { createRoot, type Root } from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { App } from './App';
import { installGlobalUnhandledRejectionHandler } from '@uj/ui';
import '@uj/design-tokens/tokens.css';
import './index.css';
// 本域特有样式(统计条 / 详情网格 / 标签树 / 身份证 / 协议 iframe / 失败原因行)。
// 之前漏引入,导致这些组件运行时完全无样式 —— 累计结算金额面板"乱的"根因在此。
import './features/shared/page.css';
// 全应用未处理 promise rejection 兜底:async 调用漏 catch 时弹红色错误 toast。
installGlobalUnhandledRejectionHandler();
let root: Root | null = null;
/**
......
{
"name": "@uj/web-store",
"version": "1.0.0",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
......
......@@ -2,9 +2,13 @@ import { StrictMode } from 'react';
import { createRoot, type Root } from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { App } from './App';
import { installGlobalUnhandledRejectionHandler } from '@uj/ui';
import '@uj/design-tokens/tokens.css';
import './index.css';
// 全应用未处理 promise rejection 兜底:async 调用漏 catch 时弹红色错误 toast。
installGlobalUnhandledRejectionHandler();
let root: Root | null = null;
function render(): void {
......
{
"name": "@uj/web-system",
"version": "1.0.0.1",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
......
......@@ -2,9 +2,13 @@ import { StrictMode } from 'react';
import { createRoot, type Root } from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { App } from './App';
import { installGlobalUnhandledRejectionHandler } from '@uj/ui';
import '@uj/design-tokens/tokens.css';
import './index.css';
// 全应用未处理 promise rejection 兜底:async 调用漏 catch 时弹红色错误 toast。
installGlobalUnhandledRejectionHandler();
let root: Root | null = null;
/**
......
{
"name": "@uj/web-usedcar",
"version": "1.0.0",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
......
......@@ -2,9 +2,13 @@ import { StrictMode } from 'react';
import { createRoot, type Root } from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { App } from './App';
import { installGlobalUnhandledRejectionHandler } from '@uj/ui';
import '@uj/design-tokens/tokens.css';
import './index.css';
// 全应用未处理 promise rejection 兜底:async 调用漏 catch 时弹红色错误 toast。
installGlobalUnhandledRejectionHandler();
let root: Root | null = null;
/**
......
......@@ -33,8 +33,13 @@ export default function ContractTab() {
permission: UC.CONTRACT_DOWNLOAD,
visible: (r) => Number(r.electronicContractStatus) === 2,
onClick: async (r) => {
const x = await operationApi.contractFile(r.id);
if (x.url) window.open(x.url, '_blank');
try {
const x = await operationApi.contractFile(r.id);
if (x.url) window.open(x.url, '_blank');
else msg.warning('未获取到合同文件地址');
} catch (e) {
msg.error(e instanceof Error ? e.message : '合同文件获取失败');
}
},
},
{
......
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>U+ 反馈提示 · 方案对比 A / B</title>
<style>
:root {
--uj-primary: #2b5ce6;
--uj-surface: #ffffff;
--uj-text-1: #1d2533;
--uj-text-2: #4a5568;
--uj-border: #e6ebf2;
--uj-success: #16a34a;
--uj-success-soft: #e9f7ef;
--uj-warning: #d97706;
--uj-warning-soft: #fdf3e5;
--uj-error: #e5484d;
--uj-error-soft: #fdedee;
--uj-info: #2b5ce6;
--uj-info-soft: #eef3ff;
--uj-shadow-card: 0 1px 2px rgba(16, 24, 40, 0.05), 0 2px 6px -2px rgba(16, 24, 40, 0.08);
--uj-radius-card: 10px;
--uj-radius-md: 6px;
}
body {
margin: 0;
background: #f4f6fa;
font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
color: var(--uj-text-1);
padding: 40px 24px 64px;
}
.head { max-width: 1080px; margin: 0 auto 28px; }
.head h1 { font-size: 20px; margin: 0 0 6px; }
.head p { margin: 0; color: var(--uj-text-2); font-size: 14px; line-height: 1.6; }
.grid {
max-width: 1080px; margin: 0 auto;
display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
}
.col {
background: #fff; border: 1px solid var(--uj-border);
border-radius: var(--uj-radius-card); padding: 20px;
}
.col h2 { font-size: 15px; margin: 0 0 4px; }
.col .sub { font-size: 12px; color: var(--uj-text-2); margin: 0 0 16px; line-height: 1.5; }
.col .state { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-bottom: 14px; }
.col.a .state { background: var(--uj-info-soft); color: var(--uj-primary); }
.col.b .state { background: #eef2f7; color: #5a6779; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.ico { width: 1em; height: 1em; display: block; }
.ant-message, .ant-notification { width: 100%; }
.ant-message-notice, .ant-notification-notice { position: relative; }
.ant-message-notice-wrapper,
.ant-notification-notice-wrapper { display: flex; align-items: center; gap: 10px; }
.ant-notification-notice-wrapper { align-items: flex-start; }
.ant-notification-notice-section { display: flex; flex-direction: column; flex: auto; min-width: 0; }
.tag { font-size: 11px; color: var(--uj-text-2); margin: 10px 0 4px; letter-spacing: 0.04em; }
/* ===================== 方案 A(已落地) ===================== */
.scheme-a .ant-message .ant-message-notice {
padding: 12px 16px; border: 1px solid var(--uj-border);
border-radius: var(--uj-radius-card); background: var(--uj-surface);
box-shadow: var(--uj-shadow-card); color: var(--uj-text-1);
}
.scheme-a .ant-message .ant-message-notice:has(.ant-message-notice-icon-success) { background: var(--uj-success-soft); border-color: var(--uj-success); }
.scheme-a .ant-message .ant-message-notice:has(.ant-message-notice-icon-error) { background: var(--uj-error-soft); border-color: var(--uj-error); }
.scheme-a .ant-message .ant-message-notice:has(.ant-message-notice-icon-warning) { background: var(--uj-warning-soft); border-color: var(--uj-warning); }
.scheme-a .ant-message .ant-message-notice:has(.ant-message-notice-icon-info),
.scheme-a .ant-message .ant-message-notice:has(.ant-message-notice-icon-loading) { background: var(--uj-info-soft); border-color: var(--uj-primary); }
.scheme-a .ant-message .ant-message-notice-title { color: var(--uj-text-1); font-weight: 600; }
.scheme-a .ant-message .ant-message-notice-icon {
display: inline-flex; align-items: center; justify-content: center;
width: 22px; height: 22px; border-radius: var(--uj-radius-md);
font-size: 13px; color: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.18);
animation: a-chip 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.scheme-a .ant-message .ant-message-notice-icon-success { background: var(--uj-success); }
.scheme-a .ant-message .ant-message-notice-icon-error { background: var(--uj-error); }
.scheme-a .ant-message .ant-message-notice-icon-warning { background: var(--uj-warning); }
.scheme-a .ant-message .ant-message-notice-icon-info,
.scheme-a .ant-message .ant-message-notice-icon-loading { background: var(--uj-primary); }
.scheme-a .ant-notification .ant-notification-notice {
padding: 14px 16px; border: 1px solid var(--uj-border);
border-radius: var(--uj-radius-card); background: var(--uj-surface);
box-shadow: var(--uj-shadow-card);
}
.scheme-a .ant-notification .ant-notification-notice-success { background: var(--uj-success-soft); border-color: var(--uj-success); }
.scheme-a .ant-notification .ant-notification-notice-error { background: var(--uj-error-soft); border-color: var(--uj-error); }
.scheme-a .ant-notification .ant-notification-notice-warning { background: var(--uj-warning-soft); border-color: var(--uj-warning); }
.scheme-a .ant-notification .ant-notification-notice-info,
.scheme-a .ant-notification .ant-notification-notice-open { background: var(--uj-info-soft); border-color: var(--uj-primary); }
.scheme-a .ant-notification .ant-notification-notice-title { color: var(--uj-text-1); font-weight: 600; }
.scheme-a .ant-notification .ant-notification-notice-description { color: var(--uj-text-2); font-size: 13px; margin-top: 2px; }
.scheme-a .ant-notification .ant-notification-notice-icon {
display: inline-flex; align-items: center; justify-content: center;
width: 26px; height: 26px; border-radius: var(--uj-radius-md);
font-size: 15px; color: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.18);
animation: a-chip 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.scheme-a .ant-notification .ant-notification-notice-icon-success { background: var(--uj-success); }
.scheme-a .ant-notification .ant-notification-notice-icon-error { background: var(--uj-error); }
.scheme-a .ant-notification .ant-notification-notice-icon-warning { background: var(--uj-warning); }
.scheme-a .ant-notification .ant-notification-notice-icon-info,
.scheme-a .ant-notification .ant-notification-notice-icon-loading { background: var(--uj-primary); }
@keyframes a-chip {
0% { transform: scale(0.4); opacity: 0; }
60% { transform: scale(1.12); opacity: 1; }
100% { transform: scale(1); }
}
/* ===================== 方案 B(备选 · 克制商务) ===================== */
/* 白卡 + 左侧 4px 语义色条 + 淡底圆线性图标,不整卡染色。 */
.scheme-b .ant-message .ant-message-notice,
.scheme-b .ant-notification .ant-notification-notice {
padding: 12px 16px; background: var(--uj-surface);
border: 1px solid var(--uj-border); border-left: 4px solid var(--uj-primary);
border-radius: var(--uj-radius-card); box-shadow: var(--uj-shadow-card);
color: var(--uj-text-1);
animation: b-in 0.26s ease-out both;
}
.scheme-b .ant-notification .ant-notification-notice { padding: 14px 16px; }
.scheme-b .ant-message .ant-message-notice:has(.ant-message-notice-icon-success),
.scheme-b .ant-notification .ant-notification-notice-success { border-left-color: var(--uj-success); }
.scheme-b .ant-message .ant-message-notice:has(.ant-message-notice-icon-error),
.scheme-b .ant-notification .ant-notification-notice-error { border-left-color: var(--uj-error); }
.scheme-b .ant-message .ant-message-notice:has(.ant-message-notice-icon-warning),
.scheme-b .ant-notification .ant-notification-notice-warning { border-left-color: var(--uj-warning); }
.scheme-b .ant-message .ant-message-notice:has(.ant-message-notice-icon-info),
.scheme-b .ant-message .ant-message-notice:has(.ant-message-notice-icon-loading),
.scheme-b .ant-notification .ant-notification-notice-info,
.scheme-b .ant-notification .ant-notification-notice-open { border-left-color: var(--uj-primary); }
.scheme-b .ant-message .ant-message-notice-title { color: var(--uj-text-1); font-weight: 600; }
.scheme-b .ant-notification .ant-notification-notice-title { color: var(--uj-text-1); font-weight: 600; }
.scheme-b .ant-notification .ant-notification-notice-description { color: var(--uj-text-2); font-size: 13px; margin-top: 2px; }
/* 图标:淡底圆 + 线性彩色字形(不填充实心),比 A 轻。 */
.scheme-b .ant-message .ant-message-notice-icon {
display: inline-flex; align-items: center; justify-content: center;
width: 24px; height: 24px; border-radius: 50%;
font-size: 13px; background: var(--uj-info-soft); color: var(--uj-primary);
}
.scheme-b .ant-notification .ant-notification-notice-icon {
display: inline-flex; align-items: center; justify-content: center;
width: 28px; height: 28px; border-radius: 50%;
font-size: 15px; background: var(--uj-info-soft); color: var(--uj-primary);
}
.scheme-b .ant-message .ant-message-notice-icon-success,
.scheme-b .ant-notification .ant-notification-notice-icon-success { background: var(--uj-success-soft); color: var(--uj-success); }
.scheme-b .ant-message .ant-message-notice-icon-error,
.scheme-b .ant-notification .ant-notification-notice-icon-error { background: var(--uj-error-soft); color: var(--uj-error); }
.scheme-b .ant-message .ant-message-notice-icon-warning,
.scheme-b .ant-notification .ant-notification-notice-icon-warning { background: var(--uj-warning-soft); color: var(--uj-warning); }
@keyframes b-in {
from { opacity: 0; transform: translateY(-8px); }
to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
.scheme-a .ant-message .ant-message-notice-icon,
.scheme-a .ant-notification .ant-notification-notice-icon,
.scheme-b .ant-message .ant-message-notice,
.scheme-b .ant-notification .ant-notification-notice { animation: none; }
}
</style>
</head>
<body>
<div class="head">
<h1>U+ 反馈提示 · 方案对比</h1>
<p>两版都已按 antd v6 真实 DOM 结构编写,位置统一为顶部居中。左边是已落地的方案 A(品牌芯片 hero),右边是备选方案 B(左侧色条 + 淡底圆线性图标,更克制)。选定后我会把对应一版落地到 <code>packages/ui/src/styles/feedback.css</code>。</p>
</div>
<div class="grid">
<!-- ============ 方案 A ============ -->
<div class="col a scheme-a">
<h2>方案 A · 品牌芯片 hero</h2>
<p class="sub">实心填充方块芯片(语义色填满 + 白字)+ 整张卡片按类型染浅色。醒目、品牌感强。</p>
<span class="state">已落地</span>
<div class="tag">MESSAGE</div>
<div class="stack">
<div class="ant-message"><div class="ant-message-notice"><div class="ant-message-notice-wrapper">
<span class="ant-message-notice-icon ant-message-notice-icon-success"><svg class="ico" viewBox="0 0 1024 1024" width="1em" height="1em" fill="currentColor"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 0 1-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"/></svg></span>
<div class="ant-message-notice-title">导出完成,文件已保存到下载目录</div>
</div></div></div>
<div class="ant-message"><div class="ant-message-notice"><div class="ant-message-notice-wrapper">
<span class="ant-message-notice-icon ant-message-notice-icon-error"><svg class="ico" viewBox="0 0 1024 1024" width="1em" height="1em" fill="currentColor"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66.3-66.3L512 563.4l-99.1-99.1-66.3 66.3-45.1-45.1 66.3-66.3L346.6 356l-66.3-66.3 45.1-45.1 66.3 66.3L512 460.6l99.1-99.1 66.3-66.3 45.1 45.1-66.3 66.3L668.4 460.6l66.3 66.3-45.1 45.1z"/></svg></span>
<div class="ant-message-notice-title">下载失败:合同编号不存在</div>
</div></div></div>
<div class="ant-message"><div class="ant-message-notice"><div class="ant-message-notice-wrapper">
<span class="ant-message-notice-icon ant-message-notice-icon-warning"><svg class="ico" viewBox="0 0 1024 1024" width="1em" height="1em" fill="currentColor"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48 48 0 1 0 0-96 48 48 0 0 0 0 96z"/></svg></span>
<div class="ant-message-notice-title">部分记录校验未通过,请检查后重试</div>
</div></div></div>
</div>
<div class="tag">NOTIFICATION</div>
<div class="stack">
<div class="ant-notification"><div class="ant-notification-notice ant-notification-notice-success"><div class="ant-notification-notice-wrapper">
<span class="ant-notification-notice-icon ant-notification-notice-icon-success"><svg class="ico" viewBox="0 0 1024 1024" width="1em" height="1em" fill="currentColor"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 0 1-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"/></svg></span>
<div class="ant-notification-notice-section">
<div class="ant-notification-notice-title">导出完成</div>
<div class="ant-notification-notice-description">用户积分明细列表导出 · 积分明细列表导出20261113145204.xlsx</div>
</div>
</div></div></div>
<div class="ant-notification"><div class="ant-notification-notice ant-notification-notice-error"><div class="ant-notification-notice-wrapper">
<span class="ant-notification-notice-icon ant-notification-notice-icon-error"><svg class="ico" viewBox="0 0 1024 1024" width="1em" height="1em" fill="currentColor"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66.3-66.3L512 563.4l-99.1-99.1-66.3 66.3-45.1-45.1 66.3-66.3L346.6 356l-66.3-66.3 45.1-45.1 66.3 66.3L512 460.6l99.1-99.1 66.3-66.3 45.1 45.1-66.3 66.3L668.4 460.6l66.3 66.3-45.1 45.1z"/></svg></span>
<div class="ant-notification-notice-section">
<div class="ant-notification-notice-title">下载失败</div>
<div class="ant-notification-notice-description">门店上架导入模板 · 网络连接超时,请稍后重试</div>
</div>
</div></div></div>
</div>
</div>
<!-- ============ 方案 B ============ -->
<div class="col b scheme-b">
<h2>方案 B · 左侧色条 + 淡底圆</h2>
<p class="sub">白卡 + 左侧 4px 语义色条 + 淡底圆线性图标,不整卡染色。安静、商务、后台感强。</p>
<span class="state">备选</span>
<div class="tag">MESSAGE</div>
<div class="stack">
<div class="ant-message"><div class="ant-message-notice"><div class="ant-message-notice-wrapper">
<span class="ant-message-notice-icon ant-message-notice-icon-success"><svg class="ico" viewBox="0 0 1024 1024" width="1em" height="1em" fill="currentColor"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 0 1-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"/></svg></span>
<div class="ant-message-notice-title">导出完成,文件已保存到下载目录</div>
</div></div></div>
<div class="ant-message"><div class="ant-message-notice"><div class="ant-message-notice-wrapper">
<span class="ant-message-notice-icon ant-message-notice-icon-error"><svg class="ico" viewBox="0 0 1024 1024" width="1em" height="1em" fill="currentColor"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66.3-66.3L512 563.4l-99.1-99.1-66.3 66.3-45.1-45.1 66.3-66.3L346.6 356l-66.3-66.3 45.1-45.1 66.3 66.3L512 460.6l99.1-99.1 66.3-66.3 45.1 45.1-66.3 66.3L668.4 460.6l66.3 66.3-45.1 45.1z"/></svg></span>
<div class="ant-message-notice-title">下载失败:合同编号不存在</div>
</div></div></div>
<div class="ant-message"><div class="ant-message-notice"><div class="ant-message-notice-wrapper">
<span class="ant-message-notice-icon ant-message-notice-icon-warning"><svg class="ico" viewBox="0 0 1024 1024" width="1em" height="1em" fill="currentColor"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48 48 0 1 0 0-96 48 48 0 0 0 0 96z"/></svg></span>
<div class="ant-message-notice-title">部分记录校验未通过,请检查后重试</div>
</div></div></div>
</div>
<div class="tag">NOTIFICATION</div>
<div class="stack">
<div class="ant-notification"><div class="ant-notification-notice ant-notification-notice-success"><div class="ant-notification-notice-wrapper">
<span class="ant-notification-notice-icon ant-notification-notice-icon-success"><svg class="ico" viewBox="0 0 1024 1024" width="1em" height="1em" fill="currentColor"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 0 1-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"/></svg></span>
<div class="ant-notification-notice-section">
<div class="ant-notification-notice-title">导出完成</div>
<div class="ant-notification-notice-description">用户积分明细列表导出 · 积分明细列表导出20261113145204.xlsx</div>
</div>
</div></div></div>
<div class="ant-notification"><div class="ant-notification-notice ant-notification-notice-error"><div class="ant-notification-notice-wrapper">
<span class="ant-notification-notice-icon ant-notification-notice-icon-error"><svg class="ico" viewBox="0 0 1024 1024" width="1em" height="1em" fill="currentColor"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66.3-66.3L512 563.4l-99.1-99.1-66.3 66.3-45.1-45.1 66.3-66.3L346.6 356l-66.3-66.3 45.1-45.1 66.3 66.3L512 460.6l99.1-99.1 66.3-66.3 45.1 45.1-66.3 66.3L668.4 460.6l66.3 66.3-45.1 45.1z"/></svg></span>
<div class="ant-notification-notice-section">
<div class="ant-notification-notice-title">下载失败</div>
<div class="ant-notification-notice-description">门店上架导入模板 · 网络连接超时,请稍后重试</div>
</div>
</div></div></div>
</div>
</div>
</div>
</body>
</html>
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>U+ 反馈提示 · 设计预览</title>
<style>
/* ===== U+ 设计令牌(与 tokens.css 同源,预览用副本) ===== */
:root {
--uj-primary: #2b5ce6;
--uj-surface: #ffffff;
--uj-text-1: #1d2533;
--uj-text-2: #4a5568;
--uj-border: #e6ebf2;
--uj-success: #16a34a;
--uj-success-soft: #e9f7ef;
--uj-success-border: #c6ebd6;
--uj-warning: #d97706;
--uj-warning-soft: #fdf3e5;
--uj-warning-border: #f6dfba;
--uj-error: #e5484d;
--uj-error-soft: #fdedee;
--uj-error-border: #f8cfd1;
--uj-info: #2b5ce6;
--uj-info-soft: #eef3ff;
--uj-info-border: #d6e2fb;
--uj-shadow-card: 0 1px 2px rgba(16, 24, 40, 0.05), 0 2px 6px -2px rgba(16, 24, 40, 0.08);
--uj-radius-card: 10px;
--uj-radius-md: 6px;
}
body {
margin: 0;
min-height: 100vh;
background: #f4f6fa;
font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
color: var(--uj-text-1);
padding: 48px 24px;
display: flex;
flex-direction: column;
align-items: center;
gap: 40px;
}
.stage {
width: 100%;
max-width: 520px;
display: flex;
flex-direction: column;
gap: 14px;
}
.stage h2 {
margin: 0 0 4px;
font-size: 15px;
font-weight: 600;
color: var(--uj-text-2);
letter-spacing: 0.02em;
}
/* ===== 下方为 feedback.css 真实规则(与 packages/ui/src/styles/feedback.css 一致) ===== */
/* MESSAGE */
.ant-message .ant-message-notice {
padding: 12px 16px;
border: 1px solid var(--uj-border);
border-radius: var(--uj-radius-card);
background: var(--uj-surface);
box-shadow: var(--uj-shadow-card);
color: var(--uj-text-1);
}
.ant-message .ant-message-notice:has(.ant-message-notice-icon-success) { background: var(--uj-success-soft); border-color: var(--uj-success-border); }
.ant-message .ant-message-notice:has(.ant-message-notice-icon-error) { background: var(--uj-error-soft); border-color: var(--uj-error-border); }
.ant-message .ant-message-notice:has(.ant-message-notice-icon-warning) { background: var(--uj-warning-soft); border-color: var(--uj-warning-border); }
.ant-message .ant-message-notice:has(.ant-message-notice-icon-info),
.ant-message .ant-message-notice:has(.ant-message-notice-icon-loading) { background: var(--uj-info-soft); border-color: var(--uj-info-border); }
.ant-message .ant-message-notice-title { color: var(--uj-text-1); font-weight: 600; }
.ant-message .ant-message-notice-icon {
display: inline-flex; align-items: center; justify-content: center;
width: 22px; height: 22px; border-radius: var(--uj-radius-md);
font-size: 13px; color: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.18);
animation: uj-feedback-chip-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.ant-message .ant-message-notice-icon-success { background: var(--uj-success); }
.ant-message .ant-message-notice-icon-error { background: var(--uj-error); }
.ant-message .ant-message-notice-icon-warning { background: var(--uj-warning); }
.ant-message .ant-message-notice-icon-info,
.ant-message .ant-message-notice-icon-loading { background: var(--uj-primary); }
/* NOTIFICATION */
.ant-notification .ant-notification-notice {
padding: 14px 16px;
border: 1px solid var(--uj-border);
border-radius: var(--uj-radius-card);
background: var(--uj-surface);
box-shadow: var(--uj-shadow-card);
}
.ant-notification .ant-notification-notice-success { background: var(--uj-success-soft); border-color: var(--uj-success-border); }
.ant-notification .ant-notification-notice-error { background: var(--uj-error-soft); border-color: var(--uj-error-border); }
.ant-notification .ant-notification-notice-warning { background: var(--uj-warning-soft); border-color: var(--uj-warning-border); }
.ant-notification .ant-notification-notice-info,
.ant-notification .ant-notification-notice-open { background: var(--uj-info-soft); border-color: var(--uj-info-border); }
.ant-notification .ant-notification-notice-title { color: var(--uj-text-1); font-weight: 600; }
.ant-notification .ant-notification-notice-description { color: var(--uj-text-2); font-size: 13px; margin-top: 2px; }
.ant-notification .ant-notification-notice-icon {
display: inline-flex; align-items: center; justify-content: center;
width: 26px; height: 26px; border-radius: var(--uj-radius-md);
font-size: 15px; color: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.18);
animation: uj-feedback-chip-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.ant-notification .ant-notification-notice-icon-success { background: var(--uj-success); }
.ant-notification .ant-notification-notice-icon-error { background: var(--uj-error); }
.ant-notification .ant-notification-notice-icon-warning { background: var(--uj-warning); }
.ant-notification .ant-notification-notice-icon-info,
.ant-notification .ant-notification-notice-icon-loading { background: var(--uj-primary); }
@keyframes uj-feedback-chip-in {
0% { transform: scale(0.4); opacity: 0; }
60% { transform: scale(1.12); opacity: 1; }
100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
.ant-message .ant-message-notice-icon,
.ant-notification .ant-notification-notice-icon { animation: none; }
}
/* ===== 预览用布局(仅 demo,不影响真实组件) ===== */
.ant-message-notice-wrapper,
.ant-notification-notice-wrapper { display: flex; align-items: center; gap: 10px; }
.ant-notification-notice-wrapper { align-items: flex-start; }
.ant-notification-notice-section { display: flex; flex-direction: column; flex: auto; min-width: 0; }
.ant-message, .ant-notification { width: 100%; }
.ant-message-notice, .ant-notification-notice { position: relative; }
.ico { width: 1em; height: 1em; display: block; }
</style>
</head>
<body>
<div class="stage">
<h2>MESSAGE(顶部居中 · 单行)</h2>
<div class="ant-message">
<div class="ant-message-notice">
<div class="ant-message-notice-wrapper">
<span class="ant-message-notice-icon ant-message-notice-icon-success"><svg class="ico" viewBox="64 64 896 896" fill="currentColor"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 0 1-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"/></svg></span>
<div class="ant-message-notice-title">导出完成,文件已保存到下载目录</div>
</div>
</div>
</div>
<div class="ant-message">
<div class="ant-message-notice">
<div class="ant-message-notice-wrapper">
<span class="ant-message-notice-icon ant-message-notice-icon-error"><svg class="ico" viewBox="64 64 896 896" fill="currentColor"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66.3-66.3L512 563.4l-99.1-99.1-66.3 66.3-45.1-45.1 66.3-66.3L346.6 356l-66.3-66.3 45.1-45.1 66.3 66.3L512 460.6l99.1-99.1 66.3-66.3 45.1 45.1-66.3 66.3L668.4 460.6l66.3 66.3-45.1 45.1z"/></svg></span>
<div class="ant-message-notice-title">下载失败:合同编号不存在</div>
</div>
</div>
</div>
<div class="ant-message">
<div class="ant-message-notice">
<div class="ant-message-notice-wrapper">
<span class="ant-message-notice-icon ant-message-notice-icon-warning"><svg class="ico" viewBox="64 64 896 896" fill="currentColor"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48 48 0 1 0 0-96 48 48 0 0 0 0 96z"/></svg></span>
<div class="ant-message-notice-title">部分记录校验未通过,请检查后重试</div>
</div>
</div>
</div>
<div class="ant-message">
<div class="ant-message-notice">
<div class="ant-message-notice-wrapper">
<span class="ant-message-notice-icon ant-message-notice-icon-loading"><svg class="ico" viewBox="0 0 1024 1024" fill="currentColor"><path d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 0 0-94.3-139.9 437.71 437.71 0 0 0-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.2 101.8 109.9 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"/></svg></span>
<div class="ant-message-notice-title">正在生成导出文件…</div>
</div>
</div>
</div>
</div>
<div class="stage">
<h2>NOTIFICATION(顶部居中 · 带描述,停留较久)</h2>
<div class="ant-notification">
<div class="ant-notification-notice ant-notification-notice-success">
<div class="ant-notification-notice-wrapper">
<span class="ant-notification-notice-icon ant-notification-notice-icon-success"><svg class="ico" viewBox="64 64 896 896" fill="currentColor"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 0 1-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"/></svg></span>
<div class="ant-notification-notice-section">
<div class="ant-notification-notice-title">导出完成</div>
<div class="ant-notification-notice-description">用户积分明细列表导出 · 积分明细列表导出20261113145204.xlsx</div>
</div>
</div>
</div>
</div>
<div class="ant-notification">
<div class="ant-notification-notice ant-notification-notice-error">
<div class="ant-notification-notice-wrapper">
<span class="ant-notification-notice-icon ant-notification-notice-icon-error"><svg class="ico" viewBox="64 64 896 896" fill="currentColor"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66.3-66.3L512 563.4l-99.1-99.1-66.3 66.3-45.1-45.1 66.3-66.3L346.6 356l-66.3-66.3 45.1-45.1 66.3 66.3L512 460.6l99.1-99.1 66.3-66.3 45.1 45.1-66.3 66.3L668.4 460.6l66.3 66.3-45.1 45.1z"/></svg></span>
<div class="ant-notification-notice-section">
<div class="ant-notification-notice-title">下载失败</div>
<div class="ant-notification-notice-description">门店上架导入模板 · 网络连接超时,请稍后重试</div>
</div>
</div>
</div>
</div>
<div class="ant-notification">
<div class="ant-notification-notice ant-notification-notice-warning">
<div class="ant-notification-notice-wrapper">
<span class="ant-notification-notice-icon ant-notification-notice-icon-warning"><svg class="ico" viewBox="64 64 896 896" fill="currentColor"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48 48 0 1 0 0-96 48 48 0 0 0 0 96z"/></svg></span>
<div class="ant-notification-notice-section">
<div class="ant-notification-notice-title">导出即将完成</div>
<div class="ant-notification-notice-description">二手车评估图片打包较大,预计还需 1 分钟</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
import { useMemo, useState } from 'react';
import { Badge, Button, Empty, Popover, Tag, message } from 'antd';
import { Badge, Button, Empty, Popover, Tag } from 'antd';
import { DownloadOutlined, ClearOutlined } from '@ant-design/icons';
import { useDownloadCenterStore } from './store';
import { cancelTask, redownload } from './engine';
......@@ -99,7 +99,6 @@ export function DownloadCenterButton() {
const panel = (
<div style={{ width: 340 }}>
<style>{`.dc-row{cursor:default}.dc-row.is-done{cursor:pointer}.dc-row.is-done:hover{background:#f5f5f5}`}</style>
{/* 头部:固定不滚动 */}
<div style={{ marginBottom: 8 }}>
<div
......@@ -148,20 +147,11 @@ export function DownloadCenterButton() {
<ul style={{ listStyle: 'none', margin: 0, padding: 0 }}>
{filteredTasks.map((t) => {
const meta = STATUS_META[t.status];
const isDone = t.status === 'done';
return (
<li
key={t.id}
className={`dc-row${isDone ? ' is-done' : ''}`}
className="dc-row"
style={{ padding: '8px 0', borderBottom: '1px solid #f0f0f0' }}
title={isDone ? '文件已保存到浏览器下载目录,点击查看位置' : undefined}
onClick={() => {
if (isDone) {
message.info(
`文件「${t.fileName ?? t.label}」已保存到浏览器下载目录,可在下载管理中查看`,
);
}
}}
>
<div style={{ display: 'flex', justifyContent: 'space-between', gap: 8 }}>
<span
......
......@@ -60,21 +60,21 @@ export function DownloadCenterProvider({
fired.add(t.id);
if (t.input.silent) return;
// 仅异步导出(长任务、需「稍后查看」)弹完成/失败通知;
// 直链 / 文件流 / 本地文件等即时落地的,一律不再弹「下载完成」提示。
if (t.kind !== 'async-export') return;
if (t.status === 'done') {
// 仅异步导出(长任务、需「稍后查看」)弹完成通知;
// 直链 / 文件流 / 本地文件等即时落地的,不再弹「下载完成」提示。
if (t.kind !== 'async-export') return;
notification.success({
message: '导出完成',
description: `${t.label}${t.fileName ? ` · ${t.fileName}` : ''}`,
placement: 'topRight',
placement: 'top',
});
} else {
// 失败:不论来源(points/usedcar/store…)、不论是否有链接,一律弹失败通知。
notification.error({
message: '导出失败',
message: t.kind === 'async-export' ? '导出失败' : '下载失败',
description: t.error || t.label,
placement: 'topRight',
placement: 'top',
});
}
});
......
import { message } from 'antd';
let installed = false;
const seen = new Map<string, number>();
const DEDUPE_MS = 3000;
/** 从 rejection reason 里尽量取出可读错误信息。 */
function extractErrorMessage(reason: unknown): string {
if (!reason) return '请求失败,请稍后重试';
if (reason instanceof Error) return reason.message || reason.name || '请求失败,请稍后重试';
if (typeof reason === 'string') return reason;
if (typeof reason === 'object') {
const m =
(reason as { message?: unknown }).message ?? (reason as { msg?: unknown }).msg;
if (typeof m === 'string' && m) return m;
}
return '请求失败,请稍后重试';
}
/**
* 全应用未处理 promise rejection 兜底。
*
* 任何 async 调用漏 catch 而抛出的异常(如「合同编号不存在」这类后端业务错误),
* 都会被这里接住并弹红色错误 toast,避免「只在 console 报错、用户毫无感知」。
*
* 设计取舍:
* - 用 antd 静态 message(非 App 上下文实例)。兜底场景下可接受:
* 1) 不依赖 React 渲染时机,全局监听即装即用;
* 2) 静态 message 挂载到 host document.body,能越过 wujie shadow DOM 始终可见;
* 3) 代价是拿不到 ConfigProvider 主题/locale,但错误文案本就是中文,样式差异可忽略。
* - 同一文案 3s 内只弹一次,避免循环/并发失败时刷屏。
*
* ⚠️ 各子应用在主壳不同的 wujie 沙箱 realm 内运行,window 是独立代理,
* 因此每个子应用入口与主壳入口都要各自装一次,才能兜住各自 realm 的 rejection。
*/
export function installGlobalUnhandledRejectionHandler(): void {
if (installed) return;
installed = true;
window.addEventListener('unhandledrejection', (event: PromiseRejectionEvent) => {
const text = extractErrorMessage(event.reason);
const now = Date.now();
const last = seen.get(text) ?? 0;
if (now - last < DEDUPE_MS) return;
seen.set(text, now);
message.error(text);
// 阻止浏览器默认处理(避免控制台再抛一次 Uncaught),但不阻断其他监听。
event.preventDefault?.();
});
}
......@@ -14,10 +14,12 @@
// 详见该文件注释。
import './styles/injectThinScrollbar';
import './styles/ui.css';
import './styles/feedback.css';
export { UApp } from './components/App';
export type { UAppProps } from './components/App';
export { useUApp, useUMessage } from './components/App/hooks';
export { installGlobalUnhandledRejectionHandler } from './components/App/globalError';
export { UButton } from './components/Button';
export type { UButtonProps } from './components/Button';
......
/* ---------------------------------------------------------------------------
* 统一反馈层(message / notification)—— 站点化设计
*
* 背景:项目用 antd v6,其 message 结构为
* .ant-message-notice (卡片本体,自带 bg / radius / shadow)
* > .ant-message-notice-icon + .ant-message-notice-icon-<type> (图标)
* > .ant-message-notice-title (文案)
* notification 为 .ant-notification-notice (卡片) + ...-icon-<type> + ...-title + ...-description,
* 且类型类直接挂在卡片上(.ant-notification-notice-<type>)。
* v5 的 .ant-message-notice-content / .ant-message-custom-content / .ant-notification-notice-message
* 在 v6 均不存在,旧版选择器全部失效——本文件按 v6 真实 DOM 重写。
*
* 设计主张:把「语义类型」做成可一眼辨认的信号,而非一行小字——
* 1) 实心图标芯片(hero):语义色填满的圆角方块 + 白色字形;
* 2) 按类型染色的卡片底(notification 用类型类,message 用 :has() 同源染色);
* 3) 芯片入场轻微回弹 pop(仅作用于芯片自身,不动 antd 的定位 transform);
* 4) 位置统一顶部居中,卡形 / 影 / 描边沿用 .uj-card 同族 token,不另造色值。
*
* 选择器用 .ant-message / .ant-notification 前缀把特异性提到 (0,2,0),
* 既能压过 antd 自带样式,又能同时覆盖「App 上下文实例」与「静态实例」
* (全局兜底用的静态 message 也挂在 .ant-message 容器内)。
* ------------------------------------------------------------------------- */
/* ============================== MESSAGE ============================== */
/* 卡片本体:收口为品牌白卡(v6 里 .ant-message-notice 即卡片,自带 bg/radius/shadow)。 */
.ant-message .ant-message-notice {
padding: 12px 16px;
border: 1px solid var(--uj-border);
border-radius: var(--uj-radius-card);
background: var(--uj-surface);
box-shadow: var(--uj-shadow-card);
color: var(--uj-text-1);
}
/* 按类型染色:v6 类型类只挂在图标上,用 :has() 让整张卡片同源染色(wordless 识别)。 */
.ant-message .ant-message-notice:has(.ant-message-notice-icon-success) {
background: var(--uj-success-soft);
border-color: var(--uj-success-border);
}
.ant-message .ant-message-notice:has(.ant-message-notice-icon-error) {
background: var(--uj-error-soft);
border-color: var(--uj-error-border);
}
.ant-message .ant-message-notice:has(.ant-message-notice-icon-warning) {
background: var(--uj-warning-soft);
border-color: var(--uj-warning-border);
}
.ant-message .ant-message-notice:has(.ant-message-notice-icon-info),
.ant-message .ant-message-notice:has(.ant-message-notice-icon-loading) {
background: var(--uj-info-soft);
border-color: var(--uj-info-border);
}
.ant-message .ant-message-notice-title {
color: var(--uj-text-1);
font-weight: 600;
}
/* 图标芯片(hero):语义色填满的圆角方块 + 白色字形,替换 antd 默认彩色透明图标。 */
.ant-message .ant-message-notice-icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 22px;
height: 22px;
border-radius: var(--uj-radius-md);
font-size: 13px;
color: #fff;
box-shadow: 0 1px 2px rgba(16, 24, 40, 0.18);
animation: uj-feedback-chip-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.ant-message .ant-message-notice-icon-success {
background: var(--uj-success);
}
.ant-message .ant-message-notice-icon-error {
background: var(--uj-error);
}
.ant-message .ant-message-notice-icon-warning {
background: var(--uj-warning);
}
.ant-message .ant-message-notice-icon-info,
.ant-message .ant-message-notice-icon-loading {
background: var(--uj-primary);
}
/* ============================ NOTIFICATION ============================ */
/* 卡片本体。 */
.ant-notification .ant-notification-notice {
padding: 14px 16px;
border: 1px solid var(--uj-border);
border-radius: var(--uj-radius-card);
background: var(--uj-surface);
box-shadow: var(--uj-shadow-card);
}
/* 按类型染色:v6 类型类直接挂在卡片上,比 :has() 更稳。 */
.ant-notification .ant-notification-notice-success {
background: var(--uj-success-soft);
border-color: var(--uj-success-border);
}
.ant-notification .ant-notification-notice-error {
background: var(--uj-error-soft);
border-color: var(--uj-error-border);
}
.ant-notification .ant-notification-notice-warning {
background: var(--uj-warning-soft);
border-color: var(--uj-warning-border);
}
.ant-notification .ant-notification-notice-info,
.ant-notification .ant-notification-notice-open {
background: var(--uj-info-soft);
border-color: var(--uj-info-border);
}
.ant-notification .ant-notification-notice-title {
color: var(--uj-text-1);
font-weight: 600;
}
.ant-notification .ant-notification-notice-description {
color: var(--uj-text-2);
}
/* 图标芯片(hero),比 message 略大以匹配通知卡的体量。 */
.ant-notification .ant-notification-notice-icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
border-radius: var(--uj-radius-md);
font-size: 15px;
color: #fff;
box-shadow: 0 1px 2px rgba(16, 24, 40, 0.18);
animation: uj-feedback-chip-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.ant-notification .ant-notification-notice-icon-success {
background: var(--uj-success);
}
.ant-notification .ant-notification-notice-icon-error {
background: var(--uj-error);
}
.ant-notification .ant-notification-notice-icon-warning {
background: var(--uj-warning);
}
.ant-notification .ant-notification-notice-icon-info,
.ant-notification .ant-notification-notice-icon-loading {
background: var(--uj-primary);
}
/* ============================ 动效 ============================ */
/* 芯片入场轻微回弹:只作用于芯片自身,不影响 antd 对 .ant-*-notice 的定位 transform。 */
@keyframes uj-feedback-chip-in {
0% {
transform: scale(0.4);
opacity: 0;
}
60% {
transform: scale(1.12);
opacity: 1;
}
100% {
transform: scale(1);
}
}
/* 尊重减少动效偏好:关闭芯片回弹,提示照常出现。 */
@media (prefers-reduced-motion: reduce) {
.ant-message .ant-message-notice-icon,
.ant-notification .ant-notification-notice-icon {
animation: none;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!