version 3

This commit is contained in:
2026-03-02 22:40:49 +08:00
parent 6e3f63185d
commit ae62c7da9d
12 changed files with 1499 additions and 216 deletions

View File

@@ -171,6 +171,17 @@
<div class="nav-dot" v-if="currentArea === 'reward'"></div>
</div>
<div class="nav-item" :class="{ 'active': currentArea === 'external' }" @click="navigateTo('external')">
<div class="nav-icon-wrapper">
<div class="nav-icon external-icon">
<span class="icon-emoji">📚</span>
<div class="icon-glow"></div>
</div>
</div>
<span class="nav-label">课外</span>
<div class="nav-dot" v-if="currentArea === 'external'"></div>
</div>
<!-- 用户信息 -->
<div class="nav-control-item user-info">
<div class="user-avatar">
@@ -255,6 +266,7 @@
<ParentArea v-else-if="currentArea === 'parent'" />
<CalendarArea v-else-if="currentArea === 'calendar'" />
<RewardArea v-else-if="currentArea === 'reward'" />
<ExternalLearningArea v-else-if="currentArea === 'external'" />
</div>
</main>
@@ -274,6 +286,7 @@ import HabitArea from './components/HabitArea.vue';
import ParentArea from './components/ParentArea.vue';
import CalendarArea from './components/CalendarArea.vue';
import RewardArea from './components/RewardArea.vue';
import ExternalLearningArea from './components/ExternalLearningArea.vue';
const starEnergyStore = useStarEnergyStore();
const currentArea = ref('');
@@ -552,15 +565,17 @@ onUnmounted(() => {
/* 能量徽章 */
.energy-badge {
background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
border-radius: 25px;
padding: 8px 20px;
box-shadow: 0 6px 20px rgba(255, 165, 0, 0.5);
border-radius: 30px;
padding: 10px 25px;
box-shadow: 0 8px 25px rgba(255, 165, 0, 0.6);
border: 3px solid #fff;
display: flex;
align-items: center;
gap: 15px;
transition: all 0.3s ease;
animation: energyPulse 2s ease-in-out infinite;
animation: energyPulse 2s ease-in-out infinite, glow 3s ease-in-out infinite;
position: relative;
overflow: hidden;
}
.energy-badge:hover {
@@ -570,7 +585,24 @@ onUnmounted(() => {
@keyframes energyPulse {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.05); }
50% { transform: scale(1.08); }
}
.energy-badge::after {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.4), transparent);
transform: rotate(45deg);
animation: shine 3s ease-in-out infinite;
}
@keyframes shine {
0% { transform: translateX(-100%) rotate(45deg); }
100% { transform: translateX(100%) rotate(45deg); }
}
.energy-stars {
@@ -776,6 +808,7 @@ header.app-header .nav-container nav.main-nav .nav-control-item {
.calendar-icon .icon-glow { background: radial-gradient(circle, #87CEEB, transparent); }
.parent-icon .icon-glow { background: radial-gradient(circle, #98FB98, transparent); }
.reward-icon .icon-glow { background: radial-gradient(circle, #FF6B6B, transparent); }
.external-icon .icon-glow { background: radial-gradient(circle, #FF6B6B, transparent); }
.home-icon { background: linear-gradient(135deg, #FFB6C1, #FF69B4); }
.knowledge-icon { background: linear-gradient(135deg, #B5EAD7, #4ECDC4); }
@@ -783,6 +816,7 @@ header.app-header .nav-container nav.main-nav .nav-control-item {
.calendar-icon { background: linear-gradient(135deg, #87CEEB, #4682B4); }
.parent-icon { background: linear-gradient(135deg, #98FB98, #32CD32); }
.reward-icon { background: linear-gradient(135deg, #FF6B6B, #4ECDC4); }
.external-icon { background: linear-gradient(135deg, #9370DB, #BA55D3); }
.nav-item:not(.active) .home-icon { background: linear-gradient(135deg, #FFE4E1, #FFB6C1); }
.nav-item:not(.active) .knowledge-icon { background: linear-gradient(135deg, #E0F7FA, #B5EAD7); }
@@ -790,6 +824,7 @@ header.app-header .nav-container nav.main-nav .nav-control-item {
.nav-item:not(.active) .calendar-icon { background: linear-gradient(135deg, #E0FFFF, #87CEEB); }
.nav-item:not(.active) .parent-icon { background: linear-gradient(135deg, #F0FFF0, #98FB98); }
.nav-item:not(.active) .reward-icon { background: linear-gradient(135deg, #FFE6E6, #FF6B6B); }
.nav-item:not(.active) .external-icon { background: linear-gradient(135deg, #E6E6FA, #9370DB); }
.nav-label {
font-size: 13px;
@@ -829,7 +864,42 @@ header.app-header .nav-container nav.main-nav .nav-control-item {
@keyframes bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-8px); }
50% { transform: translateY(-10px); }
}
@keyframes sparkle {
0%, 100% {
opacity: 1;
transform: scale(1) rotate(0deg);
}
50% {
opacity: 0.8;
transform: scale(1.2) rotate(10deg);
}
}
@keyframes glow {
0%, 100% {
box-shadow: 0 0 5px rgba(255, 215, 0, 0.5), 0 0 10px rgba(255, 215, 0, 0.3);
}
50% {
box-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 25px rgba(255, 215, 0, 0.5);
}
}
@keyframes floatUp {
0%, 100% {
transform: translateY(0) translateX(0);
}
25% {
transform: translateY(-5px) translateX(3px);
}
50% {
transform: translateY(-10px) translateX(0);
}
75% {
transform: translateY(-5px) translateX(-3px);
}
}
@keyframes wiggle {
@@ -851,23 +921,48 @@ header.app-header .nav-container nav.main-nav .nav-control-item {
}
.adventure-btn {
background: linear-gradient(135deg, #FF6B6B, #4ECDC4);
background: linear-gradient(135deg, #FF6B6B, #4ECDC4, #98FB98);
background-size: 200% 200%;
color: var(--white);
border: none;
padding: 20px 40px;
border-radius: 30px;
padding: 22px 45px;
border-radius: 35px;
font-size: 24px;
font-weight: bold;
font-family: var(--cartoon-font);
cursor: pointer;
transition: var(--transition);
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
display: flex;
align-items: center;
gap: 15px;
margin: 0 auto;
border: 4px solid var(--accent-color);
animation: bounce 2s ease-in-out infinite;
animation: bounce 2s ease-in-out infinite, bgGradient 5s ease infinite;
position: relative;
overflow: hidden;
}
@keyframes bgGradient {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
.adventure-btn::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
animation: btnShine 3s ease-in-out infinite;
}
@keyframes btnShine {
0% { left: -100%; }
50%, 100% { left: 100%; }
}
.adventure-btn:hover {
@@ -969,9 +1064,9 @@ header.app-header .nav-container nav.main-nav .nav-control-item {
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.4), transparent);
background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.5), transparent);
transform: rotate(45deg);
animation: shine 3s ease-in-out infinite;
animation: shine 4s ease-in-out infinite;
}
@keyframes shine {
@@ -979,6 +1074,15 @@ header.app-header .nav-container nav.main-nav .nav-control-item {
100% { transform: translateX(100%) rotate(45deg); }
}
.area-card::after {
content: '✨';
position: absolute;
top: 10px;
right: 10px;
font-size: 20px;
animation: sparkle 2s ease-in-out infinite;
}
.area-card::after {
content: '';
position: absolute;
@@ -1008,11 +1112,15 @@ header.app-header .nav-container nav.main-nav .nav-control-item {
}
.area-card:hover {
transform: translateY(-10px) scale(1.05) rotate(2deg);
box-shadow: var(--hover-shadow);
transform: translateY(-12px) scale(1.08) rotate(2deg);
box-shadow: var(--hover-shadow), 0 0 30px rgba(255, 105, 180, 0.3);
border-width: 6px;
}
.area-card:active {
transform: translateY(-8px) scale(1.03) rotate(1deg);
}
.area-icon {
width: 90px;
height: 90px;

View File

@@ -279,13 +279,13 @@ const scenes = [
name: '星球探索',
description: '认识太阳系的行星',
icon: '🪐',
reward: 10
reward: 1
},
{
name: '火箭发射',
description: '帮助火箭收集星星',
icon: '🚀',
reward: 15
reward: 1
}
]
},
@@ -299,13 +299,13 @@ const scenes = [
name: '小鸟学飞',
description: '学习字母和飞行',
icon: '🐦',
reward: 10
reward: 1
},
{
name: '云朵拼图',
description: '拼图游戏和形状认知',
icon: '☁️',
reward: 12
reward: 1
}
]
},
@@ -319,13 +319,13 @@ const scenes = [
name: '海底寻宝',
description: '寻找宝藏和海洋生物',
icon: '🐟',
reward: 10
reward: 1
},
{
name: '珊瑚礁保护',
description: '学习环保知识',
icon: '🪸',
reward: 15
reward: 1
}
]
},
@@ -339,13 +339,13 @@ const scenes = [
name: '地鼠打洞',
description: '学习数字和方向',
icon: '🐹',
reward: 8
reward: 1
},
{
name: '矿石开采',
description: '认识不同的矿石',
icon: '💎',
reward: 12
reward: 1
}
]
},
@@ -359,13 +359,13 @@ const scenes = [
name: '森林动物',
description: '认识森林里的动物',
icon: '🐻',
reward: 10
reward: 1
},
{
name: '植物生长',
description: '学习植物的生长过程',
icon: '🌱',
reward: 12
reward: 1
}
]
}
@@ -463,8 +463,9 @@ const startActivity = (sceneId: string, activityIndex: number) => {
const completeActivity = () => {
const scene = getSceneById(currentScene.value!);
const activity = scene.activities[currentActivityIndex.value];
starEnergyStore.addEnergy(activity.reward, 'adventure');
alert(`活动完成!获得 ${activity.reward} 颗星星能量!`);
const reward = 1; // 所有活动完成后获得1颗星星
starEnergyStore.addEnergy(reward, 'adventure');
alert(`活动完成!获得 ${reward} 颗星星能量!`);
currentActivity.value = false;
};

View File

@@ -105,7 +105,7 @@
<div class="activity-content">
<h3>星球探险</h3>
<p>认识太阳系的所有行星学习它们的特点</p>
<div class="activity-reward"> +15 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -116,7 +116,7 @@
<div class="activity-content">
<h3>星星收集</h3>
<p>帮助火箭收集星星避开陨石</p>
<div class="activity-reward"> +20 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -127,7 +127,7 @@
<div class="activity-content">
<h3>宇宙拼图</h3>
<p>拖动拼图块完成宇宙图案</p>
<div class="activity-reward"> +18 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -138,7 +138,7 @@
<div class="activity-content">
<h3>月球漫步</h3>
<p>在月球上漫步收集月球石</p>
<div class="activity-reward"> +25 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -149,7 +149,7 @@
<div class="activity-content">
<h3>星座连线</h3>
<p>按顺序连接星星组成星座</p>
<div class="activity-reward"> +22 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -343,7 +343,7 @@
<div class="activity-content">
<h3>云朵迷宫</h3>
<p>在云朵中找到正确的路径</p>
<div class="activity-reward"> +15 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -354,7 +354,7 @@
<div class="activity-content">
<h3>小鸟学飞</h3>
<p>帮助小鸟学习飞行收集字母</p>
<div class="activity-reward"> +18 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -365,7 +365,7 @@
<div class="activity-content">
<h3>彩虹画画</h3>
<p>给彩虹涂上美丽的颜色</p>
<div class="activity-reward"> +20 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -376,7 +376,7 @@
<div class="activity-content">
<h3>彩云拼图</h3>
<p>拼出可爱的云朵形状</p>
<div class="activity-reward"> +16 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -538,7 +538,7 @@
<div class="activity-content">
<h3>海底寻宝</h3>
<p>在海底寻找宝藏</p>
<div class="activity-reward"> +18 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -549,7 +549,7 @@
<div class="activity-content">
<h3>鱼儿认识</h3>
<p>认识各种海洋生物</p>
<div class="activity-reward"> +15 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -560,7 +560,7 @@
<div class="activity-content">
<h3>珊瑚涂色</h3>
<p>给美丽的珊瑚涂色</p>
<div class="activity-reward"> +20 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -571,7 +571,7 @@
<div class="activity-content">
<h3>海洋拼图</h3>
<p>拼出海底世界</p>
<div class="activity-reward"> +22 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -712,7 +712,7 @@
<div class="activity-content">
<h3>矿石开采</h3>
<p>开采各种珍贵的矿石</p>
<div class="activity-reward"> +16 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -723,7 +723,7 @@
<div class="activity-content">
<h3>地鼠打洞</h3>
<p>帮助地鼠找到正确的洞穴</p>
<div class="activity-reward"> +15 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -734,7 +734,7 @@
<div class="activity-content">
<h3>洞穴探险</h3>
<p>在黑暗的洞穴中探险</p>
<div class="activity-reward"> +20 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -843,7 +843,7 @@
<div class="activity-content">
<h3>动物朋友</h3>
<p>认识森林里的动物朋友</p>
<div class="activity-reward"> +15 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -854,7 +854,7 @@
<div class="activity-content">
<h3>植物生长</h3>
<p>帮助植物从种子长成大树</p>
<div class="activity-reward"> +18 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -865,7 +865,7 @@
<div class="activity-content">
<h3>树叶收集</h3>
<p>收集各种美丽的树叶</p>
<div class="activity-reward"> +16 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -876,7 +876,7 @@
<div class="activity-content">
<h3>森林拼图</h3>
<p>拼出美丽的森林景象</p>
<div class="activity-reward"> +20 能量</div>
<div class="activity-reward"> +1 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -1021,7 +1021,7 @@
<div class="activity-content">
<h3>九九八十一难</h3>
<p>和唐僧师徒一起经历九九八十一难学习各种知识</p>
<div class="activity-reward"> +50 能量</div>
<div class="activity-reward"> +10 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -1154,7 +1154,7 @@
<div class="activity-content">
<h3>情感教育与习惯养成</h3>
<p>和哪吒一起学习情感管理好习惯养成和价值观培养</p>
<div class="activity-reward"> +40 能量</div>
<div class="activity-reward"> +10 能量</div>
</div>
<div class="activity-start">开始 </div>
</div>
@@ -2516,7 +2516,18 @@ const initJourneyLevel = () => {
// 加载关卡题目
const loadJourneyQuestion = () => {
if (journeyLevel.value <= journeyQuestions.length) {
currentJourneyQuestion.value = journeyQuestions[journeyLevel.value - 1];
const originalQuestion = journeyQuestions[journeyLevel.value - 1];
// 复制问题对象
const questionCopy = { ...originalQuestion };
// 随机化选项顺序
if (questionCopy.options) {
questionCopy.options = [...questionCopy.options];
for (let i = questionCopy.options.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[questionCopy.options[i], questionCopy.options[j]] = [questionCopy.options[j], questionCopy.options[i]];
}
}
currentJourneyQuestion.value = questionCopy;
showJourneyFeedback.value = false;
} else {
journeyComplete.value = true;
@@ -2527,7 +2538,7 @@ const loadJourneyQuestion = () => {
const checkJourneyAnswer = (option: string) => {
isJourneyCorrect.value = option === currentJourneyQuestion.value.answer;
journeyFeedbackMessage.value = isJourneyCorrect.value
? `太棒了!回答正确!正确答案是 ${currentJourneyQuestion.value.answer}。获得 5 颗星星能量!`
? `太棒了!回答正确!正确答案是 ${currentJourneyQuestion.value.answer}。获得 2 颗星星能量!`
: `再试一次,加油!你选择的是 ${option}`;
showJourneyFeedback.value = true;
if (isJourneyCorrect.value) {
@@ -2538,9 +2549,6 @@ const checkJourneyAnswer = (option: string) => {
// 下一关
const nextJourneyLevel = () => {
if (isJourneyCorrect.value) {
// 增加星星能量
starEnergyStore.addEnergy(5, 'knowledge');
// 进入下一关
journeyLevel.value++;
@@ -2594,7 +2602,18 @@ const initNezhaLevel = () => {
// 加载哪吒闹海题目
const loadNezhaQuestion = () => {
if (nezhaLevel.value <= nezhaQuestions.length) {
currentNezhaQuestion.value = nezhaQuestions[nezhaLevel.value - 1];
const originalQuestion = nezhaQuestions[nezhaLevel.value - 1];
// 复制问题对象
const questionCopy = { ...originalQuestion };
// 随机化选项顺序
if (questionCopy.options) {
questionCopy.options = [...questionCopy.options];
for (let i = questionCopy.options.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[questionCopy.options[i], questionCopy.options[j]] = [questionCopy.options[j], questionCopy.options[i]];
}
}
currentNezhaQuestion.value = questionCopy;
showNezhaFeedback.value = false;
} else {
nezhaComplete.value = true;
@@ -2605,7 +2624,7 @@ const loadNezhaQuestion = () => {
const checkNezhaAnswer = (option: string) => {
isNezhaCorrect.value = option === currentNezhaQuestion.value.answer;
nezhaFeedbackMessage.value = isNezhaCorrect.value
? `太棒了!回答正确!正确答案是 ${currentNezhaQuestion.value.answer}。获得 5 颗星星能量!`
? `太棒了!回答正确!正确答案是 ${currentNezhaQuestion.value.answer}。获得 2 颗星星能量!`
: `再试一次,加油!你选择的是 ${option}`;
showNezhaFeedback.value = true;
if (isNezhaCorrect.value) {
@@ -2616,9 +2635,6 @@ const checkNezhaAnswer = (option: string) => {
// 哪吒闹海下一关
const nextNezhaLevel = () => {
if (isNezhaCorrect.value) {
// 增加星星能量
starEnergyStore.addEnergy(5, 'knowledge');
// 进入下一关
nezhaLevel.value++;
@@ -2773,17 +2789,8 @@ const startActivity = (activity: string) => {
// 完成活动
const completeActivity = () => {
const rewards: Record<string, number> = {
'planet-explorer': 15, 'star-collector': 20, 'space-puzzle': 18, 'moon-walk': 25, 'constellation': 22,
'cloud-maze': 15, 'bird-flight': 18, 'rainbow-paint': 20, 'cloud-puzzle': 16,
'treasure-hunt': 18, 'fish-match': 15, 'coral-color': 20, 'ocean-puzzle': 22,
'mining': 16, 'mole-whack': 15, 'cave-explore': 20,
'animal-friends': 15, 'plant-grow': 18, 'leaf-collect': 16, 'forest-puzzle': 20,
'journey-to-west': 50,
'nezha-sea': 40
};
const reward = rewards[currentActivity.value || ''] || 10;
// 西游记和哪吒闹海奖励10颗星星其他活动奖励1颗星星
const reward = currentScene.value === 'journey' || currentScene.value === 'nezha' ? 10 : 1;
starEnergyStore.addEnergy(reward, 'adventure');
playAudio('活动完成!获得' + reward + '颗星星能量!');
alert('🎉 活动完成!获得 ' + reward + ' 颗星星能量!');

View File

@@ -150,21 +150,21 @@ const tasks = ref({
{
title: '卡纸花朵',
description: '跟着 "手工兔" 学做卡纸花朵,步骤有图片 + 语音讲解',
reward: 8,
reward: 1,
completed: false,
icon: '🌸'
},
{
title: '瓶盖拼图',
description: '用瓶盖制作创意拼图,发挥想象力',
reward: 8,
reward: 1,
completed: false,
icon: '🧩'
},
{
title: '纸盘手偶',
description: '用纸盘制作可爱的手偶,自己设计表情',
reward: 8,
reward: 1,
completed: false,
icon: '🤹'
}
@@ -173,21 +173,21 @@ const tasks = ref({
{
title: '叠袜子',
description: '3-4 岁:学习叠袜子,整齐摆放',
reward: 10,
reward: 1,
completed: false,
icon: '🧦'
},
{
title: '摆碗筷',
description: '5-6 岁:帮助摆放碗筷,准备吃饭',
reward: 10,
reward: 1,
completed: false,
icon: '🍽️'
},
{
title: '整理书包',
description: '7-8 岁:自己整理书包,准备第二天的学习用品',
reward: 10,
reward: 1,
completed: false,
icon: '🎒'
}
@@ -196,21 +196,21 @@ const tasks = ref({
{
title: '蚂蚁搬家',
description: '拍蚂蚁搬家的照片,观察它们的行为',
reward: 8,
reward: 1,
completed: false,
icon: '🐜'
},
{
title: '树叶脉络',
description: '收集不同形状的树叶,观察它们的脉络',
reward: 8,
reward: 1,
completed: false,
icon: '🍃'
},
{
title: '花朵写生',
description: '在户外观察花朵,用画笔记录它们的样子',
reward: 8,
reward: 1,
completed: false,
icon: '🖌️'
}

View File

@@ -0,0 +1,819 @@
<template>
<div class="external-learning-area">
<div class="learning-header">
<div class="header-icon">📚</div>
<h2 class="header-title">课外学习天地</h2>
<p class="header-subtitle">点击链接开启知识探索之旅</p>
</div>
<!-- 学习资源分类 -->
<div class="learning-categories">
<button
v-for="category in categories"
:key="category.id"
class="category-btn"
:class="{ active: activeCategory === category.id }"
@click="setActiveCategory(category.id)"
>
<span class="category-icon">{{ category.icon }}</span>
<span class="category-name">{{ category.name }}</span>
</button>
</div>
<!-- 学习资源列表 -->
<div class="resources-container">
<div
v-for="resource in filteredResources"
:key="resource.id"
class="resource-card"
@click="openResource(resource)"
>
<div class="resource-icon">{{ resource.icon }}</div>
<div class="resource-content">
<h3 class="resource-title">{{ resource.title }}</h3>
<p class="resource-description">{{ resource.description }}</p>
<div class="resource-meta">
<span class="resource-age">{{ resource.ageRange }}</span>
<span class="resource-tag">{{ resource.tag }}</span>
</div>
</div>
<div class="resource-action">
<div class="go-btn">
<span>去学习</span>
<span>🚀</span>
</div>
</div>
</div>
</div>
<!-- 提示信息 -->
<div class="learning-tips">
<div class="tips-icon">💡</div>
<div class="tips-content">
<h4>温馨提示</h4>
<ul>
<li>每次学习时间建议控制在15-30分钟</li>
<li>学习后可以回来记录学习心得获得额外星星能量</li>
<li>学习过程中有家长陪同效果更好哦</li>
</ul>
</div>
</div>
<!-- 学习记录弹窗 -->
<div v-if="showRecordModal" class="modal-overlay" @click="closeRecordModal">
<div class="modal-content learning-record-modal" @click.stop>
<div class="modal-emoji">📝</div>
<h3 class="modal-title">记录学习成果</h3>
<p class="modal-message">你今天学习了什么</p>
<div class="record-inputs">
<div class="input-group">
<label>学习内容</label>
<textarea
v-model="recordContent"
class="record-textarea"
placeholder="说说你学到了什么..."
rows="3"
></textarea>
</div>
<div class="learning-duration">
<label>学习时长</label>
<div class="duration-options">
<button
v-for="duration in durationOptions"
:key="duration.value"
class="duration-btn"
:class="{ active: selectedDuration === duration.value }"
@click="selectedDuration = duration.value"
>
{{ duration.label }}
</button>
</div>
</div>
</div>
<div class="modal-buttons">
<button class="modal-btn" @click="submitRecord">提交记录</button>
<button class="modal-btn secondary" @click="closeRecordModal">稍后再说</button>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue';
import { useStarEnergyStore } from '../stores/starEnergy';
const starEnergyStore = useStarEnergyStore();
// 当前选中的分类
const activeCategory = ref('all');
// 学习记录相关
const showRecordModal = ref(false);
const recordContent = ref('');
const selectedDuration = ref(15);
const currentResource = ref<any>(null);
// 学习时长选项
const durationOptions = [
{ value: 10, label: '10分钟' },
{ value: 15, label: '15分钟' },
{ value: 20, label: '20分钟' },
{ value: 30, label: '30分钟' }
];
// 学习资源分类
const categories = [
{ id: 'all', name: '全部', icon: '🌟' },
{ id: 'english', name: '英语学习', icon: '🔤' },
{ id: 'science', name: '科学实验', icon: '🔬' },
{ id: 'geography', name: '地理知识', icon: '🌍' },
{ id: 'math', name: '趣味数学', icon: '🔢' },
{ id: 'art', name: '艺术创作', icon: '🎨' },
{ id: 'history', name: '历史文化', icon: '📜' }
];
// 学习资源数据
const resources = ref([
// 英语学习
{
id: 'en1',
category: 'english',
title: '六一儿童网-英文儿歌',
description: '海量英文儿歌动画边听边学适合3-12岁孩子启蒙',
url: 'http://www.61ertong.com/zt/etywgq/',
icon: '🎵',
ageRange: '3-12岁',
tag: '儿歌'
},
{
id: 'en2',
category: 'english',
title: '国家中小学智慧教育平台',
description: '教育部官方平台,小学英语课程教学资源',
url: 'https://basic.smartedu.cn/',
icon: '📚',
ageRange: '6-12岁',
tag: '官网'
},
// 科学实验
{
id: 'sc1',
category: 'science',
title: '儿童趣味科学实验',
description: '适合7岁以上儿童的科学实验视频孩子绝对爱看且能看懂',
url: 'https://www.bilibili.com/video/BV1734y1x7No',
icon: '🧪',
ageRange: '7-12岁',
tag: '视频'
},
{
id: 'sc2',
category: 'science',
title: '科学趣味动画片',
description: '小学生科学趣味动画,用动画形式讲科学,孩子一看就懂',
url: 'https://www.bilibili.com/video/BV1XJUKYPEtw',
icon: '🎬',
ageRange: '6-10岁',
tag: '动画'
},
{
id: 'sc3',
category: 'science',
title: '中国数字科技馆',
description: '中国科协、教育部、中科院共建,适合儿童的科普内容',
url: 'http://www.cdstm.cn/',
icon: '🔬',
ageRange: '6-12岁',
tag: '官网'
},
// 地理知识
{
id: 'geo1',
category: 'geography',
title: '地球科学趣味动画',
description: '小学生科学趣味动画片,从地球形成到火山地震,孩子爱看',
url: 'https://www.bilibili.com/search?keyword=小学生科学趣味动画片',
icon: '🌍',
ageRange: '6-10岁',
tag: '动画'
},
{
id: 'geo2',
category: 'geography',
title: '中国国家地理',
description: '国家级地理杂志网站,适合家长带孩子一起看',
url: 'https://www.dili360.com/',
icon: '🏔️',
ageRange: '8-12岁',
tag: '官网'
},
// 趣味数学
{
id: 'math1',
category: 'math',
title: '数学游乐场',
description: '免费免注册的数学学习网站融合游戏和学习适合3-8岁儿童',
url: 'https://www.mathplayground.com/',
icon: '🎮',
ageRange: '3-8岁',
tag: '网站'
},
{
id: 'math2',
category: 'math',
title: '免费数独游戏在线',
description: '经典数独游戏,提供多种难度,可免费在线玩',
url: 'https://sj.qq.com/topic/200076907',
icon: '🧩',
ageRange: '6-12岁',
tag: '游戏'
},
{
id: 'math3',
category: 'math',
title: '国家中小学智慧教育平台-数学',
description: '教育部官方小学数学课程资源',
url: 'https://basic.smartedu.cn/',
icon: '🧮',
ageRange: '6-12岁',
tag: '官网'
},
// 艺术创作
{
id: 'art1',
category: 'art',
title: '六一儿童网',
description: '适合1-6岁宝宝的儿童网站有儿歌、故事、绘画等内容',
url: 'http://www.61ertong.com/',
icon: '🎨',
ageRange: '3-8岁',
tag: '官网'
},
{
id: 'art2',
category: 'art',
title: '中国少儿艺教网',
description: '少儿美术教育网站,提供绘画教程、比赛、展览等活动',
url: 'http://www.art-child.com/',
icon: '🖌️',
ageRange: '5-12岁',
tag: '官网'
},
// 历史文化
{
id: 'his1',
category: 'history',
title: '故宫博物院青少网站',
description: '故宫博物院青少年专题网站,寓教于乐学习传统文化',
url: 'http://young.dpm.org.cn/',
icon: '🏛️',
ageRange: '6-15岁',
tag: '青少年'
},
{
id: 'his2',
category: 'history',
title: '国家图书馆少儿数字图书馆',
description: '海量电子书,双语绘本、科普书、动漫图书,还有有声读物',
url: 'https://kids.nlc.cn/',
icon: '📖',
ageRange: '6-12岁',
tag: '官网'
},
{
id: 'his3',
category: 'history',
title: '语文迷',
description: '专业儿童语文学习网站,成语故事、睡前故事、国学启蒙',
url: 'https://www.yuwenmi.com/',
icon: '📜',
ageRange: '6-12岁',
tag: '官网'
}
]);
// 过滤资源
const filteredResources = computed(() => {
if (activeCategory.value === 'all') {
return resources.value;
}
return resources.value.filter(r => r.category === activeCategory.value);
});
// 设置分类
const setActiveCategory = (categoryId: string) => {
activeCategory.value = categoryId;
};
// 打开学习资源
const openResource = (resource: any) => {
currentResource.value = resource;
// 询问是否记录学习
showRecordModal.value = true;
// 在新窗口打开链接
window.open(resource.url, '_blank');
};
// 提交学习记录
const submitRecord = () => {
if (!recordContent.value.trim()) {
alert('请写点什么吧!比如学到了什么,有什么收获...');
return;
}
// 根据学习时长计算奖励星星
const energyReward = Math.floor(selectedDuration.value / 10);
// 增加星星能量
starEnergyStore.addEnergy(energyReward);
alert(`太棒了!你学习了 ${selectedDuration.value} 分钟,获得 ${energyReward} 颗星星能量!⭐`);
// 重置表单
recordContent.value = '';
selectedDuration.value = 15;
showRecordModal.value = false;
currentResource.value = null;
};
// 关闭学习记录弹窗
const closeRecordModal = () => {
showRecordModal.value = false;
recordContent.value = '';
selectedDuration.value = 15;
currentResource.value = null;
};
</script>
<style scoped>
.external-learning-area {
padding: 20px;
max-width: 1400px;
margin: 0 auto;
animation: fadeIn 0.5s ease-in;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* 标题区域 */
.learning-header {
text-align: center;
margin-bottom: 30px;
position: relative;
}
.header-icon {
font-size: 80px;
margin-bottom: 15px;
animation: bounce 2s ease-in-out infinite;
}
@keyframes bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-15px); }
}
.header-title {
font-size: 32px;
font-weight: bold;
color: #FF6B6B;
margin: 0 0 10px 0;
text-shadow: 2px 2px 0 #FFD700;
}
.header-subtitle {
font-size: 18px;
color: #666;
margin: 0;
}
/* 分类按钮 */
.learning-categories {
display: flex;
flex-wrap: wrap;
gap: 12px;
justify-content: center;
margin-bottom: 30px;
}
.category-btn {
display: flex;
align-items: center;
gap: 8px;
padding: 12px 20px;
border: 3px solid #E0E0E0;
border-radius: 25px;
background: white;
cursor: pointer;
transition: all 0.3s ease;
font-size: 16px;
font-weight: bold;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}
.category-btn:hover {
transform: translateY(-3px) scale(1.05);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
.category-btn.active {
background: linear-gradient(135deg, #FF6B6B, #4ECDC4);
color: white;
border-color: #FFD700;
box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}
.category-icon {
font-size: 20px;
}
/* 资源卡片 */
.resources-container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
gap: 20px;
margin-bottom: 30px;
}
.resource-card {
display: flex;
align-items: center;
gap: 15px;
padding: 20px;
background: white;
border: 4px solid #E0E0E0;
border-radius: 20px;
cursor: pointer;
transition: all 0.3s ease;
position: relative;
overflow: hidden;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.resource-card::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.4), transparent);
transform: rotate(45deg);
animation: shine 3s ease-in-out infinite;
}
@keyframes shine {
0% { transform: translateX(-100%) rotate(45deg); }
100% { transform: translateX(100%) rotate(45deg); }
}
.resource-card:hover {
transform: translateY(-8px) scale(1.03);
border-color: #FFD700;
box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2), 0 0 30px rgba(255, 215, 0, 0.3);
}
.resource-icon {
font-size: 48px;
flex-shrink: 0;
animation: floatUp 3s ease-in-out infinite;
}
@keyframes floatUp {
0%, 100% { transform: translateY(0) translateX(0); }
25% { transform: translateY(-3px) translateX(2px); }
50% { transform: translateY(-6px) translateX(0); }
75% { transform: translateY(-3px) translateX(-2px); }
}
.resource-content {
flex: 1;
min-width: 0;
}
.resource-title {
font-size: 18px;
font-weight: bold;
color: #333;
margin: 0 0 8px 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.resource-description {
font-size: 14px;
color: #666;
margin: 0 0 10px 0;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.resource-meta {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.resource-age {
font-size: 12px;
padding: 4px 10px;
background: linear-gradient(135deg, #FFD700, #FFA500);
color: #333;
border-radius: 12px;
font-weight: bold;
}
.resource-tag {
font-size: 12px;
padding: 4px 10px;
background: linear-gradient(135deg, #4ECDC4, #44A08D);
color: white;
border-radius: 12px;
font-weight: bold;
}
.resource-action {
flex-shrink: 0;
}
.go-btn {
display: flex;
align-items: center;
gap: 5px;
padding: 10px 15px;
background: linear-gradient(135deg, #FF6B6B, #4ECDC4);
color: white;
border-radius: 15px;
font-weight: bold;
font-size: 14px;
transition: all 0.3s ease;
}
.resource-card:hover .go-btn {
transform: scale(1.1);
}
/* 温馨提示 */
.learning-tips {
background: linear-gradient(135deg, #FFF9C4, #FFE082);
border: 4px solid #FFD700;
border-radius: 20px;
padding: 20px;
display: flex;
gap: 15px;
align-items: flex-start;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.tips-icon {
font-size: 48px;
flex-shrink: 0;
animation: bounce 2s ease-in-out infinite;
}
.tips-content h4 {
font-size: 18px;
color: #FF6B6B;
margin: 0 0 10px 0;
}
.tips-content ul {
list-style: none;
padding: 0;
margin: 0;
}
.tips-content li {
font-size: 14px;
color: #555;
margin-bottom: 8px;
padding-left: 25px;
position: relative;
}
.tips-content li::before {
content: '⭐';
position: absolute;
left: 0;
}
/* 学习记录弹窗 */
.learning-record-modal {
max-width: 500px;
width: 90%;
}
.record-inputs {
margin: 20px 0;
}
.input-group {
margin-bottom: 20px;
}
.input-group label {
display: block;
font-size: 16px;
font-weight: bold;
color: #333;
margin-bottom: 10px;
}
.record-textarea {
width: 100%;
padding: 12px;
border: 3px solid #E0E0E0;
border-radius: 12px;
font-size: 14px;
font-family: inherit;
resize: vertical;
transition: all 0.3s ease;
}
.record-textarea:focus {
outline: none;
border-color: #4ECDC4;
box-shadow: 0 0 15px rgba(78, 205, 196, 0.3);
}
.learning-duration {
margin-bottom: 15px;
}
.learning-duration label {
display: block;
font-size: 16px;
font-weight: bold;
color: #333;
margin-bottom: 10px;
}
.duration-options {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.duration-btn {
padding: 10px 20px;
border: 3px solid #E0E0E0;
border-radius: 15px;
background: white;
cursor: pointer;
transition: all 0.3s ease;
font-size: 14px;
font-weight: bold;
}
.duration-btn:hover {
transform: translateY(-2px);
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}
.duration-btn.active {
background: linear-gradient(135deg, #4ECDC4, #44A08D);
color: white;
border-color: #4ECDC4;
}
/* Modal 通用样式 */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.6);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
backdrop-filter: blur(5px);
}
.modal-content {
background: white;
border-radius: 25px;
padding: 30px;
text-align: center;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
border: 5px solid #FFD700;
animation: modalIn 0.3s ease-out;
}
@keyframes modalIn {
from {
opacity: 0;
transform: scale(0.8) translateY(-20px);
}
to {
opacity: 1;
transform: scale(1) translateY(0);
}
}
.modal-emoji {
font-size: 64px;
margin-bottom: 15px;
animation: bounce 2s ease-in-out infinite;
}
.modal-title {
font-size: 28px;
font-weight: bold;
color: #FF6B6B;
margin: 0 0 10px 0;
text-shadow: 2px 2px 0 #FFD700;
}
.modal-message {
font-size: 16px;
color: #666;
margin: 0 0 20px 0;
}
.modal-buttons {
display: flex;
gap: 15px;
justify-content: center;
margin-top: 20px;
}
.modal-btn {
padding: 12px 30px;
border: none;
border-radius: 20px;
font-size: 16px;
font-weight: bold;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
.modal-btn {
background: linear-gradient(135deg, #FF6B6B, #4ECDC4);
color: white;
}
.modal-btn:hover {
transform: translateY(-3px) scale(1.05);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.modal-btn.secondary {
background: linear-gradient(135deg, #E0E0E0, #BDBDBD);
color: #333;
}
.modal-btn.secondary:hover {
transform: translateY(-3px) scale(1.05);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}
/* 响应式 */
@media (max-width: 768px) {
.header-title {
font-size: 24px;
}
.header-subtitle {
font-size: 14px;
}
.resources-container {
grid-template-columns: 1fr;
}
.resource-card {
padding: 15px;
}
.category-btn {
padding: 10px 15px;
font-size: 14px;
}
}
</style>

View File

@@ -196,8 +196,20 @@ const isChecked = (habit: keyof typeof habitData.value) => {
// 打卡习惯
const checkHabit = (habit: keyof typeof habitData.value) => {
const habitInfo = starEnergyStore.habits[habit];
if (!habitInfo) {
console.error('习惯数据不存在:', habit);
return;
}
const today = new Date().toISOString().split('T')[0];
if (habitInfo.lastChecked === today) {
alert('今天已经打卡过了,明天再来吧!💪');
return;
}
starEnergyStore.checkHabit(habit);
alert(`打卡成功!获得 10 颗星星能量!`);
alert(`打卡成功!获得 1 颗星星能量!💫`);
};
// 应用坏习惯扣分
@@ -502,19 +514,40 @@ const getMonsterEmoji = (monster: keyof typeof monsterData.value) => {
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.4), transparent);
transform: rotate(45deg);
animation: shine 3s ease-in-out infinite;
}
.habit-card::after {
content: '⭐';
position: absolute;
top: 8px;
right: 8px;
font-size: 18px;
animation: sparkle 2s ease-in-out infinite;
opacity: 0.8;
}
@keyframes shine {
0% { transform: translateX(-100%) rotate(45deg); }
100% { transform: translateX(100%) rotate(45deg); }
}
@keyframes sparkle {
0%, 100% {
opacity: 0.8;
transform: scale(1) rotate(0deg);
}
50% {
opacity: 1;
transform: scale(1.3) rotate(10deg);
}
}
.habit-card:hover {
transform: translateY(-8px) scale(1.05);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
transform: translateY(-12px) scale(1.08) rotate(2deg);
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2), 0 0 30px rgba(255, 182, 193, 0.3);
}
.habit-icon {
@@ -546,31 +579,60 @@ const getMonsterEmoji = (monster: keyof typeof monsterData.value) => {
}
.check-btn {
background: linear-gradient(135deg, #98FB98, #90EE90);
background: linear-gradient(135deg, #98FB98, #90EE90, #32CD32);
background-size: 200% 200%;
color: #006400;
border: none;
padding: 10px 20px;
border-radius: 20px;
padding: 12px 24px;
border-radius: 25px;
font-size: 14px;
font-weight: bold;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
display: flex;
align-items: center;
justify-content: center;
gap: 5px;
gap: 6px;
margin: 0 auto;
width: fit-content;
font-family: var(--cartoon-font);
animation: btnPulse 3s ease-in-out infinite;
position: relative;
overflow: hidden;
}
@keyframes btnPulse {
0%, 100% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
}
.check-btn::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
animation: btnShine 2s ease-in-out infinite;
}
@keyframes btnShine {
0% { left: -100%; }
50%, 100% { left: 100%; }
}
.check-btn:hover:not(:disabled) {
transform: translateY(-2px);
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
transform: translateY(-4px) scale(1.05);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
background: linear-gradient(135deg, #90EE90, #32CD32);
}
.check-btn:active:not(:disabled) {
transform: translateY(-2px) scale(1.02);
}
.check-btn:disabled {
background: linear-gradient(135deg, #FFD700, #FFA500);
color: white;

View File

@@ -29,7 +29,7 @@
<div class="subject-emoji">🐿</div>
<h3 class="subject-title">数学魔法课</h3>
<p class="subject-desc">和数字松鼠一起冒险</p>
<div class="subject-reward"> +15 能量</div>
<div class="subject-reward"> +1 能量</div>
</div>
<!-- 语文魔法课 -->
@@ -38,7 +38,7 @@
<div class="subject-emoji">🧚</div>
<h3 class="subject-title">语文魔法课</h3>
<p class="subject-desc">帮汉字小精灵拼偏旁</p>
<div class="subject-reward"> +15 能量</div>
<div class="subject-reward"> +1 能量</div>
</div>
<!-- 英语魔法课 -->
@@ -47,7 +47,7 @@
<div class="subject-emoji">🐦</div>
<h3 class="subject-title">英语魔法课</h3>
<p class="subject-desc">和字母小鸟走迷宫</p>
<div class="subject-reward"> +15 能量</div>
<div class="subject-reward"> +1 能量</div>
</div>
<!-- 科学魔法课 -->
@@ -56,7 +56,7 @@
<div class="subject-emoji">🌱</div>
<h3 class="subject-title">科学魔法课</h3>
<p class="subject-desc">在植物实验室做实验</p>
<div class="subject-reward"> +15 能量</div>
<div class="subject-reward"> +1 能量</div>
</div>
<!-- 日语魔法课 -->
@@ -65,27 +65,36 @@
<div class="subject-emoji">🌸</div>
<h3 class="subject-title">日语魔法课</h3>
<p class="subject-desc">学习简单的日语和50音图</p>
<div class="subject-reward"> +15 能量</div>
<div class="subject-reward"> +1 能量</div>
</div>
<!-- 地理魔法课 -->
<div class="subject-card geography" @click="selectSubject('geography')">
<div class="subject-icon">🗺</div>
<div class="subject-emoji">🌏</div>
<h3 class="subject-title">地理魔法课</h3>
<p class="subject-desc">学习中国地理常识和南北方差异</p>
<div class="subject-reward"> +1 能量</div>
</div>
</div>
<!-- 课程内容 -->
<div class="subject-content" v-if="currentSubject">
<div class="content-header">
<h3 class="content-title">{{ subjectTitles[currentSubject] }}</h3>
<h3 class="content-title">{{ currentSubject ? subjectTitles[currentSubject as keyof typeof subjectTitles] : '' }}</h3>
<button class="back-btn" @click="currentSubject = null">返回</button>
</div>
<!-- 任务列表 -->
<div class="tasks" v-if="!currentGame">
<div class="tasks" v-if="!currentGame && currentSubject">
<div class="daily-progress">
<h4>今日进度</h4>
<div class="progress-bar">
<div class="progress-fill" :style="{ width: (dailyProgress.completed[currentSubject] / dailyLimits[currentSubject]) * 100 + '%' }"></div>
<div class="progress-fill" :style="{ width: ((dailyProgress.completed[currentSubject as keyof typeof dailyProgress.completed] || 0) / dailyLimits[currentSubject as keyof typeof dailyLimits]) * 100 + '%' }"></div>
</div>
<span class="progress-text">{{ dailyProgress.completed[currentSubject] }}/{{ dailyLimits[currentSubject] }} </span>
<span class="progress-text">{{ dailyProgress.completed[currentSubject as keyof typeof dailyProgress.completed] || 0 }}/{{ dailyLimits[currentSubject as keyof typeof dailyLimits] }} </span>
</div>
<div v-for="(task, index) in tasks[currentSubject]" :key="index" class="task-card">
<div v-for="(task, index) in (tasks[currentSubject as keyof typeof tasks] || [])" :key="index" class="task-card">
<div class="task-icon">{{ task.icon }}</div>
<div class="task-info">
<h4 class="task-title">{{ task.title }}</h4>
@@ -95,8 +104,8 @@
<span>{{ task.reward }} 颗星星能量</span>
</div>
</div>
<button class="task-btn" @click="startGame(currentSubject, index)" :disabled="isDailyLimitReached(currentSubject)">
{{ task.completed ? '已完成' : isDailyLimitReached(currentSubject) ? '今日已达上限' : '开始' }}
<button class="task-btn" @click="startGame(currentSubject || '', index)" :disabled="isDailyLimitReached(currentSubject || '')">
{{ task.completed ? '已完成' : isDailyLimitReached(currentSubject || '') ? '今日已达上限' : '开始' }}
</button>
</div>
</div>
@@ -267,6 +276,33 @@
<button class="next-btn" @click="nextQuestion">下一题</button>
</div>
</div>
<!-- 地理游戏 -->
<div v-else-if="currentGame.subject === 'geography'" class="geography-game">
<div class="game-question">
<div class="question-with-audio">
<h4>{{ currentGame.question }}</h4>
<button class="audio-btn" @click="playAudio(currentGame.question)">🔊</button>
</div>
<div class="word-options">
<div
v-for="(option, idx) in currentGame.options"
:key="idx"
class="option-btn"
@click="checkGeographyAnswer(option)"
>
<span>{{ option }}</span>
<div class="option-audio-btn" @click.stop="playAudio(option)">🔊</div>
</div>
</div>
</div>
<div class="game-feedback" v-if="showFeedback">
<div :class="['feedback-message', isCorrect ? 'correct' : 'incorrect']">
{{ feedbackMessage }}
</div>
<button class="next-btn" @click="nextQuestion">下一题</button>
</div>
</div>
</div>
</div>
</div>
@@ -297,7 +333,8 @@ const dailyLimits = {
chinese: 25,
english: 25,
science: 25,
japanese: 25
japanese: 25,
geography: 25
};
// 题目进度跟踪
@@ -333,6 +370,11 @@ const progress = ref({
directions: 0,
items: 0,
greetings: 0
},
geography: {
map: 0,
basics: 0,
northSouth: 0
}
});
@@ -344,13 +386,18 @@ const dailyProgress = ref({
chinese: 0,
english: 0,
science: 0,
japanese: 0
japanese: 0,
geography: 0
}
});
// 检查是否达到每日上限
const isDailyLimitReached = (subject: string) => {
return dailyProgress.value.completed[subject as keyof typeof dailyProgress.value.completed] >= dailyLimits[subject as keyof typeof dailyLimits];
console.log('检查每日上限:', subject);
const completed = dailyProgress.value.completed[subject as keyof typeof dailyProgress.value.completed] || 0;
const limit = dailyLimits[subject as keyof typeof dailyLimits] || 25;
console.log('已完成:', completed, '上限:', limit);
return completed >= limit;
};
// 初始化时加载语音合成API的voices和进度数据
@@ -410,7 +457,8 @@ const checkDateUpdate = () => {
chinese: 0,
english: 0,
science: 0,
japanese: 0
japanese: 0,
geography: 0
}
};
@@ -427,7 +475,8 @@ const subjectTitles = {
chinese: '语文魔法课',
english: '英语魔法课',
science: '科学魔法课',
japanese: '日语魔法课'
japanese: '日语魔法课',
geography: '地理魔法课'
};
// 任务数据
@@ -595,11 +644,64 @@ const tasks = ref({
completed: false,
icon: '👋'
}
],
geography: [
{
title: '中国地图认知',
description: '认识中国地图的形状和主要省份',
reward: 5,
completed: false,
icon: '🗺️'
},
{
title: '中国地理常识',
description: '学习中国的地理位置、面积等基本常识',
reward: 5,
completed: false,
icon: '🌏'
},
{
title: '南北方差异',
description: '了解中国南北方的地理文化差异',
reward: 5,
completed: false,
icon: '🌵'
}
]
});
// 游戏数据
const gameData = {
geography: {
// 中国地图认知
map: [
{ question: '中国地图的形状像什么?', options: ['公鸡', '兔子', '大象', '龙'], answer: '公鸡' },
{ question: '中国的首都是哪里?', options: ['上海', '北京', '广州', '深圳'], answer: '北京' },
{ question: '中国最大的岛屿是哪个?', options: ['海南岛', '台湾岛', '崇明岛', '舟山群岛'], answer: '台湾岛' },
{ question: '中国最长的河流是哪条?', options: ['黄河', '长江', '珠江', '松花江'], answer: '长江' },
{ question: '中国的母亲河是哪条?', options: ['长江', '黄河', '珠江', '淮河'], answer: '黄河' }
],
// 中国地理常识
basics: [
{ question: '中国位于哪个大洲?', options: ['欧洲', '亚洲', '非洲', '北美洲'], answer: '亚洲' },
{ question: '中国的土地面积大约是多少?', options: ['960万平方公里', '860万平方公里', '760万平方公里', '660万平方公里'], answer: '960万平方公里' },
{ question: '中国的邻国中,面积最大的是哪个国家?', options: ['俄罗斯', '印度', '蒙古', '朝鲜'], answer: '俄罗斯' },
{ question: '中国的四大直辖市是北京、上海、天津和哪里?', options: ['重庆', '广州', '深圳', '成都'], answer: '重庆' },
{ question: '中国的地势特点是什么?', options: ['东高西低', '西高东低', '南高北低', '北高南低'], answer: '西高东低' },
{ question: '中国最大的高原是哪个?', options: ['青藏高原', '内蒙古高原', '黄土高原', '云贵高原'], answer: '青藏高原' },
{ question: '中国最大的平原是哪个?', options: ['东北平原', '华北平原', '长江中下游平原', '关中平原'], answer: '东北平原' },
{ question: '中国的南海诸岛属于哪个省级行政区?', options: ['广东省', '海南省', '福建省', '台湾省'], answer: '海南省' },
{ question: '中国的五岳中,位于山东省的是哪座山?', options: ['泰山', '华山', '衡山', '恒山'], answer: '泰山' }
],
// 南北方差异
northSouth: [
{ question: '中国南北方的分界线是什么?', options: ['秦岭-淮河', '长江', '黄河', '长城'], answer: '秦岭-淮河' },
{ question: '北方地区的主要粮食作物是什么?', options: ['小麦', '水稻', '玉米', '高粱'], answer: '小麦' },
{ question: '南方地区的主要粮食作物是什么?', options: ['水稻', '小麦', '玉米', '高粱'], answer: '水稻' },
{ question: '北方人喜欢吃的面食是?', options: ['面条', '米饭', '馒头', '饺子'], answer: '面条' },
{ question: '南方人喜欢吃的主食是?', options: ['米饭', '面条', '馒头', '饺子'], answer: '米饭' }
]
},
math: {
// 数数练习1-100 认知)
counting: [
@@ -2241,89 +2343,163 @@ const playAudio = (text: string) => {
// 选择学科
const selectSubject = (subject: string) => {
console.log('=== 选择学科开始 ===');
console.log('参数 subject:', subject);
console.log('currentSubject.value 修改前:', currentSubject.value);
currentSubject.value = subject;
currentGame.value = null;
console.log('currentSubject.value 修改后:', currentSubject.value);
console.log('currentGame.value:', currentGame.value);
console.log('=== 选择学科结束 ===');
};
// 开始游戏
const startGame = (subject: string, taskIndex: number) => {
console.log('开始游戏:', subject, taskIndex);
try {
console.log('开始游戏函数被调用:', subject, taskIndex);
console.log('类型检查 - subject:', typeof subject, 'taskIndex:', typeof taskIndex);
// 检查是否达到每日上限
if (isDailyLimitReached(subject)) {
const subjectName = subject === 'math' ? '数学' : subject === 'chinese' ? '语文' : subject === 'english' ? '英语' : subject === 'japanese' ? '日语' : '科学';
const limit = dailyLimits[subject as keyof typeof dailyLimits];
alert(`今日${subjectName}题目已达上限(${limit}题),明天再来挑战吧!`);
return;
// 检查是否达到每日上限
if (isDailyLimitReached(subject)) {
const subjectName = subject === 'math' ? '数学' : subject === 'chinese' ? '语文' : subject === 'english' ? '英语' : subject === 'japanese' ? '日语' : subject === 'geography' ? '地理' : '科学';
const limit = dailyLimits[subject as keyof typeof dailyLimits];
alert(`今日${subjectName}题目已达上限(${limit}题),明天再来挑战吧!`);
return;
}
// 根据学科和任务索引选择不同的题目集
let taskType = '';
let gameDataSubject: any = null;
let startIndex = 0;
switch (subject) {
case 'math':
const mathTasks = ['counting', 'shapes', 'calculation'];
taskType = mathTasks[taskIndex] || 'counting';
gameDataSubject = gameData.math[taskType as keyof typeof gameData.math];
startIndex = progress.value.math[taskType as keyof typeof progress.value.math] || 0;
break;
case 'chinese':
const chineseTasks = ['radicals', 'pinyin', 'words'];
taskType = chineseTasks[taskIndex] || 'radicals';
gameDataSubject = gameData.chinese[taskType as keyof typeof gameData.chinese];
startIndex = progress.value.chinese[taskType as keyof typeof progress.value.chinese] || 0;
break;
case 'english':
const englishTasks = ['maze', 'animal', 'dialogue'];
taskType = englishTasks[taskIndex] || 'maze';
gameDataSubject = gameData.english[taskType as keyof typeof gameData.english];
startIndex = progress.value.english[taskType as keyof typeof progress.value.english] || 0;
break;
case 'science':
const scienceTasks = ['plants', 'buoyancy', 'colors', 'chemistry', 'physics', 'experiments'];
taskType = scienceTasks[taskIndex] || 'plants';
gameDataSubject = gameData.science[taskType as keyof typeof gameData.science];
startIndex = progress.value.science[taskType as keyof typeof progress.value.science] || 0;
break;
case 'japanese':
const japaneseTasks = ['hiragana', 'animals', 'fruits', 'body', 'directions', 'items', 'greetings'];
taskType = japaneseTasks[taskIndex] || 'hiragana';
gameDataSubject = gameData.japanese[taskType as keyof typeof gameData.japanese];
startIndex = progress.value.japanese[taskType as keyof typeof progress.value.japanese] || 0;
break;
case 'geography':
const geographyTasks = ['map', 'basics', 'northSouth'];
taskType = geographyTasks[taskIndex] || 'map';
gameDataSubject = gameData.geography[taskType as keyof typeof gameData.geography];
startIndex = progress.value.geography[taskType as keyof typeof progress.value.geography] || 0;
break;
default:
gameDataSubject = gameData[subject as keyof typeof gameData];
startIndex = 0;
}
console.log('选择的任务类型:', taskType);
console.log('游戏数据:', gameDataSubject);
console.log('开始索引:', startIndex);
console.log('gameDataSubject类型:', typeof gameDataSubject);
console.log('gameDataSubject是否为数组:', Array.isArray(gameDataSubject));
console.log('gameDataSubject长度:', gameDataSubject ? gameDataSubject.length : 'N/A');
// 确保gameDataSubject是数组且有数据
if (gameDataSubject && Array.isArray(gameDataSubject) && gameDataSubject.length > 0) {
// 确保startIndex不超过题目总数
const effectiveIndex = Math.min(startIndex, gameDataSubject.length - 1);
console.log('effectiveIndex:', effectiveIndex);
// 获取题目数据
const questionData = gameDataSubject[effectiveIndex];
console.log('questionData:', questionData);
if (!questionData) {
console.error('题目数据未找到:', subject, taskType, effectiveIndex);
// 即使没有题目数据也设置currentGame.value
currentGame.value = {
subject,
taskIndex,
taskType,
question: '暂无题目数据',
options: [],
parts: [],
items: [],
answer: '',
audio: ''
};
return;
}
let shuffledOptions = null;
let shuffledAnswer = questionData.answer;
// 如果有选项,随机打乱顺序
if (questionData.options) {
// 创建选项的副本并打乱
shuffledOptions = [...questionData.options];
for (let i = shuffledOptions.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[shuffledOptions[i], shuffledOptions[j]] = [shuffledOptions[j], shuffledOptions[i]];
}
}
// 设置currentGame.value
currentGame.value = {
subject,
taskIndex,
taskType,
question: questionData.question || '暂无题目',
options: shuffledOptions || questionData.options || [],
parts: questionData.parts || [],
items: questionData.items || [],
answer: shuffledAnswer || '',
audio: questionData.audio || ''
};
console.log('当前游戏设置:', currentGame.value);
console.log('currentGame.value设置后:', currentGame.value);
} else {
console.error('游戏数据未找到或为空:', subject, taskType, gameDataSubject);
// 即使没有游戏数据也设置currentGame.value避免界面无反应
currentGame.value = {
subject,
taskIndex,
taskType,
question: '暂无题目数据',
options: [],
parts: [],
items: [],
answer: '',
audio: ''
};
}
currentQuestionIndex.value = startIndex;
showFeedback.value = false;
currentAnswer.value = '';
experimentResult.value = '';
console.log('函数执行完毕currentGame.value:', currentGame.value);
} catch (error) {
console.error('开始游戏时发生错误:', error);
alert('开始游戏时发生错误,请重试');
}
// 根据学科和任务索引选择不同的题目集
let taskType = '';
let gameDataSubject: any = null;
let startIndex = 0;
switch (subject) {
case 'math':
const mathTasks = ['counting', 'shapes', 'calculation'];
taskType = mathTasks[taskIndex] || 'counting';
gameDataSubject = gameData.math[taskType as keyof typeof gameData.math];
startIndex = progress.value.math[taskType as keyof typeof progress.value.math];
break;
case 'chinese':
const chineseTasks = ['radicals', 'pinyin', 'stories'];
taskType = chineseTasks[taskIndex] || 'radicals';
gameDataSubject = gameData.chinese[taskType as keyof typeof gameData.chinese];
startIndex = progress.value.chinese[taskType as keyof typeof progress.value.chinese];
break;
case 'english':
const englishTasks = ['maze', 'animal', 'dialogue'];
taskType = englishTasks[taskIndex] || 'maze';
gameDataSubject = gameData.english[taskType as keyof typeof gameData.english];
startIndex = progress.value.english[taskType as keyof typeof progress.value.english];
break;
case 'science':
const scienceTasks = ['plants', 'buoyancy', 'colors', 'chemistry', 'physics', 'experiments'];
taskType = scienceTasks[taskIndex] || 'plants';
gameDataSubject = gameData.science[taskType as keyof typeof gameData.science];
startIndex = progress.value.science[taskType as keyof typeof progress.value.science];
break;
case 'japanese':
const japaneseTasks = ['hiragana', 'animals', 'fruits', 'body', 'directions', 'items', 'greetings'];
taskType = japaneseTasks[taskIndex] || 'hiragana';
gameDataSubject = gameData.japanese[taskType as keyof typeof gameData.japanese];
startIndex = progress.value.japanese[taskType as keyof typeof progress.value.japanese];
break;
default:
gameDataSubject = gameData[subject as keyof typeof gameData];
}
console.log('选择的任务类型:', taskType);
console.log('游戏数据:', gameDataSubject);
console.log('开始索引:', startIndex);
if (gameDataSubject && gameDataSubject[0]) {
// 确保startIndex不超过题目总数
const effectiveIndex = Math.min(startIndex, gameDataSubject.length - 1);
currentGame.value = {
subject,
taskIndex,
taskType,
question: gameDataSubject[effectiveIndex].question,
options: gameDataSubject[effectiveIndex].options,
parts: gameDataSubject[effectiveIndex].parts,
items: gameDataSubject[effectiveIndex].items,
answer: gameDataSubject[effectiveIndex].answer,
audio: gameDataSubject[effectiveIndex].audio
};
console.log('当前游戏设置:', currentGame.value);
} else {
console.error('游戏数据未找到:', subject, taskType);
}
currentQuestionIndex.value = startIndex;
showFeedback.value = false;
currentAnswer.value = '';
experimentResult.value = '';
};
// 检查数学答案
@@ -2437,6 +2613,25 @@ const checkJapaneseAnswer = (option: string) => {
}
};
// 检查地理答案
const checkGeographyAnswer = (option: string) => {
isCorrect.value = option === currentGame.value.answer;
const task = tasks.value[currentGame.value.subject as keyof typeof tasks.value][currentGame.value.taskIndex];
let starsPerQuestion = 1;
if (currentGame.value.subject === 'math' || currentGame.value.subject === 'chinese' || currentGame.value.subject === 'english' || currentGame.value.subject === 'japanese' || currentGame.value.subject === 'geography') {
starsPerQuestion = Math.ceil(task.reward / 20);
} else if (currentGame.value.subject === 'science') {
starsPerQuestion = Math.ceil(task.reward / 10);
}
feedbackMessage.value = isCorrect.value
? `太棒了!回答正确!正确答案是 ${currentGame.value.answer}。获得 ${starsPerQuestion} 颗星星能量!`
: `再试一次,加油!你选择的是 ${option}`;
showFeedback.value = true;
if (isCorrect.value) {
playAudio(`太棒了,正确答案是 ${currentGame.value.answer}`);
}
};
// 选择语文偏旁
const selectPart = (part: string) => {
currentAnswer.value += part;
@@ -2454,12 +2649,16 @@ const nextQuestion = () => {
const taskIndex = currentGame.value.taskIndex;
const task = tasks.value[subject as keyof typeof tasks.value][taskIndex];
// 计算每题的星星奖励(总奖励除以题目数量)
// 计算每题的星星奖励(降低获得量)
let starsPerQuestion = 1;
if (subject === 'math' || subject === 'chinese' || subject === 'english') {
if (subject === 'math' || subject === 'chinese' || subject === 'english' || subject === 'japanese' || subject === 'geography') {
// 降低数学、语文、英语、日语、地理的奖励获得量
// 总奖励为5分成20题每题0.25颗向上取整为1颗
starsPerQuestion = Math.ceil(task.reward / 20); // 20题任务
} else if (subject === 'science') {
starsPerQuestion = Math.ceil(task.reward / 10); // 10题任务
// 降低科学的奖励获得量
// 总奖励为8-12分成10题每题0.8-1.2颗向上取整为1颗
starsPerQuestion = Math.ceil(task.reward / 15); // 15题任务的计算方式降低获得量
}
// 添加星星能量
@@ -2485,6 +2684,9 @@ const nextQuestion = () => {
case 'japanese':
progress.value.japanese[taskType as keyof typeof progress.value.japanese]++;
break;
case 'geography':
progress.value.geography[taskType as keyof typeof progress.value.geography]++;
break;
}
// 更新每日完成记录
@@ -2495,7 +2697,7 @@ const nextQuestion = () => {
// 检查是否达到每日上限
if (isDailyLimitReached(subject)) {
const subjectName = subject === 'math' ? '数学' : subject === 'chinese' ? '语文' : subject === 'english' ? '英语' : subject === 'japanese' ? '日语' : '科学';
const subjectName = subject === 'math' ? '数学' : subject === 'chinese' ? '语文' : subject === 'english' ? '英语' : subject === 'japanese' ? '日语' : subject === 'geography' ? '地理' : '科学';
const limit = dailyLimits[subject as keyof typeof dailyLimits];
alert(`今日${subjectName}题目已达上限(${limit}题),明天再来挑战吧!`);
currentGame.value = null;
@@ -2522,21 +2724,38 @@ const nextQuestion = () => {
case 'japanese':
gameDataSubject = gameData.japanese[taskType as keyof typeof gameData.japanese];
break;
case 'geography':
gameDataSubject = gameData.geography[taskType as keyof typeof gameData.geography];
break;
default:
gameDataSubject = gameData[subject as keyof typeof gameData];
}
if (gameDataSubject && currentQuestionIndex.value < gameDataSubject.length) {
const questionData = gameDataSubject[currentQuestionIndex.value];
let shuffledOptions = null;
let shuffledAnswer = questionData.answer;
// 如果有选项,随机打乱顺序
if (questionData.options) {
// 创建选项的副本并打乱
shuffledOptions = [...questionData.options];
for (let i = shuffledOptions.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[shuffledOptions[i], shuffledOptions[j]] = [shuffledOptions[j], shuffledOptions[i]];
}
}
currentGame.value = {
subject,
taskIndex,
taskType,
question: gameDataSubject[currentQuestionIndex.value].question,
options: gameDataSubject[currentQuestionIndex.value].options,
parts: gameDataSubject[currentQuestionIndex.value].parts,
items: gameDataSubject[currentQuestionIndex.value].items,
answer: gameDataSubject[currentQuestionIndex.value].answer,
audio: gameDataSubject[currentQuestionIndex.value].audio
question: questionData.question,
options: shuffledOptions || questionData.options,
parts: questionData.parts,
items: questionData.items,
answer: shuffledAnswer,
audio: questionData.audio
};
showFeedback.value = false;
currentAnswer.value = '';
@@ -2745,6 +2964,7 @@ const nextQuestion = () => {
.subject-card.chinese::before { background: linear-gradient(90deg, #9370DB, #DDA0DD); }
.subject-card.english::before { background: linear-gradient(90deg, #87CEEB, #4682B4); }
.subject-card.science::before { background: linear-gradient(90deg, #98FB98, #32CD32); }
.subject-card.geography::before { background: linear-gradient(90deg, #FFA500, #FFD700); }
.subject-icon {
font-size: 50px;

View File

@@ -145,14 +145,14 @@ const selectGame = (game: string) => {
// 完成迷宫
const completeMaze = () => {
starEnergyStore.addEnergy(5, 'logic');
alert('迷宫挑战成功!获得 5 颗星星能量!');
starEnergyStore.addEnergy(1, 'logic');
alert('迷宫挑战成功!获得 1 颗星星能量!');
};
// 检查找不同答案
const checkDiff = () => {
// 这里可以添加答案检查逻辑
starEnergyStore.addEnergy(5, 'logic');
starEnergyStore.addEnergy(1, 'logic');
alert('找不同挑战成功!获得 5 颗星星能量!');
};
@@ -165,14 +165,14 @@ const clearCanvas = () => {
// 完成涂鸦
const completeDoodle = () => {
starEnergyStore.addEnergy(8, 'logic');
alert('涂鸦完成!星宝把你的画变成了动画!获得 8 颗星星能量!');
starEnergyStore.addEnergy(1, 'logic');
alert('涂鸦完成!星宝把你的画变成了动画!获得 1 颗星星能量!');
};
// 创建故事
const createStory = () => {
if (storyText.value) {
starEnergyStore.addEnergy(8, 'logic');
starEnergyStore.addEnergy(1, 'logic');
alert('故事创编成功!星宝把你的故事做成了动画!获得 8 颗星星能量!');
} else {
alert('请先编写故事内容!');

View File

@@ -41,7 +41,7 @@
</div>
<div class="form-actions">
<button class="generate-feedback-btn" @click="generatePraise">重新生成</button>
<button class="read-feedback-btn" @click="readFeedback" :disabled="!generatedPraise">读给孩子听</button>
<button class="read-feedback-btn" @click="readFeedback" :disabled="!generatedPraise">🔊 读给孩子听</button>
</div>
</div>
<div v-if="savedFeedbacks.length > 0" class="saved-feedbacks">
@@ -208,10 +208,19 @@ const readFeedback = (content?: string) => {
}
try {
// 检查浏览器是否支持语音合成
if (!('speechSynthesis' in window)) {
alert('您的设备不支持语音朗读功能');
return;
}
// 停止当前正在播放的语音
window.speechSynthesis.cancel();
const speech = new SpeechSynthesisUtterance(text);
speech.lang = 'zh-CN';
speech.volume = 1;
speech.rate = 1;
speech.rate = 1.1;
speech.pitch = 1.2;
// 尝试选择更适合儿童的中文语音
@@ -254,6 +263,8 @@ const readFeedback = (content?: string) => {
}
} catch (error) {
console.error('音频播放失败:', error);
// 语音合成失败时的备用提示
alert('语音播放失败,请检查设备音频设置');
}
};

View File

@@ -347,35 +347,38 @@ const getButtonText = (reward: any) => {
// 兑换奖励
const redeemReward = (reward: any) => {
// 检查是否已兑换
if (claimedRewards.value.includes(reward.id)) {
alert('这个奖励已经兑换过了!');
return;
}
// 检查是否是BOSS奖励
if (reward.type === 'boss_defeat') {
if (starEnergyStore.getBossDefeats < reward.cost) {
insufficientStars.value = reward.cost - starEnergyStore.getBossDefeats;
const bossDefeats = starEnergyStore.getBossDefeats;
if (bossDefeats < reward.cost) {
insufficientStars.value = reward.cost - bossDefeats;
selectedReward.value = reward;
showInsufficientModal.value = true;
return;
}
} else {
// 普通奖励使用星星能量
if (starEnergyStore.getTotalEnergy < reward.cost) {
insufficientStars.value = reward.cost - starEnergyStore.getTotalEnergy;
const totalEnergy = starEnergyStore.getTotalEnergy;
if (totalEnergy < reward.cost) {
insufficientStars.value = reward.cost - totalEnergy;
selectedReward.value = reward;
showInsufficientModal.value = true;
return;
}
}
if (claimedRewards.value.includes(reward.id)) {
return;
}
selectedReward.value = reward;
let success = false;
if (reward.type === 'boss_defeat') {
// BOSS奖励使用击败次数兑换
// 这里可以添加专门的BOSS奖励兑换逻辑
success = starEnergyStore.redeemReward(reward.id, 0); // 不消耗星星
// BOSS奖励使用击败次数兑换,不消耗星星
success = starEnergyStore.redeemReward(reward.id, 0);
} else {
// 普通奖励使用星星能量
success = starEnergyStore.redeemReward(reward.id, reward.cost);
@@ -389,12 +392,14 @@ const redeemReward = (reward: any) => {
const speech = new SpeechSynthesisUtterance('恭喜你,兑换成功!');
speech.lang = 'zh-CN';
speech.volume = 1;
speech.rate = 1;
speech.rate = 1.1;
speech.pitch = 1.2;
window.speechSynthesis.speak(speech);
} catch (error) {
console.error('音频播放失败:', error);
}
} else {
alert('兑换失败,请重试!');
}
};
@@ -578,8 +583,8 @@ const closeModal = () => {
}
.reward-card:hover:not(.disabled):not(.claimed) {
transform: translateY(-5px);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
transform: translateY(-8px) scale(1.05);
box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2), 0 0 30px rgba(152, 251, 152, 0.3);
border-color: #32CD32;
}

View File

@@ -97,7 +97,11 @@
<span class="btn-icon">🚀</span>
<span class="btn-text">开始冒险</span>
</button>
<div class="start-hint">💡 点击按钮开启你的冒险之旅</div>
<button class="external-btn" @click="goToExternal">
<span class="btn-icon">📚</span>
<span class="btn-text">课外学习</span>
</button>
<div class="start-hint">💡 选择一个按钮开启你的冒险之旅</div>
</div>
</div>
@@ -170,6 +174,13 @@ const startAdventure = () => {
// 触发导航事件,显示冒险地图
emit('navigate', 'adventure');
};
const goToExternal = () => {
// 播放课外学习的语音
playAudio('让我们去课外学习天地,探索更多有趣的知识吧!');
// 触发导航事件,显示课外学习区域
emit('navigate', 'external');
};
</script>
<style scoped>
@@ -484,6 +495,7 @@ const startAdventure = () => {
font-family: var(--cartoon-font);
animation: shine 3s linear infinite;
border: 3px solid #006400;
margin: 0 10px;
}
.start-btn:hover {
@@ -496,6 +508,37 @@ const startAdventure = () => {
transform: translateY(-4px) scale(0.98);
}
.external-btn {
background: linear-gradient(135deg, #FF6B6B, #4ECDC4, #FFD700);
background-size: 200% 200%;
color: white;
border: none;
padding: 18px 50px;
border-radius: 30px;
font-size: 20px;
font-weight: bold;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
display: inline-flex;
align-items: center;
gap: 12px;
font-family: var(--cartoon-font);
animation: shine 3s linear infinite;
border: 3px solid #FFD700;
margin: 0 10px;
}
.external-btn:hover {
transform: translateY(-8px) scale(1.05);
box-shadow: 0 12px 30px rgba(255, 107, 107, 0.6);
background-position: right center;
}
.external-btn:active {
transform: translateY(-4px) scale(0.98);
}
.btn-icon {
font-size: 28px;
animation: wiggle 1.5s ease-in-out infinite;
@@ -733,8 +776,15 @@ const startAdventure = () => {
}
.start-btn {
padding: 14px 35px;
padding: 14px 25px;
font-size: 16px;
margin: 5px;
}
.external-btn {
padding: 14px 25px;
font-size: 16px;
margin: 5px;
}
.btn-icon {

View File

@@ -248,11 +248,11 @@ export const useStarEnergyStore = defineStore('starEnergy', {
}
// 奖励星星能量
this.addEnergy(10, 'habit');
this.addEnergy(1, 'habit');
// 连续3天打卡额外奖励
if (habitData.streak % 3 === 0) {
this.addEnergy(5, 'habit');
this.addEnergy(1, 'habit');
}
// 保存数据
@@ -275,7 +275,7 @@ export const useStarEnergyStore = defineStore('starEnergy', {
if (monsterData.health === 0) {
monsterData.defeated = true;
// 奖励星星能量
this.addEnergy(200, 'habit');
this.addEnergy(5, 'habit');
// 增加击败BOSS次数
this.bossDefeats++;
@@ -302,7 +302,7 @@ export const useStarEnergyStore = defineStore('starEnergy', {
if (monsterData.health === 0) {
monsterData.defeated = true;
// 奖励星星能量
this.addEnergy(200, 'habit');
this.addEnergy(5, 'habit');
// 增加击败BOSS次数
this.bossDefeats++;