登录页开发,控制台页面开发,页面跳转逻辑调整
This commit is contained in:
@@ -17,10 +17,10 @@
|
||||
<div v-if="wikiPage.editorType === 1">
|
||||
<WangEditor ref="wangEditorRef" :pageId="pageId"></WangEditor>
|
||||
</div>
|
||||
<div v-else-if="wikiPage.editorType === 2" style="padding: 10px; background: #fff;">
|
||||
<div v-else-if="wikiPage.editorType === 2" style="padding: 5px 8px 5px; background: #fff;">
|
||||
<mavonEditor ref="mavonEditorRef" v-model="markdownContent" :toolbars="toolbars" :externalLink="false"
|
||||
@save="createWikiSave(0)" @imgAdd="addMarkdownImage" placeholder="请录入文档内容"
|
||||
class="page-content-editor wang-editor-body" style="height: calc(100vh - 100px);z-index: 1;"/>
|
||||
class="page-content-editor wang-editor-body" style="height: calc(100vh - 80px);z-index: 1;"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -219,8 +219,8 @@ const addMarkdownImage = (pos, file) => {
|
||||
<style lang="scss">
|
||||
.fake-header {
|
||||
color: #333;
|
||||
height: 60px !important;
|
||||
line-height: 60px !important;
|
||||
height: 50px !important;
|
||||
line-height: 50px !important;
|
||||
|
||||
.fold-btn {
|
||||
font-size: 18px;
|
||||
|
||||
@@ -173,10 +173,19 @@ let pageContentRef = ref();
|
||||
const initQueryParam = (to) => {
|
||||
spaceId = parseInt(to.params.spaceId);
|
||||
pageId = parseInt(to.params.pageId);
|
||||
clearPageData();
|
||||
if (!!pageId) {
|
||||
loadPageDetail(pageId);
|
||||
}
|
||||
}
|
||||
const clearPageData = () => {
|
||||
wikiPage.value = {};
|
||||
wikiPageAuth.value = {};
|
||||
pageContent.value = '';
|
||||
pageContentShow.value = '';
|
||||
storePage.pageInfo = {};
|
||||
storePage.pageAuth = {};
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
<template>
|
||||
<div class="left-aside-box">
|
||||
<div class="left-aside-top-box">
|
||||
<el-select :model-value="storeSpace.chooseSpaceId" @change="spaceChangeEvents" filterable
|
||||
placeholder="选择空间" class="choice-space-select">
|
||||
<el-option-group label="" v-if="!props.readOnly">
|
||||
<el-option :key="-1" label="空间管理" :value="-1"></el-option>
|
||||
</el-option-group>
|
||||
<el-option-group label=""></el-option-group>
|
||||
<el-option v-for="item in storeSpace.spaceOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
<a-row type="flex" style="flex-flow: row nowrap;">
|
||||
<a-col flex="32px" style="margin-right: -1px;">
|
||||
<a-tooltip title="返回首页" placement="right" :mouseEnterDelay="0.5">
|
||||
<a-button @click="openHomePage" :icon="h(HomeOutlined)" class="home-page-btn"/>
|
||||
</a-tooltip>
|
||||
</a-col>
|
||||
<a-col flex="auto">
|
||||
<el-select v-model="storeSpace.chooseSpaceId" @change="spaceChangeEvents" filterable
|
||||
placeholder="选择空间" class="choice-space-select">
|
||||
<el-option v-for="item in storeSpace.spaceOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<el-autocomplete v-model="searchKeywords" v-if="!props.readOnly" :fetch-suggestions="doSearchByKeywords"
|
||||
@select="handleSearchKeywordsSelect" placeholder="在当前空间搜索"
|
||||
popper-class="search-autocomplete-popper" class="search-autocomplete">
|
||||
@@ -38,7 +43,7 @@
|
||||
</div>
|
||||
<div v-show="!spaceTreeIsClose" class="wiki-page-tree-box">
|
||||
<el-tree ref="wikiPageTreeRef" :current-node-key="props.nowPageId" :data="storePage.wikiPageList"
|
||||
:default-expanded-keys="wikiPageExpandedKeys" :expand-on-click-node="true" :class="explanClass"
|
||||
:default-expanded-keys="wikiPageExpandedKeys" :expand-on-click-node="true"
|
||||
:filter-node-method="filterPageNode" :props="defaultProps" :draggable="!props.readOnly"
|
||||
@node-click="handleNodeClick" @node-drop="handlePageDrop" node-key="id" highlight-current
|
||||
style="background-color: #fafafa;">
|
||||
@@ -112,7 +117,7 @@ import {
|
||||
EditTwo as IconParkEditTwo,
|
||||
PageTemplate as IconParkPageTemplate,
|
||||
} from '@icon-park/vue-next'
|
||||
import { EllipsisOutlined } from '@ant-design/icons-vue';
|
||||
import { EllipsisOutlined, HomeOutlined } from '@ant-design/icons-vue';
|
||||
import {ref, defineProps, defineEmits, defineExpose, onMounted, h, watch} from 'vue';
|
||||
import {useRouter, useRoute} from "vue-router";
|
||||
import pageApi from '@/assets/api/page';
|
||||
@@ -122,8 +127,6 @@ import AddMenu from "./AddMenu.vue";
|
||||
import IconDocument from "@/components/base/IconDocument.vue";
|
||||
import {ElMessageBox, ElMessage} from 'element-plus';
|
||||
import {useStoreSpaceData} from "@/store/spaceData";
|
||||
import Navigation from "@/views/page/show/Navigation.vue";
|
||||
import PageZan from "@/views/page/show/PageZan.vue";
|
||||
import MessagePrompt from "@/components/single/MessagePrompt";
|
||||
|
||||
let route = useRoute();
|
||||
@@ -132,11 +135,7 @@ let storePage = useStorePageData();
|
||||
let storeDisplay = useStoreDisplay();
|
||||
let storeSpace = useStoreSpaceData();
|
||||
|
||||
let emit = defineEmits(['spaceChangeEvents', 'setNowPageId']);
|
||||
let searchKeywords = ref('');
|
||||
let descriptorForTree = ref("点击收起目录");
|
||||
let explan = ref(false);
|
||||
let explanClass = ref("el-tree");
|
||||
let wikiPageExpandedKeys = ref([]);
|
||||
let defaultProps = ref({children: 'children', label: 'name',});
|
||||
let wikiPageTreeRef = ref();
|
||||
@@ -153,8 +152,20 @@ onMounted(() => {
|
||||
watch(() => storePage.eventPageListUpdate, () => {
|
||||
loadSpaceList();
|
||||
});
|
||||
watch(() => storeSpace.spaceInfo, () => {
|
||||
doGetPageList();
|
||||
});
|
||||
let openHomePage = (event) => {
|
||||
if (event.ctrlKey) {
|
||||
let routeUrl = router.resolve({path: `/wiki/space`});
|
||||
window.open(routeUrl.href, '_blank');
|
||||
} else {
|
||||
router.push({path: '/wiki/space'});
|
||||
}
|
||||
}
|
||||
let nowSpaceShow = ref({});
|
||||
const loadSpaceList = (spaceId) => {
|
||||
const loadSpaceList = () => {
|
||||
let spaceId = parseInt(route.params.spaceId);
|
||||
pageApi.spaceList({}).then((json) => {
|
||||
storeSpace.spaceList = json.data || [];
|
||||
let spaceOptionsNew = [];
|
||||
@@ -172,14 +183,6 @@ const loadSpaceList = (spaceId) => {
|
||||
storeSpace.chooseSpaceId = nowSpaceId;
|
||||
storePage.choosePageId = 0;
|
||||
doGetPageList();
|
||||
// TODO 在首页时跳转
|
||||
try {
|
||||
if (route.path === '/home') {
|
||||
router.push({path: '/home', query: {spaceId: nowSpaceId}});
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -188,7 +191,7 @@ const changeNodeOptionStatus = (param) => {
|
||||
optionPageId.value = param.id;
|
||||
}
|
||||
const assisSetCurrentKey = () => {
|
||||
emit('setNowPageId', route.query.pageId, props.readOnly);
|
||||
// emit('setNowPageId', route.query.pageId, props.readOnly);
|
||||
if (props.nowPageId) {
|
||||
wikiPageTreeRef.value.setCurrentKey(nowPageId.value);
|
||||
}
|
||||
@@ -257,7 +260,12 @@ const deleteWikiPage = (data) => {
|
||||
});
|
||||
}
|
||||
const spaceChangeEvents = (data) => {
|
||||
emit('spaceChangeEvents', data, props.readOnly);
|
||||
let nowSpaceShowTemp = storeSpace.spaceList.find((item) => item.id === data);
|
||||
nowSpaceShow.value = nowSpaceShowTemp;
|
||||
storeSpace.spaceInfo = nowSpaceShowTemp;
|
||||
storeSpace.chooseSpaceId = data;
|
||||
storePage.choosePageId = 0;
|
||||
router.push({path: `/view/${data}`});
|
||||
}
|
||||
const doRename = (node, data) => {
|
||||
pageApi.renamePage({"id": data.id, "name": data.name}).then((json) => {
|
||||
@@ -266,6 +274,8 @@ const doRename = (node, data) => {
|
||||
});
|
||||
}
|
||||
const doGetPageList = () => {
|
||||
storePage.pageList = [];
|
||||
storePage.favoritePageList = [];
|
||||
let param = {spaceId: storeSpace.chooseSpaceId};
|
||||
pageApi.pageList(param).then((json) => {
|
||||
storePage.wikiPageList = json.data || [];
|
||||
@@ -334,9 +344,22 @@ defineExpose({searchByKeywords});
|
||||
.left-aside-top-box {
|
||||
padding: 10px;
|
||||
|
||||
.home-page-btn {
|
||||
border-radius: 4px 0 0 4px;
|
||||
z-index: 0;
|
||||
|
||||
&:hover, &:focus, &:active {
|
||||
z-index: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.choice-space-select {
|
||||
width: 100%;
|
||||
margin-bottom: 5px;
|
||||
|
||||
.el-input__wrapper {
|
||||
border-radius: 0 4px 4px 0;
|
||||
}
|
||||
}
|
||||
|
||||
.search-autocomplete {
|
||||
|
||||
@@ -9,14 +9,8 @@ import {toRefs, ref, reactive, onMounted, onBeforeUnmount, watch, defineEmits, c
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: Number,
|
||||
max: {
|
||||
type: Number,
|
||||
default: 600
|
||||
},
|
||||
min: {
|
||||
type: Number,
|
||||
default: 300
|
||||
}
|
||||
max: {type: Number, default: 600},
|
||||
min: {type: Number, default: 200}
|
||||
});
|
||||
let emit = defineEmits(['update:modelValue', 'change']);
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ defineExpose({setContent, getContent, getPreview});
|
||||
.wang-editor-box .wang-editor-content {
|
||||
padding: 20px 0;
|
||||
overflow: auto;
|
||||
height: calc(100vh - 140px);
|
||||
height: calc(100vh - 130px);
|
||||
}
|
||||
|
||||
.wang-editor-box .w-e-bar-item {
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<div class="comment-input-box">
|
||||
<textarea rows="5" placeholder="发表评论" v-model="commentTextInput" :maxlength="500"></textarea>
|
||||
<div class="comment-btn-box">
|
||||
<el-button type="primary" size="small" @click="submitPageComment">发送</el-button>
|
||||
<a-button @click="submitPageComment">发送</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -56,7 +56,6 @@ let page = {
|
||||
// 评论相关
|
||||
let commentTextInput = ref('');
|
||||
let commentList = ref([]);
|
||||
let recommentInfo = ref({});
|
||||
|
||||
let route = useRoute();
|
||||
let router = useRouter();
|
||||
@@ -82,7 +81,6 @@ const loadCommentList = () => {
|
||||
if (!storePage.pageInfo || !storePage.pageInfo.id) {
|
||||
return;
|
||||
}
|
||||
cancelCommentUser();
|
||||
pageApi.pageCommentList({pageId: storePage.pageInfo.id}).then((json) => {
|
||||
let commentListRes = json.data || [];
|
||||
for (let i = 0; i < commentListRes.length; i++) {
|
||||
@@ -109,9 +107,6 @@ const deleteComment = (id) => {
|
||||
loadCommentList();
|
||||
});
|
||||
}
|
||||
const cancelCommentUser = () => {
|
||||
recommentInfo.value = {};
|
||||
}
|
||||
const submitPageComment = () => {
|
||||
if (commentTextInput.value.length <= 0) {
|
||||
ElMessage.error('请输入评论内容');
|
||||
@@ -120,7 +115,6 @@ const submitPageComment = () => {
|
||||
let param = {
|
||||
pageId: storePage.pageInfo.id,
|
||||
content: commentTextInput.value,
|
||||
parentId: recommentInfo.value.id,
|
||||
}
|
||||
pageApi.updatePageComment(param).then((json) => {
|
||||
let data = json.data;
|
||||
|
||||
Reference in New Issue
Block a user