!26 合并闭源版功能,创建文档时上传文件也能绑定到page上
Merge pull request !26 from sh1yu/master
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<el-container>
|
||||
<el-aside v-show="leftCollapse" :style="{ width: rightAsideWidth + 'px' }">
|
||||
<div style="padding: 10px;height: 100%;box-sizing: border-box;background: #fafafa;">
|
||||
<div style="margin-bottom: 10px">
|
||||
<div style="margin-bottom: 5px">
|
||||
<el-select :model-value="choiceSpace" filterable placeholder="选择空间" style="width: 100%" @change="spaceChangeEvents">
|
||||
<el-option-group label="">
|
||||
<el-option key="0" label="创建空间" value="0"></el-option>
|
||||
@@ -13,9 +13,6 @@
|
||||
<el-option v-for="item in spaceOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div align="center">
|
||||
<el-button :icon="ElIconPlus" style="width: 100%" v-on:click="createWiki">创建文档</el-button>
|
||||
</div>
|
||||
<el-autocomplete v-model="searchKeywords" :fetch-suggestions="doSearchByKeywords" placeholder="在当前空间搜索" popper-class="search-autocomplete" style="width: 100%; margin: 10px 0" @select="handleSearchKeywordsSelect">
|
||||
<template v-slot="{ item }">
|
||||
<div class="search-option-item">
|
||||
@@ -26,6 +23,21 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-autocomplete>
|
||||
<div style="margin-left: 10px;margin-bottom: 10px">
|
||||
<span style="color:#898989;font-size:small;">空间目录
|
||||
<el-dropdown style="float:right">
|
||||
<el-icon >
|
||||
<el-icon-plus/>
|
||||
</el-icon>
|
||||
<template v-slot:dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item v-on:click="createWiki(1,true)">创建Html</el-dropdown-item>
|
||||
<el-dropdown-item v-on:click="createWiki(2,true)">创建Markdown</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</span>
|
||||
</div>
|
||||
<div class="wiki-page-tree-box">
|
||||
<el-tree
|
||||
ref="wikiPageTreeRef"
|
||||
@@ -45,10 +57,22 @@
|
||||
<template v-slot="{ node, data }">
|
||||
<div class="page-tree-node">
|
||||
<el-tooltip :content="node.label" placement="top-start" :show-after="1000">
|
||||
<span class="label">
|
||||
<el-icon><el-icon-document/></el-icon>
|
||||
<span class="text">{{ node.label }}</span>
|
||||
</span>
|
||||
<span class="label">
|
||||
<el-icon><el-icon-document/></el-icon>
|
||||
<span class="el-dropdown-link">{{ node.label }}
|
||||
<el-dropdown style="float:right">
|
||||
<el-icon >
|
||||
<el-icon-plus/>
|
||||
</el-icon>
|
||||
<template v-slot:dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item v-on:click="createWiki(2)">创建Markdown</el-dropdown-item>
|
||||
<el-dropdown-item v-on:click="createWiki(1)">创建Html</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</span>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
@@ -206,12 +230,19 @@ const turnLeftCollapse = () => {
|
||||
}
|
||||
}, 100)
|
||||
}
|
||||
const createWiki = () => {
|
||||
if (choiceSpace.value > 0) {
|
||||
router.push({
|
||||
path: '/page/edit',
|
||||
query: {parentId: nowPageId.value}
|
||||
})
|
||||
const createWiki = (editorType,clearParentId) => {
|
||||
if (clearParentId){
|
||||
nowPageId.value = 0
|
||||
}
|
||||
if (choiceSpace.value > 0) {
|
||||
pageApi.updatePage({spaceId: choiceSpace.value,parentId: nowPageId.value,editorType:editorType,name:'未命名',content:'',preview:''})
|
||||
.then((json) => {
|
||||
router.push({
|
||||
path: '/page/edit',
|
||||
query: {parentId: nowPageId.value, pageId: json.data.id}
|
||||
})
|
||||
})
|
||||
|
||||
} else {
|
||||
ElMessage.warning('请先选择或创建空间')
|
||||
}
|
||||
|
||||
@@ -179,6 +179,9 @@ const createWikiSave = (saveAfter) => {
|
||||
}
|
||||
// 修改内容时强制不能修改父路径,只能在目录上拖动修改
|
||||
let parentIdVal = pageId.value > 0 ? '' : parentId.value
|
||||
if (!!pageId.value){
|
||||
wikiPage.value.id = pageId.value
|
||||
}
|
||||
let param = {
|
||||
spaceId: props.spaceId,
|
||||
parentId: parentIdVal,
|
||||
@@ -188,6 +191,7 @@ const createWikiSave = (saveAfter) => {
|
||||
content: content,
|
||||
preview: preview,
|
||||
}
|
||||
|
||||
pageApi.updatePage(param).then((json) => {
|
||||
ElMessage.success('保存成功!')
|
||||
// 重新加载左侧列表,跳转到展示页面
|
||||
@@ -241,6 +245,9 @@ const initQueryParam = (to) => {
|
||||
// pageId和parentId二选一,传了pageId代表编辑页面,否则代表新建页面
|
||||
pageId.value = to.query.pageId
|
||||
parentId.value = to.query.parentId
|
||||
if (!!pageId.value){
|
||||
wangEditorRef.value.setPageId(pageId.value)
|
||||
}
|
||||
if (!!pageId.value) {
|
||||
loadPageDetail(pageId.value)
|
||||
pageApi.pageLock({pageId: pageId.value}).catch((json) => {
|
||||
@@ -260,6 +267,10 @@ let mavonEditorRef = ref();
|
||||
const addMarkdownImage = (pos, file) => {
|
||||
let formData = new FormData()
|
||||
formData.append('files', file)
|
||||
if (!!pageId.value){
|
||||
formData.append('pageId', pageId.value)
|
||||
}
|
||||
|
||||
axios({
|
||||
url: fileUploadUrl.value,
|
||||
method: 'post',
|
||||
|
||||
@@ -35,7 +35,7 @@ let toolbarConfig = {
|
||||
"fullScreen", "undo", "redo", "emotion", "|", "lineHeight", "fontFamily"
|
||||
],
|
||||
};
|
||||
|
||||
let editorPageId = ref('');
|
||||
let route = useRoute();
|
||||
let editorConfig = ref({
|
||||
placeholder: '请输入文档内容',
|
||||
@@ -47,6 +47,9 @@ let editorConfig = ref({
|
||||
// 最大支持50M图片上传
|
||||
maxFileSize: 50 * 1024 * 1024,
|
||||
withCredentials: true,
|
||||
meta: {
|
||||
pageId: editorPageId,
|
||||
},
|
||||
},
|
||||
uploadVideo: {
|
||||
server: import.meta.env.VITE_APP_BASE_API + '/zyplayer-doc-wiki/page/file/wangEditor/upload',
|
||||
@@ -54,6 +57,9 @@ let editorConfig = ref({
|
||||
// 最大支持300M图片上传
|
||||
maxFileSize: 300 * 1024 * 1024,
|
||||
withCredentials: true,
|
||||
meta: {
|
||||
pageId: editorPageId,
|
||||
},
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -83,6 +89,9 @@ const getPageData = () => {
|
||||
const setTitle = (title) => {
|
||||
pageTitle.value = title;
|
||||
}
|
||||
const setPageId = (id) => {
|
||||
editorPageId.value = id;
|
||||
}
|
||||
|
||||
const setHtml = (content) => {
|
||||
editorRef.value.select([]);
|
||||
@@ -96,7 +105,7 @@ onBeforeUnmount(() => {
|
||||
editor.destroy();
|
||||
});
|
||||
|
||||
defineExpose({setTitle, setHtml, getPageData});
|
||||
defineExpose({setTitle,setPageId, setHtml, getPageData});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -5,13 +5,13 @@
|
||||
<link rel="icon" href="wiki-logo.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>WIKI文档管理系统</title>
|
||||
<script type="module" crossorigin src="assets/main.68e288a7.js"></script>
|
||||
<script type="module" crossorigin src="assets/main.476c8bf9.js"></script>
|
||||
<link rel="modulepreload" href="assets/highlight.js.b879387e.js">
|
||||
<link rel="modulepreload" href="assets/vue.9fe1449e.js">
|
||||
<link rel="modulepreload" href="assets/vendor.f45cfa8b.js">
|
||||
<link rel="modulepreload" href="assets/vant.bd56adbb.js">
|
||||
<link rel="modulepreload" href="assets/vendor.1b8bf7cc.js">
|
||||
<link rel="modulepreload" href="assets/vant.af525f67.js">
|
||||
<link rel="modulepreload" href="assets/wangeditor.cbd30c7d.js">
|
||||
<link rel="stylesheet" href="assets/style.686b5b54.css">
|
||||
<link rel="stylesheet" href="assets/style.9f11ad58.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
Reference in New Issue
Block a user