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
6455e64c
Commit
6455e64c
authored
May 13, 2025
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 页面吸附也行了
parent
9e17fad3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
114 additions
and
36 deletions
+114
-36
index.js
form/index.js
+114
-36
No files found.
form/index.js
View file @
6455e64c
...
@@ -430,27 +430,53 @@ new Vue({
...
@@ -430,27 +430,53 @@ new Vue({
region
.
on
(
'
update-end
'
,
()
=>
{
region
.
on
(
'
update-end
'
,
()
=>
{
// 检查是否与其他区间重叠
// 检查是否与其他区间重叠
const
isOverlapping
=
this
.
checkOverlap
(
region
,
groupIndex
);
const
isOverlapping
=
this
.
checkOverlap
(
region
,
groupIndex
);
// 检查是否超出页面范围
const
isOutOfBounds
=
region
.
start
<
this
.
lockedPageStart
||
region
.
end
>
this
.
lockedPageEnd
;
if
(
isOverlapping
||
isOutOfBounds
)
{
if
(
isOverlapping
)
{
// 如果有重叠
或超出范围
,恢复到原始位置
// 如果有重叠,恢复到原始位置
region
.
update
({
region
.
update
({
start
:
group
.
start
,
start
:
group
.
start
,
end
:
group
.
end
end
:
group
.
end
});
});
if
(
isOverlapping
)
{
this
.
$message
.
warning
(
'
区间不能重叠
'
);
this
.
$message
.
warning
(
'
区间不能重叠
'
);
}
else
{
this
.
$message
.
warning
(
'
不能超出页面范围
'
);
}
return
;
return
;
}
}
let
newStart
=
Number
(
region
.
start
.
toFixed
(
3
));
let
newEnd
=
Number
(
region
.
end
.
toFixed
(
3
));
const
duration
=
newEnd
-
newStart
;
// 保存原始区间长度
let
needUpdate
=
false
;
// 检查并调整开始时间,同时保持区间长度
if
(
newStart
<
this
.
lockedPageStart
)
{
newStart
=
this
.
lockedPageStart
;
newEnd
=
newStart
+
duration
;
needUpdate
=
true
;
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
(
'
已自动调整到页面结束时间
'
);
}
// 如果需要调整,更新区间位置
if
(
needUpdate
)
{
region
.
update
({
start
:
newStart
,
end
:
newEnd
});
}
// 更新组的时间范围
// 更新组的时间范围
group
.
start
=
Number
(
region
.
start
.
toFixed
(
3
))
;
group
.
start
=
newStart
;
group
.
end
=
Number
(
region
.
end
.
toFixed
(
3
))
;
group
.
end
=
newEnd
;
// 如果当前选中的就是这个组,更新编辑器中的值
// 如果当前选中的就是这个组,更新编辑器中的值
if
(
this
.
selectedGroup
===
groupIndex
)
{
if
(
this
.
selectedGroup
===
groupIndex
)
{
...
@@ -511,27 +537,53 @@ new Vue({
...
@@ -511,27 +537,53 @@ new Vue({
region
.
on
(
'
update-end
'
,
()
=>
{
region
.
on
(
'
update-end
'
,
()
=>
{
// 检查是否与其他区间重叠
// 检查是否与其他区间重叠
const
isOverlapping
=
this
.
checkOverlap
(
region
,
groupIndex
);
const
isOverlapping
=
this
.
checkOverlap
(
region
,
groupIndex
);
// 检查是否超出页面范围
const
isOutOfBounds
=
region
.
start
<
this
.
lockedPageStart
||
region
.
end
>
this
.
lockedPageEnd
;
if
(
isOverlapping
||
isOutOfBounds
)
{
if
(
isOverlapping
)
{
// 如果有重叠
或超出范围
,恢复到原始位置
// 如果有重叠,恢复到原始位置
region
.
update
({
region
.
update
({
start
:
group
.
start
,
start
:
group
.
start
,
end
:
group
.
end
end
:
group
.
end
});
});
if
(
isOverlapping
)
{
this
.
$message
.
warning
(
'
区间不能重叠
'
);
this
.
$message
.
warning
(
'
区间不能重叠
'
);
}
else
{
this
.
$message
.
warning
(
'
不能超出页面范围
'
);
}
return
;
return
;
}
}
let
newStart
=
Number
(
region
.
start
.
toFixed
(
3
));
let
newEnd
=
Number
(
region
.
end
.
toFixed
(
3
));
const
duration
=
newEnd
-
newStart
;
// 保存原始区间长度
let
needUpdate
=
false
;
// 检查并调整开始时间,同时保持区间长度
if
(
newStart
<
this
.
lockedPageStart
)
{
newStart
=
this
.
lockedPageStart
;
newEnd
=
newStart
+
duration
;
needUpdate
=
true
;
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
(
'
已自动调整到页面结束时间
'
);
}
// 如果需要调整,更新区间位置
if
(
needUpdate
)
{
region
.
update
({
start
:
newStart
,
end
:
newEnd
});
}
// 更新组的时间范围
// 更新组的时间范围
group
.
start
=
Number
(
region
.
start
.
toFixed
(
3
))
;
group
.
start
=
newStart
;
group
.
end
=
Number
(
region
.
end
.
toFixed
(
3
))
;
group
.
end
=
newEnd
;
// 如果当前选中的就是这个组,更新编辑器中的值
// 如果当前选中的就是这个组,更新编辑器中的值
if
(
this
.
selectedGroup
===
groupIndex
)
{
if
(
this
.
selectedGroup
===
groupIndex
)
{
...
@@ -1539,27 +1591,53 @@ new Vue({
...
@@ -1539,27 +1591,53 @@ new Vue({
region
.
on
(
'
update-end
'
,
()
=>
{
region
.
on
(
'
update-end
'
,
()
=>
{
// 检查是否与其他区间重叠
// 检查是否与其他区间重叠
const
isOverlapping
=
this
.
checkOverlap
(
region
,
groupIndex
);
const
isOverlapping
=
this
.
checkOverlap
(
region
,
groupIndex
);
// 检查是否超出页面范围
const
isOutOfBounds
=
region
.
start
<
this
.
lockedPageStart
||
region
.
end
>
this
.
lockedPageEnd
;
if
(
isOverlapping
||
isOutOfBounds
)
{
if
(
isOverlapping
)
{
// 如果有重叠
或超出范围
,恢复到原始位置
// 如果有重叠,恢复到原始位置
region
.
update
({
region
.
update
({
start
:
group
.
start
,
start
:
group
.
start
,
end
:
group
.
end
end
:
group
.
end
});
});
if
(
isOverlapping
)
{
this
.
$message
.
warning
(
'
区间不能重叠
'
);
this
.
$message
.
warning
(
'
区间不能重叠
'
);
}
else
{
this
.
$message
.
warning
(
'
不能超出页面范围
'
);
}
return
;
return
;
}
}
let
newStart
=
Number
(
region
.
start
.
toFixed
(
3
));
let
newEnd
=
Number
(
region
.
end
.
toFixed
(
3
));
const
duration
=
newEnd
-
newStart
;
// 保存原始区间长度
let
needUpdate
=
false
;
// 检查并调整开始时间,同时保持区间长度
if
(
newStart
<
this
.
lockedPageStart
)
{
newStart
=
this
.
lockedPageStart
;
newEnd
=
newStart
+
duration
;
needUpdate
=
true
;
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
(
'
已自动调整到页面结束时间
'
);
}
// 如果需要调整,更新区间位置
if
(
needUpdate
)
{
region
.
update
({
start
:
newStart
,
end
:
newEnd
});
}
// 更新组的时间范围
// 更新组的时间范围
group
.
start
=
Number
(
region
.
start
.
toFixed
(
3
))
;
group
.
start
=
newStart
;
group
.
end
=
Number
(
region
.
end
.
toFixed
(
3
))
;
group
.
end
=
newEnd
;
// 如果当前选中的就是这个组,更新编辑器中的值
// 如果当前选中的就是这个组,更新编辑器中的值
if
(
this
.
selectedGroup
===
groupIndex
)
{
if
(
this
.
selectedGroup
===
groupIndex
)
{
...
...
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