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
3c147b3b
Commit
3c147b3b
authored
Jun 03, 2025
by
15011343103
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat
parent
2cde63cf
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
590 additions
and
39 deletions
+590
-39
README.md
play/README.md
+80
-0
index.css
play/index.css
+219
-0
index.html
play/index.html
+26
-2
index.js
play/index.js
+265
-37
No files found.
play/README.md
0 → 100644
View file @
3c147b3b
我有一个JSON数据,字段解释如下:
```
{
"audio_points": {
"说明": "音频相关的信息",
"字段": {
"audio_url": "音频文件的URL地址",
"points": {
"说明": "音频断点信息数组",
"包含字段": {
"start": "该段音频的开始时间(秒)",
"end": "该段音频的结束时间(秒)",
"text": "该段音频对应的英文文本",
"words": {
"说明": "单词级别的时间轴信息",
"包含字段": {
"start": "单词开始时间",
"end": "单词结束时间",
"word": "具体单词"
}
}
}
}
}
},
"pages": {
"说明": "书籍页面信息数组",
"字段": {
"image_url": "页面图片的URL地址",
"page": "页码",
"start": "该页面内容在音频中的开始时间",
"end": "该页面内容在音频中的结束时间",
"groups": {
"说明": "页面中的文本组信息",
"包含字段": {
"sentence": "识别出的英文句子",
"sentence_cn": "对应的中文翻译",
"start": "句子在音频中的开始时间",
"end": "句子在音频中的结束时间",
"reason": "时间戳缺失或特殊情况的解释说明",
"group": {
"说明": "文本在图片中的位置信息",
"包含字段": {
"rect": {
"x": "文本框左上角的X坐标(相对值)",
"y": "文本框左上角的Y坐标(相对值)",
"width": "文本框的宽度(相对值)",
"height": "文本框的高度(相对值)"
},
"text": "实际文本内容"
}
}
}
}
}
}
}
```
# 需求
我希望你基于 ./play/index.html ./play/index.css ./play/index.js 帮我实现上面数据的播放功能,主要包含如下:
1、分页展示图片,每一页放一张图片。图片按照页面尺寸适配,如果是长图则左右留白,如果是宽图则上下留白
2、页面的左下角浮动两个按钮,一个是上一页,一个是下一页。
3、播放音频,有播放和暂停的按钮,也浮动在左下角,不用显示音频元素以及音频的进度条等。
4、当音频播放到哪一页,图片分页就翻到对应页。
5、翻页动画做成左右滑动然后渐入渐出。
6、手动点击上一页/下一页如果音频正在播放则立即跳转到对应页的开始时间进行播放,如果音频是暂停或者未播放的状态,这个时候点击播放则也是在这一页的开始时间进行播放,如果音频正好暂停在这一页的某个时间,此时点击播放就是继续播放,不用跳回到本页的开始时间。
7、页面的正下方居中浮动音频对应的字幕(audio_points.points.text),音频播放到哪一句就显示哪一句,播放完就隐藏,字幕的样式用 0.2透明度的黑色背景,然后字体用白色。
8、在图片上画蓝色的矩形框,数据在pages.groups
[]
.group.rect里,是相对于图片宽高的归一化坐标,当音频读到某个矩形框的时候就显示,过了就消失。
9、当音频播放到最后结束,跳回到第一页,音频也从零开始。
# 技术框架描述
Vue2、element-ui 2.12、jQuery 1.12.3
都是通过CDN的方式引入好的,你就不要用组件的形式新建其他文件了,都在 ./play/index.js 通过new VUE()的方式 全部实现逻辑部分就好。
我还给你提供了一个真实的数据文件 /form/defaultData.json
记得必须要用 Vue2 来实现
play/index.css
View file @
3c147b3b
html
,
body
{
height
:
100%
;
margin
:
0
;
padding
:
0
;
background
:
#fff
;
font-family
:
-apple-system
,
BlinkMacSystemFont
,
"Segoe UI"
,
Roboto
,
"Helvetica Neue"
,
Arial
,
sans-serif
;
overflow
:
hidden
;
}
body
{
body
{
min-height
:
100vh
;
min-width
:
100vw
;
box-sizing
:
border-box
;
}
#app
{
width
:
100vw
;
height
:
100vh
;
position
:
relative
;
overflow
:
hidden
;
}
.page-container
{
width
:
100vw
;
height
:
100vh
;
position
:
relative
;
overflow
:
hidden
;
}
.full-image-wrapper
{
width
:
100vw
;
height
:
100vh
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
background
:
#fff
;
background
:
#fff
;
position
:
absolute
;
top
:
0
;
left
:
0
;
}
.full-image
{
max-width
:
100vw
;
max-height
:
100vh
;
width
:
auto
;
height
:
auto
;
display
:
block
;
margin
:
auto
;
object-fit
:
contain
;
background
:
#fff
;
border-radius
:
0
;
box-shadow
:
none
;
}
.rect-layer
{
position
:
absolute
;
border
:
3px
solid
#2196f3
;
box-sizing
:
border-box
;
pointer-events
:
none
;
border-radius
:
4px
;
z-index
:
2
;
background
:
rgba
(
33
,
150
,
243
,
0.15
);
opacity
:
0
;
transform
:
scale
(
0.95
);
transition
:
opacity
0.3s
ease
,
transform
0.3s
ease
;
}
.rect-layer.rect-visible
{
opacity
:
1
;
transform
:
scale
(
1
);
}
.subtitle-bar
{
position
:
fixed
;
left
:
50%
;
bottom
:
40px
;
transform
:
translateX
(
-50%
);
z-index
:
20
;
pointer-events
:
none
;
padding
:
10px
20px
;
background
:
rgba
(
0
,
0
,
0
,
0.2
);
border-radius
:
4px
;
max-width
:
80%
;
}
.subtitle-text
{
color
:
#fff
;
font-size
:
1.2rem
;
text-align
:
center
;
line-height
:
1.5
;
}
.fixed-btn-group
{
position
:
fixed
;
left
:
32px
;
bottom
:
32px
;
z-index
:
30
;
display
:
flex
;
gap
:
12px
;
align-items
:
center
;
}
.fixed-btn-group
.el-button
{
border-radius
:
50px
;
box-shadow
:
0
2px
8px
rgba
(
0
,
0
,
0
,
0.12
);
padding
:
12px
24px
;
font-size
:
18px
;
}
/* 翻页动画 */
.slide-left-enter-active
,
.slide-left-leave-active
,
.slide-right-enter-active
,
.slide-right-leave-active
{
transition
:
all
0.5s
ease
;
}
.slide-left-enter
{
transform
:
translateX
(
100%
);
opacity
:
0
;
}
.slide-left-leave-to
{
transform
:
translateX
(
-100%
);
opacity
:
0
;
}
.slide-right-enter
{
transform
:
translateX
(
-100%
);
opacity
:
0
;
}
.slide-right-leave-to
{
transform
:
translateX
(
100%
);
opacity
:
0
;
}
/* 隐藏滚动条 */
body
::-webkit-scrollbar
,
html
::-webkit-scrollbar
{
display
:
none
;
}
/* 页数提示样式,可后续隐藏 */
#app
>
div
[
style
*=
"color:red"
]
{
margin-bottom
:
8px
;
}
}
#test
{
#test
{
margin
:
80px
;
margin
:
80px
;
}
}
.container
{
max-width
:
1200px
;
margin
:
0
auto
;
padding
:
20px
;
}
.content-wrapper
{
display
:
flex
;
flex-direction
:
column
;
gap
:
20px
;
margin-bottom
:
20px
;
}
.image-container
{
position
:
relative
;
width
:
100%
;
background
:
#f5f5f5
;
border-radius
:
8px
;
overflow
:
hidden
;
}
.image-container
img
{
width
:
100%
;
height
:
auto
;
display
:
block
;
}
.highlight-rect
{
position
:
absolute
;
border
:
2px
solid
#409EFF
;
background-color
:
rgba
(
64
,
158
,
255
,
0.1
);
pointer-events
:
none
;
transition
:
all
0.3s
ease
;
}
.subtitle-container
{
min-height
:
60px
;
padding
:
15px
;
background
:
#fff
;
border-radius
:
8px
;
box-shadow
:
0
2px
12px
0
rgba
(
0
,
0
,
0
,
0.1
);
}
.subtitle-text
{
font-size
:
18px
;
line-height
:
1.5
;
color
:
#333
;
text-align
:
center
;
}
.controls
{
display
:
flex
;
justify-content
:
center
;
gap
:
20px
;
padding
:
20px
0
;
}
.controls
.el-button
{
min-width
:
100px
;
}
@media
(
max-width
:
768px
)
{
.container
{
padding
:
10px
;
}
.controls
{
flex-direction
:
column
;
align-items
:
center
;
}
.controls
.el-button
{
width
:
100%
;
max-width
:
300px
;
}
}
\ No newline at end of file
play/index.html
View file @
3c147b3b
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<meta
charset=
"UTF-8"
>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"ie=edge"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"ie=edge"
>
<title>
h5-template-generato
r
</title>
<title>
Book Playe
r
</title>
<link
href=
"./index.css"
rel=
"stylesheet"
>
<link
href=
"./index.css"
rel=
"stylesheet"
>
<script
type=
"text/javascript"
src=
"//teach.cdn.ireadabc.com/h5template/h5-static-lib/js/jquery-1.12.3.min.js"
></script>
<script
type=
"text/javascript"
src=
"//teach.cdn.ireadabc.com/h5template/h5-static-lib/js/jquery-1.12.3.min.js"
></script>
<script
type=
"text/javascript"
src=
"//teach.cdn.ireadabc.com/h5template/h5-static-lib/js/air.js"
></script>
<script
type=
"text/javascript"
src=
"//teach.cdn.ireadabc.com/h5template/h5-static-lib/js/air.js"
></script>
...
@@ -15,7 +15,31 @@
...
@@ -15,7 +15,31 @@
<script
src=
"//teach.cdn.ireadabc.com/h5template/h5-static-lib/js/element-ui/index.js"
></script>
<script
src=
"//teach.cdn.ireadabc.com/h5template/h5-static-lib/js/element-ui/index.js"
></script>
</head>
</head>
<body>
<body>
<h1
id=
"test"
></h1>
<div
id=
"app"
>
<div
class=
"page-container"
>
<transition
:name=
"pageTransition"
>
<div
class=
"full-image-wrapper"
:key=
"currentPage"
>
<img
ref=
"mainImg"
:src=
"pages[currentPage].image_url"
:alt=
"'Page ' + pages[currentPage].page"
v-if=
"pages.length"
class=
"full-image"
/>
<template
v-if=
"currentRects && isRectVisible"
>
<div
v-for=
"(rect, idx) in currentRects"
:key=
"idx"
class=
"rect-layer rect-visible"
:style=
"getRectStyle(rect)"
></div>
</template>
</div>
</transition>
</div>
<div
class=
"subtitle-bar"
v-if=
"currentAudioText"
>
<div
class=
"subtitle-text"
>
{{ currentAudioText }}
</div>
</div>
<div
class=
"fixed-btn-group"
>
<el-button
icon=
"el-icon-arrow-left"
@
click=
"prevPage"
></el-button>
<el-button
type=
"primary"
:icon=
"isPlaying ? 'el-icon-video-pause' : 'el-icon-video-play'"
@
click=
"togglePlay"
>
{{ isPlaying ? '暂停' : '播放' }}
</el-button>
<el-button
icon=
"el-icon-arrow-right"
@
click=
"nextPage"
></el-button>
</div>
</div>
</body>
</body>
<script
src=
"./index.js"
></script>
<script
src=
"./index.js"
></script>
</html>
</html>
\ No newline at end of file
play/index.js
View file @
3c147b3b
/*
window.courseware.getData(callback,key); //用于获取数据
window.air.hideAirClassLoading(key,data); //页面加载完成时,必须调用此方法,用于隐藏遮罩层
*/
//对应模板的名称,这个可以不写,但是最好是能写上,同时开发多个模板的情况下如果不写这个,本地缓存可能会存在混乱
//对应模板的名称,这个可以不写,但是最好是能写上,同时开发多个模板的情况下如果不写这个,本地缓存可能会存在混乱
var
key
=
"
h5_test
"
;
var
t_name
=
'
AI_BOOK_TOOL
'
;
$
(
function
(){
window
.
courseware
.
getData
(
function
(
data
){
$
(
function
()
{
//数据加载完,才算页面加载完成
window
.
courseware
.
getData
(
function
(
data
)
{
//获取数据
if
(
!
data
)
{
if
(
data
&&
data
.
test
){
// 修正默认数据路径为根目录
$
(
"
#test
"
).
html
(
"
Hello
"
+
data
.
test
);
$
.
getJSON
(
'
/form/defaultData.json
'
,
function
(
defaultData
)
{
}
else
{
console
.
log
(
'
加载默认数据:
'
,
defaultData
);
//一般来讲,如果没有获取到数据的话,给一组默认数据,用于演示模板的展示效果,方便别人了解这个模板
initializeApp
(
defaultData
);
$
(
"
#test
"
).
html
(
"
Hello 我是演示信息!
"
);
}).
fail
(
function
()
{
console
.
error
(
'
默认数据加载失败!
'
);
});
}
else
{
console
.
log
(
'
获取到数据:
'
,
data
);
initializeApp
(
data
);
}
}
},
t_name
);
});
//数据渲染完成后,添加各种交互或者动画效果
function
initializeApp
(
data
)
{
//我这里简单做一个渐入渐出效果的例子
console
.
log
(
'
Vue 初始化
'
,
data
);
var
flag
=
true
;
new
Vue
({
setInterval
(
function
(){
el
:
'
#app
'
,
if
(
flag
){
data
:
{
$
(
"
#test
"
).
fadeIn
(
500
);
pages
:
data
.
pages
||
[],
}
else
{
audioUrl
:
data
.
audio_points
?.
audio_url
||
''
,
$
(
"
#test
"
).
fadeOut
(
500
);
audioPoints
:
data
.
audio_points
?.
points
||
[],
}
currentPage
:
0
,
flag
=
!
flag
;
isPlaying
:
false
,
},
1000
)
audio
:
null
,
currentTime
:
0
,
//在页面加载、事件、动画等都初始化完成后,一定要记得调用此方法,否则模板将是不可用的
currentGroupIndex
:
-
1
,
window
.
air
.
hideAirClassLoading
(
key
,
data
);
imageSize
:
{
width
:
0
,
height
:
0
},
currentAudioPointIndex
:
-
1
,
isManualPageChange
:
false
,
currentAudioText
:
''
,
currentRect
:
null
,
isRectVisible
:
false
,
pageTransition
:
'
slide-left
'
,
needJumpToPageStartOnPlay
:
false
,
},
computed
:
{
currentGroups
()
{
if
(
!
this
.
pages
.
length
)
return
[];
return
this
.
pages
[
this
.
currentPage
]?.
groups
||
[];
},
currentGroup
()
{
if
(
this
.
currentGroupIndex
===
-
1
)
return
null
;
return
this
.
currentGroups
[
this
.
currentGroupIndex
]
||
null
;
},
currentRects
()
{
// 当前高亮的 group 可能为 null
if
(
!
this
.
currentGroup
||
!
Array
.
isArray
(
this
.
currentGroup
.
group
))
return
[];
return
this
.
currentGroup
.
group
.
map
(
g
=>
g
.
rect
).
filter
(
Boolean
);
},
currentRectStyle
()
{
if
(
!
this
.
currentRect
||
!
this
.
imageSize
.
width
||
!
this
.
imageSize
.
height
)
{
return
{};
}
const
r
=
this
.
currentRect
;
return
{
left
:
(
r
.
x
*
this
.
imageSize
.
width
)
+
'
px
'
,
top
:
(
r
.
y
*
this
.
imageSize
.
height
)
+
'
px
'
,
width
:
(
r
.
width
*
this
.
imageSize
.
width
)
+
'
px
'
,
height
:
(
r
.
height
*
this
.
imageSize
.
height
)
+
'
px
'
,
};
}
},
watch
:
{
currentPage
(
newVal
,
oldVal
)
{
this
.
currentGroupIndex
=
-
1
;
this
.
updateImageSize
();
// 设置翻页动画方向
this
.
pageTransition
=
newVal
>
oldVal
?
'
slide-left
'
:
'
slide-right
'
;
if
(
this
.
isManualPageChange
&&
this
.
isPlaying
)
{
// 正在播放时,翻页立即跳到新页开始时间
this
.
audio
.
currentTime
=
this
.
pages
[
this
.
currentPage
].
start
;
}
// 如果音频暂停,翻页后下次播放要跳到新页开始时间
if
(
this
.
isManualPageChange
&&
!
this
.
isPlaying
)
{
this
.
needJumpToPageStartOnPlay
=
true
;
}
// 翻页后自动跳到新页面第一个有时间戳的group
const
groups
=
this
.
pages
[
this
.
currentPage
]?.
groups
||
[];
let
found
=
false
;
for
(
let
i
=
0
;
i
<
groups
.
length
;
i
++
)
{
if
(
groups
[
i
].
start
!=
null
&&
groups
[
i
].
end
!=
null
)
{
this
.
currentGroupIndex
=
i
;
found
=
true
;
break
;
}
}
if
(
!
found
)
this
.
currentGroupIndex
=
-
1
;
this
.
isManualPageChange
=
false
;
}
},
mounted
()
{
this
.
audio
=
new
Audio
(
this
.
audioUrl
);
this
.
audio
.
addEventListener
(
'
timeupdate
'
,
this
.
handleTimeUpdate
);
this
.
audio
.
addEventListener
(
'
ended
'
,
this
.
handleAudioEnded
);
this
.
updateImageSize
();
window
.
addEventListener
(
'
resize
'
,
this
.
updateImageSize
);
// 监听图片加载完成,确保能拿到尺寸
this
.
$nextTick
(()
=>
{
const
img
=
this
.
$refs
.
mainImg
;
if
(
img
)
{
img
.
onload
=
()
=>
{
this
.
updateImageSize
();
};
}
});
},
beforeDestroy
()
{
if
(
this
.
audio
)
{
this
.
audio
.
removeEventListener
(
'
timeupdate
'
,
this
.
handleTimeUpdate
);
this
.
audio
.
removeEventListener
(
'
ended
'
,
this
.
handleAudioEnded
);
this
.
audio
.
pause
();
}
window
.
removeEventListener
(
'
resize
'
,
this
.
updateImageSize
);
},
methods
:
{
updateImageSize
()
{
this
.
$nextTick
(()
=>
{
var
img
=
this
.
$refs
.
mainImg
;
if
(
img
&&
img
.
naturalWidth
)
{
this
.
imageSize
=
{
width
:
img
.
clientWidth
,
height
:
img
.
clientHeight
};
}
});
},
handleTimeUpdate
()
{
const
currentTime
=
this
.
audio
.
currentTime
;
// 检查是否需要切换页面
for
(
let
i
=
0
;
i
<
this
.
pages
.
length
;
i
++
)
{
const
page
=
this
.
pages
[
i
];
if
(
currentTime
>=
page
.
start
&&
currentTime
<=
page
.
end
)
{
if
(
this
.
currentPage
!==
i
)
{
this
.
currentPage
=
i
;
}
break
;
}
}
// 更新当前页面的高亮和字幕
const
currentPage
=
this
.
pages
[
this
.
currentPage
];
if
(
currentPage
&&
currentPage
.
groups
)
{
for
(
let
idx
=
0
;
idx
<
currentPage
.
groups
.
length
;
idx
++
)
{
const
group
=
currentPage
.
groups
[
idx
];
if
(
group
.
start
!=
null
&&
group
.
end
!=
null
&&
currentTime
>=
group
.
start
&&
currentTime
<=
group
.
end
)
{
this
.
currentGroupIndex
=
idx
;
this
.
currentAudioText
=
group
.
sentence
;
this
.
isRectVisible
=
true
;
return
;
}
}
}
this
.
currentGroupIndex
=
-
1
;
this
.
currentAudioText
=
''
;
this
.
isRectVisible
=
false
;
},
handleAudioEnded
()
{
this
.
isPlaying
=
false
;
this
.
currentRect
=
null
;
this
.
currentAudioText
=
''
;
this
.
isRectVisible
=
false
;
this
.
currentPage
=
0
;
// 播放结束后回到第一页
},
togglePlay
()
{
if
(
this
.
isPlaying
)
{
this
.
audio
.
pause
();
this
.
isPlaying
=
false
;
}
else
{
// 判断当前时间是否在当前页范围内
const
page
=
this
.
pages
[
this
.
currentPage
];
if
(
this
.
needJumpToPageStartOnPlay
||
this
.
audio
.
currentTime
<
page
.
start
||
this
.
audio
.
currentTime
>
page
.
end
||
this
.
audio
.
currentTime
===
0
||
this
.
audio
.
ended
)
{
this
.
audio
.
currentTime
=
page
.
start
;
}
this
.
needJumpToPageStartOnPlay
=
false
;
this
.
audio
.
play
();
this
.
isPlaying
=
true
;
}
},
prevPage
()
{
let
nextPage
=
this
.
currentPage
-
1
;
while
(
nextPage
>=
0
)
{
const
page
=
this
.
pages
[
nextPage
];
if
(
page
.
start
!=
null
&&
page
.
end
!=
null
)
break
;
nextPage
--
;
}
if
(
nextPage
>=
0
)
{
this
.
isManualPageChange
=
true
;
this
.
currentPage
=
nextPage
;
}
},
nextPage
()
{
let
nextPage
=
this
.
currentPage
+
1
;
while
(
nextPage
<
this
.
pages
.
length
)
{
const
page
=
this
.
pages
[
nextPage
];
if
(
page
.
start
!=
null
&&
page
.
end
!=
null
)
break
;
nextPage
++
;
}
if
(
nextPage
<
this
.
pages
.
length
)
{
this
.
isManualPageChange
=
true
;
this
.
currentPage
=
nextPage
;
}
},
getRectStyle
(
rect
)
{
if
(
!
rect
||
!
this
.
imageSize
.
width
||
!
this
.
imageSize
.
height
)
return
{};
// 获取容器尺寸
const
container
=
this
.
$refs
.
mainImg
?.
parentNode
;
if
(
!
container
)
return
{};
const
containerWidth
=
container
.
clientWidth
;
const
containerHeight
=
container
.
clientHeight
;
const
img
=
this
.
$refs
.
mainImg
;
const
imgNaturalWidth
=
img
.
naturalWidth
;
const
imgNaturalHeight
=
img
.
naturalHeight
;
// 计算图片适配后的显示宽高和偏移
let
displayWidth
,
displayHeight
,
offsetLeft
,
offsetTop
;
const
imgRatio
=
imgNaturalWidth
/
imgNaturalHeight
;
const
containerRatio
=
containerWidth
/
containerHeight
;
if
(
imgRatio
>
containerRatio
)
{
// 图片更宽,宽度撑满
displayWidth
=
containerWidth
;
displayHeight
=
containerWidth
/
imgRatio
;
offsetLeft
=
0
;
offsetTop
=
(
containerHeight
-
displayHeight
)
/
2
;
}
else
{
// 图片更高,高度撑满
displayHeight
=
containerHeight
;
displayWidth
=
containerHeight
*
imgRatio
;
offsetTop
=
0
;
offsetLeft
=
(
containerWidth
-
displayWidth
)
/
2
;
}
// 归一化坐标转像素
const
x
=
Number
(
rect
.
x
),
y
=
Number
(
rect
.
y
),
w
=
Number
(
rect
.
width
),
h
=
Number
(
rect
.
height
);
return
{
left
:
(
x
*
displayWidth
+
offsetLeft
)
+
'
px
'
,
top
:
(
y
*
displayHeight
+
offsetTop
)
+
'
px
'
,
width
:
(
w
*
displayWidth
)
+
'
px
'
,
height
:
(
h
*
displayHeight
)
+
'
px
'
,
};
}
}
});
},
key
);
// 预加载所有图片和音频
if
(
Array
.
isArray
(
data
.
pages
))
{
data
.
pages
.
forEach
(
page
=>
{
if
(
page
.
image_url
)
{
const
img
=
new
window
.
Image
();
img
.
src
=
page
.
image_url
;
}
});
}
if
(
data
.
audio_points
&&
data
.
audio_points
.
audio_url
)
{
const
audio
=
new
window
.
Audio
();
audio
.
src
=
data
.
audio_points
.
audio_url
;
// 可选:audio.preload = 'auto';
}
})
// Hide loading screen
\ No newline at end of file
window
.
air
.
hideAirClassLoading
(
t_name
,
data
);
}
\ No newline at end of file
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