wiki文档优化
This commit is contained in:
@@ -106,11 +106,6 @@ public class WikiPageController {
|
|||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
public ResponseJson<Object> update(WikiPage wikiPage, String content) {
|
public ResponseJson<Object> update(WikiPage wikiPage, String content) {
|
||||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||||
WikiSpace wikiSpaceSel = wikiSpaceService.getById(wikiPage.getSpaceId());
|
|
||||||
// 私人空间不允许调用接口获取文章
|
|
||||||
if (Objects.equals(wikiSpaceSel.getType(), 3) && !currentUser.getUserId().equals(wikiSpaceSel.getCreateUserId())) {
|
|
||||||
return DocResponseJson.warn("您没有修改该空间的文章权限!");
|
|
||||||
}
|
|
||||||
WikiPageContent pageContent = new WikiPageContent();
|
WikiPageContent pageContent = new WikiPageContent();
|
||||||
pageContent.setContent(content);
|
pageContent.setContent(content);
|
||||||
Integer delFlag = Optional.ofNullable(wikiPage.getDelFlag()).orElse(0);
|
Integer delFlag = Optional.ofNullable(wikiPage.getDelFlag()).orElse(0);
|
||||||
@@ -123,6 +118,11 @@ public class WikiPageController {
|
|||||||
if (wikiPageSel == null || Objects.equals(wikiPageSel.getEditType(), 1)) {
|
if (wikiPageSel == null || Objects.equals(wikiPageSel.getEditType(), 1)) {
|
||||||
return DocResponseJson.warn("当前页面不允许编辑!");
|
return DocResponseJson.warn("当前页面不允许编辑!");
|
||||||
}
|
}
|
||||||
|
WikiSpace wikiSpaceSel = wikiSpaceService.getById(wikiPageSel.getSpaceId());
|
||||||
|
// 私人空间不允许调用接口获取文章
|
||||||
|
if (Objects.equals(wikiSpaceSel.getType(), 3) && !currentUser.getUserId().equals(wikiSpaceSel.getCreateUserId())) {
|
||||||
|
return DocResponseJson.warn("您没有修改该空间的文章权限!");
|
||||||
|
}
|
||||||
wikiPage.setEditType(null);
|
wikiPage.setEditType(null);
|
||||||
wikiPage.setUpdateTime(new Date());
|
wikiPage.setUpdateTime(new Date());
|
||||||
wikiPage.setUpdateUserId(currentUser.getUserId());
|
wikiPage.setUpdateUserId(currentUser.getUserId());
|
||||||
|
|||||||
@@ -331,18 +331,19 @@
|
|||||||
urlParamPageId: function (newVal, oldVal) {
|
urlParamPageId: function (newVal, oldVal) {
|
||||||
if (!this.initOver) return;
|
if (!this.initOver) return;
|
||||||
var oldPageId = oldVal || 0;
|
var oldPageId = oldVal || 0;
|
||||||
// console.log(app.doNotPushState, newVal, oldVal);
|
console.log(app.doNotPushState, newVal, oldVal);
|
||||||
if (app.doNotPushState) {
|
if (!newVal) {
|
||||||
app.doNotPushState = false;
|
app.rightContentType = 0;
|
||||||
} else {
|
} else if (newVal !== oldPageId) {
|
||||||
this.urlParam.pageId = newVal;
|
|
||||||
var params = urlToParam(this.urlParam).slice(1);
|
|
||||||
window.history.pushState(null, null, '?' + params);
|
|
||||||
}
|
|
||||||
if (!!newVal && newVal > 0 && newVal !== oldPageId) {
|
|
||||||
this.wikiPageExpandedKeys = [newVal];
|
this.wikiPageExpandedKeys = [newVal];
|
||||||
this.loadPageDetail(newVal);
|
this.loadPageDetail(newVal);
|
||||||
|
if (!app.doNotPushState) {
|
||||||
|
this.urlParam.pageId = newVal;
|
||||||
|
var params = urlToParam(this.urlParam).slice(1);
|
||||||
|
window.history.pushState(null, null, '?' + params);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
app.doNotPushState = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
@@ -582,6 +583,7 @@
|
|||||||
if (validateResult(json)) {
|
if (validateResult(json)) {
|
||||||
Toast.success("保存成功!");
|
Toast.success("保存成功!");
|
||||||
app.urlParamPageId = json.data.id;
|
app.urlParamPageId = json.data.id;
|
||||||
|
app.loadPageDetail(json.data.id);
|
||||||
app.doGetPageList(null);
|
app.doGetPageList(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -652,6 +654,10 @@
|
|||||||
app.pageContent = json.data.pageContent || {};
|
app.pageContent = json.data.pageContent || {};
|
||||||
app.pageFileList = json.data.fileList || [];
|
app.pageFileList = json.data.fileList || [];
|
||||||
app.uploadFormData = {pageId: app.wikiPage.id};
|
app.uploadFormData = {pageId: app.wikiPage.id};
|
||||||
|
// 修改最后点击的项,保证刷新后点击编辑能展示编辑的项
|
||||||
|
if (!app.lastClickNode.id) {
|
||||||
|
app.lastClickNode = {id: wikiPage.id, nodePath: wikiPage.name};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.loadCommentList(pageId);
|
this.loadCommentList(pageId);
|
||||||
@@ -720,7 +726,7 @@
|
|||||||
node.children = pathIndex;
|
node.children = pathIndex;
|
||||||
} else {
|
} else {
|
||||||
app.wikiPageList = pathIndex;
|
app.wikiPageList = pathIndex;
|
||||||
app.lastClickNode = {};
|
//app.lastClickNode = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -752,10 +758,12 @@
|
|||||||
},
|
},
|
||||||
createUrlParam() {
|
createUrlParam() {
|
||||||
var url = document.location.toString();
|
var url = document.location.toString();
|
||||||
|
var urlParam = {};
|
||||||
if (url.indexOf("?") >= 0) {
|
if (url.indexOf("?") >= 0) {
|
||||||
var urlParam = {};
|
|
||||||
for (var key in this.urlParam) {
|
for (var key in this.urlParam) {
|
||||||
urlParam[key] = this.urlParam[key];
|
if (key != 'pageId') {
|
||||||
|
urlParam[key] = this.urlParam[key];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var params = url.split("?")[1];
|
var params = url.split("?")[1];
|
||||||
var paramArr = params.split("&");
|
var paramArr = params.split("&");
|
||||||
@@ -767,9 +775,12 @@
|
|||||||
}
|
}
|
||||||
if (!!urlParam.pageId) {
|
if (!!urlParam.pageId) {
|
||||||
this.urlParamPageId = parseInt(urlParam.pageId);
|
this.urlParamPageId = parseInt(urlParam.pageId);
|
||||||
|
} else {
|
||||||
|
this.urlParamPageId = 0;
|
||||||
|
this.lastClickNode = {};
|
||||||
}
|
}
|
||||||
this.urlParam = urlParam;
|
|
||||||
}
|
}
|
||||||
|
this.urlParam = urlParam;
|
||||||
},
|
},
|
||||||
init(){
|
init(){
|
||||||
page.newPageContentEditor = new window.wangEditor('#newPageContentDiv');
|
page.newPageContentEditor = new window.wangEditor('#newPageContentDiv');
|
||||||
|
|||||||
@@ -156,18 +156,19 @@
|
|||||||
urlParamPageId: function (newVal, oldVal) {
|
urlParamPageId: function (newVal, oldVal) {
|
||||||
if (!this.initOver) return;
|
if (!this.initOver) return;
|
||||||
var oldPageId = oldVal || 0;
|
var oldPageId = oldVal || 0;
|
||||||
// console.log(app.doNotPushState, newVal, oldVal);
|
console.log(app.doNotPushState, newVal, oldVal);
|
||||||
if (app.doNotPushState) {
|
if (!newVal) {
|
||||||
app.doNotPushState = false;
|
app.rightContentType = 0;
|
||||||
} else {
|
} else if (newVal !== oldPageId) {
|
||||||
this.urlParam.pageId = newVal;
|
|
||||||
var params = urlToParam(this.urlParam).slice(1);
|
|
||||||
window.history.pushState(null, null, '?' + params);
|
|
||||||
}
|
|
||||||
if (!!newVal && newVal > 0 && newVal !== oldPageId) {
|
|
||||||
this.wikiPageExpandedKeys = [newVal];
|
this.wikiPageExpandedKeys = [newVal];
|
||||||
this.loadPageDetail(newVal);
|
this.loadPageDetail(newVal);
|
||||||
|
if (!app.doNotPushState) {
|
||||||
|
this.urlParam.pageId = newVal;
|
||||||
|
var params = urlToParam(this.urlParam).slice(1);
|
||||||
|
window.history.pushState(null, null, '?' + params);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
app.doNotPushState = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
@@ -258,10 +259,12 @@
|
|||||||
},
|
},
|
||||||
createUrlParam() {
|
createUrlParam() {
|
||||||
var url = document.location.toString();
|
var url = document.location.toString();
|
||||||
|
var urlParam = {};
|
||||||
if (url.indexOf("?") >= 0) {
|
if (url.indexOf("?") >= 0) {
|
||||||
var urlParam = {};
|
|
||||||
for (var key in this.urlParam) {
|
for (var key in this.urlParam) {
|
||||||
urlParam[key] = this.urlParam[key];
|
if (key != 'pageId') {
|
||||||
|
urlParam[key] = this.urlParam[key];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var params = url.split("?")[1];
|
var params = url.split("?")[1];
|
||||||
var paramArr = params.split("&");
|
var paramArr = params.split("&");
|
||||||
@@ -273,9 +276,12 @@
|
|||||||
}
|
}
|
||||||
if (!!urlParam.pageId) {
|
if (!!urlParam.pageId) {
|
||||||
this.urlParamPageId = parseInt(urlParam.pageId);
|
this.urlParamPageId = parseInt(urlParam.pageId);
|
||||||
|
} else {
|
||||||
|
this.urlParamPageId = 0;
|
||||||
|
this.lastClickNode = {};
|
||||||
}
|
}
|
||||||
this.urlParam = urlParam;
|
|
||||||
}
|
}
|
||||||
|
this.urlParam = urlParam;
|
||||||
},
|
},
|
||||||
init(){
|
init(){
|
||||||
page.newPageContentEditor = new window.wangEditor('#newPageContentDiv');
|
page.newPageContentEditor = new window.wangEditor('#newPageContentDiv');
|
||||||
|
|||||||
Reference in New Issue
Block a user