From 10cb36829fa4080f6a578efb1ecbf416c16598b6 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Wed, 19 Jul 2023 09:01:47 +0800 Subject: [PATCH] Doc: update --- index.html | 2 +- web/src/pages/Doc/catalogList.js | 14 +++++ web/src/pages/Doc/components/CatalogBar.vue | 26 ++++---- web/src/pages/Doc/components/Sidebar.vue | 23 ++++--- web/src/pages/Doc/en/deploy/index.md | 67 ++++++++++++++++++++- web/src/pages/Doc/en/deploy/index.vue | 55 +++++++++++++++++ web/src/pages/Doc/routerList.js | 3 +- web/src/pages/Doc/zh/help1/index.md | 11 ++++ web/src/pages/Doc/zh/help1/index.vue | 21 +++++++ web/src/pages/Index/components/Header.vue | 5 ++ web/src/router.js | 46 ++++++++------ 11 files changed, 230 insertions(+), 43 deletions(-) create mode 100644 web/src/pages/Doc/en/deploy/index.vue create mode 100644 web/src/pages/Doc/zh/help1/index.md create mode 100644 web/src/pages/Doc/zh/help1/index.vue diff --git a/index.html b/index.html index 1b985c2b..a9fb8943 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -思绪思维导图
\ No newline at end of file +思绪思维导图
\ No newline at end of file diff --git a/web/src/pages/Doc/catalogList.js b/web/src/pages/Doc/catalogList.js index b709769d..ec15f6c1 100644 --- a/web/src/pages/Doc/catalogList.js +++ b/web/src/pages/Doc/catalogList.js @@ -36,6 +36,9 @@ let APIList = [ 'markdown', 'utils' ] +let helpList = new Array(1).fill(0).map((_, index) => { + return 'help' + (index + 1) +}) const createList = (lang, list) => { let langRouter = routerList.find(item => { @@ -62,28 +65,39 @@ export default { zh: [ { groupName: '开始', + type: 'doc', list: createList('zh', StartList) }, { groupName: '教程', + type: 'doc', list: createList('zh', CourseList) }, { groupName: 'API', + type: 'doc', list: createList('zh', APIList) + }, + { + groupName: '使用帮助', + type: 'help', + list: createList('zh', helpList) } ], en: [ { groupName: 'Start', + type: 'doc', list: createList('en', StartList) }, { groupName: 'Course', + type: 'doc', list: createList('zh', CourseList) }, { groupName: 'API', + type: 'doc', list: createList('en', APIList) } ] diff --git a/web/src/pages/Doc/components/CatalogBar.vue b/web/src/pages/Doc/components/CatalogBar.vue index 9399ef6a..d6106ade 100644 --- a/web/src/pages/Doc/components/CatalogBar.vue +++ b/web/src/pages/Doc/components/CatalogBar.vue @@ -66,18 +66,18 @@ export default { methods: { // 获取当前语言 initLang() { - let lang = /^\/doc\/([^\/]+)\//.exec(this.$route.path) - if (lang && lang[1]) { - this.lang = lang[1] + let lang = /^\/(doc|help)\/([^\/]+)\//.exec(this.$route.path) + if (lang && lang[2]) { + this.lang = lang[2] } }, // 初始化二级标题目录 initCatalogList(newPath, oldPath) { - let newPathRes = /^\/doc\/[^\/]+\/([^\/]+)/.exec(newPath) - let oldPathRes = /^\/doc\/[^\/]+\/([^\/]+)/.exec(oldPath) + let newPathRes = /^\/(doc|help)\/[^\/]+\/([^\/]+)/.exec(newPath) + let oldPathRes = /^\/(doc|help)\/[^\/]+\/([^\/]+)/.exec(oldPath) // 语言变了、章节变了,需要重新获取二级标题目录 - if ((!newPath && !oldPath) || newPathRes[1] !== oldPathRes[1]) { + if ((!newPath && !oldPath) || newPathRes[2] !== oldPathRes[2]) { this.$emit('scroll', 0) this.resetActive() let container = document.getElementById('doc') @@ -93,9 +93,9 @@ export default { // 如果url中存在二级标题,那么滚动到该标题所在位置 scrollToCatalog() { - let url = /^\/doc\/[^\/]+\/[^\/]+\/([^\/]+)($|\/)/.exec(this.$route.path) - if (url && url[1]) { - let h = decodeURIComponent(url[1]) + let url = /^\/(doc|help)\/[^\/]+\/[^\/]+\/([^\/]+)($|\/)/.exec(this.$route.path) + if (url && url[2]) { + let h = decodeURIComponent(url[2]) let item = this.list.find(item => { return item.title === h }) @@ -126,15 +126,15 @@ export default { let path = this.$route.path let url = '' if (!title) { - url = path.replace(/^(\/doc\/[^\/]+\/[^\/]+)($|\/|.*)$/, '$1') - } else if (/^\/doc\/[^\/]+\/[^\/]+($|\/)$/.test(path)) { + url = path.replace(/^(\/(doc|help)\/[^\/]+\/[^\/]+)($|\/|.*)$/, '$1') + } else if (/^\/(doc|help)\/[^\/]+\/[^\/]+($|\/)$/.test(path)) { url = path.replace( - /^(\/doc\/[^\/]+\/[^\/]+)($|\/)$/, + /^(\/(doc|help)\/[^\/]+\/[^\/]+)($|\/)$/, '$1/' + encodeURIComponent(title) ) } else { url = path.replace( - /^(\/doc\/[^\/]+\/[^\/]+\/)([^\/]+)($|\/)/, + /^(\/(doc|help)\/[^\/]+\/[^\/]+\/)([^\/]+)($|\/)/, (...args) => { return args[1] + encodeURIComponent(title) } diff --git a/web/src/pages/Doc/components/Sidebar.vue b/web/src/pages/Doc/components/Sidebar.vue index 4482aa3c..c9a16725 100644 --- a/web/src/pages/Doc/components/Sidebar.vue +++ b/web/src/pages/Doc/components/Sidebar.vue @@ -31,7 +31,8 @@ export default { return { groupList: [], lang: '', - currentPath: '' + currentPath: '', + type: ''// doc、help } }, created() { @@ -47,20 +48,24 @@ export default { if (item.path === this.currentPath) { return } - this.$router.push(`/doc/${this.lang}/${item.path}`) + this.$router.push(`/${this.type}/${this.lang}/${item.path}`) }, initCatalog() { // 目录列表 - let lang = /^\/doc\/([^\/]+)\//.exec(this.$route.path) - if (lang && lang[1]) { - this.lang = lang[1] - this.groupList = catalogList[this.lang] + let lang = /^\/(doc|help)\/([^\/]+)\//.exec(this.$route.path) + if (lang && lang[2]) { + this.type = lang[1]// 判断是开发文档还是帮助文档 + this.lang = lang[2] + // 过滤出对应文档的章节 + this.groupList = catalogList[this.lang].filter((item) => { + return item.type === this.type + }) } // 当前所在路径 - let path = /^\/doc\/[^\/]+\/([^\/]+)(\/|$)/.exec(this.$route.path) - if (path && path[1]) { - this.currentPath = path[1] + let path = /^\/(doc|help)\/[^\/]+\/([^\/]+)(\/|$)/.exec(this.$route.path) + if (path && path[2]) { + this.currentPath = path[2] } } } diff --git a/web/src/pages/Doc/en/deploy/index.md b/web/src/pages/Doc/en/deploy/index.md index 4a8d593f..44f11bb9 100644 --- a/web/src/pages/Doc/en/deploy/index.md +++ b/web/src/pages/Doc/en/deploy/index.md @@ -1 +1,66 @@ -# Deploy \ No newline at end of file +# Deploy + +The 'web' directory of this project provides a complete project developed based on the 'simple mind map' library, 'Vue2. x', and 'ElementUI'. The data is stored locally on the computer by default, and can also be manipulated locally on the computer. Originally intended as an online 'demo', it can also be directly used as an online version of the mind map application, online address: [https://wanglin2.github.io/mind-map/](https://wanglin2.github.io/mind-map/). + +If your network environment is slow to access the 'GitHub' service, you can also deploy it to your server. + +## Deploying to a static file server + +The project itself does not rely on the backend, so it can be deployed to a static file server. The following commands can be executed in sequence: + +```bash +git clone https://github.com/wanglin2/mind-map.git +cd mind-map +cd simple-mind-map +npm i +npm link +cd .. +cd web +npm i +npm link simple-mind-map +``` + +Then you can choose to start the local service: + +```bash +npm run serve +``` + +You can also directly package and generate construction products: + +```bash +npm run build +``` + +The packaged entry page 'index.html' can be found in the project root directory, and the corresponding static resources are located in the 'dist' directory under the root directory. The 'html' file will access the resources in the 'dist' directory through relative paths, such as 'dist/xxx'. You can directly upload these two files or directories to your static file server. In fact, this project is deployed to 'GitHub Pages' in this way. + +If you do not have any code modification requirements, it is also possible to directly copy these files from this repository. + +If you want to package 'index.html' into the 'dist' directory as well, you can modify the 'scripts.build' command in the 'web/package.json' file to delete '&& node ../copy.js' from 'vue-cli-service build && node ../copy.js'. + +If you want to modify the directory for packaging output, you can modify the 'outputDir' configuration of the 'web/vue.config.js' file to the path you want to output. + +If you want to modify the path of the 'index. html' file referencing static resources, you can modify the 'publicPath' configuration of the 'web/vue.config.js' file. + +In addition, the default route used is 'hash ', which means that there will be '#'in the path. If you want to use the 'history' route, you can modify the 'web/src/router.js' file to: + +```js +const router = new VueRouter({ + routes +}) +``` + +Change to: + +```js +const router = new VueRouter({ + mode: 'history', + routes +}) +``` + +However, this requires backend support, as our application is a single page client application. If the backend is not properly configured, users will return 404 when accessing sub routes directly in the browser. Therefore, you need to add a candidate resource on the server that covers all situations: if the 'URL' cannot match any static resources, the same 'index. html' page should be returned. + +## Docker + +In writing... \ No newline at end of file diff --git a/web/src/pages/Doc/en/deploy/index.vue b/web/src/pages/Doc/en/deploy/index.vue new file mode 100644 index 00000000..b12696d2 --- /dev/null +++ b/web/src/pages/Doc/en/deploy/index.vue @@ -0,0 +1,55 @@ + + + + + \ No newline at end of file diff --git a/web/src/pages/Doc/routerList.js b/web/src/pages/Doc/routerList.js index 1f08e498..cc378a54 100644 --- a/web/src/pages/Doc/routerList.js +++ b/web/src/pages/Doc/routerList.js @@ -47,7 +47,8 @@ export default [ { path: 'deploy', title: '部署' }, { path: 'client', title: '客户端' }, { path: 'touchEvent', title: 'TouchEvent插件' }, - { path: 'nodeImgAdjust', title: 'NodeImgAdjust插件' } + { path: 'nodeImgAdjust', title: 'NodeImgAdjust插件' }, + { path: 'help1', title: '概要/关联线' } ] }, { diff --git a/web/src/pages/Doc/zh/help1/index.md b/web/src/pages/Doc/zh/help1/index.md new file mode 100644 index 00000000..ba382983 --- /dev/null +++ b/web/src/pages/Doc/zh/help1/index.md @@ -0,0 +1,11 @@ +# 概要/关联线 + +## 概要 + +可以选中一个节点添加概要,如果想给多个节点添加一个概要,只能通过给它们的父节点添加来实现。 + +概要节点后面无法再添加节点,后续该特性也不会支持。 + +## 关联线 + +关联线添加完后要删除,需要先点击选中关联线,然后按删除键即可。 \ No newline at end of file diff --git a/web/src/pages/Doc/zh/help1/index.vue b/web/src/pages/Doc/zh/help1/index.vue new file mode 100644 index 00000000..a7a6fba9 --- /dev/null +++ b/web/src/pages/Doc/zh/help1/index.vue @@ -0,0 +1,21 @@ + + + + + \ No newline at end of file diff --git a/web/src/pages/Index/components/Header.vue b/web/src/pages/Index/components/Header.vue index a778b750..d1bc9784 100644 --- a/web/src/pages/Index/components/Header.vue +++ b/web/src/pages/Index/components/Header.vue @@ -25,6 +25,7 @@ > 客户端 +