|
|
|
@ -16,16 +16,16 @@
|
|
|
|
|
</div>
|
|
|
|
|
<el-button type="primary" @click="toggleSidebar()" style="display:none"
|
|
|
|
|
id="toggleSidebarButton">打开/关闭侧边栏</el-button>
|
|
|
|
|
<div class="sidebar" :class="{ 'active': isSidebarOpen }">
|
|
|
|
|
<div class="sidebar" :class="{ 'active': isSidebarOpen }" >
|
|
|
|
|
<!-- 侧边栏内容 -->
|
|
|
|
|
<el-menu class="sidebar-menu" :class="{ 'active': isNavbarOpen }" :collapse="isNavbarOpen">
|
|
|
|
|
<el-sub-menu index="1" class="horizontal-sub-menu">
|
|
|
|
|
<template #title>智能助手</template>
|
|
|
|
|
<el-menu-item index="1-1" @click="showContent('polish')">润色</el-menu-item>
|
|
|
|
|
<el-menu-item index="1-2" @click="showContent('rewrite')">改写</el-menu-item>
|
|
|
|
|
<el-menu-item index="1-3" @click="showContent('summary')">摘要</el-menu-item>
|
|
|
|
|
<el-menu-item index="1-4" @click="showContent('edit')">修改</el-menu-item>
|
|
|
|
|
<el-menu-item index="1-5" @click="showContent('translate')">翻译</el-menu-item>
|
|
|
|
|
<el-menu-item index="1-1" @click="showRefineDOCContent('decoration')">润色</el-menu-item>
|
|
|
|
|
<el-menu-item index="1-2" @click="showRefineDOCContent('extension')">续写</el-menu-item>
|
|
|
|
|
<el-menu-item index="1-3" @click="showRefineDOCContent('summary')">摘要</el-menu-item>
|
|
|
|
|
<el-menu-item index="1-4" @click="showRefineDOCContent('correction')">修改</el-menu-item>
|
|
|
|
|
<el-menu-item index="1-5" @click="showRefineDOCContent('translation')">翻译</el-menu-item>
|
|
|
|
|
</el-sub-menu>
|
|
|
|
|
<el-sub-menu index="2" class="horizontal-sub-menu">
|
|
|
|
|
<template #title>图文转换</template>
|
|
|
|
@ -41,11 +41,19 @@
|
|
|
|
|
<!-- Content Sections -->
|
|
|
|
|
<div v-if="currentContent" class="content-section">
|
|
|
|
|
<!-- Dynamic content based on navigation selection -->
|
|
|
|
|
<div v-if="currentContent === 'polish'">润色内容</div>
|
|
|
|
|
<div v-if="currentContent === 'rewrite'">改写内容</div>
|
|
|
|
|
<div v-if="currentContent === 'summary'">摘要内容</div>
|
|
|
|
|
<div v-if="currentContent === 'edit'">修改内容</div>
|
|
|
|
|
<div v-if="currentContent === 'translate'">翻译内容</div>
|
|
|
|
|
<div v-if="currentContent === 'refine_doc'" id='refine_doc_block'>
|
|
|
|
|
<div class="refine_docs" id="refine_docs">
|
|
|
|
|
<el-button style="margin-left: 10px; width: 40px; height: 40px;" @click="clearRefineDOCContent()"><svg t="1731509926355" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8154" width="20" height="20"><path d="M1011.43552 981.92384l-68.4032-394.40384h23.10144c18.5856 0 33.54624-14.97088 33.54624-33.55648V306.16576c0-18.5856-14.97088-33.55648-33.54624-33.55648H648.6528V37.71392c0-18.5856-14.97088-33.55648-33.55648-33.55648H408.59648c-18.5856 0-33.55648 14.97088-33.55648 33.55648v234.88512H57.5488c-18.5856 0-33.54624 14.97088-33.54624 33.55648v247.79776c0 18.5856 14.97088 33.55648 33.54624 33.55648h23.10144L12.24704 981.9136c-0.38912 1.9456-0.512 3.87072-0.512 5.6832 0 18.5856 14.97088 33.54624 33.55648 33.54624h933.10976c1.93536 0 3.88096-0.12288 5.6832-0.512 18.31936-3.08224 30.57664-20.51072 27.35104-38.7072zM114.33984 362.94656h351.03744V94.50496h92.928v268.4416h351.03744v134.22592H114.33984V362.94656zM718.336 930.816V729.48736c0-5.6832-4.64896-10.33216-10.32192-10.33216h-61.952c-5.67296 0-10.32192 4.64896-10.32192 10.33216V930.816H387.9424V729.48736c0-5.6832-4.64896-10.33216-10.32192-10.33216h-61.952c-5.67296 0-10.32192 4.64896-10.32192 10.33216V930.816H112.78336l58.20416-335.55456h681.5744L910.76608 930.816H718.336z m0 0" fill="#2C2C2C" p-id="8155"></path></svg></el-button>
|
|
|
|
|
<div v-for="(item, index) in currentRefineDocContent" :key="index" class="messages">
|
|
|
|
|
<div class="message">
|
|
|
|
|
<p>{{ item.oldContent }}</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="message-answer">
|
|
|
|
|
<pre>{{ item.newContent }}</pre>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="currentContent === 'ocr'">OCR内容</div>
|
|
|
|
|
<div v-if="currentContent === 'mindmap'">脑图生成内容</div>
|
|
|
|
|
<div v-if="currentContent === 'manual'">
|
|
|
|
@ -293,7 +301,7 @@ import {
|
|
|
|
|
import 'ckeditor5/ckeditor5.css';
|
|
|
|
|
import '../public/sidebar.css';
|
|
|
|
|
import { ElButton, ElInput, ElSelect, ElOption, ElForm, ElFormItem, ElMenu, ElMenuItem, ElColorPicker, ElSubMenu } from 'element-plus';
|
|
|
|
|
import { setConfig } from '../components/plugins'
|
|
|
|
|
import emitter, { setConfig } from '../components/plugins'
|
|
|
|
|
// import {getUserConfigFromBackend,saveData,getPageContent,getAndApplyUserStyles} from './components/utils';
|
|
|
|
|
import { useStore } from 'vuex';
|
|
|
|
|
import router from '../router/index.js';
|
|
|
|
@ -311,6 +319,7 @@ export default {
|
|
|
|
|
isSidebarOpen: false,// 侧边栏是否打开
|
|
|
|
|
isNavbarOpen: false,// 侧边栏是否打开
|
|
|
|
|
currentContent: '', // 当前侧边栏显示的表单
|
|
|
|
|
currentRefineDocContent: [], //当前侧边栏显示的文档优化的内容
|
|
|
|
|
formData: {
|
|
|
|
|
fontFamily: '',
|
|
|
|
|
color: '',
|
|
|
|
@ -328,10 +337,6 @@ export default {
|
|
|
|
|
previewStyle: {},
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.config = setConfig();
|
|
|
|
|
this.isLayoutReady = true;
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
onReady(editor) {
|
|
|
|
|
Array.from(this.$refs.editorToolbarElement.children).forEach(child => child.remove());
|
|
|
|
@ -356,6 +361,20 @@ export default {
|
|
|
|
|
showContent(formType) {
|
|
|
|
|
this.currentContent = formType;
|
|
|
|
|
},
|
|
|
|
|
// 展示文本优化表单
|
|
|
|
|
showRefineDOCContent(tag){
|
|
|
|
|
this.currentContent = 'refine_doc';
|
|
|
|
|
this.store.commit('setCurrentTag', tag);
|
|
|
|
|
if (this.store.getters.getCurrentContent){
|
|
|
|
|
this.currentRefineDocContent = this.store.getters.getCurrentContent.reduce((acc, current) => [current,...acc], []);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
clearRefineDOCContent(){
|
|
|
|
|
this.store.commit('clearContentsForTag', this.store.getters.getCurrentTag);
|
|
|
|
|
if (this.store.getters.getCurrentContent){
|
|
|
|
|
this.currentRefineDocContent = this.store.getters.getCurrentContent.reduce((acc, current)=> [current,...acc], []);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 保存用户定义样式
|
|
|
|
|
submitForm() {
|
|
|
|
|
const selectedStyles = {};
|
|
|
|
@ -438,7 +457,7 @@ export default {
|
|
|
|
|
// TODO
|
|
|
|
|
// const chat_history = []
|
|
|
|
|
try {
|
|
|
|
|
const response = await fetch('http://localhost:14514/admin/ai_layout/style_generate', {
|
|
|
|
|
const response = await fetch('/web_api/admin/ai_layout/style_generate', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
@ -615,6 +634,16 @@ export default {
|
|
|
|
|
return clearButton;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.config = setConfig();
|
|
|
|
|
this.isLayoutReady = true;
|
|
|
|
|
emitter.on('show-refine-doc-sidebar', (id) => {
|
|
|
|
|
this.isSidebarOpen = true;
|
|
|
|
|
this.isNavbarOpen = true;
|
|
|
|
|
this.showRefineDOCContent(id);
|
|
|
|
|
console.log(this.currentContent)
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
components: {
|
|
|
|
|
// 导入组件
|
|
|
|
|
ElButton, ElInput, ElSelect, ElOption, ElForm, ElFormItem, ElMenu, ElMenuItem, ElColorPicker, ElSubMenu
|
|
|
|
@ -623,6 +652,9 @@ export default {
|
|
|
|
|
if (!this.store.state.user.is_login) {
|
|
|
|
|
router.push({ name: 'login' });
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
beforeUnmount() {
|
|
|
|
|
emitter.off('show-refine-doc-sidebar');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|