Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ai_fundub
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
ai_fundub
Commits
01c3336f
Commit
01c3336f
authored
Sep 21, 2026
by
Jeff nan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat
parent
5665c6f3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
247 additions
and
82 deletions
+247
-82
index.css
form/index.css
+34
-0
index.html
form/index.html
+16
-0
index.js
form/index.js
+197
-82
No files found.
form/index.css
View file @
01c3336f
...
@@ -383,12 +383,46 @@
...
@@ -383,12 +383,46 @@
.waveform-tune-handle--end
span
{
.waveform-tune-handle--end
span
{
background
:
#f56c6c
;
background
:
#f56c6c
;
}
}
.waveform-tune-playhead
{
position
:
absolute
;
top
:
0
;
bottom
:
0
;
width
:
2px
;
margin-left
:
-1px
;
background
:
#e6a23c
;
box-shadow
:
0
0
6px
rgba
(
230
,
162
,
60
,
0.85
);
z-index
:
3
;
pointer-events
:
none
;
}
.waveform-tune-playhead
span
{
position
:
absolute
;
bottom
:
6px
;
left
:
50%
;
transform
:
translateX
(
-50%
);
padding
:
1px
6px
;
border-radius
:
3px
;
font-size
:
12px
;
color
:
#fff
;
background
:
#e6a23c
;
white-space
:
nowrap
;
pointer-events
:
none
;
}
.waveform-tune-error
{
.waveform-tune-error
{
margin-top
:
12px
;
margin-top
:
12px
;
color
:
#f56c6c
;
color
:
#f56c6c
;
font-size
:
13px
;
font-size
:
13px
;
line-height
:
1.5
;
line-height
:
1.5
;
}
}
.waveform-tune-actions
{
display
:
flex
;
align-items
:
center
;
gap
:
10px
;
margin-top
:
12px
;
}
.waveform-tune-actions__tip
{
color
:
#909399
;
font-size
:
12px
;
}
/* 提示包裹,保证禁用按钮仍可触发 tooltip */
/* 提示包裹,保证禁用按钮仍可触发 tooltip */
.disabled-tip
{
.disabled-tip
{
...
...
form/index.html
View file @
01c3336f
...
@@ -393,6 +393,22 @@
...
@@ -393,6 +393,22 @@
class=
"waveform-tune-selection"
class=
"waveform-tune-selection"
:style=
"{ left: waveformStartPct + '%', width: Math.max(0, waveformEndPct - waveformStartPct) + '%' }"
:style=
"{ left: waveformStartPct + '%', width: Math.max(0, waveformEndPct - waveformStartPct) + '%' }"
></div>
></div>
<div
v-if=
"waveformPlayheadPct != null"
class=
"waveform-tune-playhead"
:style=
"{ left: waveformPlayheadPct + '%' }"
>
<span>
{{ formatTime(waveformDialog.playheadSec) }}
</span>
</div>
</div>
<div
class=
"waveform-tune-actions"
>
<el-button
size=
"small"
type=
"success"
:disabled=
"!!waveformDialog.loading || !!waveformDialog.error"
@
click=
"toggleWaveformPreview"
>
{{ waveformDialog.playing ? '停止' : '播放' }}
</el-button>
<span
class=
"waveform-tune-actions__tip"
>
试听当前选中区间
</span>
</div>
</div>
<div
v-if=
"waveformDialog.error"
class=
"waveform-tune-error"
>
{{ waveformDialog.error }}
</div>
<div
v-if=
"waveformDialog.error"
class=
"waveform-tune-error"
>
{{ waveformDialog.error }}
</div>
</div>
</div>
...
...
form/index.js
View file @
01c3336f
...
@@ -109,6 +109,8 @@ function initVueApp(savedData) {
...
@@ -109,6 +109,8 @@ function initVueApp(savedData) {
endSec
:
0
,
endSec
:
0
,
peaks
:
[],
peaks
:
[],
dragging
:
null
,
// 'start' | 'end'
dragging
:
null
,
// 'start' | 'end'
playing
:
false
,
playheadSec
:
null
,
// 播放头当前位置(绝对秒)
},
},
},
},
computed
:
{
computed
:
{
...
@@ -124,6 +126,14 @@ function initVueApp(savedData) {
...
@@ -124,6 +126,14 @@ function initVueApp(savedData) {
if
(
!
span
||
span
<=
0
)
return
100
;
if
(
!
span
||
span
<=
0
)
return
100
;
return
((
d
.
endSec
-
d
.
windowStart
)
/
span
)
*
100
;
return
((
d
.
endSec
-
d
.
windowStart
)
/
span
)
*
100
;
},
},
waveformPlayheadPct
()
{
const
d
=
this
.
waveformDialog
;
if
(
d
.
playheadSec
==
null
||
isNaN
(
d
.
playheadSec
))
return
null
;
const
span
=
d
.
windowEnd
-
d
.
windowStart
;
if
(
!
span
||
span
<=
0
)
return
null
;
const
pct
=
((
d
.
playheadSec
-
d
.
windowStart
)
/
span
)
*
100
;
return
Math
.
max
(
0
,
Math
.
min
(
100
,
pct
));
},
},
},
mounted
()
{
mounted
()
{
// 如果有保存的数据,恢复状态
// 如果有保存的数据,恢复状态
...
@@ -726,11 +736,18 @@ function initVueApp(savedData) {
...
@@ -726,11 +736,18 @@ function initVueApp(savedData) {
return
''
;
return
''
;
},
},
// 停止句子试听
// 只停引擎,不改 UI 状态(供切换播放时内部调用)
stopSentencePreview
()
{
_stopPreviewEngine
()
{
this
.
stopPlayheadTracking
();
if
(
this
.
_previewBufferSource
)
{
try
{
this
.
_previewBufferSource
.
onended
=
null
;
}
catch
(
e
)
{}
try
{
this
.
_previewBufferSource
.
stop
();
}
catch
(
e2
)
{}
try
{
this
.
_previewBufferSource
.
disconnect
();
}
catch
(
e3
)
{}
this
.
_previewBufferSource
=
null
;
}
const
audio
=
this
.
$refs
.
sentencePreviewAudio
;
const
audio
=
this
.
$refs
.
sentencePreviewAudio
;
if
(
audio
)
{
if
(
audio
)
{
try
{
audio
.
pause
();
}
catch
(
e
)
{}
try
{
audio
.
pause
();
}
catch
(
e
4
)
{}
if
(
this
.
_previewTimeUpdate
)
{
if
(
this
.
_previewTimeUpdate
)
{
audio
.
removeEventListener
(
'
timeupdate
'
,
this
.
_previewTimeUpdate
);
audio
.
removeEventListener
(
'
timeupdate
'
,
this
.
_previewTimeUpdate
);
this
.
_previewTimeUpdate
=
null
;
this
.
_previewTimeUpdate
=
null
;
...
@@ -740,33 +757,129 @@ function initVueApp(savedData) {
...
@@ -740,33 +757,129 @@ function initVueApp(savedData) {
this
.
_previewEnded
=
null
;
this
.
_previewEnded
=
null
;
}
}
}
}
this
.
previewPlayingIndex
=
-
1
;
},
},
// 试听某一句:播放 start ~ end
// 停止试听(HTML Audio + Web Audio)
async
previewSentence
(
idx
)
{
stopSentencePreview
()
{
if
(
this
.
previewPlayingIndex
===
idx
)
{
this
.
_stopPreviewEngine
();
this
.
previewPlayingIndex
=
-
1
;
if
(
this
.
waveformDialog
)
{
this
.
waveformDialog
.
playing
=
false
;
this
.
waveformDialog
.
playheadSec
=
null
;
}
},
stopPlayheadTracking
()
{
if
(
this
.
_previewRaf
!=
null
)
{
cancelAnimationFrame
(
this
.
_previewRaf
);
this
.
_previewRaf
=
null
;
}
this
.
_previewRafActive
=
false
;
this
.
_playheadMode
=
null
;
this
.
_playheadOffset
=
0
;
this
.
_playheadCtxStart
=
0
;
this
.
_playheadEndSec
=
0
;
},
// 启动播放头跟踪(波形弹窗可见时才更新 UI)
startPlayheadTracking
(
mode
,
startSec
,
endSec
)
{
this
.
stopPlayheadTracking
();
this
.
_playheadMode
=
mode
;
// 'webaudio' | 'html'
this
.
_playheadOffset
=
startSec
;
this
.
_playheadEndSec
=
endSec
;
if
(
mode
===
'
webaudio
'
&&
this
.
_previewAudioCtx
)
{
this
.
_playheadCtxStart
=
this
.
_previewAudioCtx
.
currentTime
;
}
if
(
this
.
waveformDialog
&&
this
.
waveformDialog
.
visible
)
{
this
.
waveformDialog
.
playheadSec
=
startSec
;
}
this
.
_previewRafActive
=
true
;
const
tick
=
()
=>
{
if
(
!
this
.
_previewRafActive
)
return
;
let
now
=
startSec
;
if
(
this
.
_playheadMode
===
'
webaudio
'
&&
this
.
_previewAudioCtx
)
{
now
=
this
.
_playheadOffset
+
(
this
.
_previewAudioCtx
.
currentTime
-
this
.
_playheadCtxStart
);
}
else
if
(
this
.
_playheadMode
===
'
html
'
)
{
const
audio
=
this
.
$refs
.
sentencePreviewAudio
;
now
=
audio
?
audio
.
currentTime
:
now
;
}
if
(
this
.
waveformDialog
&&
this
.
waveformDialog
.
visible
)
{
this
.
waveformDialog
.
playheadSec
=
Math
.
min
(
now
,
this
.
_playheadEndSec
);
}
if
(
now
>=
this
.
_playheadEndSec
-
0.001
)
{
// Web Audio 会自己 onended;HTML 路径在这里停
if
(
this
.
_playheadMode
===
'
html
'
)
{
const
audio
=
this
.
$refs
.
sentencePreviewAudio
;
if
(
audio
)
{
try
{
audio
.
pause
();
}
catch
(
e
)
{}
try
{
audio
.
currentTime
=
this
.
_playheadEndSec
;
}
catch
(
e2
)
{}
}
this
.
stopSentencePreview
();
this
.
stopSentencePreview
();
return
;
return
;
}
}
const
item
=
this
.
subtitleEditor
.
mergedList
&&
this
.
subtitleEditor
.
mergedList
[
idx
];
if
(
!
item
)
return
;
const
startSec
=
this
.
parseTimeToSeconds
(
item
.
start
);
const
endSec
=
this
.
parseTimeToSeconds
(
item
.
end
);
if
(
isNaN
(
startSec
)
||
isNaN
(
endSec
)
||
endSec
<=
startSec
)
{
this
.
$message
.
warning
(
'
该句时间无效,无法试听
'
);
return
;
}
}
const
src
=
this
.
getPreviewMediaSrc
();
this
.
_previewRaf
=
requestAnimationFrame
(
tick
);
if
(
!
src
)
{
};
this
.
$message
.
warning
(
'
暂无可用音视频,无法试听
'
);
this
.
_previewRaf
=
requestAnimationFrame
(
tick
);
return
;
},
// 毫秒级精准播放区间:优先 Web Audio start(offset, duration)
async
playPreciseRange
(
startSec
,
endSec
)
{
if
(
!
(
endSec
>
startSec
))
{
this
.
$message
.
warning
(
'
播放区间无效
'
);
return
false
;
}
}
if
(
!
this
.
getPreviewMediaSrc
())
{
this
.
$message
.
warning
(
'
暂无可用音视频,无法播放
'
);
return
false
;
}
this
.
_stopPreviewEngine
();
this
.
stopSentencePreview
();
// 先尝试 Web Audio(采样级精度)
const
audio
=
this
.
$refs
.
sentencePreviewAudio
;
try
{
if
(
!
audio
)
return
;
const
buffer
=
await
this
.
ensurePreviewAudioBuffer
();
const
ctx
=
this
.
_previewAudioCtx
;
if
(
!
ctx
)
throw
new
Error
(
'
no audio ctx
'
);
if
(
ctx
.
state
===
'
suspended
'
)
await
ctx
.
resume
();
const
offset
=
Math
.
max
(
0
,
Math
.
min
(
startSec
,
buffer
.
duration
));
const
stopAt
=
Math
.
max
(
offset
,
Math
.
min
(
endSec
,
buffer
.
duration
));
const
duration
=
stopAt
-
offset
;
if
(
!
(
duration
>
0
))
{
this
.
$message
.
warning
(
'
播放区间无效
'
);
return
false
;
}
const
source
=
ctx
.
createBufferSource
();
source
.
buffer
=
buffer
;
source
.
connect
(
ctx
.
destination
);
this
.
_previewBufferSource
=
source
;
source
.
onended
=
()
=>
{
if
(
this
.
_previewBufferSource
===
source
)
{
this
.
_previewBufferSource
=
null
;
this
.
previewPlayingIndex
=
-
1
;
if
(
this
.
waveformDialog
)
{
this
.
waveformDialog
.
playing
=
false
;
this
.
waveformDialog
.
playheadSec
=
null
;
}
this
.
stopPlayheadTracking
();
}
};
// when=0 立即播;offset/duration 单位秒,按采样率裁剪,可到毫秒级
source
.
start
(
0
,
offset
,
duration
);
this
.
startPlayheadTracking
(
'
webaudio
'
,
offset
,
stopAt
);
return
true
;
}
catch
(
e
)
{
console
.
warn
(
'
Web Audio 精准播放失败,回退 HTMLAudio+rAF
'
,
e
);
}
// 回退:HTMLAudio + requestAnimationFrame
const
audio
=
this
.
$refs
.
sentencePreviewAudio
;
if
(
!
audio
)
{
this
.
$message
.
error
(
'
播放失败
'
);
return
false
;
}
const
src
=
this
.
getPreviewMediaSrc
();
const
needReload
=
!
audio
.
src
||
audio
.
getAttribute
(
'
data-src
'
)
!==
src
;
const
needReload
=
!
audio
.
src
||
audio
.
getAttribute
(
'
data-src
'
)
!==
src
;
if
(
needReload
)
{
if
(
needReload
)
{
audio
.
src
=
src
;
audio
.
src
=
src
;
...
@@ -783,35 +896,55 @@ function initVueApp(savedData) {
...
@@ -783,35 +896,55 @@ function initVueApp(savedData) {
audio
.
addEventListener
(
'
error
'
,
onErr
);
audio
.
addEventListener
(
'
error
'
,
onErr
);
audio
.
load
();
audio
.
load
();
});
});
}
catch
(
e
)
{
}
catch
(
e
rr
)
{
this
.
$message
.
error
(
'
音频加载失败
'
);
this
.
$message
.
error
(
'
音频加载失败
'
);
return
;
return
false
;
}
}
}
}
this
.
previewPlayingIndex
=
idx
;
try
{
try
{
audio
.
currentTime
=
Math
.
max
(
0
,
startSec
);
audio
.
currentTime
=
Math
.
max
(
0
,
startSec
);
}
catch
(
e
)
{}
}
catch
(
e5
)
{}
try
{
this
.
_previewTimeUpdate
=
()
=>
{
await
audio
.
play
();
if
(
audio
.
currentTime
>=
endSec
-
0.03
)
{
this
.
startPlayheadTracking
(
'
html
'
,
startSec
,
endSec
);
return
true
;
}
catch
(
e8
)
{
console
.
error
(
e8
);
this
.
$message
.
error
(
'
播放失败
'
);
this
.
stopSentencePreview
();
this
.
stopSentencePreview
();
return
false
;
}
}
};
},
this
.
_previewEnded
=
()
=>
{
// 波形弹窗:播放 / 停止当前选中区间
async
toggleWaveformPreview
()
{
if
(
this
.
waveformDialog
.
playing
)
{
this
.
stopSentencePreview
();
this
.
stopSentencePreview
();
};
return
;
audio
.
addEventListener
(
'
timeupdate
'
,
this
.
_previewTimeUpdate
);
}
audio
.
addEventListener
(
'
ended
'
,
this
.
_previewEnded
);
const
d
=
this
.
waveformDialog
;
if
(
d
.
loading
||
d
.
error
)
return
;
const
ok
=
await
this
.
playPreciseRange
(
d
.
startSec
,
d
.
endSec
);
d
.
playing
=
!!
ok
;
if
(
!
ok
)
d
.
playheadSec
=
null
;
},
try
{
// 试听某一句:播放 start ~ end
await
audio
.
play
();
async
previewSentence
(
idx
)
{
}
catch
(
e
)
{
if
(
this
.
previewPlayingIndex
===
idx
)
{
console
.
error
(
e
);
this
.
$message
.
error
(
'
播放失败
'
);
this
.
stopSentencePreview
();
this
.
stopSentencePreview
();
return
;
}
}
const
item
=
this
.
subtitleEditor
.
mergedList
&&
this
.
subtitleEditor
.
mergedList
[
idx
];
if
(
!
item
)
return
;
const
startSec
=
this
.
parseTimeToSeconds
(
item
.
start
);
const
endSec
=
this
.
parseTimeToSeconds
(
item
.
end
);
if
(
isNaN
(
startSec
)
||
isNaN
(
endSec
)
||
endSec
<=
startSec
)
{
this
.
$message
.
warning
(
'
该句时间无效,无法试听
'
);
return
;
}
const
ok
=
await
this
.
playPreciseRange
(
startSec
,
endSec
);
this
.
previewPlayingIndex
=
ok
?
idx
:
-
1
;
},
},
// 在当前句后面插入一组空句子
// 在当前句后面插入一组空句子
...
@@ -1171,8 +1304,11 @@ function initVueApp(savedData) {
...
@@ -1171,8 +1304,11 @@ function initVueApp(savedData) {
},
},
onWaveformDialogClosed
()
{
onWaveformDialogClosed
()
{
this
.
stopSentencePreview
();
this
.
unbindWaveformDragListeners
();
this
.
unbindWaveformDragListeners
();
this
.
waveformDialog
.
dragging
=
null
;
this
.
waveformDialog
.
dragging
=
null
;
this
.
waveformDialog
.
playing
=
false
;
this
.
waveformDialog
.
playheadSec
=
null
;
this
.
waveformDialog
.
peaks
=
[];
this
.
waveformDialog
.
peaks
=
[];
this
.
waveformDialog
.
error
=
''
;
this
.
waveformDialog
.
error
=
''
;
this
.
waveformDialog
.
loading
=
false
;
this
.
waveformDialog
.
loading
=
false
;
...
@@ -1959,72 +2095,53 @@ function initVueApp(savedData) {
...
@@ -1959,72 +2095,53 @@ function initVueApp(savedData) {
return
inter
/
uni
;
return
inter
/
uni
;
},
},
// 应用修改回原始数组(保存/重新生成时才真正按句子 end 对齐并写回)
// 应用修改回原始数组(保存/重新生成时才真正按句子时间写回)
// 不再输出 words:界面已改为句子级编辑,单词颗粒度会与文本不一致
applyEditorChanges
()
{
applyEditorChanges
()
{
const
merged
=
this
.
subtitleEditor
.
mergedList
||
[];
const
merged
=
this
.
subtitleEditor
.
mergedList
||
[];
// 关键修复:根据 mergedList 重新构建数组,确保“拆分后的第二句”被真实写回
const
newSList
=
[];
const
newSList
=
[];
const
newTList
=
[];
const
newTList
=
[];
// 强制使用“数值秒 Number + 三位小数”的格式
const
sFmt
=
{
kind
:
'
number
'
,
unit
:
'
sec
'
,
decimals
:
3
};
const
sFmt
=
{
kind
:
'
number
'
,
unit
:
'
sec
'
,
decimals
:
3
};
const
tFmt
=
{
kind
:
'
number
'
,
unit
:
'
sec
'
,
decimals
:
3
};
const
tFmt
=
{
kind
:
'
number
'
,
unit
:
'
sec
'
,
decimals
:
3
};
for
(
let
i
=
0
;
i
<
merged
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
merged
.
length
;
i
++
)
{
const
m
=
merged
[
i
];
const
m
=
merged
[
i
];
if
(
!
m
)
continue
;
if
(
!
m
)
continue
;
const
sWords
=
Array
.
isArray
(
m
.
sWordsRef
)
?
m
.
sWordsRef
.
slice
()
:
[];
const
tSegs
=
Array
.
isArray
(
m
.
tItemsRef
)
?
m
.
tItemsRef
.
slice
()
:
[];
const
tSegs
=
Array
.
isArray
(
m
.
tItemsRef
)
?
m
.
tItemsRef
.
slice
()
:
[];
// 以界面句子时间为准;保存时强制首/末词、翻译首/末段与之对齐
let
sStartSec
=
this
.
parseTimeToSeconds
(
m
.
start
);
let
sStartSec
=
this
.
parseTimeToSeconds
(
m
.
start
);
if
(
isNaN
(
sStartSec
)
&&
sWords
.
length
)
{
sStartSec
=
this
.
parseTimeToSeconds
(
sWords
[
0
].
start
);
}
let
sEndSec
=
this
.
parseTimeToSeconds
(
m
.
end
);
let
sEndSec
=
this
.
parseTimeToSeconds
(
m
.
end
);
if
(
isNaN
(
sEndSec
)
&&
sWords
.
length
)
{
if
(
isNaN
(
sStartSec
)
&&
Array
.
isArray
(
m
.
sWordsRef
)
&&
m
.
sWordsRef
[
0
])
{
sEndSec
=
this
.
parseTimeToSeconds
(
sWords
[
sWords
.
length
-
1
].
end
);
sStartSec
=
this
.
parseTimeToSeconds
(
m
.
sWordsRef
[
0
].
start
);
}
if
(
!
isNaN
(
sStartSec
))
{
if
(
sWords
.
length
)
{
const
first
=
sWords
[
0
];
sWords
[
0
]
=
Object
.
assign
({},
first
,
{
start
:
this
.
serializeTimeByFormat
(
sStartSec
,
this
.
timeWriteFormat
(
first
)),
});
}
}
if
(
tSegs
.
length
)
{
if
(
isNaN
(
sEndSec
)
&&
Array
.
isArray
(
m
.
sWordsRef
)
&&
m
.
sWordsRef
.
length
)
{
sEndSec
=
this
.
parseTimeToSeconds
(
m
.
sWordsRef
[
m
.
sWordsRef
.
length
-
1
].
end
);
}
// 翻译首/末段时间与句子对齐(仅内存展示用;写回仍带 translatedItems)
if
(
!
isNaN
(
sStartSec
)
&&
tSegs
.
length
)
{
const
firstT
=
tSegs
[
0
];
const
firstT
=
tSegs
[
0
];
tSegs
[
0
]
=
Object
.
assign
({},
firstT
,
{
tSegs
[
0
]
=
Object
.
assign
({},
firstT
,
{
start
:
this
.
serializeTimeByFormat
(
sStartSec
,
this
.
timeWriteFormat
(
firstT
)),
start
:
this
.
serializeTimeByFormat
(
sStartSec
,
this
.
timeWriteFormat
(
firstT
)),
});
});
}
}
}
if
(
!
isNaN
(
sEndSec
)
&&
tSegs
.
length
)
{
if
(
!
isNaN
(
sEndSec
))
{
if
(
sWords
.
length
)
{
const
last
=
sWords
[
sWords
.
length
-
1
];
sWords
[
sWords
.
length
-
1
]
=
Object
.
assign
({},
last
,
{
end
:
this
.
serializeTimeByFormat
(
sEndSec
,
this
.
timeWriteFormat
(
last
)),
});
}
if
(
tSegs
.
length
)
{
const
lastT
=
tSegs
[
tSegs
.
length
-
1
];
const
lastT
=
tSegs
[
tSegs
.
length
-
1
];
tSegs
[
tSegs
.
length
-
1
]
=
Object
.
assign
({},
lastT
,
{
tSegs
[
tSegs
.
length
-
1
]
=
Object
.
assign
({},
lastT
,
{
end
:
this
.
serializeTimeByFormat
(
sEndSec
,
this
.
timeWriteFormat
(
lastT
)),
end
:
this
.
serializeTimeByFormat
(
sEndSec
,
this
.
timeWriteFormat
(
lastT
)),
});
});
}
}
}
const
sStartOut
=
this
.
serializeTimeByFormat
(
sStartSec
,
sFmt
);
const
sStartOut
=
this
.
serializeTimeByFormat
(
sStartSec
,
sFmt
);
const
sEndOut
=
this
.
serializeTimeByFormat
(
sEndSec
,
sFmt
);
const
sEndOut
=
this
.
serializeTimeByFormat
(
sEndSec
,
sFmt
);
const
enText
=
(
typeof
m
.
subtitleText
===
'
string
'
)
const
enText
=
(
typeof
m
.
subtitleText
===
'
string
'
)
?
m
.
subtitleText
?
m
.
subtitleText
:
this
.
buildSentenceFromWords
(
sWords
);
:
this
.
buildSentenceFromWords
(
m
.
sWordsRef
);
newSList
.
push
({
newSList
.
push
({
start
:
sStartOut
,
start
:
sStartOut
,
end
:
sEndOut
,
end
:
sEndOut
,
words
:
sWords
,
text
:
enText
,
text
:
enText
,
});
});
// 翻译条目 start/end 与句子 start/end 实际对齐
const
tStartSec
=
!
isNaN
(
sStartSec
)
?
sStartSec
:
this
.
parseTimeToSeconds
(
tSegs
.
length
?
tSegs
[
0
].
start
:
sStartSec
);
const
tStartSec
=
!
isNaN
(
sStartSec
)
?
sStartSec
:
this
.
parseTimeToSeconds
(
tSegs
.
length
?
tSegs
[
0
].
start
:
sStartSec
);
const
tEndSec
=
!
isNaN
(
sEndSec
)
?
sEndSec
:
this
.
parseTimeToSeconds
(
tSegs
.
length
?
tSegs
[
tSegs
.
length
-
1
].
end
:
sEndSec
);
const
tEndSec
=
!
isNaN
(
sEndSec
)
?
sEndSec
:
this
.
parseTimeToSeconds
(
tSegs
.
length
?
tSegs
[
tSegs
.
length
-
1
].
end
:
sEndSec
);
const
tStartOut
=
this
.
serializeTimeByFormat
(
tStartSec
,
tFmt
);
const
tStartOut
=
this
.
serializeTimeByFormat
(
tStartSec
,
tFmt
);
...
@@ -2039,10 +2156,8 @@ function initVueApp(savedData) {
...
@@ -2039,10 +2156,8 @@ function initVueApp(savedData) {
translated
:
zhText
,
translated
:
zhText
,
});
});
}
}
// 用新数组覆盖旧数组(确保下一步导出/覆盖时包含拆分后的完整结果)
this
.
subtitleEditor
.
subtitleList
=
newSList
;
this
.
subtitleEditor
.
subtitleList
=
newSList
;
this
.
subtitleEditor
.
translatedList
=
newTList
;
this
.
subtitleEditor
.
translatedList
=
newTList
;
// 同步清空历史标记
this
.
subtitleEditor
.
clearedSIndices
=
[];
this
.
subtitleEditor
.
clearedSIndices
=
[];
this
.
subtitleEditor
.
clearedTIndices
=
[];
this
.
subtitleEditor
.
clearedTIndices
=
[];
this
.
$message
.
success
(
'
修改已应用到内存
'
);
this
.
$message
.
success
(
'
修改已应用到内存
'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment