提交 d88247e0 authored 作者: 安云鹏's avatar 安云鹏

写报

上级 4d4ad3f0
...@@ -134,7 +134,7 @@ export const useWrittingAsstaintStore = defineStore('writtingAsstaint', { ...@@ -134,7 +134,7 @@ export const useWrittingAsstaintStore = defineStore('writtingAsstaint', {
this.writeProgressNum=0, //写报 假进度 this.writeProgressNum=0, //写报 假进度
this.tabList[1].active=false this.tabList[1].active=false
this.tabList[2].active=false this.tabList[2].active=false
this.reportContent='' this.reportContent='' //写报内容
}, },
backToInputAndClear() { backToInputAndClear() {
...@@ -390,6 +390,7 @@ export const useWrittingAsstaintStore = defineStore('writtingAsstaint', { ...@@ -390,6 +390,7 @@ export const useWrittingAsstaintStore = defineStore('writtingAsstaint', {
} }
}, },
onmessage: async (event) => { onmessage: async (event) => {
console.log(event)
if (!event || !event.data || event.data.trim() === '') return; if (!event || !event.data || event.data.trim() === '') return;
let jsonData = null; let jsonData = null;
......
...@@ -198,7 +198,7 @@ ...@@ -198,7 +198,7 @@
</div> </div>
</div> </div>
<!-- 步骤侧边栏显隐按钮 --> <!-- 步骤侧边栏显隐按钮 -->
<div class="toggle-steps-btn" @click="store.isShowSteps = !store.isShowSteps"> <div class="toggle-steps-btn" @click=" isShowSteps ">
<div class="arrow" :class="{ 'is-active': store.isShowSteps }"></div> <div class="arrow" :class="{ 'is-active': store.isShowSteps }"></div>
</div> </div>
</div> </div>
...@@ -223,6 +223,10 @@ const emit = defineEmits(["generate"]); ...@@ -223,6 +223,10 @@ const emit = defineEmits(["generate"]);
const triggerGenerate = () => { const triggerGenerate = () => {
emit("generate"); emit("generate");
}; };
const isShowSteps=()=>{
store.isShowSteps = !store.isShowSteps
store.highlightClauseId=''
}
// 数字转中文序号 // 数字转中文序号
const getChineseNumber = (num) => { const getChineseNumber = (num) => {
...@@ -263,9 +267,8 @@ watch( ...@@ -263,9 +267,8 @@ watch(
const location=findTextInElement(element, targetText); const location=findTextInElement(element, targetText);
const containerRect = container.getBoundingClientRect(); const containerRect = container.getBoundingClientRect();
const itemRect = location; const itemRect = item.getBoundingClientRect();
const delta = itemRect.top - containerRect.top; const delta = itemRect.top - containerRect.top;
const targetTop = container.scrollTop + delta; const targetTop = container.scrollTop + delta;
// 让高亮条款的“标题区域”贴到容器顶部 // 让高亮条款的“标题区域”贴到容器顶部
...@@ -277,7 +280,7 @@ watch( ...@@ -277,7 +280,7 @@ watch(
); );
// 👇 核心:在 element 内部找文字位置 // 👇 核心:在 element 内部找文字位置
// ========================================= // =========================================
function findTextInElement(element, targetText ) { const findTextInElement=(element, targetText )=> {
// 遍历标签内的所有内容 // 遍历标签内的所有内容
const nodes = element.childNodes; const nodes = element.childNodes;
let rect ='' let rect =''
...@@ -289,7 +292,7 @@ function findTextInElement(element, targetText ) { ...@@ -289,7 +292,7 @@ function findTextInElement(element, targetText ) {
const originalText = node.textContent; const originalText = node.textContent;
function cleanText(str) { const cleanText=(str)=> {
return str return str
.replace(/(/g, '(') .replace(/(/g, '(')
.replace(/)/g, ')') .replace(/)/g, ')')
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<div class="translation-content" ref="translationContentRef"> <div class="translation-content" ref="translationContentRef">
<!-- :class="{ active: store.highlightClauseId === item.payload?.clause_number }" <!-- :class="{ active: store.highlightClauseId === item.payload?.clause_number }"
:data-clause-number="item.payload?.clause_number" --> :data-clause-number="item.payload?.clause_number" -->
<!-- 查找 --> <!-- 查找 -->
<div class="searchFor" v-if="store.isSsearchFor"> <div class="searchFor" v-if="store.isSsearchFor">
<el-input v-model="keyword" style="width: 260px;" placeholder="查找原文内容" /> <el-input v-model="keyword" style="width: 260px;" placeholder="查找原文内容" />
......
...@@ -110,7 +110,7 @@ const handleWrite=async ()=>{ ...@@ -110,7 +110,7 @@ const handleWrite=async ()=>{
try { try {
// // 等待DOM更新(确保子组件DOM已挂载) // // 等待DOM更新(确保子组件DOM已挂载)
store.tabList[2].active=true //写报生成之后放开写报按钮 store.tabList[2].active=true //写报生成之后放开写报按钮
store.headerTabType='translate' store.headerTabType='message'
await nextTick(); await nextTick();
await store.generateWrite() await store.generateWrite()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论