dma_handbook/docs/.vuepress/config.js

131 lines
4.6 KiB
JavaScript
Raw Normal View History

2025-09-29 16:51:36 +08:00
import { viteBundler } from '@vuepress/bundler-vite'
import { defaultTheme } from '@vuepress/theme-default'
import { defineUserConfig } from 'vuepress'
2025-12-23 14:23:27 +08:00
import fs from 'fs-extra'
import path from 'path'
2026-02-06 11:17:10 +08:00
import { searchPlugin } from '@vuepress/plugin-search'
2026-02-05 10:24:40 +08:00
import { SITE_BASE, CDN_BASE} from './constants.js';
2025-09-29 16:51:36 +08:00
export default defineUserConfig({
2026-03-26 17:08:01 +08:00
// // 禁用内置锚点滚动,避免冲突
// shouldPreventScroll: (to, from) => {
// return !!to.hash;
// },
//
// // 滚动偏移量
// scrollOffset: {
// home: 80,
// page: 80
// },
2026-03-12 14:43:05 +08:00
2025-09-29 16:51:36 +08:00
head: [
['meta', { name: 'og:type', content: 'website' }],
2025-12-10 17:23:41 +08:00
['meta', { property: 'og:title', content: 'DMA服务人员操作手册' }],
2025-09-29 16:51:36 +08:00
['meta', { name: 'description', content: 'DMA服务操作手册' }],
['meta', { property: 'og:description', content: 'DMA服务全流程操作指南' }],
['meta', { property: 'og:image', content: 'https://images.health.ufutx.com/202503/12/1f227399ffc2ddbf6c58eafa80627d19.png?v=' + Date.now() }],
['link', { rel: 'icon', href: 'https://images.health.ufutx.com/202503/12/1f227399ffc2ddbf6c58eafa80627d19.png?v=' + Date.now() }],
2026-02-05 10:24:40 +08:00
],
2026-03-12 14:43:05 +08:00
pages: [],
2025-09-29 16:51:36 +08:00
bundler: viteBundler({
2025-12-12 15:33:19 +08:00
viteOptions: {
build: {
rollupOptions: {
2026-03-12 14:43:05 +08:00
output: {}
2025-12-12 15:33:19 +08:00
}
2026-02-05 10:24:40 +08:00
},
server: {
proxy: {
'/api': {
2026-03-12 14:43:05 +08:00
target: 'http://192.168.0.100:8080/',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
2026-02-05 10:24:40 +08:00
}
}
},
2025-12-12 15:33:19 +08:00
}
2025-09-29 16:51:36 +08:00
}),
2026-03-12 14:43:05 +08:00
2025-09-29 16:51:36 +08:00
theme: defaultTheme({
navbar: [
'/',
{
text: '核心操作',
link: '/posts/overview',
activeMatch: '^/posts/overview',
},
{
2025-11-27 10:18:18 +08:00
text: '角色文档',
children: [
{ text: '主教练', link: '/posts/chiefCoach.html' },
{ text: '副教练', link: '/posts/assistantCoach.html' },
{ text: '客服', link: '/posts/service.html' },
{ text: '健康管理师', link: '/posts/teacher.html' },
],
2025-11-13 11:36:08 +08:00
},
{
2025-11-27 10:18:18 +08:00
text: '操作指南',
children: [
{ text: '分润提现', link: '/posts/shareBenefit' },
{ text: 'APP相关', link: '/posts/appCorrelation' },
{ text: 'DMA模块', link: '/posts/DMAModule' },
{ text: '考试预约', link: '/posts/examReservation' },
2025-12-10 17:23:41 +08:00
{ text: '代理商', link: '/posts/agent' },
{ text: '用户服务流程', link: '/posts/userServiceProcess' },
2026-01-12 10:19:10 +08:00
{ text: '行为记录', link: '/posts/behaviorRecord' },
2025-11-27 10:18:18 +08:00
],
2025-10-22 11:27:42 +08:00
},
2025-11-27 10:18:18 +08:00
{ text: '常见问题', link: '/posts/helpCenter' },
2026-01-12 10:19:10 +08:00
{ text: '更新日志', link: SITE_BASE === '/go_html/dma_handbook/' ? '/posts/changelog' : '/posts/changelogV2' },
2026-03-12 14:43:05 +08:00
],
2025-09-29 16:51:36 +08:00
sidebar: ({ pagePath }) => {
2026-03-12 14:43:05 +08:00
return [];
2025-09-29 16:51:36 +08:00
}
}),
lang:'zh-CN',
title:'DMA服务人员服务操作手册',
description: 'DMA服务人员服务操作手册',
2025-12-23 14:23:27 +08:00
base:SITE_BASE,
2025-09-29 16:51:36 +08:00
image:'https://images.health.ufutx.com/202503/12/1f227399ffc2ddbf6c58eafa80627d19.png',
2026-03-12 14:43:05 +08:00
2025-09-29 16:51:36 +08:00
plugins: [
['@vuepress/plugin-medium-zoom', {
selector: 'img',
delay: 500,
lazy: true,
options: {
loading: 'lazy',
decoding: 'async',
observer: true,
observerOptions: {
rootMargin: '0px',
threshold: 0.1
}
}
}],
2026-02-06 11:17:10 +08:00
searchPlugin({
maxSuggestions: 10,
hotKeys: ['s', '/'],
}),
2025-12-23 14:23:27 +08:00
],
async onGenerated (app) {
2026-01-19 16:38:14 +08:00
if(SITE_BASE === '/dma_handbook/') return
2026-03-12 14:43:05 +08:00
const outDir = app.options.dest
2025-12-23 14:23:27 +08:00
const htmlFiles = await fs.readdir(outDir)
for (const file of htmlFiles) {
if (!file.endsWith('.html')) continue
const filePath = path.join(outDir, file)
let content = await fs.readFile(filePath, 'utf-8')
const assetPrefix = SITE_BASE + 'assets/'
const cdnPrefix = CDN_BASE + '/assets/'
2026-03-12 14:43:05 +08:00
content = content.replace(new RegExp(assetPrefix, 'g'), cdnPrefix)
2025-12-23 14:23:27 +08:00
await fs.writeFile(filePath, content, 'utf-8')
console.log(`✅ Patched assets path in ${file}`)
}
}
2025-09-29 16:51:36 +08:00
})