131 lines
4.6 KiB
JavaScript
131 lines
4.6 KiB
JavaScript
import { viteBundler } from '@vuepress/bundler-vite'
|
|
import { defaultTheme } from '@vuepress/theme-default'
|
|
import { defineUserConfig } from 'vuepress'
|
|
import fs from 'fs-extra'
|
|
import path from 'path'
|
|
import { searchPlugin } from '@vuepress/plugin-search'
|
|
import { SITE_BASE, CDN_BASE} from './constants.js';
|
|
|
|
export default defineUserConfig({
|
|
// 禁用内置锚点滚动,避免冲突
|
|
shouldPreventScroll: (to, from) => {
|
|
return !!to.hash;
|
|
},
|
|
|
|
// 滚动偏移量
|
|
scrollOffset: {
|
|
home: 80,
|
|
page: 80
|
|
},
|
|
|
|
head: [
|
|
['meta', { name: 'og:type', content: 'website' }],
|
|
['meta', { property: 'og:title', content: 'DMA服务人员操作手册' }],
|
|
['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() }],
|
|
],
|
|
|
|
pages: [],
|
|
|
|
bundler: viteBundler({
|
|
viteOptions: {
|
|
build: {
|
|
rollupOptions: {
|
|
output: {}
|
|
}
|
|
},
|
|
server: {
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://192.168.0.100:8080/',
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(/^\/api/, '')
|
|
}
|
|
}
|
|
},
|
|
}
|
|
}),
|
|
|
|
theme: defaultTheme({
|
|
navbar: [
|
|
'/',
|
|
{
|
|
text: '核心操作',
|
|
link: '/posts/overview',
|
|
activeMatch: '^/posts/overview',
|
|
},
|
|
{
|
|
text: '角色文档',
|
|
children: [
|
|
{ text: '主教练', link: '/posts/chiefCoach.html' },
|
|
{ text: '副教练', link: '/posts/assistantCoach.html' },
|
|
{ text: '客服', link: '/posts/service.html' },
|
|
{ text: '健康管理师', link: '/posts/teacher.html' },
|
|
],
|
|
},
|
|
{
|
|
text: '操作指南',
|
|
children: [
|
|
{ text: '分润提现', link: '/posts/shareBenefit' },
|
|
{ text: 'APP相关', link: '/posts/appCorrelation' },
|
|
{ text: 'DMA模块', link: '/posts/DMAModule' },
|
|
{ text: '考试预约', link: '/posts/examReservation' },
|
|
{ text: '代理商', link: '/posts/agent' },
|
|
{ text: '用户服务流程', link: '/posts/userServiceProcess' },
|
|
{ text: '行为记录', link: '/posts/behaviorRecord' },
|
|
],
|
|
},
|
|
{ text: '常见问题', link: '/posts/helpCenter' },
|
|
{ text: '更新日志', link: SITE_BASE === '/go_html/dma_handbook/' ? '/posts/changelog' : '/posts/changelogV2' },
|
|
],
|
|
sidebar: ({ pagePath }) => {
|
|
return [];
|
|
}
|
|
}),
|
|
|
|
lang:'zh-CN',
|
|
title:'DMA服务人员服务操作手册',
|
|
description: 'DMA服务人员服务操作手册',
|
|
base:SITE_BASE,
|
|
image:'https://images.health.ufutx.com/202503/12/1f227399ffc2ddbf6c58eafa80627d19.png',
|
|
|
|
plugins: [
|
|
['@vuepress/plugin-medium-zoom', {
|
|
selector: 'img',
|
|
delay: 500,
|
|
lazy: true,
|
|
options: {
|
|
loading: 'lazy',
|
|
decoding: 'async',
|
|
observer: true,
|
|
observerOptions: {
|
|
rootMargin: '0px',
|
|
threshold: 0.1
|
|
}
|
|
}
|
|
}],
|
|
searchPlugin({
|
|
maxSuggestions: 10,
|
|
hotKeys: ['s', '/'],
|
|
}),
|
|
],
|
|
|
|
async onGenerated (app) {
|
|
if(SITE_BASE === '/dma_handbook/') return
|
|
const outDir = app.options.dest
|
|
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/'
|
|
content = content.replace(new RegExp(assetPrefix, 'g'), cdnPrefix)
|
|
await fs.writeFile(filePath, content, 'utf-8')
|
|
console.log(`✅ Patched assets path in ${file}`)
|
|
}
|
|
}
|
|
})
|