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
ec3615d7
Commit
ec3615d7
authored
Feb 05, 2026
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat
parent
a81536e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
19 deletions
+88
-19
index.css
form/index.css
+6
-6
index.html
form/index.html
+15
-5
index.js
form/index.js
+67
-8
No files found.
form/index.css
View file @
ec3615d7
...
@@ -122,22 +122,22 @@
...
@@ -122,22 +122,22 @@
/* 按钮样式美化 */
/* 按钮样式美化 */
.el-button
{
/*
.el-button {
border-radius: 8px !important;
border-radius: 8px !important;
font-weight: 500 !important;
font-weight: 500 !important;
transition: all 0.3s ease !important;
transition: all 0.3s ease !important;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}
}
*/
.el-button
:hover
{
/*
.el-button:hover {
transform: translateY(-1px) !important;
transform: translateY(-1px) !important;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}
}
*/
.el-button--primary
{
/*
.el-button--primary {
background: linear-gradient(135deg, #409eff 0%, #1890ff 100%) !important;
background: linear-gradient(135deg, #409eff 0%, #1890ff 100%) !important;
border: none !important;
border: none !important;
}
}
*/
.el-button--success
{
.el-button--success
{
background
:
linear-gradient
(
135deg
,
#67c23a
0%
,
#52c41a
100%
)
!important
;
background
:
linear-gradient
(
135deg
,
#67c23a
0%
,
#52c41a
100%
)
!important
;
...
...
form/index.html
View file @
ec3615d7
...
@@ -235,17 +235,27 @@
...
@@ -235,17 +235,27 @@
</el-tooltip>
</el-tooltip>
</div>
</div>
<div
v-if=
"subtitleEditor && subtitleEditor.mergedList"
>
<div
v-if=
"subtitleEditor && subtitleEditor.mergedList"
>
<el-timeline>
<el-timeline>
<el-timeline-item
<el-timeline-item
v-for=
"
item
in subtitleEditor.mergedList"
v-for=
"
(item, idx)
in subtitleEditor.mergedList"
:key=
"`tl-${item.index}`"
:key=
"`tl-${item.index}`"
:timestamp=
"item.start"
:timestamp=
"item.start"
placement=
"top"
placement=
"top"
>
>
<el-card
shadow=
"never"
body-style=
"padding:12px;"
>
<el-card
shadow=
"never"
body-style=
"padding:12px;"
>
<div
style=
"display:flex; align-items:center; gap:8px; color:#909399; font-size:12px; margin-bottom:4px;"
>
<div
style=
"display:flex; align-items:center; color:#909399; font-size:12px; margin-bottom:4px;"
>
<span>
#{{ item.index }}
</span>
<div
style=
"display:flex; align-items:center; gap:8px;"
>
<span>
{{ item.start }} - {{ item.end }}
</span>
<span>
#{{ item.index }}
</span>
<span>
{{ item.start }} - {{ item.end }}
</span>
<el-button
v-if=
"idx > 0"
size=
"mini"
type=
"primary"
plain
@
click=
"mergeWithPrevious(idx)"
:disabled=
"isAnyTaskRunning()"
>
与上一句合并
</el-button>
</div>
</div>
</div>
<div
style=
"display:flex; align-items:center; gap:8px; font-size:16px; margin-bottom:4px;"
>
<div
style=
"display:flex; align-items:center; gap:8px; font-size:16px; margin-bottom:4px;"
>
<span
style=
"display:block; line-height:1.05; margin:0; padding:0;"
>
<span
style=
"display:block; line-height:1.05; margin:0; padding:0;"
>
...
...
form/index.js
View file @
ec3615d7
...
@@ -28,13 +28,13 @@ document.addEventListener('DOMContentLoaded', () => {
...
@@ -28,13 +28,13 @@ document.addEventListener('DOMContentLoaded', () => {
window
.
courseware
.
getData
(
function
(
data
)
{
window
.
courseware
.
getData
(
function
(
data
)
{
window
.
air
.
hideAirClassLoading
(
key
,
data
);
window
.
air
.
hideAirClassLoading
(
key
,
data
);
//
if (!data) {
if
(
!
data
)
{
//
// 加载默认数据
// 加载默认数据
//
$.getJSON('../play/defaultData.json', function (defaultData) {
$
.
getJSON
(
'
../play/defaultData.json
'
,
function
(
defaultData
)
{
//
initVueApp(defaultData);
initVueApp
(
defaultData
);
//
})
})
//
return;
return
;
//
}
}
//数据加载完,才算页面加载完成
//数据加载完,才算页面加载完成
initVueApp
(
data
);
initVueApp
(
data
);
},
key
);
},
key
);
...
@@ -75,7 +75,9 @@ function initVueApp(savedData) {
...
@@ -75,7 +75,9 @@ function initVueApp(savedData) {
subtitleEditor
:
{
subtitleEditor
:
{
subtitleList
:
[],
subtitleList
:
[],
translatedList
:
[],
translatedList
:
[],
mergedList
:
[]
mergedList
:
[],
clearedSIndices
:
[],
clearedTIndices
:
[]
},
},
},
},
mounted
()
{
mounted
()
{
...
@@ -694,6 +696,48 @@ function initVueApp(savedData) {
...
@@ -694,6 +696,48 @@ function initVueApp(savedData) {
}
}
},
},
// 将当前条目与上一条合并(仅编辑视图,最终以 applyEditorChanges 写回)
mergeWithPrevious
(
idx
)
{
if
(
!
this
.
subtitleEditor
||
!
Array
.
isArray
(
this
.
subtitleEditor
.
mergedList
))
return
;
if
(
idx
<=
0
)
{
this
.
$message
.
warning
(
'
第一句无法再向前合并
'
);
return
;
}
if
(
this
.
isAnyTaskRunning
&&
this
.
isAnyTaskRunning
())
{
this
.
$message
.
warning
(
'
有任务进行中,合并已锁定
'
);
return
;
}
const
list
=
this
.
subtitleEditor
.
mergedList
;
const
prev
=
list
[
idx
-
1
];
const
curr
=
list
[
idx
];
if
(
!
prev
||
!
curr
)
return
;
// 合并分词(字幕与翻译)
if
(
Array
.
isArray
(
prev
.
sWordsRef
)
||
Array
.
isArray
(
curr
.
sWordsRef
))
{
prev
.
sWordsRef
=
(
prev
.
sWordsRef
||
[]).
concat
(
curr
.
sWordsRef
||
[]);
}
if
(
Array
.
isArray
(
prev
.
tItemsRef
)
||
Array
.
isArray
(
curr
.
tItemsRef
))
{
prev
.
tItemsRef
=
(
prev
.
tItemsRef
||
[]).
concat
(
curr
.
tItemsRef
||
[]);
}
// 更新时间(以当前的结束时间为准)
prev
.
end
=
curr
.
end
;
// 标记当前条目的原始索引,在应用修改时清空其内容
if
(
curr
.
sIndex
!=
null
)
{
if
(
!
Array
.
isArray
(
this
.
subtitleEditor
.
clearedSIndices
))
this
.
subtitleEditor
.
clearedSIndices
=
[];
if
(
this
.
subtitleEditor
.
clearedSIndices
.
indexOf
(
curr
.
sIndex
)
===
-
1
)
{
this
.
subtitleEditor
.
clearedSIndices
.
push
(
curr
.
sIndex
);
}
}
if
(
curr
.
tIndex
!=
null
)
{
if
(
!
Array
.
isArray
(
this
.
subtitleEditor
.
clearedTIndices
))
this
.
subtitleEditor
.
clearedTIndices
=
[];
if
(
this
.
subtitleEditor
.
clearedTIndices
.
indexOf
(
curr
.
tIndex
)
===
-
1
)
{
this
.
subtitleEditor
.
clearedTIndices
.
push
(
curr
.
tIndex
);
}
}
// 从可视列表中移除当前条目
list
.
splice
(
idx
,
1
);
this
.
$message
.
success
(
'
已与上一句合并
'
);
},
// 从任意 JSON 中提取数组(优先常见字段,其次深度搜索)
// 从任意 JSON 中提取数组(优先常见字段,其次深度搜索)
extractArrayFromJson
(
root
,
type
)
{
extractArrayFromJson
(
root
,
type
)
{
if
(
!
root
)
return
[];
if
(
!
root
)
return
[];
...
@@ -964,6 +1008,21 @@ function initVueApp(savedData) {
...
@@ -964,6 +1008,21 @@ function initVueApp(savedData) {
tList
[
tIdx
].
translated
=
this
.
buildSentenceFromTranslatedItems
(
m
.
tItemsRef
);
tList
[
tIdx
].
translated
=
this
.
buildSentenceFromTranslatedItems
(
m
.
tItemsRef
);
}
}
}
}
// 清空被合并项的原始内容,避免导出时出现重复
const
clearedS
=
Array
.
isArray
(
this
.
subtitleEditor
.
clearedSIndices
)
?
this
.
subtitleEditor
.
clearedSIndices
:
[];
const
clearedT
=
Array
.
isArray
(
this
.
subtitleEditor
.
clearedTIndices
)
?
this
.
subtitleEditor
.
clearedTIndices
:
[];
for
(
const
si
of
clearedS
)
{
if
(
sList
[
si
])
{
sList
[
si
].
words
=
[];
sList
[
si
].
text
=
''
;
}
}
for
(
const
ti
of
clearedT
)
{
if
(
tList
[
ti
])
{
tList
[
ti
].
translatedItems
=
[];
tList
[
ti
].
translated
=
''
;
}
}
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