wiki文档优化
This commit is contained in:
@@ -106,11 +106,6 @@ public class WikiPageController {
|
||||
@PostMapping("/update")
|
||||
public ResponseJson<Object> update(WikiPage wikiPage, String content) {
|
||||
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();
|
||||
pageContent.setContent(content);
|
||||
Integer delFlag = Optional.ofNullable(wikiPage.getDelFlag()).orElse(0);
|
||||
@@ -123,6 +118,11 @@ public class WikiPageController {
|
||||
if (wikiPageSel == null || Objects.equals(wikiPageSel.getEditType(), 1)) {
|
||||
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.setUpdateTime(new Date());
|
||||
wikiPage.setUpdateUserId(currentUser.getUserId());
|
||||
|
||||
@@ -331,18 +331,19 @@
|
||||
urlParamPageId: function (newVal, oldVal) {
|
||||
if (!this.initOver) return;
|
||||
var oldPageId = oldVal || 0;
|
||||
// console.log(app.doNotPushState, newVal, oldVal);
|
||||
if (app.doNotPushState) {
|
||||
app.doNotPushState = false;
|
||||
} else {
|
||||
this.urlParam.pageId = newVal;
|
||||
var params = urlToParam(this.urlParam).slice(1);
|
||||
window.history.pushState(null, null, '?' + params);
|
||||
}
|
||||
if (!!newVal && newVal > 0 && newVal !== oldPageId) {
|
||||
console.log(app.doNotPushState, newVal, oldVal);
|
||||
if (!newVal) {
|
||||
app.rightContentType = 0;
|
||||
} else if (newVal !== oldPageId) {
|
||||
this.wikiPageExpandedKeys = [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 () {
|
||||
@@ -582,6 +583,7 @@
|
||||
if (validateResult(json)) {
|
||||
Toast.success("保存成功!");
|
||||
app.urlParamPageId = json.data.id;
|
||||
app.loadPageDetail(json.data.id);
|
||||
app.doGetPageList(null);
|
||||
}
|
||||
});
|
||||
@@ -652,6 +654,10 @@
|
||||
app.pageContent = json.data.pageContent || {};
|
||||
app.pageFileList = json.data.fileList || [];
|
||||
app.uploadFormData = {pageId: app.wikiPage.id};
|
||||
// 修改最后点击的项,保证刷新后点击编辑能展示编辑的项
|
||||
if (!app.lastClickNode.id) {
|
||||
app.lastClickNode = {id: wikiPage.id, nodePath: wikiPage.name};
|
||||
}
|
||||
}
|
||||
});
|
||||
this.loadCommentList(pageId);
|
||||
@@ -720,7 +726,7 @@
|
||||
node.children = pathIndex;
|
||||
} else {
|
||||
app.wikiPageList = pathIndex;
|
||||
app.lastClickNode = {};
|
||||
//app.lastClickNode = {};
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -752,10 +758,12 @@
|
||||
},
|
||||
createUrlParam() {
|
||||
var url = document.location.toString();
|
||||
var urlParam = {};
|
||||
if (url.indexOf("?") >= 0) {
|
||||
var 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 paramArr = params.split("&");
|
||||
@@ -767,9 +775,12 @@
|
||||
}
|
||||
if (!!urlParam.pageId) {
|
||||
this.urlParamPageId = parseInt(urlParam.pageId);
|
||||
} else {
|
||||
this.urlParamPageId = 0;
|
||||
this.lastClickNode = {};
|
||||
}
|
||||
this.urlParam = urlParam;
|
||||
}
|
||||
this.urlParam = urlParam;
|
||||
},
|
||||
init(){
|
||||
page.newPageContentEditor = new window.wangEditor('#newPageContentDiv');
|
||||
|
||||
@@ -156,18 +156,19 @@
|
||||
urlParamPageId: function (newVal, oldVal) {
|
||||
if (!this.initOver) return;
|
||||
var oldPageId = oldVal || 0;
|
||||
// console.log(app.doNotPushState, newVal, oldVal);
|
||||
if (app.doNotPushState) {
|
||||
app.doNotPushState = false;
|
||||
} else {
|
||||
this.urlParam.pageId = newVal;
|
||||
var params = urlToParam(this.urlParam).slice(1);
|
||||
window.history.pushState(null, null, '?' + params);
|
||||
}
|
||||
if (!!newVal && newVal > 0 && newVal !== oldPageId) {
|
||||
console.log(app.doNotPushState, newVal, oldVal);
|
||||
if (!newVal) {
|
||||
app.rightContentType = 0;
|
||||
} else if (newVal !== oldPageId) {
|
||||
this.wikiPageExpandedKeys = [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 () {
|
||||
@@ -258,10 +259,12 @@
|
||||
},
|
||||
createUrlParam() {
|
||||
var url = document.location.toString();
|
||||
var urlParam = {};
|
||||
if (url.indexOf("?") >= 0) {
|
||||
var 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 paramArr = params.split("&");
|
||||
@@ -273,9 +276,12 @@
|
||||
}
|
||||
if (!!urlParam.pageId) {
|
||||
this.urlParamPageId = parseInt(urlParam.pageId);
|
||||
} else {
|
||||
this.urlParamPageId = 0;
|
||||
this.lastClickNode = {};
|
||||
}
|
||||
this.urlParam = urlParam;
|
||||
}
|
||||
this.urlParam = urlParam;
|
||||
},
|
||||
init(){
|
||||
page.newPageContentEditor = new window.wangEditor('#newPageContentDiv');
|
||||
|
||||
Reference in New Issue
Block a user