فهرست منبع

feat(workbench): 智能工作台入口改为描边按钮并加微动画

- 描边+主题色文字,透明底色,6px 小圆角,避免胶囊大圆角
- 红色星标常驻缓闪,悬停加速;悬停轻抬+投影,按下回弹
- 仅「去智能工作台」方向高亮,「回自主」保持灰色文字按钮
- 深色顶栏/暗色主题下同步提亮文字与描边
cc 4 هفته پیش
والد
کامیت
78988606cc
1فایلهای تغییر یافته به همراه112 افزوده شده و 7 حذف شده
  1. 112 7
      ai-electron/frontend/src/core/components/Application/src/AppWorkbenchToggle.vue

+ 112 - 7
ai-electron/frontend/src/core/components/Application/src/AppWorkbenchToggle.vue

@@ -1,7 +1,17 @@
 <template>
   <Tooltip :title="tip" placement="bottom" :mouseEnterDelay="0.4">
-    <button type="button" class="jeesite-workbench-switch" :aria-label="tip" @click="switchMode">
-      <Icon :icon="targetIcon" :size="14" />
+    <button
+      type="button"
+      class="jeesite-workbench-switch"
+      :class="{ 'jeesite-workbench-switch--primary': targetMode === 'smart' }"
+      :aria-label="tip"
+      @click="switchMode"
+    >
+      <Icon
+        :icon="targetIcon"
+        :size="targetMode === 'smart' ? 15 : 14"
+        :class="{ 'jeesite-workbench-switch__star': targetMode === 'smart' }"
+      />
       <span>{{ targetLabel }}</span>
     </button>
   </Tooltip>
@@ -12,11 +22,12 @@
    * 主界面模式切换(顶栏文字按钮)。
    *
    * 展示的是「将要去哪一侧」而不是「现在在哪一侧」:
-   *  - 主窗口(自主)里显示「智能」,点击打开/聚焦独立工作台窗口;
+   *  - 主窗口(自主)里显示「智能工作台」,点击打开/聚焦独立工作台窗口;
    *  - 智能窗口(智能)里显示「自主」,点击写偏好并把主窗口拉到前台(不关闭自己)。
    *
-   * 不使用胶囊/主色:它和顶栏的搜索、下载、设置一样是普通动作,灰色文字按钮更协调;
-   * 用途靠 Tooltip 说明,避免只看到一个模式名不知道点下去会发生什么。
+   * 智能工作台是重点推广的入口,所以只有「去智能」方向用主题色加粗文字 + 红色闪动星标,
+   * 不铺背景也能从顶栏的搜索/下载/设置里区分出来;「回自主」是退路,仍保持灰色文字按钮,
+   * 两个方向都强调会互相抢焦点。用途靠 Tooltip 说明,避免只看到一个模式名不知道点下去会发生什么。
    */
   import { computed } from 'vue';
   import { Tooltip } from 'ant-design-vue';
@@ -39,9 +50,9 @@
 
   /** 按钮展示「另一个模式」:点它就是切过去 */
   const targetMode = computed<WorkbenchMode>(() => (mode.value === 'smart' ? 'traditional' : 'smart'));
-  const targetLabel = computed(() => (targetMode.value === 'smart' ? '智能' : '自主'));
+  const targetLabel = computed(() => (targetMode.value === 'smart' ? '智能工作台' : '自主'));
   const targetIcon = computed(() =>
-    targetMode.value === 'smart' ? 'i-mdi:star-four-points-outline' : 'i-mdi:view-dashboard-outline',
+    targetMode.value === 'smart' ? 'i-mdi:star-four-points' : 'i-mdi:view-dashboard-outline',
   );
 
   /** 提示写「点下去会发生什么」,而不是重复按钮上的模式名 */
@@ -62,6 +73,7 @@
     align-items: center;
     gap: 5px;
     height: 32px;
+    margin: 0 2px;
     padding: 0 8px;
     font-size: 12.5px;
     font-weight: 500;
@@ -112,4 +124,97 @@
       background: rgba(255, 255, 255, 0.14);
     }
   }
+
+  /* ===== 重点入口:去「智能工作台」方向 =====
+     描边按钮:不铺底色(顶栏保持干净),靠主题色文字/描边 + 红色闪动星标拉出层次;
+     微动画只做「悬停轻抬 + 投影、按下回弹、星标加速闪烁」,不改变布局。
+     放在深色/暗色规则之后,靠源码顺序覆盖它们(同特异性后者生效),
+     深色场景单独补一遍 hover/active 选择器,保证特异性不输给上面的反白规则。 */
+  .@{prefix-cls}--primary {
+    padding: 0 12px;
+    font-size: 13px;
+    font-weight: 600;
+    color: @primary-color;
+    background: transparent;
+    border: 1px solid fade(@primary-color, 45%);
+    border-radius: 6px;
+    transition:
+      color 0.2s ease-out,
+      border-color 0.2s ease-out,
+      box-shadow 0.2s ease-out,
+      transform 0.2s ease-out;
+
+    &:hover {
+      color: darken(@primary-color, 8%);
+      background: transparent;
+      border-color: @primary-color;
+      box-shadow: 0 2px 8px fade(@primary-color, 20%);
+      transform: translateY(-1px);
+    }
+
+    &:active {
+      color: darken(@primary-color, 14%);
+      background: transparent;
+      box-shadow: none;
+      transform: translateY(0) scale(0.98);
+    }
+
+    /* 键盘聚焦才出环,鼠标点击不出现,避免顶栏上留一圈蓝边 */
+    &:focus-visible {
+      outline: 2px solid fade(@primary-color, 40%);
+      outline-offset: 2px;
+    }
+  }
+
+  /* 红色星标 + 缓速闪烁:页面静止时也能被余光扫到;悬停时闪得更快,给出"可点"的反馈 */
+  .@{prefix-cls}__star {
+    color: @error-color;
+    transform-origin: center;
+    animation: workbench-star-twinkle 2.4s ease-in-out infinite;
+  }
+
+  .@{prefix-cls}--primary:hover .@{prefix-cls}__star {
+    animation-duration: 1.1s;
+  }
+
+  @keyframes workbench-star-twinkle {
+    0%,
+    100% {
+      transform: scale(1) rotate(0deg);
+      opacity: 0.9;
+    }
+
+    50% {
+      transform: scale(1.18) rotate(12deg);
+      opacity: 1;
+    }
+  }
+
+  .app-topbar--dark .@{prefix-cls}--primary {
+    color: lighten(@primary-color, 22%);
+    border-color: fade(lighten(@primary-color, 22%), 45%);
+
+    &:hover {
+      color: lighten(@primary-color, 32%);
+      border-color: lighten(@primary-color, 32%);
+    }
+
+    &:active {
+      color: lighten(@primary-color, 38%);
+    }
+  }
+
+  html[data-theme='dark'] .@{prefix-cls}--primary {
+    color: lighten(@primary-color, 22%);
+    border-color: fade(lighten(@primary-color, 22%), 45%);
+
+    &:hover {
+      color: lighten(@primary-color, 32%);
+      border-color: lighten(@primary-color, 32%);
+    }
+
+    &:active {
+      color: lighten(@primary-color, 38%);
+    }
+  }
 </style>