Commit abfeff7b authored by liujiangnan's avatar liujiangnan

feat

parent 9f91ef5a
...@@ -85,22 +85,19 @@ body { ...@@ -85,22 +85,19 @@ body {
} }
.word-card-content .text-en { .word-card-content .text-en {
font-size: 28px; font-size: 24px;
font-weight: bold; font-weight: bold;
margin-bottom: 10px; margin-bottom: 5px;
line-height: 1.2;
} }
.word-card-content .phonetic { .word-card-content .phonetic {
font-size: 16px; font-size: 16px;
color: #999; color: #666;
margin-bottom: 10px; margin-bottom: 10px;
font-style: italic;
} }
.word-card-content .text-cn { .word-card-content .text-cn {
font-size: 18px; font-size: 20px;
line-height: 1.4;
} }
.el-breadcrumb-item.is-last { .el-breadcrumb-item.is-last {
...@@ -178,25 +175,53 @@ body { ...@@ -178,25 +175,53 @@ body {
bottom: 20px; bottom: 20px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10px; gap: 5px;
z-index: 1000; z-index: 1001; /* 确保控制开关在放大卡片之上 */
background-color: rgba(0, 0, 0, 0.5);
padding: 10px;
border-radius: 5px;
} }
.el-switch { .switch-container {
background-color: rgba(255, 255, 255, 0.8); display: flex;
padding: 5px; align-items: center;
border-radius: 20px; justify-content: space-between; /* 使标签和开关分布在两端 */
width: 100px; /* 设置固定宽度以确保对齐 */
} }
.el-switch__label { .switch-label {
margin-right: 10px;
color: #fff; color: #fff;
font-weight: bold; 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 * { .el-switch__label * {
font-size: 14px; 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 { .word-card-content .text-en {
display: v-bind(showEnglish ? 'block' : 'none'); display: v-bind(showEnglish ? 'block' : 'none');
...@@ -214,3 +239,38 @@ body { ...@@ -214,3 +239,38 @@ body {
.enlarged-card .text-cn { .enlarged-card .text-cn {
display: v-bind(showChinese ? 'block' : 'none'); 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;
}
...@@ -44,40 +44,46 @@ ...@@ -44,40 +44,46 @@
<template v-else> <template v-else>
<div class="word-card-content"> <div class="word-card-content">
<i v-if="item.audio_url" class="el-icon-headset audio-icon" @click.stop="playAudio(item.audio_url)"></i> <i v-if="item.audio_url" class="el-icon-headset audio-icon" @click.stop="playAudio(item.audio_url)"></i>
<div class="text-en">{{ item.text_en }}</div> <div v-show="showEnglish">
<div v-if="item.phonetic" class="phonetic">{{ item.phonetic }}</div> <div class="text-en">{{ item.text_en }}</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> </div>
</template> </template>
</el-card> </el-card>
</div> </div>
<!-- 添加全屏遮罩和放大的卡片 --> <!-- 放大卡片 -->
<div v-if="enlargedCard" class="fullscreen-overlay" @click="hideEnlargedCard"> <div v-if="enlargedCard" class="fullscreen-overlay" @click="hideEnlargedCard">
<div class="enlarged-card" @click.stop> <div class="enlarged-card" @click.stop>
<i v-if="enlargedCard.audio_url" class="el-icon-headset audio-icon" @click="playAudio(enlargedCard.audio_url)"></i> <i v-if="enlargedCard.audio_url" class="el-icon-headset audio-icon" @click="playAudio(enlargedCard.audio_url)"></i>
<div class="text-en">{{ enlargedCard.text_en }}</div> <div v-show="showEnglish">
<div v-if="enlargedCard.phonetic" class="phonetic">{{ enlargedCard.phonetic }}</div> <div class="text-en">{{ enlargedCard.text_en }}</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> </div>
<!-- 控制开关 --> <!-- 全局语言切换控制 -->
<div v-if="hasWordCards" class="control-switches"> <div v-if="hasWordCards" class="control-switches">
<el-switch <div class="switch-container">
v-model="showEnglish" <span class="switch-label">EN</span>
active-color="#13ce66" <el-switch
inactive-color="#ff4949"> v-model="showEnglish"
<span slot="active-text">EN</span> active-color="#13ce66"
<span slot="inactive-text">EN</span> inactive-color="#ff4949">
</el-switch> </el-switch>
<el-switch </div>
v-model="showChinese" <div class="switch-container">
active-color="#13ce66" <span class="switch-label">中</span>
inactive-color="#ff4949"> <el-switch
<span slot="active-text">中</span> v-model="showChinese"
<span slot="inactive-text">中</span> active-color="#13ce66"
</el-switch> inactive-color="#ff4949">
</el-switch>
</div>
</div> </div>
</div> </div>
</body> </body>
......
...@@ -55,7 +55,6 @@ new Vue({ ...@@ -55,7 +55,6 @@ new Vue({
// 检查响应是否包含预期的数据 // 检查响应是否包含预期的数据
if (response && response.rows) { if (response && response.rows) {
this.currentRows = response.rows; this.currentRows = response.rows;
// 检查是否有单词卡并更新 hasWordCards
this.hasWordCards = this.currentRows.some(item => item.text_cn); this.hasWordCards = this.currentRows.some(item => item.text_cn);
// 添加当前项到面包屑 // 添加当前项到面包屑
if (!this.breadcrumb.find(breadcrumbItem => breadcrumbItem.id === item.id)) { if (!this.breadcrumb.find(breadcrumbItem => breadcrumbItem.id === item.id)) {
...@@ -86,7 +85,7 @@ new Vue({ ...@@ -86,7 +85,7 @@ new Vue({
} }
}, },
showEnlargedCard(item) { showEnlargedCard(item) {
this.enlargedCard = item; this.enlargedCard = { ...item };
}, },
hideEnlargedCard() { hideEnlargedCard() {
this.enlargedCard = null; this.enlargedCard = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment