mirror of
https://gitee.com/dromara/zyplayer-doc.git
synced 2026-05-14 19:22:09 +08:00
文档展示和编辑,基本功能已完成
This commit is contained in:
@@ -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