fix(frontend): 菜单点击偶发无响应三处根因——①路由懒加载chunk失败被静默吞掉(新增onError自动整页重载+保险丝防循环) ②首页入口被权限接口阻塞(改乐观显示+缓存TTL10分钟+超时30s→8s) ③菜单hover预取目标页chunk(工具卡片/工作流步骤/顶部导航)
This commit is contained in:
@@ -69,6 +69,7 @@
|
||||
:class="{ 'workflow-step--disabled': !step.toolId || !stepHref(step.toolId) }"
|
||||
:style="{ '--gc': currentGroup.color }"
|
||||
@click="onWorkflowStepClick(step)"
|
||||
@mouseenter="prefetchRouteChunk(router, stepHref(step.toolId))"
|
||||
>
|
||||
<span class="step-circle" :style="circleStyle(currentGroup)">{{ index + 1 }}</span>
|
||||
<span class="step-name">{{ step.name }}</span>
|
||||
@@ -88,7 +89,7 @@
|
||||
|
||||
<div class="card-grid">
|
||||
<template v-for="tool in currentGroup.tools" :key="tool.id">
|
||||
<router-link v-if="resolveHref(tool.href)" :to="resolveHref(tool.href)!" class="tool-card" :style="cardStyle(currentGroup)">
|
||||
<router-link v-if="resolveHref(tool.href)" :to="resolveHref(tool.href)!" class="tool-card" :style="cardStyle(currentGroup)" @mouseenter="prefetchToolChunk(tool)">
|
||||
<div class="tool-card-top">
|
||||
<ToolIcon :name="tool.id" />
|
||||
<span v-if="tool.tag" class="tool-tag" :style="tagStyle(currentGroup)">{{ tool.tag }}</span>
|
||||
@@ -129,6 +130,7 @@ import { TUTORIAL_DOWNLOAD_URL } 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 { resolvePageHref } from '@/shared/page-prefix'
|
||||
import { prefetchRouteChunk } from '@/shared/route-prefetch'
|
||||
import { getPywebviewApi } from '@/shared/bridges/pywebview'
|
||||
import { getCurrentUserAppColumnKeys } from '@/shared/api/permission'
|
||||
|
||||
@@ -187,6 +189,11 @@ function onWorkflowStepClick(step: WorkflowStep) {
|
||||
showSoon(target?.href ? `${step.name}仅桌面客户端可用` : `${step.name}暂未开通,敬请期待`)
|
||||
}
|
||||
|
||||
/** 卡片 hover 预取目标页 chunk:弱网下点击跳转不再等 chunk 下载 */
|
||||
function prefetchToolChunk(tool: ToolInfo) {
|
||||
prefetchRouteChunk(router, resolveHref(tool.href))
|
||||
}
|
||||
|
||||
function onPendingClick(tool: ToolInfo) {
|
||||
if (!tool.href) {
|
||||
showSoon(`${tool.name}暂未开通,敬请期待`)
|
||||
|
||||
Reference in New Issue
Block a user