Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
word_tree_config
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
word_tree_config
Commits
abfeff7b
Commit
abfeff7b
authored
Oct 16, 2024
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat
parent
9f91ef5a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
103 additions
and
38 deletions
+103
-38
index.css
play/index.css
+74
-14
index.html
play/index.html
+28
-22
index.js
play/index.js
+1
-2
No files found.
play/index.css
View file @
abfeff7b
...
...
@@ -85,22 +85,19 @@ body {
}
.word-card-content
.text-en
{
font-size
:
2
8
px
;
font-size
:
2
4
px
;
font-weight
:
bold
;
margin-bottom
:
10px
;
line-height
:
1.2
;
margin-bottom
:
5px
;
}
.word-card-content
.phonetic
{
font-size
:
16px
;
color
:
#
999
;
color
:
#
666
;
margin-bottom
:
10px
;
font-style
:
italic
;
}
.word-card-content
.text-cn
{
font-size
:
18px
;
line-height
:
1.4
;
font-size
:
20px
;
}
.el-breadcrumb-item.is-last
{
...
...
@@ -178,25 +175,53 @@ body {
bottom
:
20px
;
display
:
flex
;
flex-direction
:
column
;
gap
:
10px
;
z-index
:
1000
;
gap
:
5px
;
z-index
:
1001
;
/* 确保控制开关在放大卡片之上 */
background-color
:
rgba
(
0
,
0
,
0
,
0.5
);
padding
:
10px
;
border-radius
:
5px
;
}
.el-switch
{
background-color
:
rgba
(
255
,
255
,
255
,
0.8
);
padding
:
5px
;
border-radius
:
20px
;
.switch-container
{
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
/* 使标签和开关分布在两端 */
width
:
100px
;
/* 设置固定宽度以确保对齐 */
}
.el-switch__label
{
.switch-label
{
margin-right
:
10px
;
color
:
#fff
;
font-weight
:
bold
;
text-shadow
:
1px
1px
2px
rgba
(
0
,
0
,
0
,
0.5
);
}
.el-switch
{
margin
:
0
;
/* 移除可能的默认边距 */
}
/* 可能需要覆盖 Element UI 的一些默认样式 */
.el-switch__label
{
position
:
absolute
;
display
:
none
;
}
.el-switch__label
*
{
font-size
:
14px
;
}
.el-switch__label--left
{
left
:
-5px
;
}
.el-switch__label--right
{
right
:
-5px
;
}
.el-switch__label.is-active
{
display
:
block
;
}
/* 根据开关状态控制文本显示 */
.word-card-content
.text-en
{
display
:
v-bind
(
showEnglish
?
'block'
:
'none'
);
...
...
@@ -214,3 +239,38 @@ body {
.enlarged-card
.text-cn
{
display
:
v-bind
(
showChinese
?
'block'
:
'none'
);
}
.word-card-content
>
div
,
.enlarged-card
>
div
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
}
.text-en
{
font-size
:
24px
;
font-weight
:
bold
;
margin-bottom
:
5px
;
}
.phonetic
{
font-size
:
16px
;
color
:
#666
;
margin-bottom
:
10px
;
}
.text-cn
{
font-size
:
20px
;
}
.enlarged-card
.text-en
{
font-size
:
36px
;
}
.enlarged-card
.phonetic
{
font-size
:
24px
;
}
.enlarged-card
.text-cn
{
font-size
:
28px
;
}
play/index.html
View file @
abfeff7b
...
...
@@ -44,42 +44,48 @@
<template
v-else
>
<div
class=
"word-card-content"
>
<i
v-if=
"item.audio_url"
class=
"el-icon-headset audio-icon"
@
click
.
stop=
"playAudio(item.audio_url)"
></i>
<div
v-show=
"showEnglish"
>
<div
class=
"text-en"
>
{{ item.text_en }}
</div>
<div
v-if=
"item.phonetic"
class=
"phonetic"
>
{{ item.phonetic }}
</div>
<div
class=
"text-cn"
>
{{ item.text_cn }}
</div>
<div
v-if=
"item.phonetic"
class=
"phonetic"
>
[{{ item.phonetic }}]
</div>
</div>
<div
class=
"text-cn"
v-show=
"showChinese"
>
{{ item.text_cn }}
</div>
</div>
</template>
</el-card>
</div>
<!--
添加全屏遮罩和放大的
卡片 -->
<!--
放大
卡片 -->
<div
v-if=
"enlargedCard"
class=
"fullscreen-overlay"
@
click=
"hideEnlargedCard"
>
<div
class=
"enlarged-card"
@
click
.
stop
>
<i
v-if=
"enlargedCard.audio_url"
class=
"el-icon-headset audio-icon"
@
click=
"playAudio(enlargedCard.audio_url)"
></i>
<div
v-show=
"showEnglish"
>
<div
class=
"text-en"
>
{{ enlargedCard.text_en }}
</div>
<div
v-if=
"enlargedCard.phonetic"
class=
"phonetic"
>
{{ enlargedCard.phonetic }}
</div>
<div
class=
"text-cn"
>
{{ enlargedCard.text_cn }}
</div>
<div
v-if=
"enlargedCard.phonetic"
class=
"phonetic"
>
[{{ enlargedCard.phonetic }}]
</div>
</div>
<div
class=
"text-cn"
v-show=
"showChinese"
>
{{ enlargedCard.text_cn }}
</div>
</div>
</div>
<!--
控制开关
-->
<!--
全局语言切换控制
-->
<div
v-if=
"hasWordCards"
class=
"control-switches"
>
<div
class=
"switch-container"
>
<span
class=
"switch-label"
>
EN
</span>
<el-switch
v-model=
"showEnglish"
active-color=
"#13ce66"
inactive-color=
"#ff4949"
>
<span
slot=
"active-text"
>
EN
</span>
<span
slot=
"inactive-text"
>
EN
</span>
</el-switch>
</div>
<div
class=
"switch-container"
>
<span
class=
"switch-label"
>
中
</span>
<el-switch
v-model=
"showChinese"
active-color=
"#13ce66"
inactive-color=
"#ff4949"
>
<span
slot=
"active-text"
>
中
</span>
<span
slot=
"inactive-text"
>
中
</span>
</el-switch>
</div>
</div>
</div>
</body>
<script
src=
"./index.js"
></script>
</html>
play/index.js
View file @
abfeff7b
...
...
@@ -55,7 +55,6 @@ new Vue({
// 检查响应是否包含预期的数据
if
(
response
&&
response
.
rows
)
{
this
.
currentRows
=
response
.
rows
;
// 检查是否有单词卡并更新 hasWordCards
this
.
hasWordCards
=
this
.
currentRows
.
some
(
item
=>
item
.
text_cn
);
// 添加当前项到面包屑
if
(
!
this
.
breadcrumb
.
find
(
breadcrumbItem
=>
breadcrumbItem
.
id
===
item
.
id
))
{
...
...
@@ -86,7 +85,7 @@ new Vue({
}
},
showEnlargedCard
(
item
)
{
this
.
enlargedCard
=
item
;
this
.
enlargedCard
=
{
...
item
}
;
},
hideEnlargedCard
()
{
this
.
enlargedCard
=
null
;
...
...
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