From b037af447f4bab40766a0073ec3e5fe72f51312b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9A=AE=E5=85=89=EF=BC=9A=E5=9F=8E=E4=B8=AD=E5=9F=8E?= <806783409@qq.com> Date: Tue, 12 Mar 2019 22:11:10 +0800 Subject: [PATCH] =?UTF-8?q?wiki=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wiki/controller/WikiPageController.java | 5 +- .../src/main/resources/doc-wiki.html | 123 +++++++++++------- 2 files changed, 81 insertions(+), 47 deletions(-) diff --git a/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageController.java b/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageController.java index b87eb911..3f8be220 100644 --- a/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageController.java +++ b/zyplayer-doc-wiki/src/main/java/com/zyplayer/doc/wiki/controller/WikiPageController.java @@ -15,6 +15,7 @@ import com.zyplayer.doc.data.service.manage.WikiPageService; import com.zyplayer.doc.data.service.manage.WikiPageZanService; import com.zyplayer.doc.wiki.controller.vo.WikiPageContentVo; import com.zyplayer.doc.wiki.controller.vo.WikiPageVo; +import org.apache.commons.lang3.StringUtils; import org.dozer.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -105,7 +106,9 @@ public class WikiPageController { DocUserDetails currentUser = DocUserUtil.getCurrentUser(); WikiPageContent pageContent = new WikiPageContent(); pageContent.setContent(content); - + if (wikiPage.getDelFlag() == 0 && StringUtils.isBlank(wikiPage.getName())) { + return DocResponseJson.warn("标题不能为空!"); + } Long id = wikiPage.getId(); if (id != null && id > 0) { WikiPage wikiPageSel = wikiPageService.getById(id); diff --git a/zyplayer-doc-wiki/src/main/resources/doc-wiki.html b/zyplayer-doc-wiki/src/main/resources/doc-wiki.html index 24ca9199..c01caae9 100644 --- a/zyplayer-doc-wiki/src/main/resources/doc-wiki.html +++ b/zyplayer-doc-wiki/src/main/resources/doc-wiki.html @@ -11,48 +11,53 @@
- - - - - - 关于 - 我的资料 - 退出登录 - - - - - -
- -
- - - - - - - - - -
-
- 创建文档 -
- - - - - + +
+
+ + + + + + + + +
- +
+ 创建文档 +
+ + + + + +
+
+ + + + + + + + + 关于 + 我的资料 + 退出登录 + + +
欢迎使用在线文档
-
{{nowSpaceShow.name}} · {{nowSpaceShow.spaceExplain}}
+
+ {{nowSpaceShow.name}} + · {{nowSpaceShow.spaceExplain}} +
@@ -89,7 +94,7 @@
-
+
@@ -232,7 +237,7 @@ el: '#app', data() { return { - isCollapse: false, + leftCollapse: true, aboutDialogVisible: false, rightContentLoading: false, rightContentType: 0,// 右侧显示类型,0=欢迎页 1=文章内容 2=编辑或新增文章 @@ -483,17 +488,27 @@ } }, createWikiCancel() { - if (isEmpty(this.lastClickNode.label)) { - this.rightContentType = 0; - } else { - this.rightContentType = 1; - } + this.$confirm('确定要取消编辑吗?您编辑的内容将不会被保存哦~', '提示', { + confirmButtonText: '确定', + cancelButtonText: '继续编辑', + type: 'warning' + }).then(() => { + if (isEmpty(this.lastClickNode.label)) { + this.rightContentType = 0; + } else { + this.rightContentType = 1; + } + }); }, createWikiSave() { var parentId = app.lastClickNode.id; if (this.newPageId > 0) { parentId = ""; } + if (isEmpty(app.newPageTitle)) { + Toast.warn("标题不能为空"); + return; + } var param = { spaceId: app.nowSpaceId, id: this.newPageId, @@ -634,11 +649,11 @@ for (var i = 0; i < result.length; i++) { var item = result[i]; item.parentId = item.parentId || 0; - item.nodePath = nodePath + item.name; item.children = [{label: '', needLoad: true}];// 初始化一个对象,点击展开时重新查询加载 pathIndex.push(item); } } + app.createNodePath(pathIndex, nodePath); if (parentId > 0) { node.children = pathIndex; } else { @@ -648,10 +663,23 @@ } }); }, + createNodePath(node, nodePath) { + if (!nodePath.endsWith("/")) { + nodePath += "/"; + } + for (var i = 0; i < node.length; i++) { + var item = node[i]; + item.nodePath = nodePath + item.name; + if (!!item.children && item.children.length > 0) { + this.createNodePath(item.children, item.nodePath); + } + } + }, init(){ page.newPageContentEditor = new window.wangEditor('#newPageContentDiv'); page.newPageContentEditor.customConfig.uploadImgServer = 'zyplayer-doc-wiki/common/upload'; page.newPageContentEditor.customConfig.zIndex = 100; + page.newPageContentEditor.customConfig.pasteFilterStyle = false; page.newPageContentEditor.create(); } } @@ -671,9 +699,12 @@ background: #409EFF; cursor: pointer; width: 100%; height:40px;line-height:40px;font-size: 25px;color: #fff;text-align: center; } + .icon-collapse{float: left;font-size: 25px;color: #aaa;margin-top: 8px;cursor: pointer;} + .icon-collapse:hover{color: #eee;} .wiki-title{font-size: 20px;} .wiki-author{font-size: 14px;color: #888;padding: 20px 0;height: 40px;line-height: 40px;} .wiki-content{font-size: 14px;} + .wiki-content.w-e-text{overflow-y: auto;} .upload-page-file .el-upload-list{display: none;} .is-link{color: #1e88e5;cursor: pointer;}