feat: 工作台美区 ZIP3 与官网/登录体验收敛
All checks were successful
Build and Deploy Front / deploy (push) Successful in 3m27s
All checks were successful
Build and Deploy Front / deploy (push) Successful in 3m27s
补齐客户工作台地图 ZIP3/港口数据与 keep-alive 重挂,并轻量化官网导航弹层与可拖意图 IP,登录页改为居中舞台。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
2736f50d1d
commit
ba565f7384
12
README.md
12
README.md
@ -94,6 +94,18 @@ npm run build
|
||||
npm run lint
|
||||
```
|
||||
|
||||
### i18n:禁止重复 key
|
||||
|
||||
`src/locale/zh-CN.ts`、`src/locale/en-US.ts`(以及 `views/**/locale` 合并进根对象后的同一字面量)里,**同一个 key 只能出现一次**。
|
||||
|
||||
Vite / esbuild 构建时若对象字面量出现重复键,会报错并导致线上 CI `pnpm run build` 失败,例如:
|
||||
|
||||
```text
|
||||
[plugin vite:esbuild] src/locale/zh-CN.ts: Duplicate key "nav.userMenu.switchLanguage" in object literal
|
||||
```
|
||||
|
||||
新增文案前先全局搜一下该 key;改语义时改原条目,不要再贴一行同名 key。中英文文件要同步检查。
|
||||
|
||||
### 页面路由与 Vite 代理(硬刷新 / 直链)
|
||||
|
||||
部分模块的**页面 path** 与后端 API 共用同一代理前缀(如 `/channel`、`/marketing`、`/finance`)。开发模式下地址栏回车、F5、外链直开时,请求会先走 Vite `server.proxy`;若未把 SPA 路径 bypass 掉,会打到后端并得到空白页 / 404。
|
||||
|
||||
@ -1,17 +1,34 @@
|
||||
[
|
||||
{ "name": "Los Angeles / Long Beach", "nameZh": "洛杉矶 / 长滩", "code": "LAX", "locode": "USLAX", "type": "container", "coord": [-118.2642, 33.7361] },
|
||||
{ "name": "Oakland", "nameZh": "奥克兰", "code": "OAK", "locode": "USOAK", "type": "container", "coord": [-122.3186, 37.7955] },
|
||||
{ "name": "Seattle / Tacoma", "nameZh": "西雅图 / 塔科马", "code": "SEA", "locode": "USSEA", "type": "container", "coord": [-122.3381, 47.589] },
|
||||
{ "name": "Houston", "nameZh": "休斯敦", "code": "HOU", "locode": "USHOU", "type": "container", "coord": [-95.0204, 29.728] },
|
||||
{ "name": "New York / New Jersey", "nameZh": "纽约 / 新泽西", "code": "NYC", "locode": "USNYC", "type": "container", "coord": [-74.0721, 40.6681] },
|
||||
{ "name": "Savannah", "nameZh": "萨凡纳", "code": "SAV", "locode": "USSAV", "type": "container", "coord": [-81.0912, 32.0809] },
|
||||
{ "name": "Charleston", "nameZh": "查尔斯顿", "code": "CHS", "locode": "USCHS", "type": "container", "coord": [-79.9067, 32.826] },
|
||||
{ "name": "Miami", "nameZh": "迈阿密", "code": "MIA", "locode": "USMIA", "type": "container", "coord": [-80.1618, 25.7781] },
|
||||
{ "name": "Norfolk", "nameZh": "诺福克", "code": "ORF", "locode": "USORF", "type": "container", "coord": [-76.3285, 36.905] },
|
||||
{ "name": "Baltimore", "nameZh": "巴尔的摩", "code": "BAL", "locode": "USBAL", "type": "container", "coord": [-76.557, 39.262] },
|
||||
{ "name": "New Orleans", "nameZh": "新奥尔良", "code": "MSY", "locode": "USMSY", "type": "container", "coord": [-90.0634, 29.934] },
|
||||
{ "name": "Jacksonville", "nameZh": "杰克逊维尔", "code": "JAX", "locode": "USJAX", "type": "container", "coord": [-81.551, 30.385] },
|
||||
{ "name": "Philadelphia", "nameZh": "费城", "code": "PHL", "locode": "USPHL", "type": "container", "coord": [-75.141, 39.89] },
|
||||
{ "name": "Boston", "nameZh": "波士顿", "code": "BOS", "locode": "USBOS", "type": "container", "coord": [-71.035, 42.36] },
|
||||
{ "name": "Portland OR", "nameZh": "波特兰", "code": "PDX", "locode": "USPDX", "type": "container", "coord": [-122.72, 45.6] }
|
||||
{ "name": "Los Angeles / Long Beach", "nameZh": "洛杉矶 / 长滩", "code": "LGB", "locode": "USLGB", "type": "sea", "coord": [-118.2642, 33.7361] },
|
||||
{ "name": "Oakland", "nameZh": "奥克兰", "code": "OAK", "locode": "USOAK", "type": "sea", "coord": [-122.3186, 37.7955] },
|
||||
{ "name": "Seattle / Tacoma", "nameZh": "西雅图 / 塔科马", "code": "SEA", "locode": "USSEA", "type": "sea", "coord": [-122.3381, 47.589] },
|
||||
{ "name": "Houston", "nameZh": "休斯敦", "code": "HOU", "locode": "USHOU", "type": "sea", "coord": [-95.0204, 29.728] },
|
||||
{ "name": "New York / New Jersey", "nameZh": "纽约 / 新泽西", "code": "NYC", "locode": "USNYC", "type": "sea", "coord": [-74.0721, 40.6681] },
|
||||
{ "name": "Savannah", "nameZh": "萨凡纳", "code": "SAV", "locode": "USSAV", "type": "sea", "coord": [-81.0912, 32.0809] },
|
||||
{ "name": "Charleston", "nameZh": "查尔斯顿", "code": "CHS", "locode": "USCHS", "type": "sea", "coord": [-79.9067, 32.826] },
|
||||
{ "name": "Miami", "nameZh": "迈阿密港", "code": "MIA", "locode": "USMIA", "type": "sea", "coord": [-80.1618, 25.7781] },
|
||||
{ "name": "Norfolk", "nameZh": "诺福克", "code": "ORF", "locode": "USORF", "type": "sea", "coord": [-76.3285, 36.905] },
|
||||
{ "name": "Baltimore", "nameZh": "巴尔的摩", "code": "BAL", "locode": "USBAL", "type": "sea", "coord": [-76.557, 39.262] },
|
||||
{ "name": "New Orleans", "nameZh": "新奥尔良", "code": "MSY", "locode": "USMSY", "type": "sea", "coord": [-90.0634, 29.934] },
|
||||
{ "name": "Jacksonville", "nameZh": "杰克逊维尔", "code": "JAX", "locode": "USJAX", "type": "sea", "coord": [-81.551, 30.385] },
|
||||
{ "name": "Philadelphia", "nameZh": "费城港", "code": "PHL", "locode": "USPHL", "type": "sea", "coord": [-75.141, 39.89] },
|
||||
{ "name": "Boston", "nameZh": "波士顿港", "code": "BOS", "locode": "USBOS", "type": "sea", "coord": [-71.035, 42.36] },
|
||||
{ "name": "Portland OR", "nameZh": "波特兰港", "code": "PDX", "locode": "USPDX", "type": "sea", "coord": [-122.72, 45.6] },
|
||||
|
||||
{ "name": "John F. Kennedy", "nameZh": "纽约肯尼迪", "code": "JFK", "locode": "USJFK", "type": "air", "coord": [-73.7781, 40.6413] },
|
||||
{ "name": "Newark Liberty", "nameZh": "纽瓦克", "code": "EWR", "locode": "USEWR", "type": "air", "coord": [-74.1687, 40.6895] },
|
||||
{ "name": "Chicago O'Hare", "nameZh": "芝加哥奥黑尔", "code": "ORD", "locode": "USORD", "type": "air", "coord": [-87.9073, 41.9742] },
|
||||
{ "name": "Los Angeles Intl", "nameZh": "洛杉矶国际", "code": "LAX", "locode": "USLAX", "type": "air", "coord": [-118.4081, 33.9416] },
|
||||
{ "name": "Miami Intl", "nameZh": "迈阿密国际", "code": "MIA", "locode": "USMIA", "type": "air", "coord": [-80.2906, 25.7959] },
|
||||
{ "name": "San Francisco Intl", "nameZh": "旧金山国际", "code": "SFO", "locode": "USSFO", "type": "air", "coord": [-122.375, 37.6213] },
|
||||
{ "name": "Dallas/Fort Worth", "nameZh": "达拉斯沃斯堡", "code": "DFW", "locode": "USDFW", "type": "air", "coord": [-97.0403, 32.8998] },
|
||||
{ "name": "Atlanta Hartsfield", "nameZh": "亚特兰大", "code": "ATL", "locode": "USATL", "type": "air", "coord": [-84.4277, 33.6407] },
|
||||
{ "name": "Seattle-Tacoma Intl", "nameZh": "西雅图 Tacoma", "code": "SEA", "locode": "USSEA", "type": "air", "coord": [-122.3088, 47.4502] },
|
||||
{ "name": "Houston Intercontinental", "nameZh": "休斯敦洲际", "code": "IAH", "locode": "USIAH", "type": "air", "coord": [-95.3414, 29.9902] },
|
||||
{ "name": "Anchorage Ted Stevens", "nameZh": "安克雷奇", "code": "ANC", "locode": "USANC", "type": "air", "coord": [-149.9983, 61.1743] },
|
||||
{ "name": "Memphis Intl", "nameZh": "孟菲斯", "code": "MEM", "locode": "USMEM", "type": "air", "coord": [-89.9767, 35.0424] },
|
||||
{ "name": "Louisville Muhammad Ali", "nameZh": "路易斯维尔", "code": "SDF", "locode": "USSDF", "type": "air", "coord": [-85.7365, 38.174] },
|
||||
{ "name": "Cincinnati/Northern Kentucky", "nameZh": "辛辛那提", "code": "CVG", "locode": "USCVG", "type": "air", "coord": [-84.6678, 39.0488] },
|
||||
{ "name": "Boston Logan", "nameZh": "波士顿洛根", "code": "BOS", "locode": "USBOS", "type": "air", "coord": [-71.0052, 42.3656] },
|
||||
{ "name": "Chicago Rockford", "nameZh": "芝加哥罗克福德", "code": "RFD", "locode": "USRFD", "type": "air", "coord": [-89.0972, 42.1954] }
|
||||
]
|
||||
|
||||
950
public/geo/us-state-zip-ranges.json
Normal file
950
public/geo/us-state-zip-ranges.json
Normal file
@ -0,0 +1,950 @@
|
||||
[
|
||||
{
|
||||
"code": "AL",
|
||||
"name": "Alabama",
|
||||
"nameZh": "阿拉巴马",
|
||||
"center": [
|
||||
-86.9,
|
||||
32.8
|
||||
],
|
||||
"ranges": [
|
||||
"350-369"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "350",
|
||||
"to": "369"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "AK",
|
||||
"name": "Alaska",
|
||||
"nameZh": "阿拉斯加",
|
||||
"center": [
|
||||
-153.5,
|
||||
64.2
|
||||
],
|
||||
"ranges": [
|
||||
"995-999"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "995",
|
||||
"to": "999"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "AZ",
|
||||
"name": "Arizona",
|
||||
"nameZh": "亚利桑那",
|
||||
"center": [
|
||||
-111.9,
|
||||
34.3
|
||||
],
|
||||
"ranges": [
|
||||
"850-865"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "850",
|
||||
"to": "865"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "AR",
|
||||
"name": "Arkansas",
|
||||
"nameZh": "阿肯色",
|
||||
"center": [
|
||||
-92.4,
|
||||
34.9
|
||||
],
|
||||
"ranges": [
|
||||
"716-729"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "716",
|
||||
"to": "729"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "CA",
|
||||
"name": "California",
|
||||
"nameZh": "加利福尼亚",
|
||||
"center": [
|
||||
-119.4,
|
||||
37.2
|
||||
],
|
||||
"ranges": [
|
||||
"900-961"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "900",
|
||||
"to": "961"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "CO",
|
||||
"name": "Colorado",
|
||||
"nameZh": "科罗拉多",
|
||||
"center": [
|
||||
-105.5,
|
||||
39
|
||||
],
|
||||
"ranges": [
|
||||
"800-816"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "800",
|
||||
"to": "816"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "CT",
|
||||
"name": "Connecticut",
|
||||
"nameZh": "康涅狄格",
|
||||
"center": [
|
||||
-72.7,
|
||||
41.6
|
||||
],
|
||||
"ranges": [
|
||||
"060-069"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "060",
|
||||
"to": "069"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "DE",
|
||||
"name": "Delaware",
|
||||
"nameZh": "特拉华",
|
||||
"center": [
|
||||
-75.5,
|
||||
39
|
||||
],
|
||||
"ranges": [
|
||||
"197-199"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "197",
|
||||
"to": "199"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "DC",
|
||||
"name": "District of Columbia",
|
||||
"nameZh": "华盛顿特区",
|
||||
"center": [
|
||||
-77,
|
||||
38.9
|
||||
],
|
||||
"ranges": [
|
||||
"200",
|
||||
"202-205"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "200",
|
||||
"to": "200"
|
||||
},
|
||||
{
|
||||
"from": "202",
|
||||
"to": "205"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "FL",
|
||||
"name": "Florida",
|
||||
"nameZh": "佛罗里达",
|
||||
"center": [
|
||||
-81.5,
|
||||
27.8
|
||||
],
|
||||
"ranges": [
|
||||
"320-349"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "320",
|
||||
"to": "349"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "GA",
|
||||
"name": "Georgia",
|
||||
"nameZh": "佐治亚",
|
||||
"center": [
|
||||
-83.4,
|
||||
32.7
|
||||
],
|
||||
"ranges": [
|
||||
"300-319",
|
||||
"398-399"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "300",
|
||||
"to": "319"
|
||||
},
|
||||
{
|
||||
"from": "398",
|
||||
"to": "399"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "HI",
|
||||
"name": "Hawaii",
|
||||
"nameZh": "夏威夷",
|
||||
"center": [
|
||||
-157.5,
|
||||
20.5
|
||||
],
|
||||
"ranges": [
|
||||
"967-968"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "967",
|
||||
"to": "968"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "ID",
|
||||
"name": "Idaho",
|
||||
"nameZh": "爱达荷",
|
||||
"center": [
|
||||
-114.5,
|
||||
44.4
|
||||
],
|
||||
"ranges": [
|
||||
"832-838"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "832",
|
||||
"to": "838"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "IL",
|
||||
"name": "Illinois",
|
||||
"nameZh": "伊利诺伊",
|
||||
"center": [
|
||||
-89.4,
|
||||
40
|
||||
],
|
||||
"ranges": [
|
||||
"600-629"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "600",
|
||||
"to": "629"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "IN",
|
||||
"name": "Indiana",
|
||||
"nameZh": "印第安纳",
|
||||
"center": [
|
||||
-86.3,
|
||||
39.9
|
||||
],
|
||||
"ranges": [
|
||||
"460-479"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "460",
|
||||
"to": "479"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "IA",
|
||||
"name": "Iowa",
|
||||
"nameZh": "艾奥瓦",
|
||||
"center": [
|
||||
-93.5,
|
||||
42
|
||||
],
|
||||
"ranges": [
|
||||
"500-529"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "500",
|
||||
"to": "529"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "KS",
|
||||
"name": "Kansas",
|
||||
"nameZh": "堪萨斯",
|
||||
"center": [
|
||||
-98.3,
|
||||
38.5
|
||||
],
|
||||
"ranges": [
|
||||
"660-679"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "660",
|
||||
"to": "679"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "KY",
|
||||
"name": "Kentucky",
|
||||
"nameZh": "肯塔基",
|
||||
"center": [
|
||||
-84.7,
|
||||
37.5
|
||||
],
|
||||
"ranges": [
|
||||
"400-427"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "400",
|
||||
"to": "427"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "LA",
|
||||
"name": "Louisiana",
|
||||
"nameZh": "路易斯安那",
|
||||
"center": [
|
||||
-91.8,
|
||||
31
|
||||
],
|
||||
"ranges": [
|
||||
"700-715"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "700",
|
||||
"to": "715"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "ME",
|
||||
"name": "Maine",
|
||||
"nameZh": "缅因",
|
||||
"center": [
|
||||
-69.4,
|
||||
45.3
|
||||
],
|
||||
"ranges": [
|
||||
"039-049"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "039",
|
||||
"to": "049"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "MD",
|
||||
"name": "Maryland",
|
||||
"nameZh": "马里兰",
|
||||
"center": [
|
||||
-76.7,
|
||||
39
|
||||
],
|
||||
"ranges": [
|
||||
"206-219"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "206",
|
||||
"to": "219"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "MA",
|
||||
"name": "Massachusetts",
|
||||
"nameZh": "马萨诸塞",
|
||||
"center": [
|
||||
-71.8,
|
||||
42.2
|
||||
],
|
||||
"ranges": [
|
||||
"010-027",
|
||||
"055"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "010",
|
||||
"to": "027"
|
||||
},
|
||||
{
|
||||
"from": "055",
|
||||
"to": "055"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "MI",
|
||||
"name": "Michigan",
|
||||
"nameZh": "密歇根",
|
||||
"center": [
|
||||
-84.5,
|
||||
44.3
|
||||
],
|
||||
"ranges": [
|
||||
"480-499"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "480",
|
||||
"to": "499"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "MN",
|
||||
"name": "Minnesota",
|
||||
"nameZh": "明尼苏达",
|
||||
"center": [
|
||||
-94.6,
|
||||
46.3
|
||||
],
|
||||
"ranges": [
|
||||
"550-567"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "550",
|
||||
"to": "567"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "MS",
|
||||
"name": "Mississippi",
|
||||
"nameZh": "密西西比",
|
||||
"center": [
|
||||
-89.7,
|
||||
32.7
|
||||
],
|
||||
"ranges": [
|
||||
"386-397"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "386",
|
||||
"to": "397"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "MO",
|
||||
"name": "Missouri",
|
||||
"nameZh": "密苏里",
|
||||
"center": [
|
||||
-92.5,
|
||||
38.4
|
||||
],
|
||||
"ranges": [
|
||||
"630-658"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "630",
|
||||
"to": "658"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "MT",
|
||||
"name": "Montana",
|
||||
"nameZh": "蒙大拿",
|
||||
"center": [
|
||||
-110.4,
|
||||
46.9
|
||||
],
|
||||
"ranges": [
|
||||
"590-599"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "590",
|
||||
"to": "599"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "NE",
|
||||
"name": "Nebraska",
|
||||
"nameZh": "内布拉斯加",
|
||||
"center": [
|
||||
-99.9,
|
||||
41.5
|
||||
],
|
||||
"ranges": [
|
||||
"680-693"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "680",
|
||||
"to": "693"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "NV",
|
||||
"name": "Nevada",
|
||||
"nameZh": "内华达",
|
||||
"center": [
|
||||
-117,
|
||||
39.3
|
||||
],
|
||||
"ranges": [
|
||||
"889-898"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "889",
|
||||
"to": "898"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "NH",
|
||||
"name": "New Hampshire",
|
||||
"nameZh": "新罕布什尔",
|
||||
"center": [
|
||||
-71.6,
|
||||
43.7
|
||||
],
|
||||
"ranges": [
|
||||
"030-038"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "030",
|
||||
"to": "038"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "NJ",
|
||||
"name": "New Jersey",
|
||||
"nameZh": "新泽西",
|
||||
"center": [
|
||||
-74.5,
|
||||
40.2
|
||||
],
|
||||
"ranges": [
|
||||
"070-089"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "070",
|
||||
"to": "089"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "NM",
|
||||
"name": "New Mexico",
|
||||
"nameZh": "新墨西哥",
|
||||
"center": [
|
||||
-106,
|
||||
34.4
|
||||
],
|
||||
"ranges": [
|
||||
"870-884"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "870",
|
||||
"to": "884"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "NY",
|
||||
"name": "New York",
|
||||
"nameZh": "纽约",
|
||||
"center": [
|
||||
-75.5,
|
||||
43
|
||||
],
|
||||
"ranges": [
|
||||
"005",
|
||||
"100-149"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "005",
|
||||
"to": "005"
|
||||
},
|
||||
{
|
||||
"from": "100",
|
||||
"to": "149"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "NC",
|
||||
"name": "North Carolina",
|
||||
"nameZh": "北卡罗来纳",
|
||||
"center": [
|
||||
-79.4,
|
||||
35.5
|
||||
],
|
||||
"ranges": [
|
||||
"270-289"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "270",
|
||||
"to": "289"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "ND",
|
||||
"name": "North Dakota",
|
||||
"nameZh": "北达科他",
|
||||
"center": [
|
||||
-100.5,
|
||||
47.5
|
||||
],
|
||||
"ranges": [
|
||||
"580-588"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "580",
|
||||
"to": "588"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "OH",
|
||||
"name": "Ohio",
|
||||
"nameZh": "俄亥俄",
|
||||
"center": [
|
||||
-82.8,
|
||||
40.3
|
||||
],
|
||||
"ranges": [
|
||||
"430-459"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "430",
|
||||
"to": "459"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "OK",
|
||||
"name": "Oklahoma",
|
||||
"nameZh": "俄克拉何马",
|
||||
"center": [
|
||||
-97.5,
|
||||
35.5
|
||||
],
|
||||
"ranges": [
|
||||
"730-749"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "730",
|
||||
"to": "749"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "OR",
|
||||
"name": "Oregon",
|
||||
"nameZh": "俄勒冈",
|
||||
"center": [
|
||||
-120.5,
|
||||
44
|
||||
],
|
||||
"ranges": [
|
||||
"970-979"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "970",
|
||||
"to": "979"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "PA",
|
||||
"name": "Pennsylvania",
|
||||
"nameZh": "宾夕法尼亚",
|
||||
"center": [
|
||||
-77.2,
|
||||
40.9
|
||||
],
|
||||
"ranges": [
|
||||
"150-196"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "150",
|
||||
"to": "196"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "RI",
|
||||
"name": "Rhode Island",
|
||||
"nameZh": "罗得岛",
|
||||
"center": [
|
||||
-71.5,
|
||||
41.7
|
||||
],
|
||||
"ranges": [
|
||||
"028-029"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "028",
|
||||
"to": "029"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "SC",
|
||||
"name": "South Carolina",
|
||||
"nameZh": "南卡罗来纳",
|
||||
"center": [
|
||||
-80.9,
|
||||
33.9
|
||||
],
|
||||
"ranges": [
|
||||
"290-299"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "290",
|
||||
"to": "299"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "SD",
|
||||
"name": "South Dakota",
|
||||
"nameZh": "南达科他",
|
||||
"center": [
|
||||
-100.2,
|
||||
44.4
|
||||
],
|
||||
"ranges": [
|
||||
"570-577"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "570",
|
||||
"to": "577"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "TN",
|
||||
"name": "Tennessee",
|
||||
"nameZh": "田纳西",
|
||||
"center": [
|
||||
-86.3,
|
||||
35.8
|
||||
],
|
||||
"ranges": [
|
||||
"370-385"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "370",
|
||||
"to": "385"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "TX",
|
||||
"name": "Texas",
|
||||
"nameZh": "得克萨斯",
|
||||
"center": [
|
||||
-99.3,
|
||||
31.4
|
||||
],
|
||||
"ranges": [
|
||||
"750-799",
|
||||
"885"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "750",
|
||||
"to": "799"
|
||||
},
|
||||
{
|
||||
"from": "885",
|
||||
"to": "885"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "UT",
|
||||
"name": "Utah",
|
||||
"nameZh": "犹他",
|
||||
"center": [
|
||||
-111.7,
|
||||
39.3
|
||||
],
|
||||
"ranges": [
|
||||
"840-847"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "840",
|
||||
"to": "847"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "VT",
|
||||
"name": "Vermont",
|
||||
"nameZh": "佛蒙特",
|
||||
"center": [
|
||||
-72.7,
|
||||
44
|
||||
],
|
||||
"ranges": [
|
||||
"050-059"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "050",
|
||||
"to": "059"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "VA",
|
||||
"name": "Virginia",
|
||||
"nameZh": "弗吉尼亚",
|
||||
"center": [
|
||||
-78.5,
|
||||
37.5
|
||||
],
|
||||
"ranges": [
|
||||
"201",
|
||||
"220-246"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "201",
|
||||
"to": "201"
|
||||
},
|
||||
{
|
||||
"from": "220",
|
||||
"to": "246"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "WA",
|
||||
"name": "Washington",
|
||||
"nameZh": "华盛顿州",
|
||||
"center": [
|
||||
-120.5,
|
||||
47.4
|
||||
],
|
||||
"ranges": [
|
||||
"980-994"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "980",
|
||||
"to": "994"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "WV",
|
||||
"name": "West Virginia",
|
||||
"nameZh": "西弗吉尼亚",
|
||||
"center": [
|
||||
-80.6,
|
||||
38.6
|
||||
],
|
||||
"ranges": [
|
||||
"247-268"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "247",
|
||||
"to": "268"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "WI",
|
||||
"name": "Wisconsin",
|
||||
"nameZh": "威斯康星",
|
||||
"center": [
|
||||
-89.6,
|
||||
44.5
|
||||
],
|
||||
"ranges": [
|
||||
"530-549"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "530",
|
||||
"to": "549"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"code": "WY",
|
||||
"name": "Wyoming",
|
||||
"nameZh": "怀俄明",
|
||||
"center": [
|
||||
-107.3,
|
||||
43
|
||||
],
|
||||
"ranges": [
|
||||
"820-831"
|
||||
],
|
||||
"rangePairs": [
|
||||
{
|
||||
"from": "820",
|
||||
"to": "831"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
1
public/geo/us-zip3-ref.json
Normal file
1
public/geo/us-zip3-ref.json
Normal file
File diff suppressed because one or more lines are too long
@ -267,6 +267,10 @@ export interface BizOpsOverviewQuery {
|
||||
laneDim: BizOpsLaneDim
|
||||
failDaysThreshold?: number
|
||||
marginRateThreshold?: number
|
||||
/** 自定义窗口起(含)yyyy-MM-dd */
|
||||
periodStart?: string
|
||||
/** 自定义窗口止(含)yyyy-MM-dd */
|
||||
periodEnd?: string
|
||||
}
|
||||
|
||||
/** 经营地图总览 GET /order/biz-ops-overview */
|
||||
@ -279,7 +283,71 @@ export async function getBizOpsOverview(
|
||||
laneDim: params.laneDim,
|
||||
failDaysThreshold: params.failDaysThreshold,
|
||||
marginRateThreshold: params.marginRateThreshold,
|
||||
periodStart: params.periodStart,
|
||||
periodEnd: params.periodEnd,
|
||||
},
|
||||
})
|
||||
return unwrapData<Record<string, unknown>>(res.data)
|
||||
}
|
||||
|
||||
export interface BizOpsUsZip3Stat {
|
||||
zip3: string
|
||||
orderCount: number
|
||||
}
|
||||
|
||||
export interface BizOpsUsZipDistribution {
|
||||
rangeDays: number
|
||||
periodStart?: string
|
||||
periodEndExclusive?: string
|
||||
usOrderCount: number
|
||||
matchedZipOrderCount: number
|
||||
zip3: BizOpsUsZip3Stat[]
|
||||
}
|
||||
|
||||
function pickRaw(raw: Record<string, unknown>, ...keys: string[]) {
|
||||
for (const key of keys) {
|
||||
if (raw[key] !== undefined && raw[key] !== null) return raw[key]
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
export interface BizOpsUsZipDistributionQuery {
|
||||
rangeDays?: 7 | 30 | 90
|
||||
periodStart?: string
|
||||
periodEnd?: string
|
||||
}
|
||||
|
||||
/** 美国 ZIP3 真实单量 GET /order/biz-ops-us-zip-distribution */
|
||||
export async function getBizOpsUsZipDistribution(
|
||||
params: BizOpsUsZipDistributionQuery | 7 | 30 | 90 = 30,
|
||||
): Promise<BizOpsUsZipDistribution> {
|
||||
const query: BizOpsUsZipDistributionQuery =
|
||||
typeof params === 'number' ? { rangeDays: params } : params || {}
|
||||
const rangeDays = query.rangeDays ?? 30
|
||||
const res = await axiosInstance.get(orderUrl('/order/biz-ops-us-zip-distribution'), {
|
||||
params: {
|
||||
rangeDays,
|
||||
periodStart: query.periodStart,
|
||||
periodEnd: query.periodEnd,
|
||||
},
|
||||
})
|
||||
const raw = unwrapData<Record<string, unknown>>(res.data)
|
||||
const list = (pickRaw(raw, 'zip3', 'Zip3') as unknown[]) || []
|
||||
return {
|
||||
rangeDays: Number(pickRaw(raw, 'rangeDays', 'RangeDays') ?? rangeDays) || rangeDays,
|
||||
periodStart: pickRaw(raw, 'periodStart', 'PeriodStart') as string | undefined,
|
||||
periodEndExclusive: pickRaw(raw, 'periodEndExclusive', 'PeriodEndExclusive') as
|
||||
| string
|
||||
| undefined,
|
||||
usOrderCount: Number(pickRaw(raw, 'usOrderCount', 'UsOrderCount') ?? 0) || 0,
|
||||
matchedZipOrderCount:
|
||||
Number(pickRaw(raw, 'matchedZipOrderCount', 'MatchedZipOrderCount') ?? 0) || 0,
|
||||
zip3: list.map((item) => {
|
||||
const row = (item || {}) as Record<string, unknown>
|
||||
return {
|
||||
zip3: String(pickRaw(row, 'zip3', 'Zip3') ?? '').padStart(3, '0').slice(0, 3),
|
||||
orderCount: Number(pickRaw(row, 'orderCount', 'OrderCount') ?? 0) || 0,
|
||||
}
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
>
|
||||
<IconNotification class="message-icon" :class="totalCount > 0 ? 'theMessage' : ''" />
|
||||
<span v-if="showLabel" class="message-label">{{ t('navbar.message') }}</span>
|
||||
<span v-if="totalCount > 0" class="message-count">({{ displayCount }})</span>
|
||||
<span v-if="totalCount > 0" class="message-count">{{ displayCount }}</span>
|
||||
</div>
|
||||
<template #content>
|
||||
<a-doption @click="() => onMessageMenuClick({ key: 'notification' })">
|
||||
@ -144,11 +144,16 @@ const onMessageMenuClick = (event: { key?: string }) => {
|
||||
|
||||
.message-count {
|
||||
flex-shrink: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 1;
|
||||
min-width: 16px;
|
||||
height: 16px;
|
||||
padding: 0 4px;
|
||||
border-radius: 8px;
|
||||
background: #f53f3f;
|
||||
color: #fff;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
line-height: 16px;
|
||||
text-align: center;
|
||||
letter-spacing: -0.02em;
|
||||
color: inherit;
|
||||
opacity: 0.92;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1733,12 +1733,7 @@ onUnmounted(() => {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
:deep(.message-count) {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.02em;
|
||||
opacity: 0.85;
|
||||
}
|
||||
/* 未读数样式由 RightTopMessage 红底胶囊负责,勿在此盖 opacity/字色 */
|
||||
|
||||
/* 用户头像:右侧锚点,轻描边即可,不做坞 */
|
||||
:deep(.user-dropdown-trigger.is-compact) {
|
||||
|
||||
@ -169,6 +169,8 @@
|
||||
border-bottom: 1px dashed rgba(26, 46, 56, 0.14);
|
||||
box-sizing: border-box;
|
||||
padding-right: 12px;
|
||||
/* 虚线分割与下方页面内容留白(原先贴死到工作台卡片) */
|
||||
margin-bottom: var(--portal-panel-inset);
|
||||
|
||||
:deep(.tab-bar) {
|
||||
flex: 1 1 auto;
|
||||
|
||||
@ -108,6 +108,9 @@
|
||||
/>
|
||||
<UsDestDetailMap
|
||||
v-else
|
||||
:range-days="Number(range) as 7 | 30 | 90"
|
||||
:period-start="activePeriod.start"
|
||||
:period-end="activePeriod.end"
|
||||
@back-world="mapFocus = 'world'"
|
||||
@collapse="closeMapFocus"
|
||||
/>
|
||||
@ -158,6 +161,7 @@ const mapFocus = ref<'none' | 'china' | 'world' | 'us'>('none')
|
||||
|
||||
const {
|
||||
range,
|
||||
activePeriod,
|
||||
laneDim,
|
||||
thresholds,
|
||||
loading,
|
||||
|
||||
@ -46,6 +46,7 @@
|
||||
</div>
|
||||
<VCharts
|
||||
v-if="ready"
|
||||
:key="chartEpoch"
|
||||
class="china-map__chart"
|
||||
:option="option"
|
||||
autoresize
|
||||
@ -84,6 +85,7 @@ import '@/utils/echarts'
|
||||
import VCharts from 'vue-echarts'
|
||||
import { formatCount } from './mock/bizOpsMock'
|
||||
import type { BizOpsSlice, ProvinceStat } from './types'
|
||||
import { useChartRemountOnActivate } from './useChartRemountOnActivate'
|
||||
import {
|
||||
ensureCnOverlays,
|
||||
ensureGeoMaps,
|
||||
@ -113,6 +115,7 @@ const emit = defineEmits<{
|
||||
}>()
|
||||
|
||||
const ready = ref(false)
|
||||
const { chartEpoch } = useChartRemountOnActivate(ready)
|
||||
const loadError = ref('')
|
||||
const highlightKey = ref<'total' | 'neu' | 'online' | 'idle7' | null>(null)
|
||||
const showCities = ref(true)
|
||||
|
||||
@ -5,6 +5,8 @@
|
||||
<button type="button" class="us-map__crumb-link" @click="$emit('back-world')">全球</button>
|
||||
<span class="us-map__crumb-sep">›</span>
|
||||
<strong>美国</strong>
|
||||
<span v-if="selectedState" class="us-map__crumb-sep">›</span>
|
||||
<strong v-if="selectedState">{{ selectedStateLabel }}</strong>
|
||||
</nav>
|
||||
<div class="us-map__actions">
|
||||
<div class="us-map__layers" role="group" aria-label="图层">
|
||||
@ -24,62 +26,297 @@
|
||||
>
|
||||
港口
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="us-map__layer"
|
||||
:class="{ 'is-on': showRanges }"
|
||||
@click="showRanges = !showRanges"
|
||||
>
|
||||
州邮编区间
|
||||
</button>
|
||||
</div>
|
||||
<button type="button" class="us-map__collapse" @click="$emit('collapse')">收起</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<VCharts v-if="ready" class="us-map__chart" :option="option" autoresize />
|
||||
<div v-else-if="loadError" class="us-map__loading is-err">{{ loadError }}</div>
|
||||
<div v-else class="us-map__loading">美国地图加载中…</div>
|
||||
<div class="us-map__body">
|
||||
<div class="us-map__stage">
|
||||
<VCharts
|
||||
v-if="ready"
|
||||
:key="chartEpoch"
|
||||
class="us-map__chart"
|
||||
:option="option"
|
||||
autoresize
|
||||
@click="onChartClick"
|
||||
/>
|
||||
<div v-else-if="loadError" class="us-map__loading is-err">{{ loadError }}</div>
|
||||
<div v-else class="us-map__loading">美国地图加载中…</div>
|
||||
<div v-if="ready && zipMeta" class="us-map__meta">
|
||||
{{ periodLabel }}美国单 {{ formatCount(zipMeta.usOrderCount) }}
|
||||
· 有邮编 {{ formatCount(zipMeta.matchedZipOrderCount) }}
|
||||
· ZIP3 {{ formatCount(zipPoints.length) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<aside v-if="showRanges" class="us-map__ranges" aria-label="各州邮编区间">
|
||||
<header class="us-map__ranges-head">
|
||||
<div>
|
||||
<strong>各州 ZIP 区间</strong>
|
||||
<span>按 ZIP3 前缀;点击州可筛选地图</span>
|
||||
</div>
|
||||
<button
|
||||
v-if="selectedState"
|
||||
type="button"
|
||||
class="us-map__ranges-clear"
|
||||
@click="selectedState = null"
|
||||
>
|
||||
清除筛选
|
||||
</button>
|
||||
</header>
|
||||
<div class="us-map__ranges-list">
|
||||
<button
|
||||
v-for="row in stateRows"
|
||||
:key="row.code"
|
||||
type="button"
|
||||
class="us-map__ranges-item"
|
||||
:class="{ 'is-active': selectedState === row.name }"
|
||||
@click="toggleState(row.name)"
|
||||
>
|
||||
<div class="us-map__ranges-item-top">
|
||||
<span class="us-map__ranges-name">
|
||||
<em>{{ row.code }}</em>
|
||||
{{ row.nameZh }}
|
||||
<small>{{ row.name }}</small>
|
||||
</span>
|
||||
<span class="us-map__ranges-count">{{ formatCount(row.orderCount) }}</span>
|
||||
</div>
|
||||
<div class="us-map__ranges-tags">
|
||||
<span v-for="r in row.ranges" :key="r" class="us-map__ranges-tag">{{ r }}</span>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { computed, onMounted, ref, watch } from 'vue'
|
||||
import '@/utils/echarts'
|
||||
import VCharts from 'vue-echarts'
|
||||
import { getBizOpsUsZipDistribution } from '@/api/workplace'
|
||||
import { formatCount } from './mock/bizOpsMock'
|
||||
import { useChartRemountOnActivate } from './useChartRemountOnActivate'
|
||||
import {
|
||||
ensureUsaGeoMap,
|
||||
ensureUsOverlays,
|
||||
ensureUsPorts,
|
||||
ensureUsStateZipRanges,
|
||||
ensureUsZip3Ref,
|
||||
type UsPortPoint,
|
||||
type UsStateZipRange,
|
||||
type UsZip3Point,
|
||||
type UsZip3RefPoint,
|
||||
} from './useGeoMaps'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
/** 与工作台统计窗口一致:7 / 30 / 90(无自定义日期时) */
|
||||
rangeDays?: 7 | 30 | 90
|
||||
/** 自定义窗口起(含)yyyy-MM-dd */
|
||||
periodStart?: string
|
||||
/** 自定义窗口止(含)yyyy-MM-dd */
|
||||
periodEnd?: string
|
||||
}>(),
|
||||
{ rangeDays: 30 },
|
||||
)
|
||||
|
||||
defineEmits<{
|
||||
(e: 'back-world'): void
|
||||
(e: 'collapse'): void
|
||||
}>()
|
||||
|
||||
const ready = ref(false)
|
||||
const { chartEpoch } = useChartRemountOnActivate(ready)
|
||||
const loadError = ref('')
|
||||
const showZip = ref(true)
|
||||
const showPorts = ref(true)
|
||||
const showRanges = ref(true)
|
||||
const ports = ref<UsPortPoint[]>([])
|
||||
const zip3 = ref<UsZip3Point[]>([])
|
||||
const zipRef = ref<UsZip3RefPoint[]>([])
|
||||
const stateRanges = ref<UsStateZipRange[]>([])
|
||||
const zipPoints = ref<UsZip3Point[]>([])
|
||||
const selectedState = ref<string | null>(null)
|
||||
const zipMeta = ref<{ usOrderCount: number; matchedZipOrderCount: number } | null>(null)
|
||||
|
||||
const selectedStateLabel = computed(() => {
|
||||
const hit = stateRanges.value.find((s) => s.name === selectedState.value)
|
||||
return hit ? `${hit.nameZh} · ${hit.code}` : selectedState.value
|
||||
})
|
||||
|
||||
const zipRefByCode = computed(() => {
|
||||
const map = new Map<string, UsZip3RefPoint>()
|
||||
for (const z of zipRef.value) map.set(z.zip3, z)
|
||||
return map
|
||||
})
|
||||
|
||||
const stateRows = computed(() => {
|
||||
const countByState = new Map<string, number>()
|
||||
for (const z of zipPoints.value) {
|
||||
countByState.set(z.stateName, (countByState.get(z.stateName) || 0) + z.orderCount)
|
||||
}
|
||||
return [...stateRanges.value]
|
||||
.map((s) => ({
|
||||
...s,
|
||||
orderCount: countByState.get(s.name) || 0,
|
||||
}))
|
||||
.sort((a, b) => b.orderCount - a.orderCount || a.code.localeCompare(b.code))
|
||||
})
|
||||
|
||||
const visibleZipPoints = computed(() => {
|
||||
if (!selectedState.value) return zipPoints.value
|
||||
return zipPoints.value.filter((z) => z.stateName === selectedState.value)
|
||||
})
|
||||
|
||||
const periodLabel = computed(() => {
|
||||
if (props.periodStart && props.periodEnd) {
|
||||
return `${props.periodStart} ~ ${props.periodEnd} `
|
||||
}
|
||||
return `近 ${props.rangeDays} 天 `
|
||||
})
|
||||
|
||||
async function loadZipDistribution() {
|
||||
const dist = await getBizOpsUsZipDistribution({
|
||||
rangeDays: props.rangeDays,
|
||||
periodStart: props.periodStart,
|
||||
periodEnd: props.periodEnd,
|
||||
})
|
||||
zipMeta.value = {
|
||||
usOrderCount: dist.usOrderCount,
|
||||
matchedZipOrderCount: dist.matchedZipOrderCount,
|
||||
}
|
||||
const refMap = zipRefByCode.value
|
||||
const stateByZip = buildZip3ToStateIndex(stateRanges.value)
|
||||
zipPoints.value = dist.zip3
|
||||
.filter((z) => z.zip3 && z.orderCount > 0)
|
||||
.map((z) => {
|
||||
const base = refMap.get(z.zip3)
|
||||
const state = base
|
||||
? {
|
||||
stateCode: base.stateCode,
|
||||
stateName: base.stateName,
|
||||
stateNameZh: base.stateNameZh,
|
||||
coord: base.coord,
|
||||
name: base.name,
|
||||
}
|
||||
: resolveStateForZip3(z.zip3, stateByZip)
|
||||
return {
|
||||
zip3: z.zip3,
|
||||
orderCount: z.orderCount,
|
||||
name: state.name,
|
||||
stateCode: state.stateCode,
|
||||
stateName: state.stateName,
|
||||
stateNameZh: state.stateNameZh,
|
||||
coord: state.coord,
|
||||
} satisfies UsZip3Point
|
||||
})
|
||||
}
|
||||
|
||||
function buildZip3ToStateIndex(states: UsStateZipRange[]) {
|
||||
const map = new Map<string, UsStateZipRange>()
|
||||
for (const s of states) {
|
||||
for (const pair of s.rangePairs || []) {
|
||||
const from = Number(pair.from)
|
||||
const to = Number(pair.to)
|
||||
if (!Number.isFinite(from) || !Number.isFinite(to)) continue
|
||||
for (let n = from; n <= to; n++) {
|
||||
map.set(String(n).padStart(3, '0'), s)
|
||||
}
|
||||
}
|
||||
}
|
||||
return map
|
||||
}
|
||||
|
||||
function resolveStateForZip3(
|
||||
zip3: string,
|
||||
index: Map<string, UsStateZipRange>,
|
||||
): Pick<UsZip3Point, 'name' | 'stateCode' | 'stateName' | 'stateNameZh' | 'coord'> {
|
||||
const s = index.get(zip3)
|
||||
if (s) {
|
||||
return {
|
||||
name: `${s.nameZh} ${zip3}`,
|
||||
stateCode: s.code,
|
||||
stateName: s.name,
|
||||
stateNameZh: s.nameZh,
|
||||
coord: s.center,
|
||||
}
|
||||
}
|
||||
return {
|
||||
name: `ZIP3 ${zip3}`,
|
||||
stateCode: '??',
|
||||
stateName: 'Unknown',
|
||||
stateNameZh: '未知州',
|
||||
coord: [-98.5, 39.5],
|
||||
}
|
||||
}
|
||||
|
||||
function toggleState(name: string) {
|
||||
selectedState.value = selectedState.value === name ? null : name
|
||||
}
|
||||
|
||||
function onChartClick(params: any) {
|
||||
if (params?.componentType === 'geo' || params?.seriesType === 'map') {
|
||||
const name = params.name as string | undefined
|
||||
if (!name) return
|
||||
toggleState(name)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
await ensureUsaGeoMap()
|
||||
const overlays = await ensureUsOverlays()
|
||||
ports.value = overlays.ports
|
||||
zip3.value = overlays.zip3
|
||||
const [portList, zipList, states] = await Promise.all([
|
||||
ensureUsPorts(),
|
||||
ensureUsZip3Ref(),
|
||||
ensureUsStateZipRanges(),
|
||||
])
|
||||
ports.value = portList
|
||||
zipRef.value = zipList
|
||||
stateRanges.value = states
|
||||
await loadZipDistribution()
|
||||
ready.value = true
|
||||
} catch (err) {
|
||||
loadError.value = err instanceof Error ? err.message : '美国地图加载失败'
|
||||
}
|
||||
})
|
||||
|
||||
watch(
|
||||
() => [props.rangeDays, props.periodStart, props.periodEnd] as const,
|
||||
() => {
|
||||
if (!ready.value) return
|
||||
void loadZipDistribution().catch((err) => {
|
||||
loadError.value = err instanceof Error ? err.message : '邮编分布加载失败'
|
||||
})
|
||||
},
|
||||
)
|
||||
|
||||
const option = computed(() => {
|
||||
const maxZip = Math.max(...zip3.value.map((z) => z.orderCount), 1)
|
||||
const points = visibleZipPoints.value
|
||||
const maxZip = Math.max(...points.map((z) => z.orderCount), 1)
|
||||
const stateOrderMap = new Map<string, number>()
|
||||
for (const z of zipPoints.value) {
|
||||
stateOrderMap.set(z.stateName, (stateOrderMap.get(z.stateName) || 0) + z.orderCount)
|
||||
}
|
||||
const maxState = Math.max(...stateOrderMap.values(), 1)
|
||||
|
||||
const series: Record<string, unknown>[] = [
|
||||
{
|
||||
name: '州单量',
|
||||
type: 'map',
|
||||
map: 'usa',
|
||||
geoIndex: 0,
|
||||
data: [],
|
||||
silent: true,
|
||||
data: [...stateOrderMap.entries()].map(([name, value]) => ({ name, value })),
|
||||
emphasis: { disabled: false },
|
||||
select: { disabled: true },
|
||||
},
|
||||
]
|
||||
|
||||
@ -98,11 +335,14 @@ const option = computed(() => {
|
||||
borderColor: 'rgba(196, 65, 12, 0.35)',
|
||||
borderWidth: 0.5,
|
||||
},
|
||||
data: zip3.value.map((z) => ({
|
||||
data: points.map((z) => ({
|
||||
name: z.zip3,
|
||||
value: [...z.coord, z.orderCount],
|
||||
labelName: z.name,
|
||||
orderCount: z.orderCount,
|
||||
stateName: z.stateName,
|
||||
stateNameZh: z.stateNameZh,
|
||||
stateCode: z.stateCode,
|
||||
})),
|
||||
})
|
||||
}
|
||||
@ -116,7 +356,9 @@ const option = computed(() => {
|
||||
rippleEffect: { brushType: 'stroke', scale: 2.6, period: 3.2 },
|
||||
symbolSize: 9,
|
||||
itemStyle: {
|
||||
color: '#1d7281',
|
||||
color(params: any) {
|
||||
return params?.data?.portType === 'air' ? '#c45c4a' : '#1d7281'
|
||||
},
|
||||
shadowBlur: 8,
|
||||
shadowColor: 'rgba(29, 114, 129, 0.35)',
|
||||
},
|
||||
@ -159,10 +401,12 @@ const option = computed(() => {
|
||||
formatter(params: any) {
|
||||
if (params.seriesName === '港口') {
|
||||
const d = params.data
|
||||
const kind = d?.portType === 'air' ? '空港' : '海港'
|
||||
return [
|
||||
`<div style="font-weight:600;margin-bottom:4px">${d?.nameZh || d?.name || params.name}</div>`,
|
||||
`${d?.nameEn || ''}`,
|
||||
`港码 ${d?.code || '—'} · LOCODE ${d?.locode || '—'}`,
|
||||
`港码 ${d?.code || '—'} · ${kind}`,
|
||||
d?.locode ? `LOCODE ${d.locode}` : '',
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join('<br/>')
|
||||
@ -171,8 +415,23 @@ const option = computed(() => {
|
||||
const d = params.data
|
||||
return [
|
||||
`<div style="font-weight:600;margin-bottom:4px">ZIP3 ${d?.name}</div>`,
|
||||
`${d?.stateNameZh || ''} ${d?.stateCode || ''}`.trim(),
|
||||
`${d?.labelName || ''}`,
|
||||
`单量 ${formatCount(d?.orderCount || 0)}(演示)`,
|
||||
`单量 ${formatCount(d?.orderCount || 0)}`,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join('<br/>')
|
||||
}
|
||||
if (params.seriesName === '州单量' || params.componentType === 'geo') {
|
||||
const name = params.name
|
||||
const state = stateRanges.value.find((s) => s.name === name)
|
||||
const count = stateOrderMap.get(name) || 0
|
||||
return [
|
||||
`<div style="font-weight:600;margin-bottom:4px">${state?.nameZh || name}</div>`,
|
||||
state ? `${state.code} · ${state.name}` : '',
|
||||
`单量 ${formatCount(count)}`,
|
||||
state ? `邮编区间 ${state.ranges.join(' / ')}` : '',
|
||||
'<span style="color:#1d7281">点击筛选该州</span>',
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join('<br/>')
|
||||
@ -180,24 +439,42 @@ const option = computed(() => {
|
||||
return params.name
|
||||
},
|
||||
},
|
||||
visualMap: showZip.value
|
||||
? {
|
||||
show: true,
|
||||
min: 0,
|
||||
max: maxZip,
|
||||
seriesIndex: 1,
|
||||
orient: 'vertical',
|
||||
right: 12,
|
||||
bottom: 16,
|
||||
itemWidth: 8,
|
||||
itemHeight: 72,
|
||||
text: ['高', '低'],
|
||||
textStyle: { color: 'rgba(26,46,56,0.45)', fontSize: 10 },
|
||||
inRange: {
|
||||
color: ['#fff5eb', '#ffd8a8', '#ff922b', '#f76707', '#d9480f'],
|
||||
},
|
||||
}
|
||||
: { show: false },
|
||||
visualMap: [
|
||||
{
|
||||
show: true,
|
||||
min: 0,
|
||||
max: maxState,
|
||||
seriesIndex: 0,
|
||||
orient: 'vertical',
|
||||
left: 12,
|
||||
bottom: 48,
|
||||
itemWidth: 8,
|
||||
itemHeight: 64,
|
||||
text: ['州高', '州低'],
|
||||
textStyle: { color: 'rgba(26,46,56,0.45)', fontSize: 10 },
|
||||
inRange: {
|
||||
color: ['#f4fafb', '#c5e4e9', '#7ebec8', '#3a9aa8', '#1d7281'],
|
||||
},
|
||||
},
|
||||
showZip.value
|
||||
? {
|
||||
show: true,
|
||||
min: 0,
|
||||
max: maxZip,
|
||||
seriesIndex: 1,
|
||||
orient: 'vertical',
|
||||
right: 12,
|
||||
bottom: 48,
|
||||
itemWidth: 8,
|
||||
itemHeight: 64,
|
||||
text: ['ZIP高', 'ZIP低'],
|
||||
textStyle: { color: 'rgba(26,46,56,0.45)', fontSize: 10 },
|
||||
inRange: {
|
||||
color: ['#fff5eb', '#ffd8a8', '#ff922b', '#f76707', '#d9480f'],
|
||||
},
|
||||
}
|
||||
: { show: false },
|
||||
],
|
||||
geo: {
|
||||
map: 'usa',
|
||||
roam: true,
|
||||
@ -216,6 +493,18 @@ const option = computed(() => {
|
||||
},
|
||||
label: { show: false },
|
||||
},
|
||||
regions: selectedState.value
|
||||
? [
|
||||
{
|
||||
name: selectedState.value,
|
||||
itemStyle: {
|
||||
areaColor: '#b7dde3',
|
||||
borderColor: '#1d7281',
|
||||
borderWidth: 1.2,
|
||||
},
|
||||
},
|
||||
]
|
||||
: [],
|
||||
},
|
||||
series,
|
||||
}
|
||||
@ -331,12 +620,166 @@ const option = computed(() => {
|
||||
}
|
||||
}
|
||||
|
||||
.us-map__body {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.us-map__stage {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.us-map__chart {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.us-map__meta {
|
||||
position: absolute;
|
||||
left: 12px;
|
||||
bottom: 12px;
|
||||
z-index: 3;
|
||||
padding: 6px 10px;
|
||||
border-radius: 8px;
|
||||
background: rgba(255, 255, 255, 0.94);
|
||||
border: 1px solid rgba(26, 46, 56, 0.08);
|
||||
font-size: 11px;
|
||||
color: rgba(26, 46, 56, 0.62);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.us-map__ranges {
|
||||
width: 280px;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
border-left: 1px solid rgba(15, 23, 42, 0.08);
|
||||
background: rgba(255, 255, 255, 0.98);
|
||||
}
|
||||
|
||||
.us-map__ranges-head {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
padding: 12px 12px 8px;
|
||||
|
||||
strong {
|
||||
display: block;
|
||||
font-size: 13px;
|
||||
font-weight: 650;
|
||||
color: #1a2e38;
|
||||
}
|
||||
|
||||
span {
|
||||
display: block;
|
||||
margin-top: 2px;
|
||||
font-size: 11px;
|
||||
color: rgba(26, 46, 56, 0.45);
|
||||
}
|
||||
}
|
||||
|
||||
.us-map__ranges-clear {
|
||||
flex-shrink: 0;
|
||||
height: 26px;
|
||||
padding: 0 8px;
|
||||
border-radius: 6px;
|
||||
border: 1px solid rgba(26, 46, 56, 0.08);
|
||||
background: #fff;
|
||||
color: var(--app-primary-color, #1d7281);
|
||||
font-size: 11px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.us-map__ranges-list {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
padding: 0 8px 10px;
|
||||
}
|
||||
|
||||
.us-map__ranges-item {
|
||||
width: 100%;
|
||||
display: block;
|
||||
margin: 0 0 6px;
|
||||
padding: 8px 10px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid rgba(15, 23, 42, 0.06);
|
||||
background: rgba(15, 23, 42, 0.02);
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.14s ease, background-color 0.14s ease;
|
||||
|
||||
&:hover {
|
||||
border-color: rgba(29, 114, 129, 0.28);
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
border-color: rgba(29, 114, 129, 0.45);
|
||||
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 8%, #fff);
|
||||
}
|
||||
}
|
||||
|
||||
.us-map__ranges-item-top {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.us-map__ranges-name {
|
||||
min-width: 0;
|
||||
font-size: 12px;
|
||||
font-weight: 650;
|
||||
color: #1a2e38;
|
||||
|
||||
em {
|
||||
font-style: normal;
|
||||
color: var(--app-primary-color, #1d7281);
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
small {
|
||||
margin-left: 4px;
|
||||
font-weight: 500;
|
||||
color: rgba(26, 46, 56, 0.4);
|
||||
}
|
||||
}
|
||||
|
||||
.us-map__ranges-count {
|
||||
flex-shrink: 0;
|
||||
font-size: 12px;
|
||||
font-weight: 650;
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: #1a2e38;
|
||||
}
|
||||
|
||||
.us-map__ranges-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.us-map__ranges-tag {
|
||||
padding: 1px 6px;
|
||||
border-radius: 999px;
|
||||
background: rgba(29, 114, 129, 0.08);
|
||||
color: rgba(26, 46, 56, 0.7);
|
||||
font-size: 11px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.us-map__loading {
|
||||
flex: 1;
|
||||
display: grid;
|
||||
@ -350,4 +793,21 @@ const option = computed(() => {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 960px) {
|
||||
.us-map__body {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.us-map__ranges {
|
||||
width: 100%;
|
||||
max-height: 38%;
|
||||
border-left: none;
|
||||
border-top: 1px solid rgba(15, 23, 42, 0.08);
|
||||
}
|
||||
|
||||
.us-map__chrome {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
</div>
|
||||
<VCharts
|
||||
v-if="ready"
|
||||
:key="chartEpoch"
|
||||
class="world-map__chart"
|
||||
:option="option"
|
||||
autoresize
|
||||
@ -56,6 +57,7 @@ import '@/utils/echarts'
|
||||
import VCharts from 'vue-echarts'
|
||||
import { formatCount, formatDays, formatMoney, latencyColor } from './mock/bizOpsMock'
|
||||
import type { BizOpsSlice, LatencyMode } from './types'
|
||||
import { useChartRemountOnActivate } from './useChartRemountOnActivate'
|
||||
import { ensureGeoMaps } from './useGeoMaps'
|
||||
|
||||
const US_WORLD_NAMES = new Set(['United States', 'United States of America', 'USA'])
|
||||
@ -76,6 +78,8 @@ const props = withDefaults(
|
||||
title?: string
|
||||
/** 未放大时也可点美国下钻邮编/港口(客户单图场景) */
|
||||
allowUsDrill?: boolean
|
||||
/** 客户侧:不展示成本/毛利等运营财务字段 */
|
||||
hideOpsFinance?: boolean
|
||||
}>(),
|
||||
{
|
||||
dense: false,
|
||||
@ -83,6 +87,7 @@ const props = withDefaults(
|
||||
expandable: true,
|
||||
title: '全球 · 目的国分布',
|
||||
allowUsDrill: false,
|
||||
hideOpsFinance: false,
|
||||
},
|
||||
)
|
||||
|
||||
@ -111,6 +116,7 @@ const statusItems = computed(() => {
|
||||
})
|
||||
|
||||
const ready = ref(false)
|
||||
const { chartEpoch } = useChartRemountOnActivate(ready)
|
||||
|
||||
onMounted(async () => {
|
||||
await ensureGeoMaps()
|
||||
@ -161,11 +167,16 @@ const option = computed(() => {
|
||||
if (!lane) return ''
|
||||
const days =
|
||||
props.latencyMode === 'success' ? lane.avgSuccessDays : lane.avgFailDays
|
||||
return [
|
||||
const lines = [
|
||||
`<div style="font-weight:600;margin-bottom:6px">${lane.fromShort} → ${lane.toCountryCode}</div>`,
|
||||
`均时 ${formatDays(days)} · 单量 ${formatCount(lane.orderCount)}`,
|
||||
`营收 ${formatMoney(lane.revenue)} · 毛利 ${formatMoney(lane.grossProfit)}`,
|
||||
].join('<br/>')
|
||||
]
|
||||
if (!props.hideOpsFinance) {
|
||||
lines.push(
|
||||
`营收 ${formatMoney(lane.revenue)} · 毛利 ${formatMoney(lane.grossProfit)}`,
|
||||
)
|
||||
}
|
||||
return lines.join('<br/>')
|
||||
}
|
||||
const d = params.data
|
||||
if (!d || d.value == null) return params.name
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import dayjs from 'dayjs'
|
||||
import { getBizOpsOverview } from '@/api/workplace'
|
||||
import { emptyBizOpsSlice } from './mock/bizOpsMock'
|
||||
import { normalizeBizOpsOverview } from './normalizeBizOps'
|
||||
@ -6,6 +7,8 @@ import type { BizOpsSlice, LaneDim, RangeKey } from './types'
|
||||
|
||||
const THRESHOLD_KEY = 'oms.bizOps.thresholds'
|
||||
|
||||
export type BizOpsPeriod = { start: string; end: string }
|
||||
|
||||
function loadThresholds() {
|
||||
try {
|
||||
const raw = localStorage.getItem(THRESHOLD_KEY)
|
||||
@ -20,23 +23,46 @@ function loadThresholds() {
|
||||
}
|
||||
}
|
||||
|
||||
/** 相对今天的近 N 天(含今天) */
|
||||
export function presetPeriod(days: 7 | 30 | 90): BizOpsPeriod {
|
||||
const end = dayjs().startOf('day')
|
||||
const start = end.subtract(days - 1, 'day')
|
||||
return {
|
||||
start: start.format('YYYY-MM-DD'),
|
||||
end: end.format('YYYY-MM-DD'),
|
||||
}
|
||||
}
|
||||
|
||||
export function useBizOpsData() {
|
||||
const range = ref<RangeKey>('30')
|
||||
/** 自定义闭区间 yyyy-MM-dd;有值时优先生效 */
|
||||
const customPeriod = ref<BizOpsPeriod | null>(null)
|
||||
const laneDim = ref<LaneDim>('product')
|
||||
const thresholds = ref(loadThresholds())
|
||||
const loading = ref(false)
|
||||
const error = ref('')
|
||||
const slice = ref<BizOpsSlice>(emptyBizOpsSlice('30', 'product'))
|
||||
|
||||
const activePeriod = computed<BizOpsPeriod>(() => {
|
||||
if (customPeriod.value?.start && customPeriod.value?.end) {
|
||||
return customPeriod.value
|
||||
}
|
||||
const days = (Number(range.value) as 7 | 30 | 90) || 30
|
||||
return presetPeriod(days === 7 || days === 90 ? days : 30)
|
||||
})
|
||||
|
||||
async function refresh() {
|
||||
loading.value = true
|
||||
error.value = ''
|
||||
try {
|
||||
const period = activePeriod.value
|
||||
const raw = await getBizOpsOverview({
|
||||
rangeDays: Number(range.value) as 7 | 30 | 90,
|
||||
laneDim: laneDim.value,
|
||||
failDaysThreshold: thresholds.value.failDaysThreshold,
|
||||
marginRateThreshold: thresholds.value.marginRateThreshold,
|
||||
periodStart: period.start,
|
||||
periodEnd: period.end,
|
||||
})
|
||||
slice.value = normalizeBizOpsOverview(raw, range.value, laneDim.value)
|
||||
} catch (e) {
|
||||
@ -56,7 +82,19 @@ export function useBizOpsData() {
|
||||
void refresh()
|
||||
}
|
||||
|
||||
watch([range, laneDim], () => {
|
||||
/** 快捷:近 7/30/90 天(清掉自定义后再设预设) */
|
||||
function applyPresetRange(next: RangeKey) {
|
||||
range.value = next
|
||||
customPeriod.value = null
|
||||
}
|
||||
|
||||
/** 日期控件:闭区间 */
|
||||
function applyCustomPeriod(start: string, end: string) {
|
||||
if (!start || !end) return
|
||||
customPeriod.value = { start, end }
|
||||
}
|
||||
|
||||
watch([range, laneDim, customPeriod], () => {
|
||||
void refresh()
|
||||
})
|
||||
|
||||
@ -78,6 +116,8 @@ export function useBizOpsData() {
|
||||
|
||||
return {
|
||||
range,
|
||||
customPeriod,
|
||||
activePeriod,
|
||||
laneDim,
|
||||
thresholds,
|
||||
loading,
|
||||
@ -87,5 +127,7 @@ export function useBizOpsData() {
|
||||
marginLowTop,
|
||||
refresh,
|
||||
saveThresholds,
|
||||
applyPresetRange,
|
||||
applyCustomPeriod,
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
import { nextTick, onActivated, ref, type Ref } from 'vue'
|
||||
|
||||
/**
|
||||
* keep-alive 切页回来后,ECharts geo/map 常因隐藏态被 autoresize 成 0×0 而空白。
|
||||
* 激活后等布局落稳再 bump key,强制重挂图表。
|
||||
*/
|
||||
export function useChartRemountOnActivate(ready: Ref<boolean>) {
|
||||
const chartEpoch = ref(0)
|
||||
|
||||
onActivated(() => {
|
||||
if (!ready.value) return
|
||||
void nextTick(() => {
|
||||
requestAnimationFrame(() => {
|
||||
chartEpoch.value += 1
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
return { chartEpoch }
|
||||
}
|
||||
@ -6,11 +6,14 @@ let ready = false
|
||||
let usaLoading: Promise<void> | null = null
|
||||
let usaReady = false
|
||||
|
||||
let overlayLoading: Promise<{
|
||||
ports: UsPortPoint[]
|
||||
zip3: UsZip3Point[]
|
||||
}> | null = null
|
||||
let overlays: { ports: UsPortPoint[]; zip3: UsZip3Point[] } | null = null
|
||||
let usPortsLoading: Promise<UsPortPoint[]> | null = null
|
||||
let usPorts: UsPortPoint[] | null = null
|
||||
|
||||
let usZipRefLoading: Promise<UsZip3RefPoint[]> | null = null
|
||||
let usZipRef: UsZip3RefPoint[] | null = null
|
||||
|
||||
let usStateRangesLoading: Promise<UsStateZipRange[]> | null = null
|
||||
let usStateRanges: UsStateZipRange[] | null = null
|
||||
|
||||
let cnOverlayLoading: Promise<{
|
||||
ports: CnPortPoint[]
|
||||
@ -22,21 +25,39 @@ export interface UsPortPoint {
|
||||
name: string
|
||||
/** 中文港名 */
|
||||
nameZh: string
|
||||
/** 三字母港码,如 LAX / NYC */
|
||||
/** 三字母港码 / IATA,如 JFK / ORD / LGB */
|
||||
code: string
|
||||
/** UN/LOCODE,如 USLAX */
|
||||
/** UN/LOCODE,如 USJFK */
|
||||
locode?: string
|
||||
/** sea=海港 · air=空港 */
|
||||
type: string
|
||||
coord: [number, number]
|
||||
}
|
||||
|
||||
export interface UsZip3Point {
|
||||
/** ZIP3 地理底表(不含单量;单量来自业务接口) */
|
||||
export interface UsZip3RefPoint {
|
||||
zip3: string
|
||||
name: string
|
||||
stateCode: string
|
||||
stateName: string
|
||||
stateNameZh: string
|
||||
coord: [number, number]
|
||||
}
|
||||
|
||||
export interface UsZip3Point extends UsZip3RefPoint {
|
||||
orderCount: number
|
||||
}
|
||||
|
||||
export interface UsStateZipRange {
|
||||
code: string
|
||||
name: string
|
||||
nameZh: string
|
||||
center: [number, number]
|
||||
/** 展示用区间,如 900-961 */
|
||||
ranges: string[]
|
||||
rangePairs: Array<{ from: string; to: string }>
|
||||
}
|
||||
|
||||
export interface CnPortPoint {
|
||||
name: string
|
||||
nameZh: string
|
||||
@ -94,26 +115,60 @@ export function ensureUsaGeoMap(): Promise<void> {
|
||||
return usaLoading
|
||||
}
|
||||
|
||||
/** 懒加载美国港口 + ZIP3 mock 叠加层 */
|
||||
export function ensureUsOverlays(): Promise<{ ports: UsPortPoint[]; zip3: UsZip3Point[] }> {
|
||||
if (overlays) return Promise.resolve(overlays)
|
||||
if (overlayLoading) return overlayLoading
|
||||
overlayLoading = Promise.all([
|
||||
fetchJson('/geo/us-ports.json'),
|
||||
fetchJson('/geo/us-zip3-mock.json'),
|
||||
])
|
||||
.then(([ports, zip3]) => {
|
||||
overlays = {
|
||||
ports: Array.isArray(ports) ? ports : [],
|
||||
zip3: Array.isArray(zip3) ? zip3 : [],
|
||||
}
|
||||
return overlays
|
||||
/** 懒加载美国港口(海港 + 空港) */
|
||||
export function ensureUsPorts(): Promise<UsPortPoint[]> {
|
||||
if (usPorts) return Promise.resolve(usPorts)
|
||||
if (usPortsLoading) return usPortsLoading
|
||||
usPortsLoading = fetchJson('/geo/us-ports.json')
|
||||
.then((ports) => {
|
||||
usPorts = Array.isArray(ports) ? ports : []
|
||||
return usPorts
|
||||
})
|
||||
.catch((err) => {
|
||||
overlayLoading = null
|
||||
usPortsLoading = null
|
||||
throw err
|
||||
})
|
||||
return overlayLoading
|
||||
return usPortsLoading
|
||||
}
|
||||
|
||||
/** 懒加载 ZIP3 → 州 / 坐标底表 */
|
||||
export function ensureUsZip3Ref(): Promise<UsZip3RefPoint[]> {
|
||||
if (usZipRef) return Promise.resolve(usZipRef)
|
||||
if (usZipRefLoading) return usZipRefLoading
|
||||
usZipRefLoading = fetchJson('/geo/us-zip3-ref.json')
|
||||
.then((rows) => {
|
||||
usZipRef = Array.isArray(rows) ? rows : []
|
||||
return usZipRef
|
||||
})
|
||||
.catch((err) => {
|
||||
usZipRefLoading = null
|
||||
throw err
|
||||
})
|
||||
return usZipRefLoading
|
||||
}
|
||||
|
||||
/** 懒加载各州邮编区间(USPS 常用 ZIP3 段,供对照) */
|
||||
export function ensureUsStateZipRanges(): Promise<UsStateZipRange[]> {
|
||||
if (usStateRanges) return Promise.resolve(usStateRanges)
|
||||
if (usStateRangesLoading) return usStateRangesLoading
|
||||
usStateRangesLoading = fetchJson('/geo/us-state-zip-ranges.json')
|
||||
.then((rows) => {
|
||||
usStateRanges = Array.isArray(rows) ? rows : []
|
||||
return usStateRanges
|
||||
})
|
||||
.catch((err) => {
|
||||
usStateRangesLoading = null
|
||||
throw err
|
||||
})
|
||||
return usStateRangesLoading
|
||||
}
|
||||
|
||||
/** @deprecated 使用 ensureUsPorts + ensureUsZip3Ref;保留以免旧引用断裂 */
|
||||
export function ensureUsOverlays(): Promise<{ ports: UsPortPoint[]; zip3: UsZip3Point[] }> {
|
||||
return Promise.all([ensureUsPorts(), ensureUsZip3Ref()]).then(([ports, zipRef]) => ({
|
||||
ports,
|
||||
zip3: zipRef.map((z) => ({ ...z, orderCount: 0 })),
|
||||
}))
|
||||
}
|
||||
|
||||
/** 懒加载中国港口 + 城市 mock(放大态叠加;城市优先用业务 slice) */
|
||||
|
||||
@ -19,16 +19,21 @@
|
||||
<span class="dest-map-panel__sub">{{ t('workplace.destMap.sub') }}</span>
|
||||
</div>
|
||||
<div class="dest-map-panel__ranges" role="group" :aria-label="t('workplace.destMap.range')">
|
||||
<button
|
||||
v-for="item in rangeOptions"
|
||||
:key="item.value"
|
||||
type="button"
|
||||
class="dest-map-panel__range"
|
||||
:class="{ 'is-active': range === item.value }"
|
||||
@click="range = item.value"
|
||||
>
|
||||
{{ item.label }}
|
||||
</button>
|
||||
<a-range-picker
|
||||
class="dest-map-panel__picker"
|
||||
size="small"
|
||||
value-format="YYYY-MM-DD"
|
||||
:model-value="dateRange"
|
||||
:allow-clear="false"
|
||||
:disabled-date="disableFutureDate"
|
||||
:shortcuts="dateShortcuts"
|
||||
popup-container="body"
|
||||
:placeholder="[
|
||||
t('workplace.destMap.dateStart'),
|
||||
t('workplace.destMap.dateEnd'),
|
||||
]"
|
||||
@change="onDateRangeChange"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="dest-map-panel__refresh"
|
||||
@ -53,6 +58,7 @@
|
||||
latency-mode="success"
|
||||
:expandable="true"
|
||||
:allow-us-drill="true"
|
||||
:hide-ops-finance="true"
|
||||
:title="t('workplace.destMap.mapLabel')"
|
||||
@select-country="onSelectCountry"
|
||||
@drill-status="onDrillStatus"
|
||||
@ -76,6 +82,7 @@
|
||||
latency-mode="success"
|
||||
:focused="true"
|
||||
:expandable="false"
|
||||
:hide-ops-finance="true"
|
||||
:title="t('workplace.destMap.mapLabel')"
|
||||
@select-country="onSelectCountry"
|
||||
@drill-status="onDrillStatus"
|
||||
@ -84,6 +91,8 @@
|
||||
/>
|
||||
<UsDestDetailMap
|
||||
v-else
|
||||
:period-start="activePeriod.start"
|
||||
:period-end="activePeriod.end"
|
||||
@back-world="mapFocus = 'world'"
|
||||
@collapse="closeMapFocus"
|
||||
/>
|
||||
@ -94,12 +103,12 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, onMounted, onUnmounted, ref, watch } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import WorldDestMap from '../biz-ops/WorldDestMap.vue';
|
||||
import UsDestDetailMap from '../biz-ops/UsDestDetailMap.vue';
|
||||
import { useBizOpsData } from '../biz-ops/useBizOpsData';
|
||||
import type { RangeKey } from '../biz-ops/types';
|
||||
import { presetPeriod, useBizOpsData } from '../biz-ops/useBizOpsData';
|
||||
|
||||
defineOptions({ name: 'CustomerDestMapPanel' });
|
||||
|
||||
@ -107,7 +116,15 @@ const MY_ORDERS_PATH = '/order/myOrders';
|
||||
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
const { range, laneDim, loading, error, slice, refresh } = useBizOpsData();
|
||||
const {
|
||||
laneDim,
|
||||
loading,
|
||||
error,
|
||||
slice,
|
||||
refresh,
|
||||
activePeriod,
|
||||
applyCustomPeriod,
|
||||
} = useBizOpsData();
|
||||
|
||||
/** 客户工作台只看目的国维度 */
|
||||
laneDim.value = 'country';
|
||||
@ -116,21 +133,60 @@ const selectedCountry = ref<string | null>(null);
|
||||
/** none=总览;world=全球放大;us=美国邮编/港口 */
|
||||
const mapFocus = ref<'none' | 'world' | 'us'>('none');
|
||||
|
||||
const rangeOptions = computed(() => [
|
||||
{ value: '7' as RangeKey, label: t('workplace.destMap.range7') },
|
||||
{ value: '30' as RangeKey, label: t('workplace.destMap.range30') },
|
||||
{ value: '90' as RangeKey, label: t('workplace.destMap.range90') },
|
||||
const dateRange = computed(() => [activePeriod.value.start, activePeriod.value.end]);
|
||||
|
||||
/** Arco ShortcutType.value 需返回 Date/string/number,不要塞 Dayjs 实例 */
|
||||
const dateShortcuts = computed(() => [
|
||||
{
|
||||
label: t('workplace.destMap.range7'),
|
||||
value: () => {
|
||||
const p = presetPeriod(7);
|
||||
return [p.start, p.end];
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('workplace.destMap.range30'),
|
||||
value: () => {
|
||||
const p = presetPeriod(30);
|
||||
return [p.start, p.end];
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('workplace.destMap.range90'),
|
||||
value: () => {
|
||||
const p = presetPeriod(90);
|
||||
return [p.start, p.end];
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
/** Arco 传入的是原生 Date,不能当 Dayjs 调 endOf */
|
||||
function disableFutureDate(current: Date) {
|
||||
if (!current) return false;
|
||||
return dayjs(current).startOf('day').isAfter(dayjs().startOf('day'));
|
||||
}
|
||||
|
||||
function onDateRangeChange(value: unknown) {
|
||||
const pair = Array.isArray(value) ? value : null;
|
||||
if (!pair?.[0] || !pair?.[1]) return;
|
||||
const start = String(pair[0]).slice(0, 10);
|
||||
const end = String(pair[1]).slice(0, 10);
|
||||
applyCustomPeriod(start, end);
|
||||
selectedCountry.value = null;
|
||||
}
|
||||
|
||||
const focusAriaLabel = computed(() =>
|
||||
mapFocus.value === 'us'
|
||||
? t('workplace.destMap.usLabel')
|
||||
: t('workplace.destMap.mapLabel'),
|
||||
);
|
||||
|
||||
watch(range, () => {
|
||||
selectedCountry.value = null;
|
||||
});
|
||||
watch(
|
||||
() => activePeriod.value.start + activePeriod.value.end,
|
||||
() => {
|
||||
selectedCountry.value = null;
|
||||
},
|
||||
);
|
||||
|
||||
function periodQuery() {
|
||||
const start = slice.value.periodStart;
|
||||
@ -201,6 +257,8 @@ onUnmounted(() => {
|
||||
}
|
||||
|
||||
.dest-map-panel__toolbar {
|
||||
position: relative;
|
||||
z-index: 5;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -230,11 +288,23 @@ onUnmounted(() => {
|
||||
.dest-map-panel__ranges {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
gap: 8px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.dest-map-panel__range,
|
||||
.dest-map-panel__picker {
|
||||
width: 260px;
|
||||
height: 28px;
|
||||
border-radius: 8px;
|
||||
background: rgba(15, 23, 42, 0.04);
|
||||
border-color: transparent;
|
||||
|
||||
:deep(.arco-picker-input input) {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.dest-map-panel__refresh {
|
||||
height: 28px;
|
||||
padding: 0 10px;
|
||||
@ -258,11 +328,6 @@ onUnmounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
.dest-map-panel__range.is-active {
|
||||
color: var(--app-primary-color, #1d7281);
|
||||
background: color-mix(in srgb, var(--app-primary-color, #1d7281) 12%, #fff);
|
||||
}
|
||||
|
||||
.dest-map-panel__error {
|
||||
margin: 0 14px 8px;
|
||||
padding: 8px 10px;
|
||||
|
||||
@ -13,9 +13,6 @@
|
||||
@click="openList"
|
||||
>
|
||||
<span class="wk-inbox__badge-label">{{ t('workplace.inbox') }}</span>
|
||||
<span v-if="unreadCount > 0" class="wk-inbox__badge-count">
|
||||
{{ unreadCount > 99 ? '99+' : unreadCount }}
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<div class="wk-inbox__stage">
|
||||
|
||||
@ -302,12 +302,21 @@
|
||||
|
||||
<style scoped lang="less">
|
||||
.banner {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: 12px 16px 8px;
|
||||
background: transparent;
|
||||
padding: 12px 16px;
|
||||
/* 客户工作台:与地图卡同一套白底卡片,避免问候条「飘」在灰底上 */
|
||||
background: var(--wp-card-bg, #fff);
|
||||
border: var(--wp-card-border, 1px solid rgba(15, 23, 42, 0.06));
|
||||
border-radius: var(--wp-card-radius, 14px);
|
||||
box-shadow: var(--wp-card-shadow, none);
|
||||
|
||||
&.is-compact {
|
||||
padding: 2px 0;
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
|
||||
.banner-row {
|
||||
min-height: 0;
|
||||
@ -336,6 +345,10 @@
|
||||
|
||||
&.is-cockpit {
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
|
||||
.banner-row {
|
||||
min-height: 0;
|
||||
|
||||
@ -310,7 +310,27 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.stat-grid--priority {
|
||||
gap: 10px;
|
||||
gap: 20px;
|
||||
|
||||
/* 公共 less 里 overflow:hidden 会裁掉外侧伪元素,这里放开 */
|
||||
.stat-card {
|
||||
overflow: visible;
|
||||
isolation: auto;
|
||||
}
|
||||
|
||||
/* 卡片之间短竖线隔离,不拉满高度 */
|
||||
.stat-card:not(:last-child)::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: calc(100% + 10px);
|
||||
z-index: 2;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 1px;
|
||||
height: 36px;
|
||||
background: rgba(26, 46, 56, 0.22);
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* 待处理:独立卡片,箭头暗示可点,去掉重复「点击查看」文案 */
|
||||
@ -356,44 +376,58 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
/* 概览:同一浅底井里的指标,和待处理卡明确分区 */
|
||||
/* 概览:无灰底;指标间用圆点分隔(区别于待办区短竖线) */
|
||||
.stat-overview {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 0;
|
||||
border: 1px solid rgba(15, 23, 42, 0.06);
|
||||
border-radius: 12px;
|
||||
background: rgba(15, 23, 42, 0.02);
|
||||
overflow: hidden;
|
||||
gap: 0 24px;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.stat-metric {
|
||||
appearance: none;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
padding: 12px 14px;
|
||||
padding: 10px 8px;
|
||||
border: none;
|
||||
border-right: 1px solid rgba(15, 23, 42, 0.06);
|
||||
border-radius: 0;
|
||||
border-radius: 8px;
|
||||
background: transparent;
|
||||
text-align: left;
|
||||
font: inherit;
|
||||
color: inherit;
|
||||
cursor: default;
|
||||
overflow: visible;
|
||||
|
||||
&:last-child {
|
||||
border-right: none;
|
||||
&:not(:last-child)::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: calc(100% + 12px);
|
||||
z-index: 1;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
border-radius: 50%;
|
||||
background: rgba(26, 46, 56, 0.22);
|
||||
box-shadow:
|
||||
0 -10px 0 rgba(26, 46, 56, 0.12),
|
||||
0 10px 0 rgba(26, 46, 56, 0.12);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&--clickable {
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background: rgba(255, 255, 255, 0.72);
|
||||
background: rgba(15, 23, 42, 0.03);
|
||||
|
||||
.stat-metric__value {
|
||||
color: var(--app-primary-color, #1d7281);
|
||||
|
||||
@ -45,6 +45,8 @@ export default {
|
||||
'workplace.destMap.range7': '7D',
|
||||
'workplace.destMap.range30': '30D',
|
||||
'workplace.destMap.range90': '90D',
|
||||
'workplace.destMap.dateStart': 'Start',
|
||||
'workplace.destMap.dateEnd': 'End',
|
||||
'workplace.destMap.refresh': 'Refresh',
|
||||
'workplace.orderAnalysis.title': 'Order Analysis',
|
||||
'workplace.orderAnalysis.day': 'Day',
|
||||
|
||||
@ -45,6 +45,8 @@ export default {
|
||||
'workplace.destMap.range7': '近7天',
|
||||
'workplace.destMap.range30': '近30天',
|
||||
'workplace.destMap.range90': '近90天',
|
||||
'workplace.destMap.dateStart': '开始日期',
|
||||
'workplace.destMap.dateEnd': '结束日期',
|
||||
'workplace.destMap.refresh': '刷新',
|
||||
'workplace.orderAnalysis.title': '订单分析',
|
||||
'workplace.orderAnalysis.day': '日',
|
||||
|
||||
@ -141,7 +141,7 @@ onMounted(async () => {
|
||||
position: relative;
|
||||
width: 550px;
|
||||
height: 400px;
|
||||
transform: scale(0.445);
|
||||
transform: scale(0.36);
|
||||
transform-origin: bottom left;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
@ -14,32 +14,12 @@
|
||||
</div>
|
||||
|
||||
<div class="login-hero__inner">
|
||||
<picture
|
||||
v-if="isCustomer"
|
||||
class="login-hero__silhouette"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<source srcset="/login-assets/hero-plane.webp" type="image/webp" />
|
||||
<img
|
||||
src="/login-assets/hero-plane.png"
|
||||
alt=""
|
||||
draggable="false"
|
||||
decoding="async"
|
||||
/>
|
||||
</picture>
|
||||
|
||||
<div class="login-hero__content">
|
||||
<div v-if="isCustomer" class="login-hero__heading">
|
||||
<h1 class="login-hero__tagline">{{ brandCopy.navFullName }}</h1>
|
||||
<span class="login-hero__rule" aria-hidden="true" />
|
||||
<p class="login-hero__trust">{{ t('login.hero.trust.customer') }}</p>
|
||||
</div>
|
||||
|
||||
<template v-if="isCustomer">
|
||||
<p class="login-hero__desc">
|
||||
{{ t('login.hero.desc.customer', { name: brandCopy.navName }) }}
|
||||
</p>
|
||||
|
||||
<div class="login-hero__tools">
|
||||
<form class="login-hero__search" @submit.prevent="onTrackSubmit">
|
||||
<input
|
||||
@ -146,6 +126,7 @@ import {
|
||||
IconMindMapping,
|
||||
IconRobot,
|
||||
} from '@arco-design/web-vue/es/icon';
|
||||
|
||||
defineOptions({ name: 'LoginHero' });
|
||||
|
||||
interface HeroPillar {
|
||||
@ -169,7 +150,7 @@ const adminPillars: HeroPillar[] = [
|
||||
icon: IconThunderbolt,
|
||||
titleKey: 'login.hero.admin.pillar.speed.title',
|
||||
descKey: 'login.hero.admin.pillar.speed.desc',
|
||||
t: 0.40,
|
||||
t: 0.4,
|
||||
},
|
||||
{
|
||||
key: 'reach',
|
||||
@ -193,7 +174,7 @@ const agentPillars: HeroPillar[] = [
|
||||
icon: IconThunderbolt,
|
||||
titleKey: 'login.hero.agent.pillar.orders.title',
|
||||
descKey: 'login.hero.agent.pillar.orders.desc',
|
||||
t: 0.40,
|
||||
t: 0.4,
|
||||
},
|
||||
{
|
||||
key: 'commission',
|
||||
@ -784,17 +765,17 @@ onBeforeUnmount(() => {
|
||||
|
||||
.login-hero--admin .login-hero__visual {
|
||||
position: absolute;
|
||||
left: calc((var(--login-split-top) + var(--login-split-bottom)) / 4 - 150px);
|
||||
top: 50%;
|
||||
bottom: auto;
|
||||
left: -12px;
|
||||
bottom: -46px;
|
||||
top: auto;
|
||||
z-index: 1;
|
||||
width: min(380px, 32vw);
|
||||
width: min(320px, 30vw);
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
transform: translate(-50%, -50%) scale(1.3);
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
transform: none;
|
||||
justify-content: flex-end;
|
||||
align-self: auto;
|
||||
}
|
||||
|
||||
|
||||
@ -56,6 +56,10 @@ function preloadTarget() {
|
||||
targetPreloaded = true;
|
||||
const hero = new Image();
|
||||
hero.src = TARGET_HERO[props.target];
|
||||
// 切回客户登录时预拉角色包,避免点进去再等
|
||||
if (props.target === 'customer') {
|
||||
void import('./LoginCharacters.vue');
|
||||
}
|
||||
}
|
||||
|
||||
function onSwitchClick(e: MouseEvent) {
|
||||
|
||||
@ -10,90 +10,84 @@
|
||||
]"
|
||||
ref="containerRef"
|
||||
>
|
||||
<div ref="leftSplitRef" class="login-split login-split--left" aria-hidden="true" />
|
||||
<div ref="rightSplitRef" class="login-split login-split--right" aria-hidden="true" />
|
||||
<div class="login-stage">
|
||||
<div ref="leftSplitRef" class="login-split login-split--left" aria-hidden="true" />
|
||||
<div ref="rightSplitRef" class="login-split login-split--right" aria-hidden="true" />
|
||||
|
||||
<LoginCareBanner
|
||||
v-if="shellReady && isAdminLogin && careBannerReady"
|
||||
/>
|
||||
<LoginCareBanner
|
||||
v-if="shellReady && isAdminLogin && careBannerReady"
|
||||
/>
|
||||
|
||||
<div v-if="shellReady" ref="leftPaneRef" class="login-pane login-pane--left">
|
||||
<div
|
||||
v-if="!isCustomerLogin"
|
||||
class="login-brand-corner"
|
||||
:class="{ 'login-brand-corner--light': isLightMode }"
|
||||
>
|
||||
<span class="login-brand-corner__name">{{ brandCopy.navName }}</span>
|
||||
<span class="login-brand-corner__suffix">· {{ brandCornerSuffix }}</span>
|
||||
<div v-if="shellReady" ref="leftPaneRef" class="login-pane login-pane--left">
|
||||
<aside v-if="isCustomerLogin" class="login-hero-panel">
|
||||
<LoginHero
|
||||
:light="isLightMode"
|
||||
portal="customer"
|
||||
/>
|
||||
</aside>
|
||||
<div v-if="isCustomerLogin" class="login-characters-panel">
|
||||
<LoginCharacters v-if="showCharacters" @register="registerLoginCharacters" />
|
||||
</div>
|
||||
</div>
|
||||
<aside v-if="isCustomerLogin" class="login-hero-panel">
|
||||
|
||||
<aside
|
||||
v-if="shellReady && !isCustomerLogin"
|
||||
class="login-hero-panel login-hero-panel--admin"
|
||||
>
|
||||
<LoginHero
|
||||
:light="isLightMode"
|
||||
portal="customer"
|
||||
:portal="isAgentLogin ? 'agent' : 'admin'"
|
||||
/>
|
||||
</aside>
|
||||
<div v-if="isCustomerLogin" class="login-characters-panel">
|
||||
<LoginCharacters v-if="showCharacters" @register="registerLoginCharacters" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<aside
|
||||
v-if="shellReady && !isCustomerLogin"
|
||||
class="login-hero-panel login-hero-panel--admin"
|
||||
>
|
||||
<LoginHero
|
||||
:light="isLightMode"
|
||||
:portal="isAgentLogin ? 'agent' : 'admin'"
|
||||
/>
|
||||
</aside>
|
||||
|
||||
<div v-if="shellReady" ref="rightPaneRef" class="login-pane login-pane--right">
|
||||
<div
|
||||
ref="loginFormRef"
|
||||
:class="[
|
||||
'login-form',
|
||||
{
|
||||
'login-form--ready': shellReady,
|
||||
'login-form--portal-row': isAdminLogin,
|
||||
},
|
||||
]"
|
||||
>
|
||||
<div class="login-form-toolbar">
|
||||
<LoginLangToggle />
|
||||
<a-tooltip :content="isLightMode ? t('login.theme.toNight') : t('login.theme.toDay')">
|
||||
<a-button
|
||||
shape="circle"
|
||||
type="text"
|
||||
class="theme-toggle-btn"
|
||||
:aria-label="isLightMode ? t('login.theme.toNight') : t('login.theme.toDay')"
|
||||
@click="toggleAppearance"
|
||||
>
|
||||
<template #icon>
|
||||
<icon-sun-fill v-if="!isLightMode" />
|
||||
<icon-moon-fill v-else />
|
||||
</template>
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
</div>
|
||||
<div class="login-content">
|
||||
<LoginForm
|
||||
v-if="activeKey === 'pwd'"
|
||||
:login-type="loginType"
|
||||
@switch-wechat="setLoginMode('wechat')"
|
||||
@prefetch-wechat="prefetchWechatQr"
|
||||
/>
|
||||
<WechatLogin
|
||||
v-if="isCustomerLogin && (activeKey === 'wechat' || wechatMounted)"
|
||||
v-show="activeKey === 'wechat'"
|
||||
ref="wechatLoginRef"
|
||||
@switch-pwd="setLoginMode('pwd')"
|
||||
<div v-if="shellReady" ref="rightPaneRef" class="login-pane login-pane--right">
|
||||
<div
|
||||
ref="loginFormRef"
|
||||
:class="[
|
||||
'login-form',
|
||||
{
|
||||
'login-form--ready': shellReady,
|
||||
'login-form--portal-row': isAdminLogin,
|
||||
},
|
||||
]"
|
||||
>
|
||||
<div class="login-form-toolbar">
|
||||
<LoginLangToggle />
|
||||
<a-tooltip :content="isLightMode ? t('login.theme.toNight') : t('login.theme.toDay')">
|
||||
<a-button
|
||||
shape="circle"
|
||||
type="text"
|
||||
class="theme-toggle-btn"
|
||||
:aria-label="isLightMode ? t('login.theme.toNight') : t('login.theme.toDay')"
|
||||
@click="toggleAppearance"
|
||||
>
|
||||
<template #icon>
|
||||
<icon-sun-fill v-if="!isLightMode" />
|
||||
<icon-moon-fill v-else />
|
||||
</template>
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
</div>
|
||||
<div class="login-content">
|
||||
<LoginForm
|
||||
v-if="activeKey === 'pwd'"
|
||||
:login-type="loginType"
|
||||
@switch-wechat="setLoginMode('wechat')"
|
||||
@prefetch-wechat="prefetchWechatQr"
|
||||
/>
|
||||
<WechatLogin
|
||||
v-if="isCustomerLogin && (activeKey === 'wechat' || wechatMounted)"
|
||||
v-show="activeKey === 'wechat'"
|
||||
ref="wechatLoginRef"
|
||||
@switch-pwd="setLoginMode('pwd')"
|
||||
/>
|
||||
</div>
|
||||
<LoginPortalSwitch
|
||||
v-if="loginType !== OmsLoginType.Agent"
|
||||
:target="isCustomerLogin ? 'admin' : 'customer'"
|
||||
:placement="isAdminLogin ? 'row' : 'corner'"
|
||||
/>
|
||||
</div>
|
||||
<LoginPortalSwitch
|
||||
v-if="loginType !== OmsLoginType.Agent"
|
||||
:target="isCustomerLogin ? 'admin' : 'customer'"
|
||||
:placement="isAdminLogin ? 'row' : 'corner'"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -124,16 +118,13 @@ import {
|
||||
} from './composables/useLoginCharacters';
|
||||
import { LOGIN_EXIT_KEY, type LoginExitApi } from './composables/useLoginExit';
|
||||
import { isPortalIrisActive } from '@/utils/page-transition-flag';
|
||||
import { brandCopy } from '@/utils/brandCopy';
|
||||
|
||||
/** Admin login never mounts WeChat; keep it out of the critical path */
|
||||
const WechatLogin = defineAsyncComponent(
|
||||
() => import('./components/wechat-login.vue'),
|
||||
);
|
||||
/** Characters + gsap are decorative; async so first paint stays light */
|
||||
const LoginCharacters = defineAsyncComponent(
|
||||
() => import('./components/LoginCharacters.vue'),
|
||||
);
|
||||
/** Characters + gsap 异步;客户登录尽早预取,避免切换回来才开始拉包 */
|
||||
const loadLoginCharacters = () => import('./components/LoginCharacters.vue');
|
||||
const LoginCharacters = defineAsyncComponent(loadLoginCharacters);
|
||||
const LoginCareBanner = defineAsyncComponent(
|
||||
() => import('./components/LoginCareBanner.vue'),
|
||||
);
|
||||
@ -149,9 +140,6 @@ const loginType = computed(() => getLoginTypeFromRouteName(route.name as string)
|
||||
const isCustomerLogin = computed(() => loginType.value === OmsLoginType.Customer);
|
||||
const isAgentLogin = computed(() => loginType.value === OmsLoginType.Agent);
|
||||
const isAdminLogin = computed(() => loginType.value === OmsLoginType.User);
|
||||
const brandCornerSuffix = computed(() =>
|
||||
isAgentLogin.value ? t('login.brand.suffix.agent') : brandCopy.navFullName,
|
||||
);
|
||||
/** 角色动画偏重,首屏延后空闲再挂 */
|
||||
const showCharacters = ref(false);
|
||||
/** 管理端关怀条在翻页结束后再挂,避免展开过程中插入一块新图层 */
|
||||
@ -327,16 +315,20 @@ function afterPortalIris(run: () => void) {
|
||||
onMounted(() => {
|
||||
document.documentElement.classList.add(LOGIN_PAGE_SCROLL_LOCK_CLASS);
|
||||
shellReady.value = true;
|
||||
if (isCustomerLogin.value) {
|
||||
void loadLoginCharacters();
|
||||
}
|
||||
const idle = window.requestIdleCallback
|
||||
? (cb: () => void, timeout = 1200) => window.requestIdleCallback(cb, { timeout })
|
||||
: (cb: () => void, timeout = 1200) => window.setTimeout(cb, Math.min(timeout, 400));
|
||||
const enteredByIris = isPortalIrisActive();
|
||||
afterPortalIris(() => {
|
||||
careBannerReady.value = true;
|
||||
// 表单先出,空闲后再挂角色,避免和首屏 JS/图抢带宽
|
||||
idle(() => {
|
||||
showCharacters.value = true;
|
||||
}, enteredByIris ? 480 : 1600);
|
||||
// 角色尽早挂上;包已预取时几乎无缝
|
||||
if (isCustomerLogin.value) {
|
||||
window.setTimeout(() => {
|
||||
showCharacters.value = true;
|
||||
}, 120);
|
||||
}
|
||||
idle(() => {
|
||||
void import('@/locale').then(({ ensureFullLocaleMessages }) => {
|
||||
void ensureFullLocaleMessages();
|
||||
@ -366,13 +358,34 @@ onBeforeUnmount(() => {
|
||||
max-height: 100dvh;
|
||||
min-height: 100dvh;
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: max(24px, 4vh) max(24px, 3vw);
|
||||
overflow: hidden;
|
||||
overscroll-behavior: none;
|
||||
background: #e6ebf0;
|
||||
}
|
||||
|
||||
.login-container--light {
|
||||
--login-left-bg: #e8eef5;
|
||||
--login-right-bg: var(--app-page-bg, #f0f3f4);
|
||||
background: #eef1f4;
|
||||
}
|
||||
|
||||
/* 登录主舞台:约 80% 视口,不铺满全屏 */
|
||||
.login-stage {
|
||||
position: relative;
|
||||
width: min(80vw, 1360px);
|
||||
height: min(80dvh, 920px);
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
overflow: hidden;
|
||||
border-radius: 20px;
|
||||
background: var(--login-right-bg);
|
||||
box-shadow:
|
||||
0 1px 2px rgba(15, 23, 42, 0.04),
|
||||
0 24px 64px rgba(15, 23, 42, 0.12);
|
||||
}
|
||||
|
||||
.login-container--exit {
|
||||
@ -611,6 +624,14 @@ onBeforeUnmount(() => {
|
||||
.login-container {
|
||||
--login-split-top: 0%;
|
||||
--login-split-bottom: 0%;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.login-stage {
|
||||
width: min(92vw, 520px);
|
||||
height: auto;
|
||||
min-height: min(78dvh, 720px);
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
.login-split--left,
|
||||
@ -641,6 +662,16 @@ onBeforeUnmount(() => {
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
.login-container {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.login-stage {
|
||||
width: 100%;
|
||||
min-height: min(86dvh, 680px);
|
||||
border-radius: 14px;
|
||||
}
|
||||
|
||||
.login-form {
|
||||
max-width: 97% !important;
|
||||
padding: 36px 20px 52px;
|
||||
|
||||
@ -135,36 +135,6 @@
|
||||
@open-routes="$emit('open-routes', $event)"
|
||||
@ask="$emit('ask', $event)"
|
||||
/>
|
||||
<div class="ai-intent-section" role="group" :aria-label="copy.intentAria">
|
||||
<div class="ai-intent-ribbon" :class="{ 'is-en': !isZh }">
|
||||
<button
|
||||
v-for="door in ribbonDoors"
|
||||
:key="door.id"
|
||||
type="button"
|
||||
class="ai-intent-ribbon__item"
|
||||
:class="{ 'is-featured': door.id === 'agent' || door.featured }"
|
||||
:aria-label="
|
||||
(isZh ? door.zh.title : door.en.title) +
|
||||
'。' +
|
||||
(isZh ? door.zh.hint : door.en.hint)
|
||||
"
|
||||
:disabled="busy"
|
||||
@click="onHomeDoor(door)"
|
||||
>
|
||||
<span class="ai-intent-ribbon__face" aria-hidden="true">
|
||||
<span class="ai-intent-ribbon__icon">
|
||||
<SiteIllusIcon :name="door.icon" />
|
||||
</span>
|
||||
<span class="ai-intent-ribbon__label">{{
|
||||
isZh ? door.zh.title : door.en.title
|
||||
}}</span>
|
||||
</span>
|
||||
<span class="ai-intent-ribbon__hint" aria-hidden="true">{{
|
||||
isZh ? door.zh.hint : door.en.hint
|
||||
}}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ai-composer-dock">
|
||||
<div class="ai-composer-slot--chat">
|
||||
@ -184,20 +154,21 @@
|
||||
</div>
|
||||
<!-- 贴视口底:不进 flex 内容流,避免随 VV/矮屏一起被挤缩 -->
|
||||
<div class="ai-trust-bar">
|
||||
<SitePartnerMarquee
|
||||
:is-zh="isZh"
|
||||
:tag="brandCopy.navFullName"
|
||||
:aria="copy.partnerAria"
|
||||
/>
|
||||
<a class="ai-trust-icp" href="https://beian.miit.gov.cn" target="_blank" rel="noopener">
|
||||
<svg class="ai-trust-glyph" viewBox="0 0 16 16" aria-hidden="true">
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M8 0c-.69 0-1.843.265-2.928.56-1.111.3-2.229.655-2.887.87a1.54 1.54 0 0 0-1.044 1.262c-.596 4.477.787 7.795 2.465 9.99a11.8 11.8 0 0 0 2.517 2.453c.386.273.744.482 1.048.625.28.132.581.24.829.24s.548-.108.829-.24c.304-.143.662-.352 1.048-.625a11.8 11.8 0 0 0 2.517-2.453c1.678-2.195 3.061-5.513 2.465-9.99a1.54 1.54 0 0 0-1.044-1.262 62.4 62.4 0 0 0-2.887-.87C9.843.266 8.69 0 8 0m2.146 5.146a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L7.5 7.793z"
|
||||
/>
|
||||
</svg>
|
||||
<span class="ai-trust-label">{{ brandCopy.icp }}</span>
|
||||
</a>
|
||||
<div class="ai-trust-bar__inner">
|
||||
<SitePartnerMarquee
|
||||
:is-zh="isZh"
|
||||
:aria="copy.partnerAria"
|
||||
/>
|
||||
<a class="ai-trust-icp" href="https://beian.miit.gov.cn" target="_blank" rel="noopener">
|
||||
<svg class="ai-trust-glyph" viewBox="0 0 16 16" aria-hidden="true">
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M8 0c-.69 0-1.843.265-2.928.56-1.111.3-2.229.655-2.887.87a1.54 1.54 0 0 0-1.044 1.262c-.596 4.477.787 7.795 2.465 9.99a11.8 11.8 0 0 0 2.517 2.453c.386.273.744.482 1.048.625.28.132.581.24.829.24s.548-.108.829-.24c.304-.143.662-.352 1.048-.625a11.8 11.8 0 0 0 2.517-2.453c1.678-2.195 3.061-5.513 2.465-9.99a1.54 1.54 0 0 0-1.044-1.262 62.4 62.4 0 0 0-2.887-.87C9.843.266 8.69 0 8 0m2.146 5.146a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L7.5 7.793z"
|
||||
/>
|
||||
</svg>
|
||||
<span class="ai-trust-label">{{ brandCopy.icp }}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<aside
|
||||
@ -261,16 +232,9 @@
|
||||
import EdiComposer from '@/components/EdiAssistant/EdiComposer.vue';
|
||||
import SitePartnerMarquee from './SitePartnerMarquee.vue';
|
||||
import SiteMessageCard from './SiteMessageCard.vue';
|
||||
import SiteIllusIcon from './SiteIllusIcon.vue';
|
||||
import SiteFeaturedRoutes from './SiteFeaturedRoutes.vue';
|
||||
import SiteRunway from './SiteRunway.vue';
|
||||
import {
|
||||
FULFILL_DOOR_IDS,
|
||||
GROWTH_DOOR_IDS,
|
||||
HOME_DOORS,
|
||||
SITE_FOLLOWUP_INTENTS,
|
||||
WELCOME_COPY,
|
||||
} from './lib/site-welcome';
|
||||
import { SITE_FOLLOWUP_INTENTS, WELCOME_COPY } from './lib/site-welcome';
|
||||
import { ROUTE_DEST_PRESETS } from './lib/portal-catalog';
|
||||
import { brandCopy, resolveAiWelcomeTitle } from '@/utils/brandCopy';
|
||||
|
||||
@ -347,21 +311,6 @@
|
||||
buttons[index]?.focus();
|
||||
}
|
||||
|
||||
function doorById(id: string) {
|
||||
return HOME_DOORS.find((d) => d.id === id);
|
||||
}
|
||||
|
||||
const fulfillDoors = FULFILL_DOOR_IDS.map(doorById).filter(
|
||||
(d): d is (typeof HOME_DOORS)[number] => !!d,
|
||||
);
|
||||
const growthDoors = GROWTH_DOOR_IDS.map(doorById).filter(
|
||||
(d): d is (typeof HOME_DOORS)[number] => !!d,
|
||||
);
|
||||
const featuredDoor = HOME_DOORS.find((d) => d.id === 'agent') ?? null;
|
||||
const ribbonDoors = [...fulfillDoors, featuredDoor, ...growthDoors].filter(
|
||||
(d): d is (typeof HOME_DOORS)[number] => !!d,
|
||||
);
|
||||
|
||||
/** 官网 H5 / PC 统一完整标题(品牌 Logo 弹窗可配,本地缓存秒开) */
|
||||
const heroTitle = computed(() => resolveAiWelcomeTitle(props.isZh, false));
|
||||
|
||||
@ -372,10 +321,6 @@
|
||||
|
||||
const visibleFollowups = computed(() => SITE_FOLLOWUP_INTENTS.slice(0, FOLLOWUP_VISIBLE));
|
||||
|
||||
function onHomeDoor(door: (typeof HOME_DOORS)[number]) {
|
||||
emit('intent', door.intentId);
|
||||
}
|
||||
|
||||
function formatThreadTime(ts: number) {
|
||||
const date = new Date(ts);
|
||||
const now = new Date();
|
||||
|
||||
@ -24,7 +24,10 @@
|
||||
height="36"
|
||||
/>
|
||||
</span>
|
||||
<span class="site-nav-wordmark__text">BCDship</span>
|
||||
<span class="site-nav-wordmark__copy">
|
||||
<span class="site-nav-wordmark__text">BCDship</span>
|
||||
<span class="site-nav-wordmark__tag">{{ brandCopy.navFullName }}</span>
|
||||
</span>
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
@ -139,6 +142,7 @@
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { brandLogoImages } from '@/utils/brandLogo';
|
||||
import { brandCopy } from '@/utils/brandCopy';
|
||||
import { useUserStore } from '@/store';
|
||||
import { useRbacUserStore } from '@/store/modules/rbac-user';
|
||||
import { applyRbacUserToUserStore } from '@/utils/enter-system';
|
||||
@ -252,7 +256,7 @@
|
||||
|
||||
const dockRef = ref<HTMLElement | null>(null);
|
||||
const sliderRef = ref<HTMLElement | null>(null);
|
||||
const SLIDER_INSET = 3;
|
||||
const SLIDER_INSET = 0;
|
||||
const sliderPos = { x: 0, w: 0, visible: false };
|
||||
let sliderReady = false;
|
||||
let sliderRaf = 0;
|
||||
|
||||
313
src/views/site/SiteIntentFab.vue
Normal file
313
src/views/site/SiteIntentFab.vue
Normal file
@ -0,0 +1,313 @@
|
||||
<template>
|
||||
<div
|
||||
v-show="visible"
|
||||
ref="hostRef"
|
||||
class="site-intent-fab"
|
||||
:class="{
|
||||
'is-open': open && !drag.moved,
|
||||
'is-en': !isZh,
|
||||
'is-dragging': drag.active && drag.moved,
|
||||
'is-panel-right': panelRight,
|
||||
}"
|
||||
:style="hostStyle"
|
||||
@pointerenter="onEnter"
|
||||
@pointerleave="onLeave"
|
||||
>
|
||||
<div
|
||||
class="site-intent-fab__panel"
|
||||
role="menu"
|
||||
:aria-label="ariaLabel"
|
||||
:aria-hidden="open && !drag.moved ? 'false' : 'true'"
|
||||
@pointerdown.stop
|
||||
>
|
||||
<p class="site-intent-fab__caption">{{ caption }}</p>
|
||||
<button
|
||||
v-for="(door, index) in doors"
|
||||
:key="door.id"
|
||||
type="button"
|
||||
class="site-intent-fab__item"
|
||||
:class="{ 'is-featured': door.id === 'agent' }"
|
||||
:style="{ '--i': String(index) }"
|
||||
role="menuitem"
|
||||
:tabindex="open && !drag.moved ? 0 : -1"
|
||||
:disabled="busy || !open || drag.moved"
|
||||
:aria-label="itemAria(door)"
|
||||
@click="onPick(door)"
|
||||
>
|
||||
<span class="site-intent-fab__icon" aria-hidden="true">
|
||||
<SiteIllusIcon :name="door.icon" />
|
||||
</span>
|
||||
<span class="site-intent-fab__copy">
|
||||
<span class="site-intent-fab__label">{{ isZh ? door.zh.title : door.en.title }}</span>
|
||||
<span class="site-intent-fab__hint">{{ isZh ? door.zh.hint : door.en.hint }}</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="site-intent-fab__core"
|
||||
:aria-expanded="open && !drag.moved ? 'true' : 'false'"
|
||||
:aria-label="coreLabel"
|
||||
@pointerdown="onCorePointerDown"
|
||||
@pointermove="onCorePointerMove"
|
||||
@pointerup="onCorePointerUp"
|
||||
@pointercancel="onCorePointerUp"
|
||||
@click.prevent
|
||||
>
|
||||
<EdiAvatar size="lg" :pulse="false" />
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue';
|
||||
import EdiAvatar from '@/components/EdiAssistant/EdiAvatar.vue';
|
||||
import SiteIllusIcon from './SiteIllusIcon.vue';
|
||||
import {
|
||||
FULFILL_DOOR_IDS,
|
||||
GROWTH_DOOR_IDS,
|
||||
HOME_DOORS,
|
||||
WELCOME_COPY,
|
||||
} from './lib/site-welcome';
|
||||
|
||||
const EDGE = 16;
|
||||
const DRAG_THRESHOLD = 6;
|
||||
const PANEL_W = 292;
|
||||
const POS_KEY = 'oms-site-intent-fab-pos';
|
||||
const fabSize = ref(68);
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
isZh: boolean;
|
||||
busy?: boolean;
|
||||
visible?: boolean;
|
||||
}>(),
|
||||
{
|
||||
busy: false,
|
||||
visible: true,
|
||||
},
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
intent: [id: string];
|
||||
}>();
|
||||
|
||||
const hostRef = ref<HTMLElement | null>(null);
|
||||
const open = ref(false);
|
||||
const hoverCapable = ref(true);
|
||||
const left = ref(0);
|
||||
const top = ref(0);
|
||||
const panelRight = ref(false);
|
||||
const drag = reactive({
|
||||
active: false,
|
||||
moved: false,
|
||||
startX: 0,
|
||||
startY: 0,
|
||||
origLeft: 0,
|
||||
origTop: 0,
|
||||
});
|
||||
let closeTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
const doors = computed(() => {
|
||||
const fulfill = FULFILL_DOOR_IDS.map((id) => HOME_DOORS.find((d) => d.id === id)).filter(
|
||||
Boolean,
|
||||
);
|
||||
const growth = GROWTH_DOOR_IDS.map((id) => HOME_DOORS.find((d) => d.id === id)).filter(
|
||||
Boolean,
|
||||
);
|
||||
const agent = HOME_DOORS.find((d) => d.id === 'agent');
|
||||
return [...fulfill, agent, ...growth].filter(
|
||||
(d): d is (typeof HOME_DOORS)[number] => !!d,
|
||||
);
|
||||
});
|
||||
|
||||
const ariaLabel = computed(() =>
|
||||
props.isZh ? WELCOME_COPY.zh.intentAria : WELCOME_COPY.en.intentAria,
|
||||
);
|
||||
|
||||
const caption = computed(() => (props.isZh ? '快捷咨询' : 'Quick asks'));
|
||||
|
||||
const coreLabel = computed(() =>
|
||||
props.isZh
|
||||
? open.value
|
||||
? '收起快捷入口'
|
||||
: '展开快捷入口'
|
||||
: open.value
|
||||
? 'Collapse shortcuts'
|
||||
: 'Open shortcuts',
|
||||
);
|
||||
|
||||
const hostStyle = computed(() => ({
|
||||
left: `${left.value}px`,
|
||||
top: `${top.value}px`,
|
||||
width: `${fabSize.value}px`,
|
||||
height: `${fabSize.value}px`,
|
||||
}));
|
||||
|
||||
function itemAria(door: (typeof HOME_DOORS)[number]) {
|
||||
const title = props.isZh ? door.zh.title : door.en.title;
|
||||
const hint = props.isZh ? door.zh.hint : door.en.hint;
|
||||
return `${title}。${hint}`;
|
||||
}
|
||||
|
||||
function syncPanelSide() {
|
||||
panelRight.value = left.value < PANEL_W + EDGE + 24;
|
||||
}
|
||||
|
||||
function syncFabSize() {
|
||||
fabSize.value = window.matchMedia('(max-width: 780px)').matches ? 60 : 68;
|
||||
}
|
||||
|
||||
function clampPos(x: number, y: number) {
|
||||
const size = fabSize.value;
|
||||
const maxX = Math.max(EDGE, window.innerWidth - size - EDGE);
|
||||
const maxY = Math.max(EDGE, window.innerHeight - size - EDGE);
|
||||
return {
|
||||
x: Math.min(Math.max(x, EDGE), maxX),
|
||||
y: Math.min(Math.max(y, EDGE), maxY),
|
||||
};
|
||||
}
|
||||
|
||||
function persistPos() {
|
||||
try {
|
||||
sessionStorage.setItem(
|
||||
POS_KEY,
|
||||
JSON.stringify({ left: left.value, top: top.value }),
|
||||
);
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
function readStoredPos(): { left: number; top: number } | null {
|
||||
try {
|
||||
const raw = sessionStorage.getItem(POS_KEY);
|
||||
if (!raw) return null;
|
||||
const parsed = JSON.parse(raw) as { left?: number; top?: number };
|
||||
if (typeof parsed.left !== 'number' || typeof parsed.top !== 'number') return null;
|
||||
return { left: parsed.left, top: parsed.top };
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function initPos() {
|
||||
syncFabSize();
|
||||
const stored = readStoredPos();
|
||||
const fallback = {
|
||||
x: window.innerWidth - fabSize.value - 28,
|
||||
y: Math.round(window.innerHeight * (2 / 3) - fabSize.value / 2),
|
||||
};
|
||||
const next = clampPos(stored?.left ?? fallback.x, stored?.top ?? fallback.y);
|
||||
left.value = next.x;
|
||||
top.value = next.y;
|
||||
syncPanelSide();
|
||||
}
|
||||
|
||||
function clearCloseTimer() {
|
||||
if (closeTimer) {
|
||||
clearTimeout(closeTimer);
|
||||
closeTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
function onEnter() {
|
||||
if (!hoverCapable.value || drag.active) return;
|
||||
clearCloseTimer();
|
||||
open.value = true;
|
||||
}
|
||||
|
||||
function onLeave() {
|
||||
if (!hoverCapable.value || drag.active) return;
|
||||
clearCloseTimer();
|
||||
closeTimer = setTimeout(() => {
|
||||
open.value = false;
|
||||
closeTimer = null;
|
||||
}, 120);
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
open.value = !open.value;
|
||||
}
|
||||
|
||||
function onPick(door: (typeof HOME_DOORS)[number]) {
|
||||
emit('intent', door.intentId);
|
||||
open.value = false;
|
||||
}
|
||||
|
||||
function onCorePointerDown(e: PointerEvent) {
|
||||
if (e.button !== 0) return;
|
||||
(e.currentTarget as HTMLElement | null)?.setPointerCapture?.(e.pointerId);
|
||||
drag.active = true;
|
||||
drag.moved = false;
|
||||
drag.startX = e.clientX;
|
||||
drag.startY = e.clientY;
|
||||
drag.origLeft = left.value;
|
||||
drag.origTop = top.value;
|
||||
}
|
||||
|
||||
function onCorePointerMove(e: PointerEvent) {
|
||||
if (!drag.active) return;
|
||||
const dx = e.clientX - drag.startX;
|
||||
const dy = e.clientY - drag.startY;
|
||||
if (!drag.moved) {
|
||||
if (Math.abs(dx) + Math.abs(dy) < DRAG_THRESHOLD) return;
|
||||
drag.moved = true;
|
||||
open.value = false;
|
||||
clearCloseTimer();
|
||||
}
|
||||
const next = clampPos(drag.origLeft + dx, drag.origTop + dy);
|
||||
left.value = next.x;
|
||||
top.value = next.y;
|
||||
syncPanelSide();
|
||||
}
|
||||
|
||||
function onCorePointerUp() {
|
||||
if (!drag.active) return;
|
||||
const wasDrag = drag.moved;
|
||||
drag.active = false;
|
||||
if (wasDrag) {
|
||||
persistPos();
|
||||
drag.moved = false;
|
||||
return;
|
||||
}
|
||||
drag.moved = false;
|
||||
toggle();
|
||||
}
|
||||
|
||||
function onDocPointerDown(e: PointerEvent) {
|
||||
if (!open.value) return;
|
||||
const root = e.target;
|
||||
if (!(root instanceof Node)) return;
|
||||
if (hostRef.value && !hostRef.value.contains(root)) open.value = false;
|
||||
}
|
||||
|
||||
function onViewportResize() {
|
||||
syncFabSize();
|
||||
const next = clampPos(left.value, top.value);
|
||||
left.value = next.x;
|
||||
top.value = next.y;
|
||||
syncPanelSide();
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(v) => {
|
||||
if (!v) open.value = false;
|
||||
},
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
hoverCapable.value = window.matchMedia('(hover: hover) and (pointer: fine)').matches;
|
||||
initPos();
|
||||
document.addEventListener('pointerdown', onDocPointerDown, true);
|
||||
window.addEventListener('resize', onViewportResize);
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
clearCloseTimer();
|
||||
document.removeEventListener('pointerdown', onDocPointerDown, true);
|
||||
window.removeEventListener('resize', onViewportResize);
|
||||
});
|
||||
</script>
|
||||
@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<div class="ai-partner-marquee" :aria-label="aria">
|
||||
<span class="ai-partner-marquee__tag">{{ tag }}</span>
|
||||
<div
|
||||
ref="viewRef"
|
||||
class="ai-partner-marquee__viewport"
|
||||
@ -51,7 +50,6 @@
|
||||
|
||||
defineProps<{
|
||||
isZh: boolean;
|
||||
tag: string;
|
||||
aria: string;
|
||||
}>();
|
||||
|
||||
|
||||
@ -132,12 +132,15 @@
|
||||
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 v-if="routeHasRealCover(item)" class="ai-route-card__media" aria-hidden="true">
|
||||
<img
|
||||
class="ai-route-card__cover"
|
||||
:src="resolveRouteCoverUrl(item)"
|
||||
alt=""
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
/>
|
||||
</div>
|
||||
<div class="ai-route-card__body">
|
||||
<div class="ai-route-card__head">
|
||||
<div class="ai-route-card__titles">
|
||||
|
||||
@ -90,6 +90,12 @@
|
||||
@open-panel="openPanel"
|
||||
/>
|
||||
</Transition>
|
||||
<SiteIntentFab
|
||||
:is-zh="isZh"
|
||||
:busy="busy"
|
||||
:visible="!chatting"
|
||||
@intent="onIntent"
|
||||
/>
|
||||
<SiteWecomModal :open="wecomOpen" :is-zh="isZh" :url="WECOM_KF_URL" @close="wecomOpen = false" />
|
||||
</div>
|
||||
</template>
|
||||
@ -105,6 +111,7 @@
|
||||
import SiteServicesPanel from './SiteServicesPanel.vue';
|
||||
import SiteTopicPanel from './SiteTopicPanel.vue';
|
||||
import SiteWecomModal from './SiteWecomModal.vue';
|
||||
import SiteIntentFab from './SiteIntentFab.vue';
|
||||
import SiteDotGrid from './SiteDotGrid.vue';
|
||||
import {
|
||||
goOfficialLoginFromHref,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user