v0.5.5: 应急页 v0.5.4 + 移除IT设备升级 + admin登录修复 + 内容审核架构 + 知识库

This commit is contained in:
Simon
2026-06-16 10:07:42 +08:00
parent 10b37a6acc
commit 60e67b0681
59 changed files with 4195 additions and 110 deletions
+4
View File
@@ -22,6 +22,10 @@
"typescript": "^5.5.0",
"vite": "^5.3.0",
"vue-tsc": "^2.0.0"
},
"engines": {
"node": ">=20.0.0 <21.0.0",
"pnpm": ">=9.0.0"
}
},
"node_modules/@babel/helper-string-parser": {
+16 -1
View File
@@ -5,7 +5,8 @@
// 包括:
// 1. /login → 登录页(简单的用户名密码表单)
// 2. /workspace → 坐席工作台(需要认证)
// 3. / → 重定向到 /workspace
// 3. /agent-preview → v0.5.4 BC/DR 应急页坐席视图(公开)
// 4. / → 重定向到 /workspace
// =============================================================================
import { createRouter, createWebHistory } from 'vue-router'
@@ -33,6 +34,13 @@ const routes = [
component: () => import('@/views/Workspace.vue'),
meta: { title: '坐席工作台', requiresAuth: true },
},
// v0.5.4 BC/DR 应急页坐席视图
{
path: '/agent-preview',
name: 'AgentPreview',
component: () => import('@/views/AgentPreviewView.vue'),
meta: { title: '坐席助手', requiresAuth: false },
},
]
// --------------------------------------------------------------------------
@@ -74,6 +82,13 @@ router.beforeEach((to, _from, next) => {
const requiresAuth = to.meta.requiresAuth !== false // 默认需要认证
const token = localStorage.getItem('agent_token')
// v0.5.4 BC/DR 应急页(agent-preview)不需 Portal token
// 它的鉴权由 /emergency 入口的企微 JS-SDK 完成
if (to.name === 'AgentPreview') {
next()
return
}
if (requiresAuth && !token) {
// 需要认证但没有 token,跳转到 Portal 统一入口
window.location.href = '/itportal/'
@@ -0,0 +1,207 @@
<!-- =============================================================================
// 企微IT智能服务台 — 应急页坐席视图 (v0.5.4)
// =============================================================================
// 说明:BC/DR 应急场景下,显示坐席端 AI 助手面板
// 桌面端:全宽显示 AiAssistantPanel(AI推荐/快速回复/操作步骤/用户信息)
// 移动端:顶部"右栏"按钮,点击从右侧滑出 AI 助手面板
// ============================================================================= -->
<template>
<div class="agent-preview">
<!-- ====== 顶部条 ====== -->
<div class="agent-preview__topbar">
<div class="topbar-left">
<span class="logo">🎧</span>
<div class="title-block">
<h1 class="title">坐席助手</h1>
<p class="subtitle">IT 智能服务台 · 应急模式</p>
</div>
</div>
<div class="topbar-right">
<!-- 移动端:右栏按钮(打开抽屉) -->
<el-button
v-if="isMobile"
type="primary"
size="small"
@click="drawerVisible = true"
>
<el-icon><Menu /></el-icon>
<span>AI 助手</span>
</el-button>
<!-- 桌面端:userid 标签 -->
<div v-else class="userid-tag">
userid: {{ userid || 'anonymous' }}
</div>
</div>
</div>
<!-- ====== 桌面端:直接显示 AiAssistantPanel ====== -->
<div v-if="!isMobile" class="agent-preview__content">
<AiAssistantPanel />
</div>
<!-- ====== 移动端:抽屉(el-drawer 从右侧滑出) ====== -->
<el-drawer
v-if="isMobile"
v-model="drawerVisible"
direction="rtl"
size="90%"
:with-header="false"
>
<div class="agent-preview__drawer-header">
<span class="drawer-title">🤖 AI 助手</span>
<el-button
type="text"
size="small"
@click="drawerVisible = false"
>
关闭
</el-button>
</div>
<div class="agent-preview__drawer-body">
<AiAssistantPanel />
</div>
</el-drawer>
<!-- ====== 移动端:底部提示 ====== -->
<div v-if="isMobile" class="agent-preview__mobile-hint">
<p>💡 电脑端访问可获得完整体验(AI 助手常驻右侧)</p>
<p>移动端请点上方"AI 助手"按钮打开</p>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue'
import { useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
import { Menu } from '@element-plus/icons-vue'
import AiAssistantPanel from '@/components/assistant/AiAssistantPanel.vue'
const route = useRoute()
const drawerVisible = ref(false)
const userid = computed(() => (route.query.userid as string) || '')
const isMobile = computed(() => window.innerWidth < 500)
if (userid.value) {
ElMessage({
message: '坐席模式',
type: 'success',
duration: 1500,
})
}
</script>
<style scoped>
.agent-preview {
display: flex;
flex-direction: column;
height: 100dvh;
background: #f5f7fa;
font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
}
/* ====== 顶部条 ====== */
.agent-preview__topbar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 20px;
background: white;
border-bottom: 1px solid #e4e7ed;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
z-index: 10;
}
.topbar-left {
display: flex;
align-items: center;
gap: 12px;
}
.logo {
font-size: 28px;
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
border-radius: 10px;
}
.title-block {
display: flex;
flex-direction: column;
}
.title {
font-size: 16px;
font-weight: 600;
color: #303133;
margin: 0;
}
.subtitle {
font-size: 12px;
color: #909399;
margin: 0;
}
.userid-tag {
font-size: 12px;
color: #909399;
padding: 4px 10px;
background: #f5f7fa;
border-radius: 4px;
}
/* ====== 桌面端内容区 ====== */
.agent-preview__content {
flex: 1;
overflow: hidden;
display: flex;
max-width: 1200px;
margin: 0 auto;
width: 100%;
background: white;
}
/* ====== 抽屉 ====== */
.agent-preview__drawer-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 16px;
border-bottom: 1px solid #e4e7ed;
background: #fafafa;
}
.drawer-title {
font-size: 15px;
font-weight: 600;
color: #303133;
}
.agent-preview__drawer-body {
height: calc(100% - 45px);
overflow-y: auto;
background: white;
}
/* ====== 移动端提示 ====== */
.agent-preview__mobile-hint {
padding: 12px 20px;
background: #fdf6ec;
color: #e6a23c;
font-size: 12px;
text-align: center;
line-height: 1.6;
border-top: 1px solid #faecd8;
}
.agent-preview__mobile-hint p {
margin: 0;
}
</style>
+10
View File
@@ -186,6 +186,16 @@ function onRightResizeEnd(): void {
// ============================================================================
onMounted(async () => {
// 修复 v0.5.1: 企微点坐席直接打开 /itagent/ 时,URL 没 ?token=
// 路由守卫虽然会跳到 /itportal/,但在这之前 axios 已经发了请求 → 弹 401
// 这里在 onMounted 第一行主动检查 token,没 token 立刻跳 portal,避免 401 弹错
const hasAgentToken = localStorage.getItem('agent_token')
const hasPortalToken = localStorage.getItem('portal_token')
if (!hasAgentToken && !hasPortalToken) {
window.location.href = '/itportal/'
return
}
// 初始化主题
themeStore.initTheme()
// 初始化坐席信息