2019-02-17 20:20:39 +08:00
|
|
|
|
<!DOCTYPE HTML>
|
|
|
|
|
|
<html lang="en">
|
|
|
|
|
|
<head>
|
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
|
|
|
|
|
<title>wiki文档管理系统</title>
|
|
|
|
|
|
<link rel="shortcut icon" href="webjars/doc-wiki/img/wiki.ico"/>
|
|
|
|
|
|
<link rel="stylesheet" href="webjars/doc-wiki/css/element-ui.css">
|
|
|
|
|
|
<link rel="stylesheet" href="webjars/doc-wiki/css/doc-wiki.css" />
|
|
|
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
|
|
|
<div id="app">
|
|
|
|
|
|
<el-container style="height: 100%;">
|
2019-03-07 20:53:13 +08:00
|
|
|
|
<el-header>
|
|
|
|
|
|
<!--<div class="logo" @click="aboutDialogVisible = true">zyplayer-doc-wiki</div>-->
|
|
|
|
|
|
<el-dropdown @command="notOpen" trigger="click">
|
|
|
|
|
|
<i class="el-icon-setting" style="margin-right: 15px; font-size: 16px;cursor: pointer;color: #fff;"> </i>
|
|
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
|
|
|
<el-dropdown-item command="">我的资料</el-dropdown-item>
|
|
|
|
|
|
<el-dropdown-item command="">退出登录</el-dropdown-item>
|
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
|
</el-dropdown>
|
|
|
|
|
|
</el-header>
|
2019-03-06 23:39:38 +08:00
|
|
|
|
<el-container>
|
2019-03-07 20:53:13 +08:00
|
|
|
|
<el-aside width="auto" style="height: 100%;">
|
|
|
|
|
|
<div style="padding: 10px;">
|
|
|
|
|
|
<!--<el-row><el-switch v-model="isCollapse"></el-switch></el-row>-->
|
|
|
|
|
|
<div style="margin-bottom: 10px;">
|
|
|
|
|
|
<el-select v-model="choiceSpace" @change="spaceChangeEvents" filterable placeholder="选择空间" style="width: 100%;">
|
|
|
|
|
|
<el-option-group label="">
|
|
|
|
|
|
<el-option key="0" label="创建空间" value="0"></el-option>
|
|
|
|
|
|
</el-option-group>
|
|
|
|
|
|
<el-option-group label="已有空间">
|
|
|
|
|
|
<el-option v-for="item in spaceOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
|
|
|
|
|
</el-option-group>
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div align="center">
|
|
|
|
|
|
<el-button v-on:click="createWiki" icon="el-icon-plus" style="width: 100%;">创建文档</el-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<el-input v-model="searchKeywords" placeholder="搜索文档" style="margin: 10px 0;">
|
|
|
|
|
|
<el-button slot="append" icon="el-icon-search" v-on:click="searchByKeywords"></el-button>
|
|
|
|
|
|
</el-input>
|
|
|
|
|
|
<el-tree :props="defaultProps" @node-click="handleNodeClick" :load="loadSpaceList" lazy></el-tree>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-aside>
|
2019-03-06 23:39:38 +08:00
|
|
|
|
<el-main class="doc-body-box">
|
|
|
|
|
|
<el-row type="border-card" v-show="rightContentType == 0">
|
|
|
|
|
|
<div style="margin-top: 30px;color: #666; text-align: center;">欢迎使用在线文档</div>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
<el-row type="border-card" v-show="rightContentType == 1">
|
|
|
|
|
|
<div class="wiki-title">
|
|
|
|
|
|
{{wikiPage.name}}
|
2019-02-28 22:38:56 +08:00
|
|
|
|
<div style="float: right;">
|
2019-03-06 23:39:38 +08:00
|
|
|
|
<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>
|
2019-02-28 22:38:56 +08:00
|
|
|
|
</div>
|
2019-02-17 20:20:39 +08:00
|
|
|
|
</div>
|
2019-03-06 23:39:38 +08:00
|
|
|
|
<div class="wiki-author">
|
|
|
|
|
|
创建时间:{{wikiPage.createUserName}} {{wikiPage.createTime}} 最后修改:{{wikiPage.updateUserName}} {{wikiPage.updateTime}}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="wiki-files">
|
|
|
|
|
|
<div style="margin-bottom: 5px; height: 40px;">
|
|
|
|
|
|
<div style="float: right;">
|
|
|
|
|
|
<!--:on-preview="handlePreview"-->
|
|
|
|
|
|
<!--:on-remove="handleRemove"-->
|
|
|
|
|
|
<!--:before-remove="beforeRemove"-->
|
|
|
|
|
|
<!--:on-exceed="handleExceed"-->
|
|
|
|
|
|
<el-upload
|
|
|
|
|
|
class="upload-page-file"
|
|
|
|
|
|
action="zyplayer-doc-wiki/common/upload"
|
|
|
|
|
|
: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>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<el-table v-show="pageFileList.length > 0" :data="pageFileList" border style="width: 100%; margin-bottom: 5px;">
|
|
|
|
|
|
<el-table-column label="文件名">
|
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
|
<a target="_blank" :href="scope.row.fileUrl">{{scope.row.fileName}}</a>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column prop="createUserName" label="创建人"></el-table-column>
|
|
|
|
|
|
<el-table-column prop="createTime" label="创建时间"></el-table-column>
|
|
|
|
|
|
<el-table-column label="操作">
|
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
|
<el-button v-on:click="deletePageFile(scope.row)">删除</el-button>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="wiki-content">
|
|
|
|
|
|
<div v-html="pageContent.content"></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div style="margin-top: 20px; font-size: 14px;">
|
|
|
|
|
|
<span style="vertical-align: top;" class="is-link">
|
|
|
|
|
|
<img src="webjars/doc-wiki/img/zan.png" style="vertical-align: middle;">
|
|
|
|
|
|
<span v-show="wikiPage.selfZan == 0" v-on:click="zanPage(1)">赞</span>
|
|
|
|
|
|
<span v-show="wikiPage.selfZan == 1" v-on:click="zanPage(0)">踩</span>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span style="margin-left: 10px;vertical-align: top;">
|
|
|
|
|
|
<span v-if="wikiPage.selfZan == 0 && wikiPage.zanNum <= 0">成为第一个赞同者</span>
|
|
|
|
|
|
<span v-else-if="wikiPage.selfZan == 0 && wikiPage.zanNum > 0"><span class="is-link" v-on:click="showZanPageUser">{{wikiPage.zanNum}}人</span>赞了它</span>
|
|
|
|
|
|
<span v-else-if="wikiPage.selfZan == 1 && wikiPage.zanNum <= 1">我赞了它</span>
|
|
|
|
|
|
<span v-else-if="wikiPage.selfZan == 1 && wikiPage.zanNum > 1"><span class="is-link" v-on:click="showZanPageUser">我和{{wikiPage.zanNum-1}}个其他人</span>赞了它</span>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-show="commentList.length > 0" class="comment-box" style="margin-top: 20px;">
|
2019-03-07 20:53:13 +08:00
|
|
|
|
<div style="border-bottom: 1px solid #67C23A;padding-bottom: 10px;">评论列表:</div>
|
|
|
|
|
|
<div v-for="(comment,index) in commentList" :key="comment.id" :data-id="comment.id" :data-index="index" style="border-bottom: 1px solid #eee;padding: 10px;">
|
2019-03-06 23:39:38 +08:00
|
|
|
|
<div>
|
2019-03-07 20:53:13 +08:00
|
|
|
|
<div :style="'background-color: '+comment.color" class="head">{{comment.createUserName.substr(0,1)}}</div>
|
2019-03-06 23:39:38 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div style="padding-left: 55px;">
|
2019-03-07 20:53:13 +08:00
|
|
|
|
{{comment.createUserName}}
|
|
|
|
|
|
<span style="color: #888;font-size: 13px;padding-left: 10px;">{{comment.createTime}}</span>
|
|
|
|
|
|
<span style="color: #888;font-size: 13px;margin-left: 10px;cursor: pointer;" @click="recommentUser(comment.id, index)">回复</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<pre style="padding: 10px 0 0 55px;">{{comment.content}}</pre>
|
|
|
|
|
|
<div v-for="(commentSub,indexSub) in comment.commentList" :key="commentSub.id" :data-id="commentSub.id" :data-index="indexSub" style="border-bottom: 1px solid #eee;padding: 10px;margin-left: 40px;">
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<div :style="'background-color: '+commentSub.color" class="head">{{commentSub.createUserName.substr(0,1)}}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div style="padding-left: 55px;">
|
|
|
|
|
|
{{commentSub.createUserName}}
|
|
|
|
|
|
<span style="color: #888;font-size: 13px;padding-left: 10px;">{{commentSub.createTime}}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<pre style="padding: 10px 0 0 55px;">{{commentSub.content}}</pre>
|
2019-03-06 23:39:38 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div style="margin: 20px 0 50px 0;">
|
2019-03-07 20:53:13 +08:00
|
|
|
|
<el-input type="textarea" v-model="commentTextInput" :rows="5" :placeholder="recommentInfo.placeholder || '请输入评论内容'"></el-input>
|
2019-03-06 23:39:38 +08:00
|
|
|
|
<div align="right" style="margin-top: 5px;">
|
2019-03-07 20:53:13 +08:00
|
|
|
|
<el-button type="primary" v-on:click="submitPageComment">提交评论</el-button>
|
|
|
|
|
|
<el-button v-on:click="cancelCommentUser">取消</el-button>
|
2019-03-06 23:39:38 +08:00
|
|
|
|
</div>
|
2019-03-06 22:17:57 +08:00
|
|
|
|
</div>
|
2019-03-06 23:39:38 +08:00
|
|
|
|
</el-row>
|
|
|
|
|
|
<el-row type="border-card" v-show="rightContentType == 2">
|
|
|
|
|
|
<div style="margin-bottom: 10px;">
|
|
|
|
|
|
父级:{{lastClickNode.nodePath || '/'}}
|
|
|
|
|
|
<el-tooltip class="item" content="在根目录创建文档">
|
|
|
|
|
|
<el-button type="text" @click="lastClickNode={}" style="padding: 0 10px;">根目录</el-button>
|
|
|
|
|
|
</el-tooltip>
|
2019-03-05 23:15:47 +08:00
|
|
|
|
</div>
|
2019-03-06 23:39:38 +08:00
|
|
|
|
<el-input v-model="newPageTitle" placeholder="请输入标题"></el-input>
|
|
|
|
|
|
<div id="newPageContentDiv" style="margin: 10px 0;"></div>
|
|
|
|
|
|
<el-button type="primary" v-on:click="createWikiSave">保存</el-button>
|
|
|
|
|
|
<el-button v-on:click="createWikiCancel">取消</el-button>
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
</el-main>
|
|
|
|
|
|
</el-container>
|
2019-02-17 20:20:39 +08:00
|
|
|
|
</el-container>
|
2019-03-06 22:17:57 +08:00
|
|
|
|
<!--点赞人员弹窗-->
|
|
|
|
|
|
<el-dialog title="赞了它的人" :visible.sync="zanUserDialogVisible" width="600px">
|
|
|
|
|
|
<el-table :data="zanUserList" border :show-header="false" style="width: 100%; margin-bottom: 5px;">
|
|
|
|
|
|
<el-table-column prop="createUserName" show-header label="用户"></el-table-column>
|
|
|
|
|
|
<el-table-column prop="createTime" show-header label="时间"></el-table-column>
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
</el-dialog>
|
2019-02-28 22:38:56 +08:00
|
|
|
|
<!--关于弹窗-->
|
2019-02-17 20:20:39 +08:00
|
|
|
|
<el-dialog title="关于zyplayer-doc-wiki" :visible.sync="aboutDialogVisible" width="600px">
|
|
|
|
|
|
<el-form>
|
|
|
|
|
|
<el-form-item label="项目地址:">
|
|
|
|
|
|
<a target="_blank" href="https://gitee.com/zyplayer/zyplayer-doc">zyplayer-doc</a>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="开发人员:">
|
|
|
|
|
|
<a target="_blank" href="http://zyplayer.com">暮光:城中城</a>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="">
|
|
|
|
|
|
欢迎加群讨论,QQ群号:466363173,欢迎提交需求,欢迎使用和加入开发!
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</body>
|
|
|
|
|
|
<script type="text/javascript" src="webjars/doc-wiki/vue/vue.js"></script>
|
|
|
|
|
|
<script type="text/javascript" src="webjars/doc-wiki/js/element-ui.js"></script>
|
|
|
|
|
|
<!-- ajax 用到了jquery -->
|
|
|
|
|
|
<script type="text/javascript" src="webjars/doc-wiki/js/jquery-3.1.0.min.js"></script>
|
|
|
|
|
|
<script type="text/javascript" src="webjars/doc-wiki/js/common.js"></script>
|
|
|
|
|
|
<script type="text/javascript" src="webjars/doc-wiki/js/toast.js"></script>
|
|
|
|
|
|
<script type="text/javascript" src="webjars/doc-wiki/js/formatjson.js"></script>
|
|
|
|
|
|
<script type="text/javascript" src="webjars/doc-wiki/js/doc-wiki-tree.js"></script>
|
2019-02-28 22:38:56 +08:00
|
|
|
|
<script type="text/javascript" src="webjars/doc-wiki/lib/wangEditor/wangEditor.js"></script>
|
2019-02-17 20:20:39 +08:00
|
|
|
|
|
|
|
|
|
|
<script>
|
2019-02-28 22:38:56 +08:00
|
|
|
|
var page = {
|
|
|
|
|
|
newPageContentEditor: '',
|
2019-03-06 23:39:38 +08:00
|
|
|
|
colorArr: ["#67C23A", "#409EFF", "#E6A23C", "#F56C6C", "#909399", "#303133"],
|
2019-03-07 20:53:13 +08:00
|
|
|
|
userHeadColor: {},
|
2019-02-28 22:38:56 +08:00
|
|
|
|
};
|
2019-02-17 20:20:39 +08:00
|
|
|
|
var app = new Vue({
|
|
|
|
|
|
el: '#app',
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
isCollapse: false,
|
|
|
|
|
|
aboutDialogVisible: false,
|
2019-02-27 21:38:25 +08:00
|
|
|
|
rightContentLoading: false,
|
2019-02-28 22:38:56 +08:00
|
|
|
|
rightContentType: 0,// 右侧显示类型,0=欢迎页 1=文章内容 2=编辑或新增文章
|
2019-02-27 21:38:25 +08:00
|
|
|
|
pathIndex: [],
|
2019-02-17 20:20:39 +08:00
|
|
|
|
defaultProps: {
|
|
|
|
|
|
children: 'children',
|
2019-02-27 21:38:25 +08:00
|
|
|
|
label: 'label',
|
|
|
|
|
|
isLeaf: 'leaf'
|
2019-02-17 20:20:39 +08:00
|
|
|
|
},
|
2019-03-07 20:53:13 +08:00
|
|
|
|
// 空间搜索相关
|
|
|
|
|
|
spaceOptions: [],
|
|
|
|
|
|
spaceList:[],
|
|
|
|
|
|
choiceSpace: "",
|
|
|
|
|
|
nowSpaceId: 0,
|
2019-02-17 20:20:39 +08:00
|
|
|
|
// 依据目录树存储的map全局对象
|
|
|
|
|
|
treePathDataMap: new Map(),
|
|
|
|
|
|
// 搜索的输入内容
|
|
|
|
|
|
searchKeywords: "",
|
2019-02-27 21:38:25 +08:00
|
|
|
|
lastClickNode: {},
|
2019-03-06 22:17:57 +08:00
|
|
|
|
// 编辑相关
|
2019-02-28 22:38:56 +08:00
|
|
|
|
newPageId: "",
|
|
|
|
|
|
newPageTitle: "",
|
|
|
|
|
|
// 页面展示相关
|
2019-03-07 20:53:13 +08:00
|
|
|
|
wikiPageList:[],
|
2019-02-28 22:38:56 +08:00
|
|
|
|
wikiPage: {},
|
|
|
|
|
|
pageContent: {},
|
|
|
|
|
|
pageFileList: [],
|
2019-03-04 23:20:40 +08:00
|
|
|
|
uploadFileList: [],
|
2019-03-05 23:15:47 +08:00
|
|
|
|
uploadFormData: {pageId: 0},
|
2019-03-06 22:17:57 +08:00
|
|
|
|
zanUserDialogVisible: false,
|
|
|
|
|
|
zanUserList: [],
|
2019-03-05 23:15:47 +08:00
|
|
|
|
// 评论相关
|
2019-03-06 22:17:57 +08:00
|
|
|
|
commentTextInput: "",
|
|
|
|
|
|
commentList: [],
|
2019-03-07 20:53:13 +08:00
|
|
|
|
recommentInfo: {},
|
2019-02-17 20:20:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
mounted: function () {
|
2019-02-28 22:38:56 +08:00
|
|
|
|
this.init();
|
2019-02-17 20:20:39 +08:00
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2019-03-05 23:15:47 +08:00
|
|
|
|
zanPage(yn) {
|
|
|
|
|
|
var param = {yn: yn, pageId: app.wikiPage.id};
|
|
|
|
|
|
ajaxTemp("zyplayer-doc-wiki/page/zan/update", "post", "json", param, function (json) {
|
|
|
|
|
|
if (validateResult(json)) {
|
|
|
|
|
|
app.wikiPage.selfZan = yn;
|
|
|
|
|
|
app.wikiPage.zanNum = app.wikiPage.zanNum + (yn == 1 ? 1 : -1);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
showZanPageUser() {
|
2019-03-06 22:17:57 +08:00
|
|
|
|
app.zanUserDialogVisible = true;
|
|
|
|
|
|
app.zanUserList = [];
|
|
|
|
|
|
var param = {pageId: app.wikiPage.id};
|
|
|
|
|
|
ajaxTemp("zyplayer-doc-wiki/page/zan/list", "post", "json", param, function (json) {
|
|
|
|
|
|
if (validateResult(json)) {
|
|
|
|
|
|
app.zanUserList = json.data;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2019-03-05 23:15:47 +08:00
|
|
|
|
},
|
2019-03-07 20:53:13 +08:00
|
|
|
|
recommentUser(id, index) {
|
|
|
|
|
|
this.recommentInfo = {id: id, index: index, placeholder: '回复' + (index + 1) + '楼'};
|
|
|
|
|
|
},
|
|
|
|
|
|
cancelCommentUser() {
|
|
|
|
|
|
this.recommentInfo = {};
|
|
|
|
|
|
},
|
2019-03-05 23:15:47 +08:00
|
|
|
|
submitPageComment() {
|
2019-03-07 20:53:13 +08:00
|
|
|
|
var param = {
|
|
|
|
|
|
pageId: app.wikiPage.id, content: app.commentTextInput,
|
|
|
|
|
|
parentId: app.recommentInfo.id
|
|
|
|
|
|
};
|
2019-03-06 22:17:57 +08:00
|
|
|
|
ajaxTemp("zyplayer-doc-wiki/page/comment/update", "post", "json", param, function (json) {
|
|
|
|
|
|
if (validateResult(json)) {
|
2019-03-06 23:39:38 +08:00
|
|
|
|
var data = json.data;
|
2019-03-07 20:53:13 +08:00
|
|
|
|
var color = page.userHeadColor[data.createUserId];
|
|
|
|
|
|
if (!color) {
|
|
|
|
|
|
color = page.colorArr[Math.ceil(Math.random() * page.colorArr.length) - 1];
|
|
|
|
|
|
page.userHeadColor[data.createUserId] = color;
|
|
|
|
|
|
}
|
|
|
|
|
|
data.color = color;
|
2019-03-06 22:17:57 +08:00
|
|
|
|
app.commentTextInput = "";
|
2019-03-06 23:39:38 +08:00
|
|
|
|
app.commentList.push(data);
|
2019-03-06 22:17:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
uploadFileError(err) {
|
|
|
|
|
|
Toast.success("上传失败," + err);
|
2019-03-05 23:15:47 +08:00
|
|
|
|
},
|
|
|
|
|
|
uploadFileSuccess(response) {
|
2019-03-06 22:17:57 +08:00
|
|
|
|
if (validateResult(response)) {
|
|
|
|
|
|
app.pageFileList.push(response.data);
|
|
|
|
|
|
Toast.success("上传成功!");
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
deletePageFile(row) {
|
2019-03-06 23:39:38 +08:00
|
|
|
|
this.$confirm('确定要删除此文件吗?', '提示', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
var param = {id: row.id, delFlag: 1};
|
|
|
|
|
|
ajaxTemp("zyplayer-doc-wiki/page/file/update", "post", "json", param, function (json) {
|
|
|
|
|
|
if (validateResult(json)) {
|
|
|
|
|
|
var pageFileList = [];
|
|
|
|
|
|
for (var i = 0; i < app.pageFileList.length; i++) {
|
|
|
|
|
|
if (app.pageFileList[i].id != row.id) {
|
|
|
|
|
|
pageFileList.push(app.pageFileList[i]);
|
|
|
|
|
|
}
|
2019-03-06 22:17:57 +08:00
|
|
|
|
}
|
2019-03-06 23:39:38 +08:00
|
|
|
|
app.pageFileList = pageFileList;
|
2019-03-06 22:17:57 +08:00
|
|
|
|
}
|
2019-03-06 23:39:38 +08:00
|
|
|
|
});
|
2019-03-06 22:17:57 +08:00
|
|
|
|
});
|
2019-03-05 23:15:47 +08:00
|
|
|
|
},
|
2019-03-06 23:39:38 +08:00
|
|
|
|
editWikiAuth() {
|
|
|
|
|
|
Toast.notOpen();
|
|
|
|
|
|
},
|
|
|
|
|
|
notOpen() {
|
|
|
|
|
|
Toast.notOpen();
|
|
|
|
|
|
},
|
2019-03-05 23:15:47 +08:00
|
|
|
|
editWiki() {
|
2019-02-28 22:38:56 +08:00
|
|
|
|
this.rightContentType = 2;
|
|
|
|
|
|
this.newPageId = app.wikiPage.id;
|
|
|
|
|
|
this.newPageTitle = app.wikiPage.name;
|
|
|
|
|
|
page.newPageContentEditor.txt.html(app.pageContent.content || "");
|
|
|
|
|
|
},
|
2019-03-06 22:17:57 +08:00
|
|
|
|
createWiki() {
|
2019-02-28 22:38:56 +08:00
|
|
|
|
this.newPageId = "";
|
2019-03-06 22:17:57 +08:00
|
|
|
|
this.newPageTitle = "";
|
|
|
|
|
|
page.newPageContentEditor.txt.html("");
|
2019-02-27 21:38:25 +08:00
|
|
|
|
this.rightContentType = 2;
|
2019-02-17 20:20:39 +08:00
|
|
|
|
},
|
2019-03-06 22:17:57 +08:00
|
|
|
|
createWikiCancel() {
|
2019-02-28 22:38:56 +08:00
|
|
|
|
if (isEmpty(this.lastClickNode.label)) {
|
|
|
|
|
|
this.rightContentType = 0;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.rightContentType = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2019-03-06 22:17:57 +08:00
|
|
|
|
createWikiSave() {
|
2019-02-28 22:38:56 +08:00
|
|
|
|
var parentId = app.lastClickNode.id;
|
|
|
|
|
|
if (this.newPageId > 0) {
|
|
|
|
|
|
parentId = "";
|
|
|
|
|
|
}
|
|
|
|
|
|
var param = {
|
|
|
|
|
|
spaceId: 1,
|
|
|
|
|
|
id: this.newPageId,
|
|
|
|
|
|
name: app.newPageTitle,
|
|
|
|
|
|
parentId: parentId,
|
|
|
|
|
|
content: page.newPageContentEditor.txt.html()
|
|
|
|
|
|
};
|
|
|
|
|
|
ajaxTemp("zyplayer-doc-wiki/page/update", "post", "json", param, function (json) {
|
|
|
|
|
|
if (validateResult(json)) {
|
|
|
|
|
|
Toast.success("保存成功!");
|
2019-03-05 23:15:47 +08:00
|
|
|
|
app.loadPageDetail(json.data.id);
|
2019-02-28 22:38:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
2019-02-17 20:20:39 +08:00
|
|
|
|
handleNodeClick(data) {
|
2019-02-28 22:38:56 +08:00
|
|
|
|
app.rightContentType = 1;
|
|
|
|
|
|
if (app.lastClickNode.id == data.id) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
console.log("点击节点:", data);
|
2019-02-27 21:38:25 +08:00
|
|
|
|
app.lastClickNode = data;
|
2019-02-28 22:38:56 +08:00
|
|
|
|
this.loadPageDetail(app.lastClickNode.id);
|
|
|
|
|
|
},
|
2019-03-07 20:53:13 +08:00
|
|
|
|
spaceChangeEvents(data) {
|
|
|
|
|
|
app.nowSpaceId = data;
|
|
|
|
|
|
if (data == 0) {
|
|
|
|
|
|
this.$prompt('请输入空间名', '创建空间', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
|
}).then(({value}) => {
|
|
|
|
|
|
var param = {name: value};
|
|
|
|
|
|
ajaxTemp("zyplayer-doc-wiki/space/update", "post", "json", param, function (json) {
|
|
|
|
|
|
if (validateResult(json)) {
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
loadSpaceList(node, resolve) {
|
|
|
|
|
|
ajaxTemp("zyplayer-doc-wiki/space/list", "post", "json", {}, function (json) {
|
|
|
|
|
|
if (validateResult(json)) {
|
|
|
|
|
|
app.spaceList = json.data || [];
|
|
|
|
|
|
var spaceOptions = [];
|
|
|
|
|
|
for (var i = 0; i < app.spaceList.length; i++) {
|
|
|
|
|
|
spaceOptions.push({
|
|
|
|
|
|
label: app.spaceList[i].name, value: app.spaceList[i].id
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
app.spaceOptions = spaceOptions;
|
|
|
|
|
|
if (app.spaceList.length > 0) {
|
|
|
|
|
|
app.nowSpaceId = app.spaceList[0].id;
|
|
|
|
|
|
app.loadNodeChildren(node, resolve);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
2019-02-28 22:38:56 +08:00
|
|
|
|
loadPageDetail(pageId) {
|
|
|
|
|
|
app.rightContentType = 1;
|
|
|
|
|
|
var param = {id: pageId};
|
|
|
|
|
|
ajaxTemp("zyplayer-doc-wiki/page/detail", "post", "json", param, function (json) {
|
|
|
|
|
|
if (validateResult(json)) {
|
2019-03-05 23:15:47 +08:00
|
|
|
|
var wikiPage = json.data.wikiPage || {};
|
|
|
|
|
|
wikiPage.selfZan = json.data.selfZan || 0;
|
|
|
|
|
|
app.wikiPage = wikiPage;
|
2019-02-28 22:38:56 +08:00
|
|
|
|
app.pageContent = json.data.pageContent || {};
|
|
|
|
|
|
app.pageFileList = json.data.fileList || [];
|
2019-03-05 23:15:47 +08:00
|
|
|
|
app.uploadFormData = {pageId: app.wikiPage.id};
|
2019-02-28 22:38:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
2019-03-06 22:17:57 +08:00
|
|
|
|
this.loadCommentList(pageId);
|
|
|
|
|
|
},
|
|
|
|
|
|
loadCommentList(pageId) {
|
|
|
|
|
|
app.commentList = [];
|
2019-03-07 20:53:13 +08:00
|
|
|
|
app.cancelCommentUser();
|
2019-03-06 22:17:57 +08:00
|
|
|
|
var param = {pageId: pageId};
|
|
|
|
|
|
ajaxTemp("zyplayer-doc-wiki/page/comment/list", "post", "json", param, function (json) {
|
|
|
|
|
|
if (validateResult(json)) {
|
2019-03-06 23:39:38 +08:00
|
|
|
|
var commentList = json.data || [];
|
|
|
|
|
|
for (var i = 0; i < commentList.length; i++) {
|
2019-03-07 20:53:13 +08:00
|
|
|
|
var color = page.userHeadColor[commentList[i].createUserId];
|
|
|
|
|
|
if (!color) {
|
|
|
|
|
|
color = page.colorArr[Math.ceil(Math.random() * page.colorArr.length) - 1];
|
|
|
|
|
|
page.userHeadColor[commentList[i].createUserId] = color;
|
|
|
|
|
|
}
|
|
|
|
|
|
commentList[i].color = color;
|
|
|
|
|
|
var subCommentList = commentList[i].commentList || [];
|
|
|
|
|
|
for (var j = 0; j < subCommentList.length; j++) {
|
|
|
|
|
|
var subItem = subCommentList[j];
|
|
|
|
|
|
var colorSub = page.userHeadColor[subItem.createUserId];
|
|
|
|
|
|
if (!colorSub) {
|
|
|
|
|
|
colorSub = page.colorArr[Math.ceil(Math.random() * page.colorArr.length) - 1];
|
|
|
|
|
|
page.userHeadColor[subItem.createUserId] = colorSub;
|
|
|
|
|
|
}
|
|
|
|
|
|
subItem.color = colorSub;
|
|
|
|
|
|
}
|
|
|
|
|
|
commentList[i].commentList = subCommentList;
|
2019-03-06 23:39:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
app.commentList = commentList;
|
2019-03-06 22:17:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
2019-02-17 20:20:39 +08:00
|
|
|
|
},
|
|
|
|
|
|
searchByKeywords() {
|
|
|
|
|
|
app.pathIndex = createTreeViewByTreeWithMerge(app.dubboDocList, app.searchKeywords);
|
2019-02-27 21:38:25 +08:00
|
|
|
|
},
|
2019-02-28 22:38:56 +08:00
|
|
|
|
loadNodeChildren(node, resolve) {
|
2019-02-27 21:38:25 +08:00
|
|
|
|
if (node.level === 0) {
|
2019-02-28 22:38:56 +08:00
|
|
|
|
this.doGetPageList(null, node, resolve);
|
2019-02-27 21:38:25 +08:00
|
|
|
|
} else {
|
2019-02-28 22:38:56 +08:00
|
|
|
|
this.doGetPageList(node.data.id, node, resolve);
|
2019-02-27 21:38:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2019-02-28 22:38:56 +08:00
|
|
|
|
doGetPageList(parentId, node, resolve) {
|
|
|
|
|
|
var nodePath = "";
|
|
|
|
|
|
if (!!node.data) {
|
|
|
|
|
|
nodePath = node.data.nodePath || "/";
|
|
|
|
|
|
if (!nodePath.endsWith("/")) {
|
|
|
|
|
|
nodePath += "/";
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
nodePath = "/";
|
|
|
|
|
|
}
|
2019-03-07 20:53:13 +08:00
|
|
|
|
var param = {spaceId: this.nowSpaceId, parentId: parentId};
|
2019-02-27 21:38:25 +08:00
|
|
|
|
ajaxTemp("zyplayer-doc-wiki/page/list", "post", "json", param, function (json) {
|
|
|
|
|
|
if (validateResult(json)) {
|
|
|
|
|
|
app.wikiPageList = json.data || [];
|
|
|
|
|
|
var pathIndex = [];
|
|
|
|
|
|
for (var i = 0; i < json.data.length; i++) {
|
|
|
|
|
|
var item = json.data[i];
|
|
|
|
|
|
pathIndex.push({
|
|
|
|
|
|
id: item.id,
|
|
|
|
|
|
label: item.name,
|
|
|
|
|
|
leaf: item.nodeType == 1,
|
2019-02-28 22:38:56 +08:00
|
|
|
|
nodePath: nodePath + item.name,
|
2019-02-27 21:38:25 +08:00
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
resolve(pathIndex);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2019-02-28 22:38:56 +08:00
|
|
|
|
},
|
|
|
|
|
|
init(){
|
|
|
|
|
|
var E = window.wangEditor;
|
|
|
|
|
|
page.newPageContentEditor = new E('#newPageContentDiv');
|
2019-03-04 23:20:40 +08:00
|
|
|
|
page.newPageContentEditor.customConfig.uploadImgServer = 'zyplayer-doc-wiki/common/upload';
|
2019-02-28 22:38:56 +08:00
|
|
|
|
page.newPageContentEditor.create();
|
2019-02-17 20:20:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
</script>
|
|
|
|
|
|
<style>
|
|
|
|
|
|
html,body,#app {
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
}
|
2019-03-06 23:39:38 +08:00
|
|
|
|
pre{margin: 0;white-space: pre-wrap;font-size: 14px; font-family: auto;}
|
2019-02-17 20:20:39 +08:00
|
|
|
|
.el-menu {
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
border-right: 0;
|
|
|
|
|
|
margin-right: 3px;
|
|
|
|
|
|
}
|
2019-03-07 20:53:13 +08:00
|
|
|
|
.el-header {background-color: #409EFF; color: #333; line-height: 40px; text-align: right;height: 40px !important;}
|
2019-02-17 20:20:39 +08:00
|
|
|
|
.doc-body-box{
|
2019-03-07 20:53:13 +08:00
|
|
|
|
overflow-x: hidden;overflow-y: auto;width: 100%;
|
2019-02-28 22:38:56 +08:00
|
|
|
|
padding: 10px;border-left: 1px solid #f1f1f1; box-sizing: border-box;
|
2019-02-17 20:20:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
.el-tree{margin-right: 3px;}
|
|
|
|
|
|
.logo{
|
|
|
|
|
|
background: #409EFF; cursor: pointer;
|
2019-03-07 20:53:13 +08:00
|
|
|
|
width: 100%; height:40px;line-height:40px;font-size: 25px;color: #fff;text-align: center;
|
2019-02-17 20:20:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
.wiki-title{font-size: 20px;}
|
|
|
|
|
|
.wiki-author{font-size: 14px;padding: 10px 0;}
|
|
|
|
|
|
.wiki-content{font-size: 14px;}
|
2019-03-05 23:15:47 +08:00
|
|
|
|
|
|
|
|
|
|
.upload-page-file .el-upload-list{display: none;}
|
|
|
|
|
|
.is-link{color: #1e88e5;cursor: pointer;}
|
2019-03-06 23:39:38 +08:00
|
|
|
|
|
|
|
|
|
|
/*评论*/
|
|
|
|
|
|
.comment-box .head{
|
|
|
|
|
|
float: left;background-color: #ccc;border-radius: 50%;margin-right: 10px;
|
|
|
|
|
|
width: 45px; height: 45px; line-height: 45px;text-align: center;color: #fff;
|
|
|
|
|
|
}
|
2019-02-17 20:20:39 +08:00
|
|
|
|
</style>
|
|
|
|
|
|
</html>
|
|
|
|
|
|
|