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
78402008
Commit
78402008
authored
Jul 30, 2025
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 逐字高亮
parent
f5e2f981
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
4159 additions
and
332407 deletions
+4159
-332407
README.md
play/README.md
+56
-74
defaultData.json
play/defaultData.json
+0
-2052
defaultData_1.json
play/defaultData_1.json
+3418
-329507
index.css
play/index.css
+97
-286
index.html
play/index.html
+73
-63
index.js
play/index.js
+303
-425
schema.json
play/schema.json
+212
-0
No files found.
play/README.md
View file @
78402008
我有一个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": "实际文本内容"
}
}
}
}
}
}
}
```
# 需求
基于JSON数据实现的绘本阅读器系统,支持音频同步播放、页面切换、文本高亮等功能。
我希望你基于 ./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
1.
**分页展示图片**
- 每一页显示一张图片,图片按照页面尺寸适配
2.
**页面控制**
- 左下角浮动上一页/下一页按钮
3.
**音频播放控制**
- 播放/暂停按钮,浮动在左下角
4.
**音频页面同步**
- 音频播放到哪一页就显示对应页面
5.
**智能跳转**
- 手动切换页面时,如果音频正在播放则跳转到对应页面的开始时间
6.
**蓝色矩形框**
- 当音频读到某个矩形框时显示,过了就消失
7.
**单词高亮**
- 当音频读到某个单词时显示黄色背景高亮,切换页时高亮消失
8.
**循环播放**
- 音频播放结束后自动回到第一页重新开始
都是通过CDN的方式引入好的,你就不要用组件的形式新建其他文件了,都在 ./play/index.js 通过new VUE()的方式 全部实现逻辑部分就好。
## 技术栈
我还给你提供了一个真实的数据文件 /form/defaultData.json
-
Vue 2
-
Element UI 2.12
-
jQuery 1.12.3
-
原生HTML5 Audio API
记得必须要用 Vue2 来实现
## 数据结构
JSON数据包含以下字段:
-
`audio_url`
: 音频文件地址
-
`pages`
: 页面数组,每个页面包含:
-
`image_url`
: 图片地址
-
`page`
: 页面编号
-
`start`
: 页面开始时间(秒)
-
`end`
: 页面结束时间(秒)
-
`groups`
: 句子组数组,包含文本位置和时间信息
## 使用方法
1.
启动本地服务器:
```
bash
cd
play
python3
-m
http.server 8000
```
2.
打开浏览器访问:
`http://localhost:8000`
3.
使用控制按钮:
-
点击播放按钮开始播放音频
-
点击暂停按钮暂停播放
-
点击上一页/下一页按钮切换页面
-
观察文本高亮和矩形框显示效果
## 文件结构
-
`index.html`
- 主页面模板
-
`index.css`
- 样式文件
-
`index.js`
- Vue应用逻辑
-
`defaultData_1.json`
- 示例数据文件
-
`schema.json`
- 数据格式定义
## 注意事项
-
确保音频文件和图片文件可以正常访问
-
数据文件需要符合schema.json定义的格式
-
浏览器需要支持HTML5 Audio API
play/defaultData.json
deleted
100644 → 0
View file @
f5e2f981
This diff is collapsed.
Click to expand it.
play/defaultData_1.json
View file @
78402008
This diff is collapsed.
Click to expand it.
play/index.css
View file @
78402008
html
,
body
{
*
{
height
:
100%
;
margin
:
0
;
margin
:
0
;
padding
:
0
;
padding
:
0
;
background
:
#fff
;
box-sizing
:
border-box
;
font-family
:
-apple-system
,
BlinkMacSystemFont
,
"Segoe UI"
,
Roboto
,
"Helvetica Neue"
,
Arial
,
sans-serif
;
overflow
:
hidden
;
}
}
body
{
body
{
min-height
:
100vh
;
font-family
:
Arial
,
sans-serif
;
min-width
:
100vw
;
background-color
:
#f5f5f5
;
box-sizing
:
border-box
;
overflow
:
hidden
;
}
}
#app
{
#app
{
width
:
100vw
;
width
:
100vw
;
height
:
100vh
;
height
:
100vh
;
position
:
relative
;
position
:
relative
;
overflow
:
hidden
;
background-color
:
#000
;
}
}
.
page
-container
{
.
book
-container
{
width
:
100
vw
;
width
:
100
%
;
height
:
100
vh
;
height
:
100
%
;
position
:
relative
;
position
:
relative
;
overflow
:
hidden
;
}
.full-image-wrapper
{
width
:
100vw
;
height
:
100vh
;
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
justify-content
:
center
;
justify-content
:
center
;
background
:
#fff
;
position
:
absolute
;
top
:
0
;
left
:
0
;
}
}
.full-image
{
.page-image
{
max-width
:
100vw
;
max-width
:
100%
;
max-height
:
100vh
;
max-height
:
100%
;
width
:
auto
;
height
:
auto
;
display
:
block
;
margin
:
auto
;
object-fit
:
contain
;
object-fit
:
contain
;
background
:
#fff
;
display
:
block
;
border-radius
:
0
;
box-shadow
:
none
;
}
.rect-layer
{
position
:
absolute
;
border
:
3px
dashed
#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
{
.image-container
{
opacity
:
1
;
position
:
relative
;
transform
:
scale
(
1
);
width
:
100%
;
height
:
100%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
}
/* 单词级别矩形高亮样式 */
.highlight-rect
{
.word-rect-layer
{
position
:
absolute
;
position
:
absolute
;
background-color
:
rgba
(
255
,
235
,
59
,
0.3
);
border
:
2px
dashed
#007bff
;
border
:
2px
solid
#ffeb3b
;
background-color
:
transparent
;
border-radius
:
4px
;
pointer-events
:
none
;
pointer-events
:
none
;
z-index
:
3
;
z-index
:
15
;
box-shadow
:
0
0
8px
rgba
(
255
,
235
,
59
,
0.5
);
transition
:
all
0.2s
ease
;
}
.word-rect-layer
:hover
{
background-color
:
rgba
(
255
,
235
,
59
,
0.5
);
box-shadow
:
0
0
12px
rgba
(
255
,
235
,
59
,
0.8
);
}
}
.subtitle-bar
{
.word-highlight
{
position
:
fixed
;
position
:
absolute
;
left
:
50%
;
background-color
:
rgba
(
255
,
235
,
59
,
0.2
);
bottom
:
40px
;
border
:
1px
solid
#f57f17
;
transform
:
translateX
(
-50%
);
border-radius
:
3px
;
z-index
:
20
;
pointer-events
:
none
;
pointer-events
:
none
;
padding
:
10px
20px
;
z-index
:
1
;
background
:
rgba
(
0
,
0
,
0
,
0.2
);
transition
:
all
0.2s
ease
;
border-radius
:
4px
;
box-shadow
:
0
0
5px
rgba
(
255
,
235
,
59
,
0.5
);
width
:
80%
;
}
.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
{
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
{
.image-container
{
position
:
relative
;
position
:
relative
;
width
:
100%
;
width
:
100%
;
background
:
#f5f5f5
;
height
:
100%
;
border-radius
:
8px
;
display
:
flex
;
overflow
:
hidden
;
align-items
:
center
;
}
justify-content
:
center
;
.image-container
img
{
width
:
100%
;
height
:
auto
;
display
:
block
;
}
}
.
highlight-rect
{
.
controls
{
position
:
absolute
;
position
:
absolute
;
border
:
2px
solid
#409EFF
;
bottom
:
20px
;
background-color
:
rgba
(
64
,
158
,
255
,
0.1
);
left
:
20px
;
pointer-events
:
none
;
z-index
:
100
;
transition
:
all
0.3s
ease
;
display
:
flex
;
gap
:
10px
;
}
}
.subtitle-container
{
.control-btn
{
min-height
:
60px
;
width
:
50px
;
padding
:
15px
;
height
:
50px
;
background
:
#fff
;
border
:
none
;
border-radius
:
8px
;
border-radius
:
50%
;
box-shadow
:
0
2px
12px
0
rgba
(
0
,
0
,
0
,
0.1
);
background-color
:
rgba
(
255
,
255
,
255
,
0.9
);
color
:
#333
;
font-size
:
18px
;
cursor
:
pointer
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
transition
:
all
0.3s
ease
;
box-shadow
:
0
2px
8px
rgba
(
0
,
0
,
0
,
0.2
);
}
}
.subtitle-text
{
.control-btn
:hover
{
color
:
#fff
;
background-color
:
rgba
(
255
,
255
,
255
,
1
);
font-size
:
2.4rem
;
transform
:
scale
(
1.1
);
font-weight
:
bold
;
text-align
:
center
;
line-height
:
1.5
;
}
}
.subtitle-text
span
{
.control-btn
:active
{
display
:
inline-block
;
transform
:
scale
(
0.95
);
margin
:
0
8px
;
transition
:
all
0.2s
ease
;
}
}
.subtitle-text
.highlighted-word
{
.control-btn
:disabled
{
color
:
#ffeb3b
;
opacity
:
0.5
;
text-shadow
:
0
0
10px
rgba
(
255
,
235
,
59
,
0.8
);
cursor
:
not-allowed
;
transform
:
scale
(
1.05
);
font-weight
:
900
;
animation
:
wordPulse
0.5s
ease-in-out
;
}
}
@keyframes
wordPulse
{
.play-btn
{
0
%
{
transform
:
scale
(
1
);
}
background-color
:
rgba
(
76
,
175
,
80
,
0.9
);
50
%
{
transform
:
scale
(
1.1
);
}
color
:
white
;
100
%
{
transform
:
scale
(
1.05
);
}
}
}
.controls
{
.play-btn
:hover
{
display
:
flex
;
background-color
:
rgba
(
76
,
175
,
80
,
1
);
justify-content
:
center
;
gap
:
20px
;
padding
:
20px
0
;
}
}
.controls
.el-button
{
.pause-btn
{
min-width
:
100px
;
background-color
:
rgba
(
255
,
152
,
0
,
0.9
);
color
:
white
;
}
}
@media
(
max-width
:
768px
)
{
.pause-btn
:hover
{
.container
{
background-color
:
rgba
(
255
,
152
,
0
,
1
);
padding
:
10px
;
}
.controls
{
flex-direction
:
column
;
align-items
:
center
;
}
.controls
.el-button
{
width
:
100%
;
max-width
:
300px
;
}
}
}
/* 调试面板样式 */
.page-info
{
.debug-panel
{
position
:
absolute
;
position
:
fixed
;
top
:
20px
;
top
:
20px
;
right
:
20px
;
right
:
20px
;
background
:
rgba
(
0
,
0
,
0
,
0.8
);
background
-color
:
rgba
(
0
,
0
,
0
,
0.7
);
color
:
#fff
;
color
:
white
;
padding
:
15px
;
padding
:
1
0px
1
5px
;
border-radius
:
8
px
;
border-radius
:
5
px
;
font-size
:
14px
;
font-size
:
14px
;
z-index
:
100
;
z-index
:
100
;
min-width
:
200px
;
}
.debug-info
div
{
margin-bottom
:
5px
;
font-family
:
monospace
;
}
}
/* 预加载界面样式 */
.loading
{
.loading-screen
{
position
:
absolute
;
position
:
fixed
;
top
:
50%
;
top
:
0
;
left
:
50%
;
left
:
0
;
transform
:
translate
(
-50%
,
-50%
);
width
:
100vw
;
height
:
100vh
;
background
:
linear-gradient
(
135deg
,
#667eea
0%
,
#764ba2
100%
);
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
z-index
:
9999
;
}
.loading-content
{
text-align
:
center
;
color
:
white
;
color
:
white
;
max-width
:
400px
;
font-size
:
18px
;
padding
:
40px
;
z-index
:
200
;
}
.loading-spinner
{
width
:
60px
;
height
:
60px
;
border
:
4px
solid
rgba
(
255
,
255
,
255
,
0.3
);
border-top
:
4px
solid
white
;
border-radius
:
50%
;
animation
:
spin
1s
linear
infinite
;
margin
:
0
auto
20px
;
}
@keyframes
spin
{
0
%
{
transform
:
rotate
(
0deg
);
}
100
%
{
transform
:
rotate
(
360deg
);
}
}
.loading-text
{
font-size
:
24px
;
font-weight
:
bold
;
margin-bottom
:
30px
;
}
.loading-progress
{
margin-top
:
20px
;
}
.progress-bar
{
width
:
100%
;
height
:
8px
;
background
:
rgba
(
255
,
255
,
255
,
0.3
);
border-radius
:
4px
;
overflow
:
hidden
;
margin-bottom
:
10px
;
}
.progress-fill
{
height
:
100%
;
background
:
white
;
border-radius
:
4px
;
transition
:
width
0.3s
ease
;
}
.progress-text
{
font-size
:
16px
;
opacity
:
0.8
;
}
}
/* 主要内容样式 */
.error
{
.main-content
{
position
:
absolute
;
width
:
100vw
;
top
:
50%
;
height
:
100vh
;
left
:
50%
;
position
:
relative
;
transform
:
translate
(
-50%
,
-50%
);
overflow
:
hidden
;
color
:
#ff4444
;
font-size
:
18px
;
text-align
:
center
;
z-index
:
200
;
}
}
play/index.html
View file @
78402008
...
@@ -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>
Book Player
</title>
<title>
绘本阅读器
</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>
...
@@ -16,72 +16,82 @@
...
@@ -16,72 +16,82 @@
</head>
</head>
<body>
<body>
<div
id=
"app"
>
<div
id=
"app"
>
<!-- 预加载界面 -->
<div
v-if=
"loading"
class=
"loading"
>
<div
class=
"loading-screen"
v-if=
"isLoading"
>
加载中...
<div
class=
"loading-content"
>
<div
class=
"loading-spinner"
></div>
<div
class=
"loading-text"
>
正在加载资源...
</div>
<div
class=
"loading-progress"
>
<div
class=
"progress-bar"
>
<div
class=
"progress-fill"
:style=
"{ width: loadingProgress + '%' }"
></div>
</div>
<div
class=
"progress-text"
>
{{ loadedAssets }}/{{ totalAssets }} ({{ loadingProgress }}%)
</div>
</div>
</div>
</div>
<div
v-else-if=
"error"
class=
"error"
>
{{ error }}
</div>
</div>
<!-- 主要内容 -->
<div
v-else
class=
"book-container"
>
<div
class=
"main-content"
v-else
>
<div
class=
"page-container"
>
<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"
/>
<div
class=
"image-container"
>
<template
v-if=
"currentRects && isRectVisible"
>
<img
<div
v-for=
"(rect, idx) in currentRects"
:key=
"idx"
class=
"rect-layer rect-visible"
:style=
"getRectStyle(rect)"
></div>
v-if=
"currentPage"
</template>
:src=
"currentPage.image_url"
<!-- 单词级别矩形高亮 -->
:alt=
"'第' + (currentPageIndex + 1) + '页'"
<template
v-if=
"highlightedWordRects && isRectVisible"
>
class=
"page-image"
@
load=
"onImageLoad"
@
error=
"onImageError"
/>
<!-- 蓝色矩形框 -->
<div
<div
v-for=
"(wordRect, idx) in highlightedWordRects"
v-for=
"(rect, index) in activeRects"
:key=
"'word-' + idx"
:key=
"'rect-' + index"
class=
"word-rect-layer"
class=
"highlight-rect"
:style=
"getWordRectStyle(wordRect)"
:style=
"getRectStyle(rect)"
:title=
"wordRect.text"
></div>
<!-- 单词高亮 -->
<div
v-for=
"(word, index) in activeWords"
:key=
"'word-' + index"
class=
"word-highlight"
:style=
"getWordStyle(word)"
></div>
></div>
</template>
</div>
</div>
</div>
<div
class=
"subtitle-bar"
v-if=
"currentAudioText"
>
<div
class=
"subtitle-text"
>
<!-- 控制按钮 -->
<span
<div
class=
"controls"
>
v-for=
"(word, index) in currentWords"
<button
:key=
"index"
class=
"control-btn"
:class=
"{ 'highlighted-word': highlightedWordIndexes.includes(index) }"
:disabled=
"currentPageIndex === 0"
@
click=
"previousPage"
title=
"上一页"
>
>
{{ word.word }}
‹
</span>
</button>
</div>
</div>
<!-- 调试面板 -->
<button
<div
class=
"debug-panel"
v-if=
"isPlaying"
>
v-if=
"!isPlaying"
<div
class=
"debug-info"
>
class=
"control-btn play-btn"
<div>
时间: {{ debugInfo.currentTime.toFixed(2) }}s
</div>
@
click=
"playAudio"
<div>
单词数: {{ debugInfo.totalWords }}
</div>
title=
"播放"
<div>
高亮索引: {{ debugInfo.highlightedIndexes.join(', ') }}
</div>
>
<div>
当前单词: {{ debugInfo.currentWord }}
</div>
▶
<div>
单词矩形数: {{ debugInfo.wordRectsCount }}
</div>
</button>
<div>
组单词数: {{ debugInfo.groupWordsCount }}
</div>
</div>
<button
</div>
v-else
<div
class=
"fixed-btn-group"
>
class=
"control-btn pause-btn"
<el-button
@
click=
"pauseAudio"
type=
"primary"
title=
"暂停"
:icon=
"isPlaying ? 'el-icon-video-pause' : 'el-icon-video-play'"
>
@
click=
"togglePlay"
>
❚❚
{{ isPlaying ? '暂停' : '播放' }}
</button>
</el-button>
<el-button
icon=
"el-icon-arrow-left"
@
click=
"prevPage"
>
上一页
</el-button>
<button
<el-button
icon=
"el-icon-arrow-right"
@
click=
"nextPage"
>
下一页
</el-button>
class=
"control-btn"
:disabled=
"currentPageIndex === totalPages - 1"
@
click=
"nextPage"
title=
"下一页"
>
›
</button>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
play/index.js
View file @
78402008
This diff is collapsed.
Click to expand it.
play/schema.json
0 → 100644
View file @
78402008
{
"$schema"
:
"http://json-schema.org/draft-07/schema#"
,
"title"
:
"教育内容数据结构"
,
"description"
:
"包含音频和页面数据的教育内容 JSON Schema"
,
"type"
:
"object"
,
"properties"
:
{
"audio_url"
:
{
"type"
:
"string"
,
"format"
:
"uri"
,
"description"
:
"音频文件的 URL 地址"
},
"pages"
:
{
"type"
:
"array"
,
"description"
:
"页面数据数组"
,
"items"
:
{
"type"
:
"object"
,
"properties"
:
{
"image_url"
:
{
"type"
:
"string"
,
"format"
:
"uri"
,
"description"
:
"页面图片的 URL 地址"
},
"page"
:
{
"type"
:
"integer"
,
"description"
:
"页面编号"
},
"start"
:
{
"type"
:
"number"
,
"description"
:
"页面开始时间(秒)"
},
"end"
:
{
"type"
:
"number"
,
"description"
:
"页面结束时间(秒)"
},
"groups"
:
{
"type"
:
"array"
,
"description"
:
"句子组数组"
,
"items"
:
{
"type"
:
"object"
,
"properties"
:
{
"sentence"
:
{
"type"
:
"string"
,
"description"
:
"英文句子"
},
"sentence_cn"
:
{
"type"
:
"string"
,
"description"
:
"中文翻译"
},
"start"
:
{
"type"
:
"number"
,
"description"
:
"句子开始时间(秒)"
},
"end"
:
{
"type"
:
"number"
,
"description"
:
"句子结束时间(秒)"
},
"reason"
:
{
"type"
:
[
"string"
,
"null"
],
"description"
:
"处理原因说明,可能为 null"
},
"group"
:
{
"type"
:
"array"
,
"description"
:
"文本组数组"
,
"items"
:
{
"type"
:
"object"
,
"properties"
:
{
"rect"
:
{
"type"
:
"object"
,
"properties"
:
{
"x"
:
{
"type"
:
"string"
,
"pattern"
:
"^[0-9]+
\\
.[0-9]+$"
,
"description"
:
"矩形区域 X 坐标(相对于图片尺寸的位置)"
},
"y"
:
{
"type"
:
"string"
,
"pattern"
:
"^[0-9]+
\\
.[0-9]+$"
,
"description"
:
"矩形区域 Y 坐标(相对于图片尺寸的位置)"
},
"width"
:
{
"type"
:
"string"
,
"pattern"
:
"^[0-9]+
\\
.[0-9]+$"
,
"description"
:
"矩形区域宽度(相对于图片尺寸的位置)"
},
"height"
:
{
"type"
:
"string"
,
"pattern"
:
"^[0-9]+
\\
.[0-9]+$"
,
"description"
:
"矩形区域高度(相对于图片尺寸的位置)"
}
},
"required"
:
[
"x"
,
"y"
,
"width"
,
"height"
],
"additionalProperties"
:
false
},
"text"
:
{
"type"
:
"string"
,
"description"
:
"文本内容"
},
"words"
:
{
"type"
:
"array"
,
"description"
:
"单词数组"
,
"items"
:
{
"type"
:
"object"
,
"properties"
:
{
"text"
:
{
"type"
:
"string"
,
"description"
:
"单词文本"
},
"rect"
:
{
"type"
:
"object"
,
"properties"
:
{
"x"
:
{
"type"
:
"string"
,
"pattern"
:
"^[0-9]+
\\
.[0-9]+$"
,
"description"
:
"单词区域 X 坐标(相对于图片尺寸的位置)"
},
"y"
:
{
"type"
:
"string"
,
"pattern"
:
"^[0-9]+
\\
.[0-9]+$"
,
"description"
:
"单词区域 Y 坐标(相对于图片尺寸的位置)"
},
"width"
:
{
"type"
:
"string"
,
"pattern"
:
"^[0-9]+
\\
.[0-9]+$"
,
"description"
:
"单词区域宽度(相对于图片尺寸的位置)"
},
"height"
:
{
"type"
:
"string"
,
"pattern"
:
"^[0-9]+
\\
.[0-9]+$"
,
"description"
:
"单词区域高度(相对于图片尺寸的位置)"
}
},
"required"
:
[
"x"
,
"y"
,
"width"
,
"height"
],
"additionalProperties"
:
false
},
"chars"
:
{
"type"
:
"array"
,
"description"
:
"字符数组"
,
"items"
:
{
"type"
:
"object"
,
"properties"
:
{
"text"
:
{
"type"
:
"string"
,
"description"
:
"字符文本"
},
"rect"
:
{
"type"
:
"object"
,
"properties"
:
{
"x"
:
{
"type"
:
"string"
,
"pattern"
:
"^[0-9]+
\\
.[0-9]+$"
,
"description"
:
"字符区域 X 坐标"
},
"y"
:
{
"type"
:
"string"
,
"pattern"
:
"^[0-9]+
\\
.[0-9]+$"
,
"description"
:
"字符区域 Y 坐标"
},
"width"
:
{
"type"
:
"string"
,
"pattern"
:
"^[0-9]+
\\
.[0-9]+$"
,
"description"
:
"字符区域宽度"
},
"height"
:
{
"type"
:
"string"
,
"pattern"
:
"^[0-9]+
\\
.[0-9]+$"
,
"description"
:
"字符区域高度"
}
},
"required"
:
[
"x"
,
"y"
,
"width"
,
"height"
],
"additionalProperties"
:
false
}
},
"required"
:
[
"text"
,
"rect"
],
"additionalProperties"
:
false
}
},
"start"
:
{
"type"
:
[
"number"
,
"null"
],
"description"
:
"单词开始时间(秒),可能为 null"
},
"end"
:
{
"type"
:
[
"number"
,
"null"
],
"description"
:
"单词结束时间(秒),可能为 null"
},
"reason"
:
{
"type"
:
[
"string"
,
"null"
],
"description"
:
"处理原因说明,可能为 null"
}
},
"required"
:
[
"text"
,
"rect"
,
"chars"
],
"additionalProperties"
:
false
}
}
},
"required"
:
[
"rect"
,
"text"
,
"words"
],
"additionalProperties"
:
false
}
}
},
"required"
:
[
"sentence"
,
"sentence_cn"
,
"start"
,
"end"
,
"reason"
,
"group"
],
"additionalProperties"
:
false
}
}
},
"required"
:
[
"image_url"
,
"page"
,
"start"
,
"end"
,
"groups"
],
"additionalProperties"
:
false
}
}
},
"required"
:
[
"audio_url"
,
"pages"
],
"additionalProperties"
:
false
}
\ 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