Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
AI_BOOK_TOOL
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_BOOK_TOOL
Commits
cdcd8a1b
Commit
cdcd8a1b
authored
May 14, 2025
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 区间调整完善
parent
d3955af2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
16 deletions
+36
-16
index.js
form/index.js
+36
-16
No files found.
form/index.js
View file @
cdcd8a1b
...
...
@@ -1416,10 +1416,16 @@ new Vue({
let
newStart
=
Number
(
region
.
start
.
toFixed
(
3
));
let
newEnd
=
Number
(
region
.
end
.
toFixed
(
3
));
const
duration
=
newEnd
-
newStart
;
// 保存原始区间长度
const
originalStart
=
group
.
start
;
const
originalEnd
=
group
.
end
;
const
duration
=
newEnd
-
newStart
;
let
needUpdate
=
false
;
// 检查并调整开始时间,同时保持区间长度
// 判断是拖拽整个区间还是调整大小
const
isDragging
=
Math
.
abs
((
newEnd
-
newStart
)
-
(
originalEnd
-
originalStart
))
<
0.001
;
if
(
isDragging
)
{
// 拖拽整个区间的情况
if
(
newStart
<
this
.
lockedPageStart
)
{
newStart
=
this
.
lockedPageStart
;
newEnd
=
newStart
+
duration
;
...
...
@@ -1427,17 +1433,31 @@ new Vue({
this
.
$message
.
warning
(
'
已自动调整到页面开始时间
'
);
}
// 检查并调整结束时间,同时保持区间长度
if
(
newEnd
>
this
.
lockedPageEnd
)
{
newEnd
=
this
.
lockedPageEnd
;
newStart
=
newEnd
-
duration
;
// 如果调整后的开始时间小于页面开始时间,则以页面开始时间为准
if
(
newStart
<
this
.
lockedPageStart
)
{
newStart
=
this
.
lockedPageStart
;
}
needUpdate
=
true
;
this
.
$message
.
warning
(
'
已自动调整到页面结束时间
'
);
}
}
else
{
// 调整区间大小的情况
if
(
newStart
<
this
.
lockedPageStart
)
{
// 如果是调整开始时间且超出边界,恢复到原始开始时间
newStart
=
originalStart
;
needUpdate
=
true
;
this
.
$message
.
warning
(
'
开始时间不能早于页面开始时间
'
);
}
if
(
newEnd
>
this
.
lockedPageEnd
)
{
// 如果是调整结束时间且超出边界,恢复到原始结束时间
newEnd
=
originalEnd
;
needUpdate
=
true
;
this
.
$message
.
warning
(
'
结束时间不能晚于页面结束时间
'
);
}
}
// 如果需要调整,更新区间位置
if
(
needUpdate
)
{
...
...
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