文档展示和编辑,基本功能已完成

This commit is contained in:
暮光:城中城
2019-06-02 22:38:36 +08:00
parent 49189587ce
commit 96d081fdae
14 changed files with 162 additions and 72 deletions

View File

@@ -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");
}
}
}

View File

@@ -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();
}

View File

@@ -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: {