文档展示和编辑,基本功能已完成
This commit is contained in:
@@ -148,7 +148,6 @@
|
||||
leftCollapse: true,
|
||||
aboutDialogVisible: false,
|
||||
rightContentLoading: false,
|
||||
rightContentType: 0,// 右侧显示类型,0=欢迎页 1=文章内容 2=编辑或新增文章
|
||||
pathIndex: [],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
@@ -158,7 +157,6 @@
|
||||
spaceOptions: [],
|
||||
spaceList:[],
|
||||
choiceSpace: "",
|
||||
nowSpaceId: '',
|
||||
nowSpaceShow: {},
|
||||
newSpaceDialogVisible: false,
|
||||
manageSpaceDialogVisible: false,
|
||||
@@ -169,11 +167,14 @@
|
||||
{min: 2, max: 25, message: '长度在 2 到 25 个字符', trigger: 'blur'}
|
||||
],
|
||||
},
|
||||
nowClickPath: {
|
||||
id: '',
|
||||
path: '',
|
||||
},
|
||||
// 依据目录树存储的map全局对象
|
||||
treePathDataMap: new Map(),
|
||||
// 搜索的输入内容
|
||||
searchKeywords: "",
|
||||
lastClickNode: {},
|
||||
// 编辑相关
|
||||
newPageId: "",
|
||||
newPageTitle: "",
|
||||
@@ -206,30 +207,27 @@
|
||||
this.loadSpaceList();
|
||||
},
|
||||
methods: {
|
||||
sendMsgToParent: function (msg) {
|
||||
alert(msg)
|
||||
},
|
||||
createWiki() {
|
||||
if (app.nowSpaceId > 0) {
|
||||
this.$router.push({path: '/page/edit'});
|
||||
if (this.nowClickPath.spaceId > 0) {
|
||||
var param = {
|
||||
spaceId: this.nowClickPath.spaceId,
|
||||
parentId: this.nowClickPath.parentId, path: this.nowClickPath.path
|
||||
};
|
||||
this.$router.push({path: '/page/edit', query: param});
|
||||
} else {
|
||||
toast.warn("请先选择或创建空间");
|
||||
}
|
||||
},
|
||||
changeWikiPageExpandedKeys(pageId) {
|
||||
this.wikiPageExpandedKeys = [pageId];
|
||||
},
|
||||
searchByKeywords() {
|
||||
this.sendMsgToParent();
|
||||
this.$refs.wikiPageTree.filter(app.searchKeywords);
|
||||
},
|
||||
handleNodeClick(data) {
|
||||
app.rightContentType = 1;
|
||||
if (app.lastClickNode.id == data.id) {
|
||||
return;
|
||||
}
|
||||
console.log("点击节点:", data);
|
||||
app.lastClickNode = data;
|
||||
app.urlParamPageId = app.lastClickNode.id;
|
||||
var pageId = app.lastClickNode.id;
|
||||
this.$router.push({path: '/page/show', query: {pageId: pageId}});
|
||||
this.nowClickPath = {spaceId: this.nowClickPath.spaceId, pageId: data.id, parentId: data.id, path: data.path};
|
||||
this.$router.push({path: '/page/show', query: this.nowClickPath});
|
||||
},
|
||||
handleNodeExpand(node) {
|
||||
if (node.children.length > 0 && node.children[0].needLoad) {
|
||||
@@ -244,7 +242,7 @@
|
||||
if (dropType == 'inner') {
|
||||
param.parentId = dropNode.data.id;
|
||||
}
|
||||
this.common.post(this.apilist1.pageUpdate, param, function (json) {
|
||||
this.common.post(this.apilist1.pageChangeParent, param, function (json) {
|
||||
app.doGetPageList(null);
|
||||
});
|
||||
},
|
||||
@@ -274,14 +272,15 @@
|
||||
spaceChangeEvents(data) {
|
||||
if (data == 0) {
|
||||
app.newSpaceForm = {id: '', name: '', spaceExplain: '', treeLazyLoad: 0, openDoc: 0, uuid: '', type: 1};
|
||||
app.choiceSpace = app.nowSpaceId;
|
||||
app.choiceSpace = app.nowClickPath.spaceId;
|
||||
app.newSpaceDialogVisible = true;
|
||||
} else if (data == -1) {
|
||||
app.choiceSpace = app.nowSpaceId;
|
||||
// 使得选择的空间展示不变
|
||||
app.choiceSpace = app.nowClickPath.spaceId;
|
||||
app.manageSpaceDialogVisible = true;
|
||||
} else {
|
||||
app.nowSpaceId = data;
|
||||
app.rightContentType = 0;
|
||||
// 切换空间,重新初始化当前点击项,防止创建保存到之前点击的空间下去了
|
||||
app.nowClickPath = {spaceId: data};
|
||||
for (var i = 0; i < app.spaceList.length; i++) {
|
||||
if (app.spaceList[i].id == data) {
|
||||
app.nowSpaceShow = app.spaceList[i];
|
||||
@@ -289,6 +288,7 @@
|
||||
}
|
||||
}
|
||||
app.doGetPageList(null);
|
||||
app.$router.push({path: '/home'});
|
||||
}
|
||||
},
|
||||
loadSpaceList() {
|
||||
@@ -302,9 +302,10 @@
|
||||
}
|
||||
app.spaceOptions = spaceOptions;
|
||||
if (app.spaceList.length > 0) {
|
||||
app.nowSpaceId = app.spaceList[0].id;
|
||||
var spaceId = app.spaceList[0].id;
|
||||
app.nowSpaceShow = app.spaceList[0];
|
||||
app.choiceSpace = app.nowSpaceId;
|
||||
app.nowClickPath = {spaceId: spaceId};
|
||||
app.choiceSpace = spaceId;
|
||||
app.doGetPageList(null);
|
||||
}
|
||||
});
|
||||
@@ -319,7 +320,7 @@
|
||||
} else {
|
||||
nodePath = "/";
|
||||
}
|
||||
var param = {spaceId: this.nowSpaceId, parentId: parentId || 0};
|
||||
var param = {spaceId: app.nowClickPath.spaceId, parentId: parentId || 0};
|
||||
if (app.nowSpaceShow.treeLazyLoad == 0) {
|
||||
param.parentId = null;
|
||||
}
|
||||
@@ -391,10 +392,9 @@
|
||||
app.spaceOptions.push({
|
||||
label: json.data.name, value: json.data.id
|
||||
});
|
||||
app.nowSpaceId = json.data.id;
|
||||
app.nowSpaceShow = json.data;
|
||||
app.choiceSpace = app.nowSpaceId;
|
||||
app.rightContentType = 0;
|
||||
app.nowClickPath = {spaceId: json.data.id};
|
||||
app.choiceSpace = json.data.id;
|
||||
app.doGetPageList(null);
|
||||
}
|
||||
app.newSpaceForm = {id: '', name: '', spaceExplain: '', treeLazyLoad: 0, openDoc: 0, uuid: '', type: 1};
|
||||
|
||||
@@ -3,6 +3,7 @@ var URL = {
|
||||
userLogout: '/user/logout',
|
||||
getUserInfo: '/user/getUserInfo',
|
||||
pageUpdate: '/zyplayer-doc-wiki/page/update',
|
||||
pageChangeParent: '/zyplayer-doc-wiki/page/changeParent',
|
||||
pageList: '/zyplayer-doc-wiki/page/list',
|
||||
updatePage: '/zyplayer-doc-wiki/page/update',
|
||||
pageDetail: '/zyplayer-doc-wiki/page/detail',
|
||||
|
||||
@@ -5,11 +5,11 @@ var href = window.location.href;
|
||||
var _fn = {
|
||||
href: href,
|
||||
// 这里设置接口域名
|
||||
HOST: 'http://local.zyplayer.com:8083/zyplayer-doc-manage',
|
||||
HOST1: 'http://local.zyplayer.com:8083/zyplayer-doc-manage',
|
||||
// 打包时使用下面这两行,就是上两级的意思
|
||||
// HOST: '../..',
|
||||
// HOST1: '../..',
|
||||
// HOST: 'http://local.zyplayer.com:8083/zyplayer-doc-manage',
|
||||
// HOST1: 'http://local.zyplayer.com:8083/zyplayer-doc-manage',
|
||||
// 打包时使用下面这两行,文件就放在根目录下,所以当前路劲就好
|
||||
HOST: './',
|
||||
HOST1: './',
|
||||
|
||||
mixUrl: function (host, url) {
|
||||
var p;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div v-on:click="sendMsgToParent">
|
||||
<div>
|
||||
<div style="margin-top: 30px;color: #666; text-align: center; font-size: 30px;">欢迎使用在线文档</div>
|
||||
<div style="margin-top: 30px;color: #666; text-align: center;">
|
||||
{{nowSpaceShow.name}}
|
||||
@@ -28,7 +28,7 @@
|
||||
// this.common.post(this.apilist1.getUserInfo, {}, function (json) {});
|
||||
},
|
||||
sendMsgToParent: function () {
|
||||
global.vue.$app.sendMsgToParent("xxx");
|
||||
// global.vue.$app.sendMsgToParent("xxx");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div style="margin-bottom: 10px;padding: 10px;" v-else>
|
||||
父级:{{parentPath.path || '/'}}
|
||||
<el-tooltip class="item" content="在根目录创建文档">
|
||||
<el-button type="text" @click="parentPath = {}" style="padding: 0 10px;">根目录</el-button>
|
||||
<el-button type="text" @click="changeToRootPath" style="padding: 0 10px;">根目录</el-button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<el-input v-model="newPageTitle" placeholder="请输入标题"></el-input>
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
<script>
|
||||
import toast from '../../common/lib/common/toast'
|
||||
import global from '../../common/config/global'
|
||||
import WangEditor from 'wangeditor'
|
||||
|
||||
var app;
|
||||
@@ -28,13 +29,8 @@
|
||||
return {
|
||||
editor: {},
|
||||
// 编辑相关
|
||||
nowSpaceId: "",
|
||||
newPageId: "",
|
||||
newPageTitle: "",
|
||||
parentPath: {
|
||||
id: '',
|
||||
path: '',
|
||||
},
|
||||
parentPath: {},
|
||||
wikiPage: {},
|
||||
};
|
||||
},
|
||||
@@ -48,6 +44,9 @@
|
||||
this.initQueryParam(this.$route);
|
||||
},
|
||||
methods: {
|
||||
changeToRootPath() {
|
||||
app.parentPath = {spaceId: this.parentPath.spaceId};
|
||||
},
|
||||
createWikiCancel() {
|
||||
this.$confirm('确定要取消编辑吗?您编辑的内容将不会被保存哦~', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
@@ -58,26 +57,24 @@
|
||||
});
|
||||
},
|
||||
createWikiSave() {
|
||||
var parentId = app.parentPath.id;
|
||||
if (this.wikiPage.id > 0) {
|
||||
parentId = "";
|
||||
}
|
||||
// 修改内容时强制不能修改父路径,只能在目录上拖动修改
|
||||
var parentId = (this.wikiPage.id > 0) ? '' : app.parentPath.parentId;
|
||||
if (this.common.isEmpty(app.newPageTitle)) {
|
||||
toast.warn("标题不能为空");
|
||||
return;
|
||||
}
|
||||
var param = {
|
||||
spaceId: app.nowSpaceId,
|
||||
spaceId: app.parentPath.spaceId,
|
||||
parentId: parentId,
|
||||
id: app.wikiPage.id,
|
||||
name: app.newPageTitle,
|
||||
parentId: parentId,
|
||||
content: this.editor.txt.html()
|
||||
};
|
||||
this.common.post(this.apilist1.updatePage, param, function (json) {
|
||||
toast.success("保存成功!");
|
||||
// app.urlParamPageId = json.data.id;
|
||||
// app.loadPageDetail(json.data.id);
|
||||
// app.doGetPageList(null);
|
||||
// 重新加载左侧列表,跳转到展示页面
|
||||
global.vue.$app.doGetPageList(null);
|
||||
app.$router.push({path: '/page/show', query: {pageId: json.data.id}});
|
||||
});
|
||||
},
|
||||
loadPageDetail(pageId) {
|
||||
@@ -88,7 +85,6 @@
|
||||
app.pageContent = json.data.pageContent || {};
|
||||
app.pageFileList = json.data.fileList || [];
|
||||
// 内容
|
||||
app.nowSpaceId = app.wikiPage.spaceId;
|
||||
app.newPageTitle = app.wikiPage.name;
|
||||
app.editor.txt.html(app.pageContent.content || "");
|
||||
});
|
||||
@@ -103,10 +99,12 @@
|
||||
}
|
||||
},
|
||||
initQueryParam(to) {
|
||||
this.nowSpaceId = to.query.spaceId;
|
||||
var pageId = to.query.pageId;
|
||||
if (!!pageId) {
|
||||
this.loadPageDetail(pageId);
|
||||
this.parentPath = {
|
||||
spaceId: to.query.spaceId, pageId: to.query.pageId,
|
||||
parentId: to.query.parentId, path: to.query.path
|
||||
};
|
||||
if (!!this.parentPath.pageId) {
|
||||
this.loadPageDetail(this.parentPath.pageId);
|
||||
} else {
|
||||
this.cleanPage();
|
||||
}
|
||||
|
||||
@@ -3,21 +3,23 @@
|
||||
<el-row type="border-card">
|
||||
<div class="wiki-title">
|
||||
{{wikiPage.name}}
|
||||
<div style="float: right;">
|
||||
<el-button type="text" icon="el-icon-edit" v-on:click="editWiki">编辑</el-button>
|
||||
<el-button type="text" icon="el-icon-setting" v-on:click="editWikiAuth">访问权限</el-button>
|
||||
<el-button type="text" icon="el-icon-delete" v-on:click="deleteWikiPage">删除</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wiki-author">
|
||||
<span>创建:{{wikiPage.createUserName}} {{wikiPage.createTime}} <span v-show="wikiPage.updateUserName">修改:{{wikiPage.updateUserName}} {{wikiPage.updateTime}}</span></span>
|
||||
<div>
|
||||
创建:{{wikiPage.createUserName}} {{wikiPage.createTime}}
|
||||
<span v-show="wikiPage.updateUserName">修改:{{wikiPage.updateUserName}} {{wikiPage.updateTime}}</span>
|
||||
<div style="float: right;">
|
||||
<el-upload class="upload-page-file" :action="apilist1.commonUpload"
|
||||
:with-credentials="true"
|
||||
:on-success="uploadFileSuccess" :on-error="uploadFileError"
|
||||
name="files" show-file-list multiple :data="uploadFormData" :limit="999">
|
||||
<el-button icon="el-icon-upload">上传附件</el-button>
|
||||
name="files" show-file-list multiple :data="uploadFormData" :limit="999"
|
||||
style="display: inline;margin-right: 10px;">
|
||||
<el-button type="text" icon="el-icon-upload">上传附件</el-button>
|
||||
</el-upload>
|
||||
<el-button type="text" icon="el-icon-edit" v-on:click="editWiki">编辑</el-button>
|
||||
<el-button type="text" icon="el-icon-setting" v-on:click="editWikiAuth">访问权限</el-button>
|
||||
<el-button type="text" icon="el-icon-delete" v-on:click="deleteWikiPage">删除</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wiki-files">
|
||||
@@ -95,6 +97,7 @@
|
||||
|
||||
<script>
|
||||
import toast from '../../common/lib/common/toast'
|
||||
import global from '../../common/config/global'
|
||||
var app;
|
||||
var page = {
|
||||
colorArr: ["#67C23A", "#409EFF", "#E6A23C", "#F56C6C", "#909399", "#303133"],
|
||||
@@ -129,6 +132,9 @@
|
||||
var pageId = this.$route.query.pageId;
|
||||
if (!!pageId) {
|
||||
this.loadPageDetail(pageId);
|
||||
setTimeout(function () {
|
||||
global.vue.$app.changeWikiPageExpandedKeys(pageId);
|
||||
}, 200);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -65,7 +65,7 @@ public class WikiPageController {
|
||||
List<WikiPageVo> nodePageList;
|
||||
if (wikiPage.getParentId() == null) {
|
||||
nodePageList = listMap.get(0L);
|
||||
this.setChildren(listMap, nodePageList);
|
||||
this.setChildren(listMap, nodePageList, "");
|
||||
} else {
|
||||
nodePageList = listMap.get(wikiPage.getParentId());
|
||||
}
|
||||
@@ -106,6 +106,29 @@ public class WikiPageController {
|
||||
return DocResponseJson.ok(vo);
|
||||
}
|
||||
|
||||
@PostMapping("/changeParent")
|
||||
public ResponseJson<Object> changeParent(WikiPage wikiPage) {
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
Long id = wikiPage.getId();
|
||||
WikiPage wikiPageSel = wikiPageService.getById(id);
|
||||
if (wikiPageSel == null || Objects.equals(wikiPageSel.getEditType(), 1)) {
|
||||
return DocResponseJson.warn("当前页面不允许编辑!");
|
||||
}
|
||||
WikiSpace wikiSpaceSel = wikiSpaceService.getById(wikiPageSel.getSpaceId());
|
||||
// 私人空间不允许调用接口获取文章
|
||||
if (SpaceType.isOthersPrivate(wikiSpaceSel.getType(), currentUser.getUserId(), wikiSpaceSel.getCreateUserId())) {
|
||||
return DocResponseJson.warn("您没有修改该空间的文章权限!");
|
||||
}
|
||||
WikiPage wikiPageUp = new WikiPage();
|
||||
wikiPageUp.setId(wikiPage.getId());
|
||||
wikiPageUp.setParentId(wikiPage.getParentId());
|
||||
wikiPageUp.setUpdateTime(new Date());
|
||||
wikiPageUp.setUpdateUserId(currentUser.getUserId());
|
||||
wikiPageUp.setUpdateUserName(currentUser.getUsername());
|
||||
wikiPageService.updateById(wikiPage);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public ResponseJson<Object> update(WikiPage wikiPage, String content) {
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
@@ -153,15 +176,17 @@ public class WikiPageController {
|
||||
return DocResponseJson.ok(wikiPage);
|
||||
}
|
||||
|
||||
private void setChildren(Map<Long, List<WikiPageVo>> listMap, List<WikiPageVo> nodePageList) {
|
||||
private void setChildren(Map<Long, List<WikiPageVo>> listMap, List<WikiPageVo> nodePageList, String path) {
|
||||
if (nodePageList == null || listMap == null) {
|
||||
return;
|
||||
}
|
||||
for (WikiPageVo page : nodePageList) {
|
||||
String nowPath = path + "/" + page.getName();
|
||||
page.setPath(nowPath);
|
||||
List<WikiPageVo> wikiPageVos = listMap.get(page.getId());
|
||||
if (wikiPageVos != null && wikiPageVos.size() > 0) {
|
||||
page.setChildren(wikiPageVos);
|
||||
this.setChildren(listMap, wikiPageVos);
|
||||
this.setChildren(listMap, wikiPageVos, nowPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.zyplayer.doc.data.repository.manage.entity.WikiPage;
|
||||
import java.util.List;
|
||||
|
||||
public class WikiPageVo extends WikiPage {
|
||||
private String path;
|
||||
private List<WikiPageVo> children;
|
||||
|
||||
public List<WikiPageVo> getChildren() {
|
||||
@@ -14,4 +15,12 @@ public class WikiPageVo extends WikiPage {
|
||||
public void setChildren(List<WikiPageVo> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
14
zyplayer-doc-wiki/src/main/resources/doc-wiki-v2.html
Normal file
14
zyplayer-doc-wiki/src/main/resources/doc-wiki-v2.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>wiki文档管理系统</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="text/javascript" src="manifest.js?022aa721bfefa1874f75"></script><script type="text/javascript" src="vendor.js?f23a64ebc49a36156887"></script><script type="text/javascript" src="index.js?787b2f00cf4c5f8dad65"></script></body>
|
||||
|
||||
</html>
|
||||
|
||||
14
zyplayer-doc-wiki/src/main/resources/index.js
Normal file
14
zyplayer-doc-wiki/src/main/resources/index.js
Normal file
File diff suppressed because one or more lines are too long
2
zyplayer-doc-wiki/src/main/resources/manifest.js
Normal file
2
zyplayer-doc-wiki/src/main/resources/manifest.js
Normal file
@@ -0,0 +1,2 @@
|
||||
!function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r=window.webpackJsonp;window.webpackJsonp=function(t,c,u){for(var a,i,f,l=0,s=[];l<t.length;l++)i=t[l],o[i]&&s.push(o[i][0]),o[i]=0;for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&(e[a]=c[a]);for(r&&r(t,c,u);s.length;)s.shift()();if(u)for(l=0;l<u.length;l++)f=n(n.s=u[l]);return f};var t={},o={2:0};n.e=function(e){function r(){a.onerror=a.onload=null,clearTimeout(i);var n=o[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),o[e]=void 0)}var t=o[e];if(0===t)return new Promise(function(e){e()});if(t)return t[2];var c=new Promise(function(n,r){t=o[e]=[n,r]});t[2]=c;var u=document.getElementsByTagName("head")[0],a=document.createElement("script");a.type="text/javascript",a.charset="utf-8",a.async=!0,a.timeout=12e4,n.nc&&a.setAttribute("nonce",n.nc),a.src=n.p+""+e+".js?"+{0:"f23a64ebc49a36156887",1:"787b2f00cf4c5f8dad65"}[e];var i=setTimeout(r,12e4);return a.onerror=a.onload=r,u.appendChild(a),c},n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:t})},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n.oe=function(e){throw console.error(e),e}}([]);
|
||||
//# sourceMappingURL=manifest.js.map?022aa721bfefa1874f75
|
||||
21
zyplayer-doc-wiki/src/main/resources/vendor.js
Normal file
21
zyplayer-doc-wiki/src/main/resources/vendor.js
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user