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