feat(common-tools): 工具台新增常用工具分类,三个桌面工具网页化

- tool-catalog 最前插入「常用工具」组(brand_common_tools,23 工具·4 大分类),
  三工具各自权限键:pricing-calc / five-asin / keyword-share
- /pricing-calc:站点(英 GBP÷9、德法 EUR÷8)+ 买货价/运费 → 营业额/利润/
  利润率/换算汇率,公式与精度照抄桌面版,纯函数 node --test 钉住
- /five-asin:五国常量 + ASIN 10 位校验 → 亚马逊商品链接,window.open 与
  :href 出口全部过 safeHttpUrl(url-outlet 棘轮),邮编一键复制
- /keyword-share:筛选/四级类目级联/统计卡/表格分页 200/标记与取消使用/
  添加/删除/随机抽词/共享记录,对接 keywordshare 后端九端点
- 顶栏与 BrandTopBar 导航同步;router 注册三路由;补 test:mount 脚本
  (vitest mount 套件入口,与后管同口径)
This commit is contained in:
2026-10-23 21:56:56 +08:00
parent 2c85f47c3b
commit 208583e14c
18 changed files with 2424 additions and 17 deletions
@@ -12,15 +12,15 @@
<span class="hero-pill">运营辅助 · 数据安全 · 高效跟价</span>
<h1 class="hero-title">让亚马逊运营,更清晰高效</h1>
<p class="hero-sub">
从采集、去重、查品到上架跟价,20 个工具按「前端 · 运营 · 后勤」三线组织,每条工具一句话讲清用途,标准流程一步不缺。
从换算、查询、采集、去重到上架跟价,23 个工具按「常用 · 前端 · 运营 · 后勤」四线组织,每条工具一句话讲清用途,标准流程一步不缺。
</p>
<div class="hero-stats">
<div class="stat">
<strong style="color: #2dd4bf">20</strong>
<strong style="color: #2dd4bf">23</strong>
<span>个工具</span>
</div>
<div class="stat">
<strong style="color: #60a5fa">3</strong>
<strong style="color: #60a5fa">4</strong>
<span>大分类</span>
</div>
<div class="stat">
@@ -128,7 +128,7 @@ import AmazonFooterBar from '@/pages/amazon/components/AmazonFooterBar.vue'
import ToolIcon from '@/pages/amazon/components/ToolIcon.vue'
import { TUTORIAL_DOWNLOAD_URL, resolveTutorialDownloadUrl } from '@/pages/amazon/download-btn'
import { filterGroupsByPermission, filterWorkflowByPermission, TOOL_GROUPS, TOOL_MAP } from '@/pages/amazon/tool-catalog'
import type { ToolGroup, ToolInfo, VisibleGroup, WorkflowStep } from '@/pages/amazon/tool-catalog'
import type { ToolGroup, ToolGroupKey, ToolInfo, VisibleGroup, WorkflowStep } from '@/pages/amazon/tool-catalog'
import { resolvePageHref } from '@/shared/page-prefix'
import { isHttpUrl, safeHttpUrl } from '@/shared/utils/safe-url'
import { prefetchRouteChunk } from '@/shared/route-prefetch'
@@ -143,7 +143,7 @@ const visibleGroups = ref<VisibleGroup[]>(TOOL_GROUPS.map((group) => ({ ...group
const permissionUnavailable = ref(false)
const statusText = ref('')
const statusType = ref<'normal' | 'error'>('normal')
const activeCat = ref<'front' | 'ops' | 'logi'>('front')
const activeCat = ref<ToolGroupKey>('front')
let statusTimer: number | undefined
const currentGroup = computed(() => visibleGroups.value.find((g) => g.key === activeCat.value) ?? visibleGroups.value[0])
@@ -249,15 +249,15 @@ async function onDownloadClick() {
window.open(safeHttpUrl(url), '_blank', 'noopener')
}
function onCatChange(key: 'front' | 'ops' | 'logi') {
function onCatChange(key: ToolGroupKey) {
activeCat.value = key
history.replaceState(null, '', `#group-${key}`)
}
function parseHashGroup() {
const hash = window.location.hash.replace('#', '')
const m = /^group-(front|ops|logi)$/.exec(hash)
if (m) activeCat.value = m[1] as 'front' | 'ops' | 'logi'
const m = /^group-(common|front|ops|logi)$/.exec(hash)
if (m) activeCat.value = m[1] as ToolGroupKey
}
onMounted(async () => {
@@ -35,6 +35,7 @@ import AmazonTopBar from '@/pages/amazon/components/AmazonTopBar.vue'
import AmazonFooterBar from '@/pages/amazon/components/AmazonFooterBar.vue'
import DownloadProgressPanel from '@/shared/components/DownloadProgressPanel.vue'
import { TOOL_DETAILS, TOOL_GROUPS, TOOL_MAP } from '@/pages/amazon/tool-catalog'
import type { ToolGroupKey } from '@/pages/amazon/tool-catalog'
import { resolvePageHref } from '@/shared/page-prefix'
/** Aliprice 注册推广链接(对齐 gemini-code 工具页头 Aliprice 按钮) */
@@ -48,7 +49,7 @@ const props = defineProps<{
const tool = computed(() => TOOL_MAP.get(props.toolId))
const group = computed(() => TOOL_GROUPS.find((g) => g.tools.some((t) => t.id === props.toolId)))
const groupKey = computed(() => group.value?.key ?? 'front')
const groupKey = computed<ToolGroupKey>(() => group.value?.key ?? 'front')
const detailText = computed(() => {
if (!tool.value) return ''
return TOOL_DETAILS[tool.value.id] ?? tool.value.desc
@@ -42,21 +42,21 @@ import { computed, onMounted, ref } from 'vue'
import BrandApiSecretSettingsButton from '@/pages/brand/components/BrandApiSecretSettingsButton.vue'
import NotificationBell from '@/shared/components/NotificationBell.vue'
import { filterGroupsByPermission, TOOL_GROUPS } from '@/pages/amazon/tool-catalog'
import type { VisibleGroup } from '@/pages/amazon/tool-catalog'
import type { ToolGroupKey, VisibleGroup } from '@/pages/amazon/tool-catalog'
import { resolvePageHref } from '@/shared/page-prefix'
import { getCurrentUserAppColumnKeys } from '@/shared/api/permission'
const props = withDefaults(
defineProps<{
/** 当前工具所属分类(功能页高亮对应 tab;工具台首页不传) */
activeCat?: 'front' | 'ops' | 'logi'
activeCat?: ToolGroupKey
}>(),
{
activeCat: undefined,
},
)
const emit = defineEmits<{ change: [key: 'front' | 'ops' | 'logi'] }>()
const emit = defineEmits<{ change: [key: ToolGroupKey] }>()
const activeCat = computed(() => props.activeCat)
const visibleCats = ref<VisibleGroup[]>(TOOL_GROUPS.map((group) => ({ ...group, tools: [...group.tools] })))
@@ -67,7 +67,7 @@ const toolbarHref = resolvePageHref('/new_web_source/amazon-console.html')
/** 返回桌面入口首页(亚马逊/视频/图片入口) */
const homeHref = resolvePageHref('/new_web_source/home.html')
function onTabClick(key: 'front' | 'ops' | 'logi') {
function onTabClick(key: ToolGroupKey) {
emit('change', key)
}
+44 -1
View File
@@ -29,8 +29,11 @@ export type WorkflowStep = {
toolId?: string
}
/** 工具分组键(常用工具组排在最前) */
export type ToolGroupKey = 'common' | 'front' | 'ops' | 'logi'
export type ToolGroup = {
key: 'front' | 'ops' | 'logi'
key: ToolGroupKey
/** 菜单权限组键(与 BrandTopBar 一致) */
columnKey: string
name: string
@@ -48,6 +51,37 @@ export type ToolGroup = {
}
export const TOOL_GROUPS: ReadonlyArray<ToolGroup> = [
{
key: 'common',
columnKey: 'brand_common_tools',
name: '常用工具',
desc: '换算 · 查询 · 词库共享,高频小工具',
color: '#F59E0B',
weak: '#3A2A10',
tools: [
{
id: 'pricing-calc',
name: '定价利润换算',
desc: '输入售价、运费、成本,自动换算利润与毛利,多币种同步',
href: '/pricing-calc',
permissionKeys: ['pricing-calc'],
},
{
id: 'five-asin',
name: '五国ASIN快速查询',
desc: '按国家输入ASIN,自动生成带邮编与汇率的链接,跳转谷歌直达',
href: '/five-asin',
permissionKeys: ['five-asin'],
},
{
id: 'keyword-share',
name: '五国关键词共享',
desc: '词库跨账户共享、已使用标记、操作记录留痕,防重复使用',
href: '/keyword-share',
permissionKeys: ['keyword-share'],
},
],
},
{
key: 'front',
columnKey: 'brand_front_tools',
@@ -260,6 +294,9 @@ export const TOOL_GROUPS: ReadonlyArray<ToolGroup> = [
/** 图标渐变背景(照 icons.py ICON_COLORS 转 CSS) */
export const TOOL_ICON_GRADIENTS: Record<string, string> = {
'pricing-calc': 'linear-gradient(180deg, #FCD34D, #F59E0B)',
'five-asin': 'linear-gradient(180deg, #FDBA74, #F97316)',
'keyword-share': 'linear-gradient(180deg, #86EFAC, #22C55E)',
collect: 'linear-gradient(180deg, #5EEAD4, #14B8A6)',
variant: 'linear-gradient(180deg, #93C5FD, #3B82F6)',
dedupe: 'linear-gradient(180deg, #C4B5FD, #8B5CF6)',
@@ -287,6 +324,12 @@ export const TOOL_ICON_GRADIENTS: Record<string, string> = {
* 默认描边 stroke:#fff width:3(方头 butt),实心填充 shape 用 .fill 标记
*/
export const TOOL_ICON_SHAPES: Record<string, string> = {
// 定价利润换算:计算器(屏+按键)
'pricing-calc': '<rect x="12" y="8" width="24" height="32" rx="2"/><line x1="17" y1="14" x2="31" y2="14"/><line x1="18" y1="23" x2="22" y2="23"/><line x1="26" y1="23" x2="30" y2="23"/><line x1="18" y1="29" x2="22" y2="29"/><line x1="26" y1="29" x2="30" y2="29"/><line x1="18" y1="35" x2="22" y2="35"/><line x1="26" y1="35" x2="30" y2="35"/>',
// 五国ASIN快速查询:地球+放大镜
'five-asin': '<circle cx="21" cy="21" r="12"/><line x1="21" y1="9" x2="21" y2="33"/><line x1="9" y1="21" x2="33" y2="21"/><path d="M11 13 A 14 14 0 0 0 31 13"/><path d="M11 29 A 14 14 0 0 1 31 29"/><circle cx="32" cy="32" r="7"/><line x1="37" y1="37" x2="42" y2="42" stroke-width="4"/>',
// 五国关键词共享:分享三节点
'keyword-share': '<circle class="fill" cx="13" cy="24" r="4"/><circle class="fill" cx="34" cy="11" r="4"/><circle class="fill" cx="34" cy="37" r="4"/><line x1="16" y1="22" x2="31" y2="13"/><line x1="16" y1="26" x2="31" y2="35"/>',
// 采集数据:圆角方框+向下箭头
collect: '<rect x="10" y="8" width="28" height="24"/><line x1="24" y1="14" x2="24" y2="36"/><path class="fill" d="M19 33 L29 33 L24 38 Z"/>',
// ASIN变体采集:两个重叠方框