修复初始化显示文档菜单显示高亮问题,修复重复点击报错问题
This commit is contained in:
@@ -1,111 +1,128 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="global-layout-vue">
|
<div class="global-layout-vue">
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-aside v-show="leftCollapse" :style="{ width: rightAsideWidth + 'px' }">
|
<el-aside v-show="leftCollapse" :style="{ width: rightAsideWidth + 'px' }">
|
||||||
<div style="padding: 10px;height: 100%;box-sizing: border-box;background: #fafafa;">
|
<div style="padding: 10px;height: 100%;box-sizing: border-box;background: #fafafa;">
|
||||||
<div style="margin-bottom: 10px;">
|
<div style="margin-bottom: 10px;">
|
||||||
<el-select :value="choiceSpace" @change="spaceChangeEvents" filterable placeholder="选择空间" style="width: 100%;">
|
<el-select :value="choiceSpace" filterable placeholder="选择空间" style="width: 100%;"
|
||||||
<el-option-group label="">
|
@change="spaceChangeEvents">
|
||||||
<el-option key="0" label="创建空间" value="0"></el-option>
|
<el-option-group label="">
|
||||||
<el-option key="-1" label="空间管理" value="-1"></el-option>
|
<el-option key="0" label="创建空间" value="0"></el-option>
|
||||||
</el-option-group>
|
<el-option key="-1" label="空间管理" value="-1"></el-option>
|
||||||
<el-option-group label="">
|
</el-option-group>
|
||||||
<el-option v-for="item in spaceOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
<el-option-group label="">
|
||||||
</el-option-group>
|
<el-option v-for="item in spaceOptions" :key="item.value" :label="item.label"
|
||||||
</el-select>
|
:value="item.value"></el-option>
|
||||||
</div>
|
</el-option-group>
|
||||||
<div align="center">
|
</el-select>
|
||||||
<el-button v-on:click="createWiki" icon="el-icon-plus" style="width: 100%;">创建文档</el-button>
|
</div>
|
||||||
</div>
|
<div align="center">
|
||||||
<el-autocomplete
|
<el-button icon="el-icon-plus" style="width: 100%;" v-on:click="createWiki">创建文档</el-button>
|
||||||
style="width: 100%;margin: 10px 0;" popper-class="search-autocomplete"
|
</div>
|
||||||
v-model="searchKeywords"
|
<el-autocomplete
|
||||||
:fetch-suggestions="doSearchByKeywords"
|
v-model="searchKeywords" :fetch-suggestions="doSearchByKeywords"
|
||||||
placeholder="在当前空间搜索"
|
placeholder="在当前空间搜索"
|
||||||
@select="handleSearchKeywordsSelect"
|
popper-class="search-autocomplete"
|
||||||
>
|
style="width: 100%;margin: 10px 0;"
|
||||||
<template slot-scope="{ item }">
|
@select="handleSearchKeywordsSelect"
|
||||||
<div class="search-option-item">
|
>
|
||||||
<div class="title">
|
<template slot-scope="{ item }">
|
||||||
<span v-html="item.pageTitle || '-'"></span>
|
<div class="search-option-item">
|
||||||
</div>
|
<div class="title">
|
||||||
<span class="content" v-html="item.previewContent || '-'"></span>
|
<span v-html="item.pageTitle || '-'"></span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
<span class="content" v-html="item.previewContent || '-'"></span>
|
||||||
</el-autocomplete>
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-autocomplete>
|
||||||
<div style="overflow: auto; padding-bottom: 30px;">
|
<div style="overflow: auto; padding-bottom: 30px;">
|
||||||
<el-tree :props="defaultProps" :data="wikiPageList" @node-click="handleNodeClick"
|
<el-tree ref="wikiPageTree"
|
||||||
@node-expand="handleNodeExpand" draggable @node-drop="handlePageDrop"
|
:current-node-key="nowPageId"
|
||||||
ref="wikiPageTree" :filter-node-method="filterPageNode" highlight-current
|
:data="wikiPageList"
|
||||||
:expand-on-click-node="false" :default-expanded-keys="wikiPageExpandedKeys"
|
:default-expanded-keys="wikiPageExpandedKeys"
|
||||||
|
:expand-on-click-node="false"
|
||||||
|
:filter-node-method="filterPageNode"
|
||||||
|
:props="defaultProps"
|
||||||
|
draggable
|
||||||
|
highlight-current
|
||||||
node-key="id"
|
node-key="id"
|
||||||
style="background-color: #fafafa;">
|
style="background-color: #fafafa;"
|
||||||
|
@node-click="handleNodeClick"
|
||||||
|
@node-expand="handleNodeExpand"
|
||||||
|
@node-drop="handlePageDrop">
|
||||||
</el-tree>
|
</el-tree>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-aside>
|
</el-aside>
|
||||||
<RightResize v-model="rightAsideWidth" @change="rightAsideWidthChange" v-show="leftCollapse"></RightResize>
|
<RightResize v-show="leftCollapse" v-model="rightAsideWidth" @change="rightAsideWidthChange"></RightResize>
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-header>
|
<el-header>
|
||||||
<i class="el-icon-fold el-icon-s-fold" v-if="leftCollapse" @click="turnLeftCollapse"></i>
|
<i v-if="leftCollapse" class="el-icon-fold el-icon-s-fold" @click="turnLeftCollapse"></i>
|
||||||
<i class="el-icon-fold el-icon-s-unfold" v-else @click="turnLeftCollapse"></i>
|
<i v-else class="el-icon-fold el-icon-s-unfold" @click="turnLeftCollapse"></i>
|
||||||
<span class="header-right-user-name">{{userSelfInfo.userName}}</span>
|
<span class="header-right-user-name">{{ userSelfInfo.userName }}</span>
|
||||||
<el-popover placement="bottom" width="600" trigger="click" v-model="userMessagePopVisible">
|
<el-popover v-model="userMessagePopVisible" placement="bottom" trigger="click" width="600">
|
||||||
<el-badge :is-dot="haveNotReadUserMessage" slot="reference" style="line-height: 20px;margin: 0 15px;">
|
<el-badge slot="reference" :is-dot="haveNotReadUserMessage"
|
||||||
<i class="el-icon-bell head-icon" @click="loadUserMessageIfPopVisible" style="margin-right: 0;"></i>
|
style="line-height: 20px;margin: 0 15px;">
|
||||||
|
<i class="el-icon-bell head-icon" style="margin-right: 0;"
|
||||||
|
@click="loadUserMessageIfPopVisible"></i>
|
||||||
</el-badge>
|
</el-badge>
|
||||||
<div style="margin-bottom: 10px;">
|
<div style="margin-bottom: 10px;">
|
||||||
<span style="font-size: 14px;font-weight: bold;">通知</span>
|
<span style="font-size: 14px;font-weight: bold;">通知</span>
|
||||||
<el-link v-if="haveNotReadUserMessage" type="primary" icon="el-icon-check" style="float: right;" v-on:click="readAllUserMessage">本页标记已读</el-link>
|
<el-link v-if="haveNotReadUserMessage" icon="el-icon-check" style="float: right;"
|
||||||
|
type="primary" v-on:click="readAllUserMessage">本页标记已读
|
||||||
|
</el-link>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-user-message">
|
<div class="header-user-message">
|
||||||
<el-table :data="userMessageList" border style="width: 100%; margin-bottom: 5px;" max-height="500" size="mini">
|
<el-table :data="userMessageList" border max-height="500"
|
||||||
<el-table-column prop="operatorUserName" label="操作人" width="100px"></el-table-column>
|
size="mini" style="width: 100%; margin-bottom: 5px;">
|
||||||
<el-table-column prop="creationTime" label="操作时间" width="140px"></el-table-column>
|
<el-table-column label="操作人" prop="operatorUserName" width="100px"></el-table-column>
|
||||||
|
<el-table-column label="操作时间" prop="creationTime" width="140px"></el-table-column>
|
||||||
<el-table-column label="内容">
|
<el-table-column label="内容">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row.msgContent}}
|
{{ scope.row.msgContent }}
|
||||||
<el-badge :is-dot="scope.row.msgStatus==0" slot="reference" style="line-height: 10px;padding-right: 5px;">
|
<el-badge slot="reference" :is-dot="scope.row.msgStatus==0"
|
||||||
<el-link type="primary" v-on:click="showUserMessage(scope.row)">查看></el-link>
|
style="line-height: 10px;padding-right: 5px;">
|
||||||
|
<el-link type="primary" v-on:click="showUserMessage(scope.row)">查看>
|
||||||
|
</el-link>
|
||||||
</el-badge>
|
</el-badge>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<div class="page-info-box">
|
<div class="page-info-box">
|
||||||
<el-pagination
|
<el-pagination
|
||||||
@current-change="handleCurrentChange"
|
:current-page="userMsgParam.pageNum"
|
||||||
:page-size="userMsgParam.pageSize"
|
:page-size="userMsgParam.pageSize"
|
||||||
:current-page="userMsgParam.pageNum"
|
:total="userMsgTotalCount"
|
||||||
layout="prev, pager, next, total"
|
layout="prev, pager, next, total"
|
||||||
:total="userMsgTotalCount"
|
@current-change="handleCurrentChange"
|
||||||
>
|
>
|
||||||
</el-pagination>
|
</el-pagination>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
<el-dropdown @command="userSettingDropdown" trigger="click">
|
<el-dropdown trigger="click" @command="userSettingDropdown">
|
||||||
<i class="el-icon-setting head-icon"></i>
|
<i class="el-icon-setting head-icon"></i>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item command="console">控制台</el-dropdown-item>
|
<el-dropdown-item command="console">控制台</el-dropdown-item>
|
||||||
<el-dropdown-item command="aboutDoc">关于</el-dropdown-item>
|
<el-dropdown-item command="aboutDoc">关于</el-dropdown-item>
|
||||||
<el-dropdown-item command="userSignOut" divided>退出登录</el-dropdown-item>
|
<el-dropdown-item command="userSignOut" divided>退出登录</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main style="padding: 0;border-left: 1px solid #dcdfe6;">
|
<el-main style="padding: 0;border-left: 1px solid #dcdfe6;">
|
||||||
<router-view @loadPageList="loadPageList"
|
<router-view :spaceId="choiceSpace"
|
||||||
|
:spaceInfo="getSpaceInfo(choiceSpace)"
|
||||||
@changeExpandedKeys="changeWikiPageExpandedKeys"
|
@changeExpandedKeys="changeWikiPageExpandedKeys"
|
||||||
@switchSpace="switchSpacePage"
|
@loadPageList="loadPageList"
|
||||||
@loadSpace="loadSpaceList"
|
@loadSpace="loadSpaceList"
|
||||||
:spaceId="choiceSpace"
|
@switchSpace="switchSpacePage">
|
||||||
:spaceInfo="getSpaceInfo(choiceSpace)">
|
|
||||||
</router-view>
|
</router-view>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
</el-container>
|
</el-container>
|
||||||
<create-space ref="createSpace" @success="loadSpaceList"></create-space>
|
<create-space ref="createSpace" @success="loadSpaceList"></create-space>
|
||||||
<about-dialog ref="aboutDialog"></about-dialog>
|
<about-dialog ref="aboutDialog"></about-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -116,313 +133,366 @@ import RightResize from './RightResize.vue'
|
|||||||
import aboutDialog from "../../views/common/AboutDialog";
|
import aboutDialog from "../../views/common/AboutDialog";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
leftCollapse: true,
|
leftCollapse: true,
|
||||||
rightContentLoading: false,
|
rightContentLoading: false,
|
||||||
pathIndex: [],
|
pathIndex: [],
|
||||||
defaultProps: {
|
defaultProps: {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'name'
|
label: 'name'
|
||||||
},
|
},
|
||||||
// 空间搜索相关
|
// 空间搜索相关
|
||||||
spaceOptions: [],
|
spaceOptions: [],
|
||||||
spaceList:[],
|
spaceList: [],
|
||||||
choiceSpace: "",
|
choiceSpace: "",
|
||||||
nowSpaceShow: {},
|
nowSpaceShow: {},
|
||||||
nowPageId: '',
|
nowPageId: '',
|
||||||
// 依据目录树存储的map全局对象
|
// 依据目录树存储的map全局对象
|
||||||
treePathDataMap: new Map(),
|
treePathDataMap: new Map(),
|
||||||
// 搜索的输入内容
|
// 搜索的输入内容
|
||||||
searchKeywords: "",
|
searchKeywords: "",
|
||||||
// 页面展示相关
|
// 页面展示相关
|
||||||
wikiPageList:[],
|
wikiPageList: [],
|
||||||
wikiPage: {},
|
wikiPage: {},
|
||||||
wikiPageExpandedKeys: [],
|
wikiPageExpandedKeys: [],
|
||||||
userSelfInfo: {},
|
userSelfInfo: {},
|
||||||
userMessageList: [],
|
userMessageList: [],
|
||||||
haveNotReadUserMessage: false,
|
haveNotReadUserMessage: false,
|
||||||
userMessagePopVisible: false,
|
userMessagePopVisible: false,
|
||||||
userMsgTotalCount: 0,
|
userMsgTotalCount: 0,
|
||||||
userMsgParam: {
|
userMsgParam: {
|
||||||
sysType: 2,
|
sysType: 2,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
},
|
},
|
||||||
rightAsideWidth: 300,
|
rightAsideWidth: 300,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
RightResize,
|
RightResize,
|
||||||
"create-space": CreateSpace,
|
"create-space": CreateSpace,
|
||||||
'about-dialog': aboutDialog
|
'about-dialog': aboutDialog
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
|
||||||
|
mounted: function () {
|
||||||
|
this.loadSpaceList();
|
||||||
|
this.loadUserMessageList();
|
||||||
|
this.getSelfUserInfo();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
loadPageList(param) {
|
||||||
|
param = param || {};
|
||||||
|
this.doGetPageList(param.parentId, param.node);
|
||||||
},
|
},
|
||||||
computed: {
|
turnLeftCollapse() {
|
||||||
},
|
this.leftCollapse = !this.leftCollapse;
|
||||||
mounted: function () {
|
setTimeout(() => {
|
||||||
this.loadSpaceList();
|
if (this.leftCollapse) {
|
||||||
this.loadUserMessageList();
|
this.rightAsideWidthChange(this.rightAsideWidth + 1);
|
||||||
this.getSelfUserInfo();
|
} else {
|
||||||
},
|
this.rightAsideWidthChange(1);
|
||||||
methods: {
|
|
||||||
loadPageList(param) {
|
|
||||||
param = param || {};
|
|
||||||
this.doGetPageList(param.parentId, param.node);
|
|
||||||
},
|
|
||||||
turnLeftCollapse() {
|
|
||||||
this.leftCollapse = !this.leftCollapse;
|
|
||||||
setTimeout(() => {
|
|
||||||
if (this.leftCollapse) {
|
|
||||||
this.rightAsideWidthChange(this.rightAsideWidth + 1);
|
|
||||||
} else {
|
|
||||||
this.rightAsideWidthChange(1);
|
|
||||||
}
|
|
||||||
}, 100);
|
|
||||||
},
|
|
||||||
createWiki() {
|
|
||||||
if (this.choiceSpace > 0) {
|
|
||||||
this.$router.push({path: '/page/edit', query: {parentId: this.nowPageId}});
|
|
||||||
} else {
|
|
||||||
this.$message.warning("请先选择或创建空间");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
changeWikiPageExpandedKeys(pageId) {
|
|
||||||
// 展开没有触发子节点的加载,如果去加载子节点有还找不到当前的node,暂不展开
|
|
||||||
// this.wikiPageExpandedKeys = [pageId];
|
|
||||||
},
|
|
||||||
doSearchByKeywords(queryString, callback) {
|
|
||||||
if (!queryString || !queryString.trim()) {
|
|
||||||
callback([]);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
pageApi.pageNews({spaceId: this.choiceSpace, keywords: queryString}).then(json => {
|
}, 100);
|
||||||
let spacePageNews = json.data || [];
|
},
|
||||||
callback(spacePageNews);
|
createWiki() {
|
||||||
});
|
if (this.choiceSpace > 0) {
|
||||||
},
|
this.$router.push({path: '/page/edit', query: {parentId: this.nowPageId}});
|
||||||
handleSearchKeywordsSelect(item) {
|
} else {
|
||||||
this.searchKeywords = '';
|
this.$message.warning("请先选择或创建空间");
|
||||||
this.$router.push({path: '/page/show', query: {pageId: item.pageId}});
|
}
|
||||||
},
|
},
|
||||||
searchByKeywords() {
|
changeWikiPageExpandedKeys(pageId) {
|
||||||
this.$refs.wikiPageTree.filter(this.searchKeywords);
|
// 展开没有触发子节点的加载,如果去加载子节点有还找不到当前的node,暂不展开
|
||||||
},
|
// this.wikiPageExpandedKeys = [pageId];
|
||||||
searchByKeywordsNewPage() {
|
},
|
||||||
var routeUrl = this.$router.resolve({path: '/page/search', query: {keywords: this.searchKeywords}});
|
doSearchByKeywords(queryString, callback) {
|
||||||
window.open(routeUrl.href, '_blank');
|
if (!queryString || !queryString.trim()) {
|
||||||
},
|
callback([]);
|
||||||
handleNodeClick(data) {
|
return;
|
||||||
console.log("点击节点:", data);
|
}
|
||||||
this.nowPageId = data.id;
|
pageApi.pageNews({spaceId: this.choiceSpace, keywords: queryString}).then(json => {
|
||||||
this.$router.push({path: '/page/show', query: {pageId: data.id}});
|
let spacePageNews = json.data || [];
|
||||||
this.handleNodeExpand(data);
|
callback(spacePageNews);
|
||||||
},
|
});
|
||||||
handleNodeExpand(node) {
|
},
|
||||||
if (node.children.length > 0 && node.children[0].needLoad) {
|
handleSearchKeywordsSelect(item) {
|
||||||
console.log("加载节点:", node);
|
this.searchKeywords = '';
|
||||||
this.doGetPageList(node.id, node);
|
this.$router.push({path: '/page/show', query: {pageId: item.pageId}});
|
||||||
}
|
},
|
||||||
},
|
searchByKeywords() {
|
||||||
handlePageDrop(draggingNode, dropNode, dropType, ev) {
|
this.$refs.wikiPageTree.filter(this.searchKeywords);
|
||||||
console.log('tree drop: ', draggingNode.data, dropNode.data, dropType);
|
},
|
||||||
// 'prev'、'inner'、'next'
|
searchByKeywordsNewPage() {
|
||||||
// before、after、inner
|
var routeUrl = this.$router.resolve({path: '/page/search', query: {keywords: this.searchKeywords}});
|
||||||
var param = {id: draggingNode.data.id, parentId: dropNode.data.parentId};
|
window.open(routeUrl.href, '_blank');
|
||||||
if (dropType == 'inner') {
|
},
|
||||||
param.parentId = dropNode.data.id;
|
handleNodeClick(data) {
|
||||||
} else if (dropType == 'before') {
|
console.log("点击节点:", data, this.nowPageId);
|
||||||
param.beforeSeq = dropNode.data.seqNo;
|
this.nowPageId = data.id;
|
||||||
} else if (dropType == 'after') {
|
this.$router.push({path: '/page/show', query: {pageId: data.id}});
|
||||||
param.afterSeq = dropNode.data.seqNo;
|
this.handleNodeExpand(data);
|
||||||
}
|
},
|
||||||
pageApi.pageChangeParent(param).then(res => {
|
handleNodeExpand(node) {
|
||||||
this.doGetPageList(null);
|
if (node.children && node.children.length > 0 && node.children[0].needLoad) {
|
||||||
});
|
console.log("加载节点:", node);
|
||||||
},
|
this.doGetPageList(node.id, node);
|
||||||
loadUserMessageIfPopVisible() {
|
}
|
||||||
if (!this.userMessagePopVisible) {
|
},
|
||||||
this.loadUserMessageList();
|
handlePageDrop(draggingNode, dropNode, dropType, ev) {
|
||||||
}
|
console.log('tree drop: ', draggingNode.data, dropNode.data, dropType);
|
||||||
},
|
// 'prev'、'inner'、'next'
|
||||||
loadUserMessageList() {
|
// before、after、inner
|
||||||
userApi.getUserMessageList(this.userMsgParam).then(res => {
|
var param = {id: draggingNode.data.id, parentId: dropNode.data.parentId};
|
||||||
this.userMessageList = res.data || [];
|
if (dropType == 'inner') {
|
||||||
this.userMsgTotalCount = res.total || 0;
|
param.parentId = dropNode.data.id;
|
||||||
this.haveNotReadUserMessage = (this.userMessageList.filter(item => item.msgStatus == 0).length) > 0;
|
} else if (dropType == 'before') {
|
||||||
});
|
param.beforeSeq = dropNode.data.seqNo;
|
||||||
},
|
} else if (dropType == 'after') {
|
||||||
showUserMessage(row) {
|
param.afterSeq = dropNode.data.seqNo;
|
||||||
if (row.msgStatus == 0) {
|
}
|
||||||
userApi.readUserMessage({ids: row.id}).then(() => {
|
pageApi.pageChangeParent(param).then(res => {
|
||||||
this.loadUserMessageList();
|
this.doGetPageList(null);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
if (row.msgType >= 2 && row.msgType <= 12) {
|
loadUserMessageIfPopVisible() {
|
||||||
this.$router.push({path: '/page/show', query: {pageId: row.dataId}});
|
if (!this.userMessagePopVisible) {
|
||||||
this.userMessagePopVisible = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
readAllUserMessage() {
|
|
||||||
let msgIds = [];
|
|
||||||
this.userMessageList.filter(item => item.msgStatus == 0).forEach(item => {
|
|
||||||
msgIds.push(item.id);
|
|
||||||
});
|
|
||||||
if (msgIds.length <= 0) return;
|
|
||||||
userApi.readUserMessage({ids: msgIds.join(',')}).then(() => {
|
|
||||||
this.$message.success("标记成功");
|
|
||||||
this.loadUserMessageList();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleCurrentChange(val) {
|
|
||||||
this.userMsgParam.pageNum = val;
|
|
||||||
this.loadUserMessageList();
|
this.loadUserMessageList();
|
||||||
},
|
}
|
||||||
filterPageNode(value, data) {
|
},
|
||||||
if (!value || !data.name) return true;
|
loadUserMessageList() {
|
||||||
// issues:I2CG72 忽略大小写
|
userApi.getUserMessageList(this.userMsgParam).then(res => {
|
||||||
let name = data.name.toLowerCase();
|
this.userMessageList = res.data || [];
|
||||||
return name.indexOf(value.toLowerCase()) !== -1;
|
this.userMsgTotalCount = res.total || 0;
|
||||||
},
|
this.haveNotReadUserMessage = (this.userMessageList.filter(item => item.msgStatus == 0).length) > 0;
|
||||||
spaceChangeEvents(data) {
|
});
|
||||||
if (data == 0) {
|
},
|
||||||
// 新建空间
|
showUserMessage(row) {
|
||||||
this.$refs.createSpace.show();
|
if (row.msgStatus == 0) {
|
||||||
} else if (data == -1) {
|
userApi.readUserMessage({ids: row.id}).then(() => {
|
||||||
// 管理空间
|
this.loadUserMessageList();
|
||||||
this.$router.push({path: '/space/manage'});
|
});
|
||||||
} else {
|
}
|
||||||
this.choiceSpace = data;
|
if (row.msgType >= 2 && row.msgType <= 12) {
|
||||||
for (let i = 0; i < this.spaceList.length; i++) {
|
this.$router.push({path: '/page/show', query: {pageId: row.dataId}});
|
||||||
if (this.spaceList[i].id == data) {
|
this.userMessagePopVisible = false;
|
||||||
this.nowSpaceShow = this.spaceList[i];
|
}
|
||||||
break;
|
},
|
||||||
}
|
readAllUserMessage() {
|
||||||
}
|
let msgIds = [];
|
||||||
|
this.userMessageList.filter(item => item.msgStatus == 0).forEach(item => {
|
||||||
|
msgIds.push(item.id);
|
||||||
|
});
|
||||||
|
if (msgIds.length <= 0) return;
|
||||||
|
userApi.readUserMessage({ids: msgIds.join(',')}).then(() => {
|
||||||
|
this.$message.success("标记成功");
|
||||||
|
this.loadUserMessageList();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
this.userMsgParam.pageNum = val;
|
||||||
|
this.loadUserMessageList();
|
||||||
|
},
|
||||||
|
filterPageNode(value, data) {
|
||||||
|
if (!value || !data.name) return true;
|
||||||
|
// issues:I2CG72 忽略大小写
|
||||||
|
let name = data.name.toLowerCase();
|
||||||
|
return name.indexOf(value.toLowerCase()) !== -1;
|
||||||
|
},
|
||||||
|
spaceChangeEvents(data) {
|
||||||
|
if (data == 0) {
|
||||||
|
// 新建空间
|
||||||
|
this.$refs.createSpace.show();
|
||||||
|
} else if (data == -1) {
|
||||||
|
// 管理空间
|
||||||
|
this.$router.push({path: '/space/manage'});
|
||||||
|
} else {
|
||||||
|
this.choiceSpace = data;
|
||||||
|
for (let i = 0; i < this.spaceList.length; i++) {
|
||||||
|
if (this.spaceList[i].id == data) {
|
||||||
|
this.nowSpaceShow = this.spaceList[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.nowPageId = '';
|
||||||
|
this.doGetPageList(null);
|
||||||
|
this.$router.push({path: '/home', query: {spaceId: data}});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loadSpaceList(spaceId) {
|
||||||
|
pageApi.spaceList({}).then(json => {
|
||||||
|
this.spaceList = json.data || [];
|
||||||
|
let spaceOptions = [];
|
||||||
|
this.spaceList.forEach(item => spaceOptions.push({label: item.name, value: item.id}));
|
||||||
|
this.spaceOptions = spaceOptions;
|
||||||
|
if (this.spaceList.length > 0) {
|
||||||
|
let nowSpaceId = spaceId;
|
||||||
|
let nowSpaceShow = this.spaceList.find(item => item.id == spaceId);
|
||||||
|
if (!nowSpaceShow) {
|
||||||
|
nowSpaceShow = this.spaceList[0];
|
||||||
|
nowSpaceId = nowSpaceShow.id;
|
||||||
|
}
|
||||||
|
this.nowSpaceShow = nowSpaceShow;
|
||||||
|
this.choiceSpace = nowSpaceId;
|
||||||
this.nowPageId = '';
|
this.nowPageId = '';
|
||||||
this.doGetPageList(null);
|
this.doGetPageList(null);
|
||||||
this.$router.push({path: '/home', query: {spaceId: data}});
|
// TODO 在首页时跳转
|
||||||
}
|
try {
|
||||||
},
|
if (this.$router.app._route.path == "/home") {
|
||||||
loadSpaceList(spaceId) {
|
this.$router.push({path: '/home', query: {spaceId: nowSpaceId}});
|
||||||
pageApi.spaceList({}).then(json => {
|
|
||||||
this.spaceList = json.data || [];
|
|
||||||
let spaceOptions = [];
|
|
||||||
this.spaceList.forEach(item => spaceOptions.push({label: item.name, value: item.id}));
|
|
||||||
this.spaceOptions = spaceOptions;
|
|
||||||
if (this.spaceList.length > 0) {
|
|
||||||
let nowSpaceId = spaceId;
|
|
||||||
let nowSpaceShow = this.spaceList.find(item => item.id == spaceId);
|
|
||||||
if (!nowSpaceShow) {
|
|
||||||
nowSpaceShow = this.spaceList[0];
|
|
||||||
nowSpaceId = nowSpaceShow.id;
|
|
||||||
}
|
}
|
||||||
this.nowSpaceShow = nowSpaceShow;
|
} catch (e) {
|
||||||
this.choiceSpace = nowSpaceId;
|
console.log(e);
|
||||||
this.nowPageId = '';
|
|
||||||
this.doGetPageList(null);
|
|
||||||
// TODO 在首页时跳转
|
|
||||||
try {
|
|
||||||
if (this.$router.app._route.path == "/home") {
|
|
||||||
this.$router.push({path: '/home', query: {spaceId: nowSpaceId}});
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
doGetPageList(parentId, node) {
|
|
||||||
let param = {spaceId: this.choiceSpace};
|
|
||||||
pageApi.pageList(param).then(json => {
|
|
||||||
this.wikiPageList = json.data || [];
|
|
||||||
});
|
|
||||||
},
|
|
||||||
userSettingDropdown(command) {
|
|
||||||
console.log("command:" + command);
|
|
||||||
if (command == 'userSignOut') {
|
|
||||||
this.userSignOut();
|
|
||||||
} else if (command == 'aboutDoc') {
|
|
||||||
this.$refs.aboutDialog.show();
|
|
||||||
} else if (command == 'myInfo') {
|
|
||||||
this.$router.push({path: '/user/myInfo'});
|
|
||||||
} else if (command == 'console') {
|
|
||||||
window.open(process.env.VUE_APP_BASE_API, '_blank');
|
|
||||||
} else {
|
|
||||||
this.$message.warning("暂未开放");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
userSignOut() {
|
|
||||||
userApi.userLogout().then(() => {
|
|
||||||
location.reload();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getSelfUserInfo() {
|
|
||||||
userApi.getSelfUserInfo().then(json=>{
|
|
||||||
this.userSelfInfo = json.data;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getSpaceInfo(spaceId) {
|
|
||||||
for (let i = 0; i < this.spaceList.length; i++) {
|
|
||||||
if (this.spaceList[i].id == spaceId) {
|
|
||||||
return this.spaceList[i];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {};
|
});
|
||||||
},
|
},
|
||||||
switchSpacePage(spaceId) {
|
doGetPageList(parentId, node) {
|
||||||
spaceId = parseInt(spaceId);
|
let param = {spaceId: this.choiceSpace};
|
||||||
if (this.choiceSpace == spaceId) {
|
pageApi.pageList(param).then(json => {
|
||||||
return;
|
this.wikiPageList = json.data || [];
|
||||||
}
|
// 设置默认选中效果
|
||||||
this.choiceSpace = spaceId;
|
this.$nextTick(() => {
|
||||||
this.doGetPageList(null);
|
this.nowPageId = this.$route.query.pageId
|
||||||
},
|
if (this.nowPageId) {
|
||||||
rightAsideWidthChange(width) {
|
console.log("moern?")
|
||||||
this.$store.commit('global/setRightAsideWidth', width);
|
this.$refs['wikiPageTree'].setCurrentKey(this.nowPageId)
|
||||||
},
|
}
|
||||||
}
|
})
|
||||||
}
|
});
|
||||||
|
},
|
||||||
|
userSettingDropdown(command) {
|
||||||
|
console.log("command:" + command);
|
||||||
|
if (command == 'userSignOut') {
|
||||||
|
this.userSignOut();
|
||||||
|
} else if (command == 'aboutDoc') {
|
||||||
|
this.$refs.aboutDialog.show();
|
||||||
|
} else if (command == 'myInfo') {
|
||||||
|
this.$router.push({path: '/user/myInfo'});
|
||||||
|
} else if (command == 'console') {
|
||||||
|
window.open(process.env.VUE_APP_BASE_API, '_blank');
|
||||||
|
} else {
|
||||||
|
this.$message.warning("暂未开放");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
userSignOut() {
|
||||||
|
userApi.userLogout().then(() => {
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getSelfUserInfo() {
|
||||||
|
userApi.getSelfUserInfo().then(json => {
|
||||||
|
this.userSelfInfo = json.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getSpaceInfo(spaceId) {
|
||||||
|
for (let i = 0; i < this.spaceList.length; i++) {
|
||||||
|
if (this.spaceList[i].id == spaceId) {
|
||||||
|
return this.spaceList[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
switchSpacePage(spaceId) {
|
||||||
|
spaceId = parseInt(spaceId);
|
||||||
|
if (this.choiceSpace == spaceId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.choiceSpace = spaceId;
|
||||||
|
this.doGetPageList(null);
|
||||||
|
},
|
||||||
|
rightAsideWidthChange(width) {
|
||||||
|
this.$store.commit('global/setRightAsideWidth', width);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
html, body {
|
html, body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
.global-layout-vue{height: 100%;}
|
|
||||||
|
|
||||||
#app, .el-container, .el-menu {
|
.global-layout-vue {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
.el-header {
|
|
||||||
background-color: #1D4E89 !important;
|
#app, .el-container, .el-menu {
|
||||||
}
|
height: 100%;
|
||||||
.header-right-user-name{color: #fff;padding-right: 5px;}
|
}
|
||||||
.el-header {color: #333; line-height: 40px; text-align: right;height: 40px !important;}
|
|
||||||
.el-icon-fold{float: left;font-size: 25px;color: #aaa;margin-top: 8px;cursor: pointer;}
|
.el-header {
|
||||||
.el-icon-fold:hover{color: #eee;}
|
background-color: #1D4E89 !important;
|
||||||
.head-icon{margin-right: 15px; font-size: 16px;cursor: pointer;color: #fff;}
|
}
|
||||||
.header-user-message .page-info-box{text-align: right;margin-top: 10px;}
|
|
||||||
.upgrade-info{max-height: 150px;overflow-y: auto;word-break: break-all; white-space: pre-wrap; line-height: 26px;}
|
.header-right-user-name {
|
||||||
.search-option-item {
|
color: #fff;
|
||||||
white-space: nowrap;
|
padding-right: 5px;
|
||||||
overflow: hidden;
|
}
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
.el-header {
|
||||||
.search-option-item .title {
|
color: #333;
|
||||||
font-weight: bold;
|
line-height: 40px;
|
||||||
white-space: nowrap;
|
text-align: right;
|
||||||
overflow: hidden;
|
height: 40px !important;
|
||||||
text-overflow: ellipsis;
|
}
|
||||||
}
|
|
||||||
.search-option-item .content {
|
.el-icon-fold {
|
||||||
font-size: 12px;
|
float: left;
|
||||||
color: #888;
|
font-size: 25px;
|
||||||
}
|
color: #aaa;
|
||||||
.search-autocomplete {
|
margin-top: 8px;
|
||||||
width: 600px !important;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-icon-fold:hover {
|
||||||
|
color: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.head-icon {
|
||||||
|
margin-right: 15px;
|
||||||
|
font-size: 16px;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-user-message .page-info-box {
|
||||||
|
text-align: right;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upgrade-info {
|
||||||
|
max-height: 150px;
|
||||||
|
overflow-y: auto;
|
||||||
|
word-break: break-all;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
line-height: 26px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-option-item {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-option-item .title {
|
||||||
|
font-weight: bold;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-option-item .content {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-autocomplete {
|
||||||
|
width: 600px !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import routes from './routes'
|
|||||||
import store from './store/index'
|
import store from './store/index'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import VueAxios from 'vue-axios'
|
import VueAxios from 'vue-axios'
|
||||||
|
// 注册一个全局自定义指令
|
||||||
|
import hljs from 'highlight.js'
|
||||||
|
import 'highlight.js/styles/googlecode.css'
|
||||||
|
|
||||||
Vue.use(ElementUI);
|
Vue.use(ElementUI);
|
||||||
Vue.use(VueRouter);
|
Vue.use(VueRouter);
|
||||||
@@ -15,28 +18,31 @@ Vue.use(VueAxios, axios);
|
|||||||
|
|
||||||
// 公用方法
|
// 公用方法
|
||||||
Vue.prototype.$store = store;
|
Vue.prototype.$store = store;
|
||||||
|
// 路由重复点击报错处理
|
||||||
|
const originalPush = VueRouter.prototype.push
|
||||||
|
VueRouter.prototype.push = function push(location) {
|
||||||
|
return originalPush.call(this, location).catch(err => err)
|
||||||
|
}
|
||||||
|
|
||||||
const router = new VueRouter({routes});
|
const router = new VueRouter({routes});
|
||||||
// 路由跳转时判断处理
|
// 路由跳转时判断处理
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
if (to.name) {
|
if (to.name) {
|
||||||
document.title = to.name;
|
document.title = to.name;
|
||||||
}
|
}
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let vue = new Vue({
|
let vue = new Vue({
|
||||||
el: '#app',
|
el: '#app',
|
||||||
router,
|
router,
|
||||||
render(h) {
|
render(h) {
|
||||||
return h(App);
|
return h(App);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 注册一个全局自定义指令
|
|
||||||
import hljs from 'highlight.js'
|
|
||||||
import 'highlight.js/styles/googlecode.css'
|
|
||||||
|
|
||||||
Vue.directive('highlight', function (el) {
|
Vue.directive('highlight', function (el) {
|
||||||
let blocks = el.querySelectorAll('pre code');
|
let blocks = el.querySelectorAll('pre code');
|
||||||
blocks.forEach((block) => {
|
blocks.forEach((block) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user