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
129fedbd
Commit
129fedbd
authored
May 13, 2025
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat
parent
19056cab
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
11 deletions
+36
-11
index.html
form/index.html
+10
-9
index.js
form/index.js
+26
-2
No files found.
form/index.html
View file @
129fedbd
...
@@ -297,20 +297,21 @@
...
@@ -297,20 +297,21 @@
</el-button>
</el-button>
</el-button-group>
</el-button-group>
<el-
slider
<el-
button-group
style=
"margin-left: 10px;"
>
v-model=
"zoomLevel"
<el-button
size=
"small"
@
click=
"handleZoomOut"
:disabled=
"audioLoading"
>
:min=
"1"
<i
class=
"el-icon-zoom-out"
></i>
:max=
"500"
</el-button>
@
change=
"handleZoom"
<el-button
size=
"small"
@
click=
"handleZoomIn"
:disabled=
"audioLoading"
>
:disabled=
"audioLoading"
<i
class=
"el-icon-zoom-in"
></i>
style=
"width: 200px;"
>
</el-button
>
</el-
slider
>
</el-
button-group
>
<el-button
<el-button
size=
"small"
size=
"small"
:type=
"isPageLocked ? 'danger' : 'primary'"
:type=
"isPageLocked ? 'danger' : 'primary'"
@
click=
"togglePageLock"
@
click=
"togglePageLock"
:class=
"{ 'is-active': isPageLocked }"
>
:class=
"{ 'is-active': isPageLocked }"
style=
"margin-left: 10px;"
>
<i
:class=
"isPageLocked ? 'el-icon-lock' : 'el-icon-unlock'"
></i>
<i
:class=
"isPageLocked ? 'el-icon-lock' : 'el-icon-unlock'"
></i>
{{ isPageLocked ? '解锁页面' : '锁定页面' }}
{{ isPageLocked ? '解锁页面' : '锁定页面' }}
</el-button>
</el-button>
...
...
form/index.js
View file @
129fedbd
...
@@ -5,6 +5,9 @@ new Vue({
...
@@ -5,6 +5,9 @@ new Vue({
wavesurfer
:
null
,
wavesurfer
:
null
,
isPlaying
:
false
,
isPlaying
:
false
,
zoomLevel
:
50
,
zoomLevel
:
50
,
minZoom
:
1
,
maxZoom
:
500
,
zoomStep
:
20
,
// 每次放大/缩小的步长
audioRegions
:
{},
audioRegions
:
{},
// 数据相关
// 数据相关
...
@@ -589,6 +592,27 @@ new Vue({
...
@@ -589,6 +592,27 @@ new Vue({
}
}
},
},
// 缩放控制方法
handleZoomIn
()
{
if
(
!
this
.
wavesurfer
)
return
;
const
newZoom
=
Math
.
min
(
this
.
maxZoom
,
this
.
zoomLevel
+
this
.
zoomStep
);
if
(
newZoom
!==
this
.
zoomLevel
)
{
this
.
zoomLevel
=
newZoom
;
this
.
handleZoom
(
this
.
zoomLevel
);
}
},
handleZoomOut
()
{
if
(
!
this
.
wavesurfer
)
return
;
const
newZoom
=
Math
.
max
(
this
.
minZoom
,
this
.
zoomLevel
-
this
.
zoomStep
);
if
(
newZoom
!==
this
.
zoomLevel
)
{
this
.
zoomLevel
=
newZoom
;
this
.
handleZoom
(
this
.
zoomLevel
);
}
},
handleZoom
(
value
)
{
handleZoom
(
value
)
{
if
(
!
this
.
wavesurfer
)
return
;
if
(
!
this
.
wavesurfer
)
return
;
...
@@ -599,7 +623,7 @@ new Vue({
...
@@ -599,7 +623,7 @@ new Vue({
const
progress
=
currentTime
/
duration
;
const
progress
=
currentTime
/
duration
;
// 更新缩放设置
// 更新缩放设置
if
(
value
===
1
)
{
if
(
value
===
this
.
minZoom
)
{
// 最小缩放级别时,填充父容器
// 最小缩放级别时,填充父容器
this
.
wavesurfer
.
params
.
fillParent
=
true
;
this
.
wavesurfer
.
params
.
fillParent
=
true
;
this
.
wavesurfer
.
params
.
scrollParent
=
false
;
this
.
wavesurfer
.
params
.
scrollParent
=
false
;
...
@@ -613,7 +637,7 @@ new Vue({
...
@@ -613,7 +637,7 @@ new Vue({
this
.
wavesurfer
.
zoom
(
value
);
this
.
wavesurfer
.
zoom
(
value
);
// 重新定位到之前的位置
// 重新定位到之前的位置
if
(
value
>
1
)
{
if
(
value
>
this
.
minZoom
)
{
// 使用保存的进度或当前进度作为锚点
// 使用保存的进度或当前进度作为锚点
const
targetProgress
=
this
.
currentProgress
||
progress
;
const
targetProgress
=
this
.
currentProgress
||
progress
;
this
.
wavesurfer
.
seekTo
(
targetProgress
);
this
.
wavesurfer
.
seekTo
(
targetProgress
);
...
...
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