f2bcac0a4d
- 还原 ChatTimeline.vue/api/index.ts 未提交 WIP(新页自建,旧文件回 HEAD) - /staff-chat/:ownerId/:tab?/:talkerId? 路由 + 占位 StaffChat.vue(Task 9 替换) - types: MomentsPost/MomentsList/StaffStatsCounts/StaffStatsDetail + ChatSession.pinned + Account.avatar - api: getMoments/getStaffStatsCounts/getStaffStatsDetail + sessions is_del + messages msg_type/q 过滤 - format: relativeChatTime(今天HH:mm/昨天/M月D日/YYYY年M月D日) + 4 例 vitest spec(全过,vitest 未入 devDependencies,npx 拉取运行) - tsconfig.app.json exclude __tests__(vitest 未装,保持 vue-tsc 通过) Co-Authored-By: Claude <noreply@anthropic.com>
113 lines
3.2 KiB
TypeScript
113 lines
3.2 KiB
TypeScript
import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
|
|
|
|
// `/` redirects to `/customers`. Chat timeline params are path segments so the
|
|
// URL is shareable + survives refresh:
|
|
// /chat/:channel/:ownerId/:talkerId? (1:1 DM; talkerId optional → account-level)
|
|
// /group/:channel/:ownerId/:roomId? (group chat — same component, room_id)
|
|
const routes: RouteRecordRaw[] = [
|
|
{
|
|
path: '/',
|
|
redirect: { name: 'customers' },
|
|
},
|
|
{
|
|
path: '/customers',
|
|
name: 'customers',
|
|
component: () => import('@/views/CustomerList.vue'),
|
|
meta: { title: '客户列表' },
|
|
},
|
|
{
|
|
path: '/staff',
|
|
name: 'staff',
|
|
component: () => import('@/views/StaffList.vue'),
|
|
meta: { title: '员工列表' },
|
|
},
|
|
{
|
|
// Standalone 员工详情 page mirroring 云客's
|
|
// /cms/customer/userDetailNew?userId=... — replaces the all-fields drawer
|
|
// degradation for the 员工姓名 click. Row-click in StaffList still opens
|
|
// the drawer for a quick preview.
|
|
path: '/staff-detail/:userId',
|
|
name: 'staff-detail',
|
|
component: () => import('@/views/StaffDetail.vue'),
|
|
props: true,
|
|
meta: { title: '员工详情' },
|
|
},
|
|
{
|
|
path: '/accounts',
|
|
redirect: { name: 'staff' },
|
|
},
|
|
{
|
|
path: '/groups',
|
|
name: 'groups',
|
|
component: () => import('@/views/GroupList.vue'),
|
|
meta: { title: '群列表' },
|
|
},
|
|
{
|
|
path: '/calls',
|
|
name: 'calls',
|
|
component: () => import('@/views/CallList.vue'),
|
|
meta: { title: '通话记录' },
|
|
},
|
|
{
|
|
path: '/sms',
|
|
name: 'sms',
|
|
component: () => import('@/views/SmsList.vue'),
|
|
meta: { title: '短信记录' },
|
|
},
|
|
{
|
|
path: '/sync',
|
|
name: 'sync',
|
|
component: () => import('@/views/SyncStatus.vue'),
|
|
meta: { title: '同步状态' },
|
|
},
|
|
{
|
|
path: '/search',
|
|
name: 'search',
|
|
component: () => import('@/views/SearchView.vue'),
|
|
meta: { title: '搜索' },
|
|
},
|
|
{
|
|
path: '/chat/:channel/:ownerId/:talkerId?',
|
|
name: 'chat',
|
|
component: () => import('@/views/ChatTimeline.vue'),
|
|
props: true,
|
|
meta: { title: '聊天记录' },
|
|
},
|
|
{
|
|
// Group chat timeline — same component, but with a `roomId` prop so it
|
|
// issues a room_id query instead of a talker_id query.
|
|
path: '/group/:channel/:ownerId/:roomId?',
|
|
name: 'group-chat',
|
|
component: () => import('@/views/ChatTimeline.vue'),
|
|
props: true,
|
|
meta: { title: '群聊记录' },
|
|
},
|
|
{
|
|
// 员工聊天窗口(对齐云客 wechat-window 五视图): tab=single|group|moments|contacts|stats
|
|
// tab=group 时 talkerId 语义为 roomId; ?msgid= 定位消息(红包转账明细跳转)
|
|
path: '/staff-chat/:ownerId/:tab(single|group|moments|contacts|stats)?/:talkerId?',
|
|
name: 'staff-chat',
|
|
component: () => import('@/views/StaffChat.vue'),
|
|
props: true,
|
|
meta: { title: '员工聊天窗口' },
|
|
},
|
|
{
|
|
// Anything else → back to the list.
|
|
path: '/:pathMatch(.*)*',
|
|
redirect: { name: 'customers' },
|
|
},
|
|
]
|
|
|
|
export const router = createRouter({
|
|
history: createWebHistory(),
|
|
routes,
|
|
scrollBehavior() {
|
|
return { top: 0 }
|
|
},
|
|
})
|
|
|
|
router.afterEach((to) => {
|
|
const title = (to.meta.title as string | undefined) ?? ''
|
|
document.title = title ? `${title} · 云客数据镜像` : '云客数据镜像'
|
|
})
|