修改README

This commit is contained in:
jmal 2020-03-13 12:41:56 +08:00
parent 51e4c85019
commit c7969607b8
6 changed files with 18 additions and 54 deletions

View File

@ -35,6 +35,16 @@ npm install
# develop
npm run dev
```
### 4. Build
```bush
# build for test environment
npm run build:stage
# build for production environment
npm run build:prod
```
This will automatically open http://localhost:9528
## Browsers support

View File

@ -8,7 +8,7 @@ import getPageTitle from '@/utils/get-page-title'
NProgress.configure({ showSpinner: false }) // NProgress Configuration
const whiteList = ['/login','/public/articles','/public/article','/share'] // no redirect whitelist
const whiteList = ['/login','/public/articles','/public/articles/article','/share'] // no redirect whitelist
router.beforeEach(async(to, from, next) => {
// start progress bar

View File

@ -1,63 +1,17 @@
<template>
<div v-html="htms"></div>
<div v-html="html"></div>
</template>
<script>
import showdown from "showdown"
let converter = new showdown.Converter();
export default {
data() {
return {
htms: ""
html: ""
}
},
created() {
this.setMakedown()
},
methods: {
setMakedown() {
this.htms = converter.makeHtml('# 标题\n' +
'```java\n' +
'/***\n' +
' * 重命名\n' +
' * @param username\n' +
' * @param id\n' +
' * @return\n' +
' */\n' +
' @Override\n' +
' public ResponseResult<Object> rename(String newFileName, String username, String id) {\n' +
' FileDocument fileDocument = mongoTemplate.findById(id, FileDocument.class, COLLECTION_NAME);\n' +
' if (fileDocument != null) {\n' +
' String currentDirectory = getUserDirectory(fileDocument.getPath());\n' +
' String filePath = rootPath + File.separator + username + currentDirectory;\n' +
' File file = new File(filePath + fileDocument.getName());\n' +
' if(fileDocument.getIsFolder()){\n' +
' Query query = new Query();\n' +
' String searchPath = currentDirectory + fileDocument.getName();\n' +
' String newPath = currentDirectory + newFileName;\n' +
' query.addCriteria(Criteria.where("path").regex("^"+searchPath));\n' +
' List<FileDocument> documentList = mongoTemplate.find(query, FileDocument.class, COLLECTION_NAME);\n' +
' // 修改该文件夹下的所有文件的path\n' +
' documentList.parallelStream().forEach(rep -> {\n' +
' String path = rep.getPath();\n' +
' String newFilePath = replaceStart(path, searchPath, newPath);\n' +
' Update update = new Update();\n' +
' update.set("path",newFilePath);\n' +
' Query query1 = new Query();\n' +
' query1.addCriteria(Criteria.where("_id").is(rep.getId()));\n' +
' mongoTemplate.upsert(query1, update, COLLECTION_NAME);\n' +
' });\n' +
' }\n' +
' if (renameFile(newFileName, id, filePath, file)) {\n' +
' return ResultUtil.error("重命名失败");\n' +
' }\n' +
' return ResultUtil.success(true);\n' +
' } else {\n' +
' return ResultUtil.error("数据库查询失败");\n' +
' }\n' +
' }\n' +
'```\n')
}
}
}
</script>

View File

@ -1420,14 +1420,14 @@ export default {
}
} else {
if(row.contentType.includes('text')){
// let routeData = this.$router.resolve({path: '/public/p',query: {mark: row.id}})
// let routeData = this.$router.resolve({path: '/public/articles/article',query: {mark: row.id}})
// window.open(routeData.href, '_blank');
this.$router.push(`/public/articles/article?mark=${row.id}`)
}else{
// 打开文件
const fileIds = [row.id]
const url = process.env.VUE_APP_BASE_FILE_API + 'preview/' + row.name + '?jmal-token=' + this.$store.state.user.token + '&fileIds=' + fileIds
window.open(url, '_self')
window.open(url, '_blank')
}
}
}

View File

@ -20,7 +20,7 @@
<div v-show="titleList.length > 0" class="right-bj">
<div class="slimScrollDiv">
<div class="right-menu">
<div class="right-menu" style="max-height: 700px">
<div class="toc-content">
<header class="toc-header"><svg-icon icon-class="contents"></svg-icon><span>目录</span></header>
</div>
@ -51,7 +51,8 @@
toolbarsFlag: true,
content:'',
html:'',
titleList: []
titleList: [],
tocMaxHeight: 500
}
},
mounted() {

View File

@ -3,7 +3,6 @@
</template>
<script>
import showdown from "showdown"
converter.setOption('tables', true); // 将表格显示出来
export default {
data() {