文档展示和编辑,基本功能已完成
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 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>
|
||||
</el-upload>
|
||||
<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"
|
||||
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: {
|
||||
|
||||
Reference in New Issue
Block a user