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
04f2dc2a
Commit
04f2dc2a
authored
Jul 28, 2026
by
Jeff nan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 精度问题处理
parent
31f3de74
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
17 deletions
+15
-17
index.js
form/index.js
+15
-17
No files found.
form/index.js
View file @
04f2dc2a
...
@@ -860,6 +860,12 @@ function initVueApp(savedData) {
...
@@ -860,6 +860,12 @@ function initVueApp(savedData) {
};
};
},
},
// 写回时间:保留原字段类型(number/string、秒/毫秒/时码),但小数位强制 3 位(毫秒精度)
timeWriteFormat
(
sampleItem
)
{
const
base
=
this
.
detectTimeFormatFromArray
([
sampleItem
||
{}]);
return
Object
.
assign
({},
base
,
{
decimals
:
3
});
},
// 校验并确认时间编辑
// 校验并确认时间编辑
confirmTimeEdit
()
{
confirmTimeEdit
()
{
const
d
=
this
.
timeEditDialog
;
const
d
=
this
.
timeEditDialog
;
...
@@ -922,8 +928,7 @@ function initVueApp(savedData) {
...
@@ -922,8 +928,7 @@ function initVueApp(savedData) {
if
(
d
.
type
===
'
sentence-start
'
)
{
if
(
d
.
type
===
'
sentence-start
'
)
{
item
.
start
=
display
;
item
.
start
=
display
;
if
(
words
[
0
])
{
if
(
words
[
0
])
{
const
fmt
=
this
.
detectTimeFormatFromArray
([
words
[
0
]]);
this
.
$set
(
words
[
0
],
'
start
'
,
this
.
serializeTimeByFormat
(
total
,
this
.
timeWriteFormat
(
words
[
0
])));
this
.
$set
(
words
[
0
],
'
start
'
,
this
.
serializeTimeByFormat
(
total
,
fmt
));
}
}
}
else
if
(
d
.
type
===
'
sentence-end
'
)
{
}
else
if
(
d
.
type
===
'
sentence-end
'
)
{
// 句子 end ↔ 末词 end ↔ 翻译末段 end 保持一致
// 句子 end ↔ 末词 end ↔ 翻译末段 end 保持一致
...
@@ -935,8 +940,7 @@ function initVueApp(savedData) {
...
@@ -935,8 +940,7 @@ function initVueApp(savedData) {
this
.
$message
.
error
(
'
目标分词不存在
'
);
this
.
$message
.
error
(
'
目标分词不存在
'
);
return
;
return
;
}
}
const
fmt
=
this
.
detectTimeFormatFromArray
([
word
]);
this
.
$set
(
word
,
'
start
'
,
this
.
serializeTimeByFormat
(
total
,
this
.
timeWriteFormat
(
word
)));
this
.
$set
(
word
,
'
start
'
,
this
.
serializeTimeByFormat
(
total
,
fmt
));
if
(
d
.
wordIndex
===
0
)
item
.
start
=
display
;
if
(
d
.
wordIndex
===
0
)
item
.
start
=
display
;
}
else
if
(
d
.
type
===
'
word-end
'
)
{
}
else
if
(
d
.
type
===
'
word-end
'
)
{
const
word
=
words
[
d
.
wordIndex
];
const
word
=
words
[
d
.
wordIndex
];
...
@@ -944,8 +948,7 @@ function initVueApp(savedData) {
...
@@ -944,8 +948,7 @@ function initVueApp(savedData) {
this
.
$message
.
error
(
'
目标分词不存在
'
);
this
.
$message
.
error
(
'
目标分词不存在
'
);
return
;
return
;
}
}
const
fmt
=
this
.
detectTimeFormatFromArray
([
word
]);
this
.
$set
(
word
,
'
end
'
,
this
.
serializeTimeByFormat
(
total
,
this
.
timeWriteFormat
(
word
)));
this
.
$set
(
word
,
'
end
'
,
this
.
serializeTimeByFormat
(
total
,
fmt
));
// 改的是最后一个单词:同步句子 end + 翻译末段 end
// 改的是最后一个单词:同步句子 end + 翻译末段 end
if
(
d
.
wordIndex
===
words
.
length
-
1
)
{
if
(
d
.
wordIndex
===
words
.
length
-
1
)
{
item
.
end
=
display
;
item
.
end
=
display
;
...
@@ -969,8 +972,7 @@ function initVueApp(savedData) {
...
@@ -969,8 +972,7 @@ function initVueApp(savedData) {
if
(
!
skipWords
&&
words
.
length
)
{
if
(
!
skipWords
&&
words
.
length
)
{
const
last
=
words
[
words
.
length
-
1
];
const
last
=
words
[
words
.
length
-
1
];
if
(
last
)
{
if
(
last
)
{
const
fmt
=
this
.
detectTimeFormatFromArray
([
last
]);
this
.
$set
(
last
,
'
end
'
,
this
.
serializeTimeByFormat
(
endSec
,
this
.
timeWriteFormat
(
last
)));
this
.
$set
(
last
,
'
end
'
,
this
.
serializeTimeByFormat
(
endSec
,
fmt
));
}
}
}
}
if
(
!
skipTranslated
)
{
if
(
!
skipTranslated
)
{
...
@@ -978,8 +980,7 @@ function initVueApp(savedData) {
...
@@ -978,8 +980,7 @@ function initVueApp(savedData) {
if
(
tSegs
.
length
)
{
if
(
tSegs
.
length
)
{
const
lastT
=
tSegs
[
tSegs
.
length
-
1
];
const
lastT
=
tSegs
[
tSegs
.
length
-
1
];
if
(
lastT
)
{
if
(
lastT
)
{
const
fmtT
=
this
.
detectTimeFormatFromArray
([
lastT
]);
this
.
$set
(
lastT
,
'
end
'
,
this
.
serializeTimeByFormat
(
endSec
,
this
.
timeWriteFormat
(
lastT
)));
this
.
$set
(
lastT
,
'
end
'
,
this
.
serializeTimeByFormat
(
endSec
,
fmtT
));
}
}
}
}
}
}
...
@@ -1029,9 +1030,8 @@ function initVueApp(savedData) {
...
@@ -1029,9 +1030,8 @@ function initVueApp(savedData) {
if
(
!
lastWord
)
return
;
if
(
!
lastWord
)
return
;
const
wordEndSec
=
this
.
parseTimeToSeconds
(
lastWord
.
end
);
const
wordEndSec
=
this
.
parseTimeToSeconds
(
lastWord
.
end
);
if
(
!
isNaN
(
wordEndSec
)
&&
Math
.
abs
(
wordEndSec
-
sentenceEndSec
)
<
0.001
)
return
;
if
(
!
isNaN
(
wordEndSec
)
&&
Math
.
abs
(
wordEndSec
-
sentenceEndSec
)
<
0.001
)
return
;
const
fmtSample
=
(
lastWord
.
end
!=
null
||
lastWord
.
start
!=
null
)
?
[
lastWord
]
:
[
s
];
const
fmtSample
=
(
lastWord
.
end
!=
null
||
lastWord
.
start
!=
null
)
?
lastWord
:
s
;
const
fmt
=
this
.
detectTimeFormatFromArray
(
fmtSample
);
lastWord
.
end
=
this
.
serializeTimeByFormat
(
sentenceEndSec
,
this
.
timeWriteFormat
(
fmtSample
));
lastWord
.
end
=
this
.
serializeTimeByFormat
(
sentenceEndSec
,
fmt
);
fixed
+=
1
;
fixed
+=
1
;
});
});
if
(
fixed
>
0
)
{
if
(
fixed
>
0
)
{
...
@@ -1429,16 +1429,14 @@ function initVueApp(savedData) {
...
@@ -1429,16 +1429,14 @@ function initVueApp(savedData) {
if
(
!
isNaN
(
sEndSec
))
{
if
(
!
isNaN
(
sEndSec
))
{
if
(
sWords
.
length
)
{
if
(
sWords
.
length
)
{
const
last
=
sWords
[
sWords
.
length
-
1
];
const
last
=
sWords
[
sWords
.
length
-
1
];
const
fmt
=
this
.
detectTimeFormatFromArray
([
last
]);
sWords
[
sWords
.
length
-
1
]
=
Object
.
assign
({},
last
,
{
sWords
[
sWords
.
length
-
1
]
=
Object
.
assign
({},
last
,
{
end
:
this
.
serializeTimeByFormat
(
sEndSec
,
fmt
),
end
:
this
.
serializeTimeByFormat
(
sEndSec
,
this
.
timeWriteFormat
(
last
)
),
});
});
}
}
if
(
tSegs
.
length
)
{
if
(
tSegs
.
length
)
{
const
lastT
=
tSegs
[
tSegs
.
length
-
1
];
const
lastT
=
tSegs
[
tSegs
.
length
-
1
];
const
fmtT
=
this
.
detectTimeFormatFromArray
([
lastT
]);
tSegs
[
tSegs
.
length
-
1
]
=
Object
.
assign
({},
lastT
,
{
tSegs
[
tSegs
.
length
-
1
]
=
Object
.
assign
({},
lastT
,
{
end
:
this
.
serializeTimeByFormat
(
sEndSec
,
fmtT
),
end
:
this
.
serializeTimeByFormat
(
sEndSec
,
this
.
timeWriteFormat
(
lastT
)
),
});
});
}
}
}
}
...
...
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