知识库 · 提示词
把任何内容(甚至中文)变成英语学习内容的Prompt
这个Prompt能将任意中文或英文内容,自动转化为高质量英语学习网站,包括中英互译、CET-4词汇提炼、沉浸式闪卡、阅读高亮等完整学习功能。支持Gemini、Claude等AI一键生成。
效果
Gemini 生成 https://share.qiaomu.ai/view/777a6da
Claude 生成 https://share.qiaomu.ai/view/6a4c981
Prompt1:如果粘贴长文本变附件,用这个Prompt
{{content}}
---
处理加工我上面提供的文本,做中英互译,提炼CET4单词,用这些内容,生成和附件一模一样的网站。
Prompt2:如果Google AIstudio,不支持粘贴附件,用这个提示词
{{content}}
---
处理加工我提供的文本,做中英互译,提炼CET4单词,用这些内容,生成和下面代码和功能完成一样的网站:
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>乔木英语 - 高保真原型</title>
<link href="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
<link href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-100-M/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-100-M/marked/4.0.2/marked.min.js"></script>
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/alpinejs/3.9.0/cdn.min.js" defer></script>
<style>
body {
font-family: 'Noto Sans SC', sans-serif;
-webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}
.font-serif { font-family: 'Noto Serif SC', serif; }
.smooth-transition { transition: all 0.3s ease-in-out; }
.module-fade-enter-active, .module-fade-leave-active { transition: opacity 0.4s ease-in-out; }
.module-fade-enter-from, .module-fade-leave-to { opacity: 0; }
/* Flashcard 3D Flip */
.flashcard-container {
perspective: 1000px;
height: 480px; /* 增加高度 */
}
.flashcard {
position: relative;
width: 100%;
height: 100%;
transform-style: preserve-3d;
transition: transform 0.7s ease-in-out;
cursor: pointer;
}
.flashcard.is-flipped { transform: rotateY(180deg); }
.flashcard-face {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
-webkit-backface-visibility: hidden; /* Safari */
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 1.5rem; /* p-6 */
border-radius: 0.5rem; /* rounded-lg */
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); /* shadow-md */
}
.flashcard-front { background-color: white; }
.flashcard-back { background-color: #f0f9ff; /* sky-50 */ transform: rotateY(180deg); }
/* Progress Bar */
.progress-bar-container {
height: 4px;
background-color: #e5e7eb; /* gray-200 */
border-radius: 2px;
overflow: hidden;
position: fixed;
bottom: 0;
left: 0;
width: 100%;
z-index: 40; /* Below header */
}
.progress-bar {
height: 100%;
background-color: #1f2937; /* gray-800 */
transition: width 0.3s ease-in-out;
}
/* Reading Text Highlight */
.highlighted-word {
background-color: #fef9c3; /* yellow-100 */
cursor: pointer;
padding: 0 2px;
border-radius: 2px;
transition: background-color 0.2s ease;
}
.highlighted-word:hover { background-color: #fde047; /* yellow-400 */ }
/* Quiz Feedback */
.option-button.correct { background-color: #dcfce7; /* green-100 */ border-color: #22c55e; /* green-500 */ color: #166534; /* green-800 */ }
.option-button.incorrect { background-color: #fee2e2; /* red-100 */ border-color: #ef4444; /* red-500 */ color: #991b1b; /* red-800 */ }
.option-button:disabled { opacity: 0.7; cursor: not-allowed; }
/* Poster Modal */
.poster-modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
display: flex;
justify-content: center;
align-items: center;
z-index: 100;
cursor: pointer;
}
.poster-content {
width: 90%;
max-width: 400px;
aspect-ratio: 9 / 16;
background-color: white;
overflow: hidden;
position: relative;
display: flex;
flex-direction: column;
padding: 1.25rem;
}
@keyframes posterFadeIn {
from { opacity: 0; transform: scale(0.95); }
to { opacity: 1; transform: scale(1); }
}
@keyframes floatAnimation {
0% { transform: translateY(0); }
50% { transform: translateY(-10px); }
100% { transform: translateY(0); }
}
.poster-header {
text-align: center;
margin-bottom: 1rem;
}
.poster-header h2 {
font-size: 1.75rem;
margin-bottom: 0.25rem;
}
.poster-stats {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0.75rem;
margin-bottom: 1rem;
}
.stat-card {
padding: 0.75rem;
border-radius: 0.5rem;
text-align: center;
}
.stat-number {
font-size: 1.5rem;
font-weight: bold;
margin-bottom: 0.25rem;
}
.stat-label {
font-size: 0.75rem;
}
.poster-words {
margin-bottom: 1rem;
}
.poster-words h3 {
font-size: 1rem;
margin-bottom: 0.75rem;
}
.word-card {
margin-bottom: 0.75rem;
padding: 0.75rem;
border-radius: 0.5rem;
}
.word-text {
font-size: 1rem;
font-weight: bold;
margin-bottom: 0.125rem;
}
.word-phonetic {
font-size: 0.75rem;
margin-bottom: 0.25rem;
}
.word-definition {
font-size: 0.75rem;
line-height: 1.4;
}
.poster-footer {
margin-top: auto;
text-align: center;
padding-bottom: 0.5rem; /* 确保底部有足够空间 */
}
.poster-quote {
font-size: 0.75rem;
margin-bottom: 0.75rem;
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 3; /* 限制为3行 */
-webkit-box-orient: vertical;
overflow: hidden;
max-height: 3.6em; /* 约等于3行的高度 */
}
.poster-branding {
font-size: 0.75rem;
opacity: 0.6;
position: relative;
bottom: 0;
width: 100%;
padding: 0.25rem 0;
}
/* 大胆现代风格 */
.poster-bold-modern {
background: linear-gradient(135deg, #000 0%, #1a1a1a 100%);
color: #fff;
padding: 1.5rem;
position: relative;
overflow: hidden;
}
.poster-bold-modern::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(45deg,
rgba(255, 0, 128, 0.1) 0%,
rgba(255, 255, 0, 0.1) 100%);
transform: rotate(-15deg);
pointer-events: none;
}
.poster-bold-modern .poster-header {
margin-bottom: 2rem;
}
.poster-bold-modern .poster-header h2 {
font-size: 3.75rem;
font-weight: 900;
line-height: 1;
text-transform: uppercase;
letter-spacing: -0.02em;
margin-bottom: 0.5rem;
background: linear-gradient(90deg, #ff0080, #ff8c00);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
transform: skew(-5deg);
}
.poster-bold-modern .stat-card {
background: rgba(255, 255, 255, 0.1);
border: 2px solid rgba(255, 255, 255, 0.2);
backdrop-filter: blur(10px);
transform: skew(-5deg);
}
.poster-bold-modern .stat-number {
font-size: 2.5rem;
font-weight: 900;
color: #ff0080;
}
.poster-bold-modern .word-card {
background: rgba(0, 0, 0, 0.5);
border-left: 4px solid #ff0080;
padding: 0.5rem; /* 减小内边距 */
margin-bottom: 0.5rem; /* 减小外边距 */
transform: translateX(-0.5rem); /* 减小偏移 */
position: relative;
}
.poster-bold-modern .word-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(90deg,
rgba(255, 0, 128, 0.1),
transparent);
pointer-events: none;
}
.poster-bold-modern .word-text {
font-size: 0.875rem; /* 减小字体大小 */
font-weight: 700;
letter-spacing: 0.05em;
color: #fff;
margin-bottom: 0.125rem;
}
.poster-bold-modern .word-phonetic {
font-size: 0.625rem; /* 减小字体大小 */
color: rgba(255, 255, 255, 0.8);
margin-bottom: 0.125rem;
}
.poster-bold-modern .word-definition {
font-size: 0.625rem; /* 减小字体大小 */
line-height: 1.2;
color: rgba(255, 255, 255, 0.9);
}
/* 赛博朋克风格 */
.poster-cyberpunk {
background: #000020;
color: #0ff;
padding: 1.5rem;
position: relative;
overflow: hidden;
}
.poster-cyberpunk::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background:
linear-gradient(90deg,
rgba(0, 255, 255, 0.1) 1px,
transparent 1px
),
linear-gradient(
rgba(0, 255, 255, 0.1) 1px,
transparent 1px
);
background-size: 20px 20px;
pointer-events: none;
}
.poster-cyberpunk .poster-header {
position: relative;
z-index: 1;
}
.poster-cyberpunk .poster-header h2 {
font-family: 'Courier New', monospace;
font-size: 2.5rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.2em;
color: #0ff;
text-shadow:
2px 2px 0px #f0f,
-2px -2px 0px #0ff;
margin-bottom: 1rem;
}
.poster-cyberpunk .stat-card {
background: rgba(0, 255, 255, 0.05);
border: 1px solid #0ff;
box-shadow:
0 0 10px rgba(0, 255, 255, 0.3),
inset 0 0 20px rgba(0, 255, 255, 0.2);
position: relative;
}
.poster-cyberpunk .stat-card::before {
content: '';
position: absolute;
top: -1px;
left: -1px;
right: -1px;
bottom: -1px;
background: linear-gradient(45deg,
transparent 0%,
rgba(0, 255, 255, 0.2) 50%,
transparent 100%);
z-index: -1;
}
.poster-cyberpunk .word-card {
background: rgba(0, 0, 0, 0.7);
border: 1px solid #0ff;
box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
margin-bottom: 1rem;
position: relative;
overflow: hidden;
}
.poster-cyberpunk .word-text {
font-family: 'Courier New', monospace;
color: #fff;
text-transform: uppercase;
letter-spacing: 0.1em;
position: relative;
}
.poster-cyberpunk .word-phonetic {
color: #0ff;
font-style: italic;
}
.poster-cyberpunk .word-definition {
color: #0fc;
font-size: 0.875rem;
}
/* 优雅复古风格 */
.poster-elegant-vintage {
background: #f8f3e3;
color: #2c1810;
padding: 1.5rem;
position: relative;
border: 8px double #8b4513;
}
.poster-elegant-vintage::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image:
radial-gradient(circle at center, rgba(139, 69, 19, 0.05) 1px, transparent 1px),
radial-gradient(circle at center, rgba(139, 69, 19, 0.05) 1px, transparent 1px);
background-size: 20px 20px;
background-position: 0 0, 10px 10px;
pointer-events: none;
opacity: 0.5;
}
.poster-elegant-vintage .poster-header {
text-align: center;
margin-bottom: 1.5rem;
padding-bottom: 1rem;
border-bottom: 1px solid #8b4513;
position: relative;
}
.poster-elegant-vintage .poster-header::before,
.poster-elegant-vintage .poster-header::after {
content: '•';
position: absolute;
bottom: -0.5rem;
font-size: 1rem;
color: #8b4513;
background: #f8f3e3;
padding: 0 0.5rem;
}
.poster-elegant-vintage .poster-header::before {
left: 45%;
}
.poster-elegant-vintage .poster-header::after {
right: 45%;
}
.poster-elegant-vintage .poster-header h2 {
font-family: 'Noto Serif SC', serif;
font-size: 2rem;
color: #8b4513;
letter-spacing: 0.1em;
text-shadow: 1px 1px 0 #f8f3e3;
}
.poster-elegant-vintage .stat-card {
background: #fff;
border: 1px solid #8b4513;
box-shadow: 3px 3px 0 #8b4513;
position: relative;
}
.poster-elegant-vintage .word-card {
background: #fff;
border: 1px solid #8b4513;
box-shadow: 2px 2px 0 #8b4513; /* 减小阴影 */
padding: 0.5rem; /* 减小内边距 */
margin-bottom: 0.5rem; /* 减小外边距 */
position: relative;
}
.poster-elegant-vintage .word-text {
font-family: 'Noto Serif SC', serif;
color: #2c1810;
font-size: 0.875rem; /* 减小字体大小 */
font-weight: 600;
margin-bottom: 0.125rem;
}
.poster-elegant-vintage .word-phonetic {
font-style: italic;
color: #8b4513;
font-size: 0.625rem; /* 减小字体大小 */
margin-bottom: 0.125rem;
}
.poster-elegant-vintage .word-definition {
font-family: 'Noto Serif SC', serif;
color: #2c1810;
font-size: 0.625rem; /* 减小字体大小 */
line-height: 1.2;
}
/* 新未来主义风格 */
.poster-neo-futurism {
background: linear-gradient(135deg, #f5f5f7 0%, #ffffff 100%);
color: #1d1d1f;
padding: 1.5rem;
position: relative;
overflow: hidden;
}
.poster-neo-futurism::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background:
radial-gradient(
circle at 50% -20%,
rgba(0, 122, 255, 0.1),
transparent 70%
);
pointer-events: none;
}
.poster-neo-futurism .poster-header h2 {
font-weight: 300;
font-size: 2rem;
letter-spacing: -0.03em;
background: linear-gradient(90deg, #007aff, #5856d6);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-bottom: 0.75rem;
white-space: nowrap;
overflow: visible;
}
.poster-neo-futurism .stat-card {
background: rgba(255, 255, 255, 0.7);
backdrop-filter: blur(20px);
border: 1px solid rgba(0, 0, 0, 0.1);
box-shadow:
0 4px 6px rgba(0, 0, 0, 0.05),
inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}
.poster-neo-futurism .word-card {
background: rgba(255, 255, 255, 0.7);
backdrop-filter: blur(20px);
border: 1px solid rgba(0, 0, 0, 0.1);
box-shadow:
0 4px 6px rgba(0, 0, 0, 0.05),
inset 0 0 0 1px rgba(255, 255, 255, 0.5);
padding: 1rem;
margin-bottom: 1rem;
position: relative;
overflow: hidden;
}
.poster-neo-futurism .word-card::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(
45deg,
transparent,
rgba(0, 122, 255, 0.1),
transparent
);
transform: rotate(45deg);
pointer-events: none;
}
.poster-neo-futurism .word-text {
background: linear-gradient(90deg, #007aff, #5856d6);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-weight: 500;
font-size: 1.25rem;
}
.poster-neo-futurism .word-phonetic {
color: #86868b;
}
.poster-neo-futurism .word-definition {
color: #1d1d1f;
line-height: 1.6;
}
/* 移除赛博朋克动效 */
@keyframes cyberpunk-glitch {
0% { transform: none; text-shadow: none; }
100% { transform: none; text-shadow: none; }
}
@keyframes cyberpunk-scanlines {
0% { background-position: 0 0; }
100% { background-position: 0 0; }
}
/* 阅读区域样式优化 */
.prose {
max-width: none;
font-size: 1.125rem;
line-height: 2; /* 增加行高 */
color: #1f2937;
}
.bilingual-pair .english {
color: #1f2937;
font-size: 1.125rem;
line-height: 2; /* 增加行高 */
margin-bottom: 0.5rem;
}
.bilingual-pair .chinese {
color: #374151;
font-size: 1.125rem;
line-height: 2; /* 增加行高 */
padding-left: 1rem;
border-left: 2px solid #e5e7eb;
}
</style>
<meta name="code-type" content="html">
</head>
<body class="bg-gray-100" x-data="app()">
<!-- Top Navigation -->
<header class="bg-white shadow-md sticky top-0 z-50">
<nav class="container mx-auto px-4 sm:px-6 lg:px-8 py-3 flex justify-between items-center">
<div @click="currentModule = 'words'; currentWordIndex = 0; wordCardFlipped = false;" class="text-xl font-black text-gray-800 font-serif cursor-pointer hover:text-gray-900 transform hover:scale-105 transition-all duration-200">乔木英语</div>
<div class="hidden sm:flex ml-auto space-x-4">
<button @click="currentModule = 'words'" :class="{'text-gray-800 border-b-2 border-gray-800 font-semibold': currentModule === 'words', 'text-gray-500 hover:text-gray-700': currentModule !== 'words'}" class="py-2 px-1 smooth-transition">单词学习</button>
<button @click="currentModule = 'reading'" :class="{'text-gray-800 border-b-2 border-gray-800 font-semibold': currentModule === 'reading', 'text-gray-500 hover:text-gray-700': currentModule !== 'reading'}" class="py-2 px-1 smooth-transition">阅读学习</button>
<button @click="currentModule = 'quiz'" :class="{'text-gray-800 border-b-2 border-gray-800 font-semibold': currentModule === 'quiz', 'text-gray-500 hover:text-gray-700': currentModule !== 'quiz'}" class="py-2 px-1 smooth-transition">理解测试</button>
<button @click="currentModule = 'achievement'" :class="{'text-gray-800 border-b-2 border-gray-800 font-semibold': currentModule === 'achievement', 'text-gray-500 hover:text-gray-700': currentModule !== 'achievement'}" class="py-2 px-1 smooth-transition">学习成就</button>
</div>
<!-- Mobile Menu Button -->
<div class="sm:hidden">
<button @click="mobileMenuOpen = !mobileMenuOpen" class="text-gray-600 focus:outline-none">
<i class="fas fa-bars"></i>
</button>
</div>
</nav>
<!-- Mobile Menu -->
<div x-show="mobileMenuOpen" @click.away="mobileMenuOpen = false" class="sm:hidden absolute top-full left-0 right-0 bg-white shadow-lg py-2 z-40" x-transition>
<button @click="currentModule = 'words'; mobileMenuOpen = false" class="block w-full text-left px-4 py-2 text-sm" :class="{'text-gray-800 font-semibold': currentModule === 'words', 'text-gray-700': currentModule !== 'words'}">单词学习</button>
<button @click="currentModule = 'reading'; mobileMenuOpen = false" class="block w-full text-left px-4 py-2 text-sm" :class="{'text-gray-800 font-semibold': currentModule === 'reading', 'text-gray-700': currentModule !== 'reading'}">阅读学习</button>
<button @click="currentModule = 'quiz'; mobileMenuOpen = false" class="block w-full text-left px-4 py-2 text-sm" :class="{'text-gray-800 font-semibold': currentModule === 'quiz', 'text-gray-700': currentModule !== 'quiz'}">理解测试</button>
<button @click="currentModule = 'achievement'; mobileMenuOpen = false" class="block w-full text-left px-4 py-2 text-sm" :class="{'text-gray-800 font-semibold': currentModule === 'achievement', 'text-gray-700': currentModule !== 'achievement'}">学习成就</button>
</div>
</header>
<main class="container mx-auto p-4 sm:p-6 lg:p-8 pb-16"> <!-- Added padding-bottom for progress bar -->
<!-- Word Learning Module -->
<div x-show="currentModule === 'words'" x-transition:enter="module-fade-enter-active" x-transition:enter-start="module-fade-enter-from" x-transition:enter-end="module-fade-enter-to" x-transition:leave="module-fade-leave-active" x-transition:leave-start="module-fade-leave-from" x-transition:leave-end="module-fade-leave-to"
class="swipe-area"
@touchstart="handleTouchStart"
@touchmove="handleTouchMove"
@touchend="handleTouchEnd('words')">
<h2 class="text-2xl font-semibold mb-6 text-gray-800 text-center">单词学习</h2>
<div class="max-w-md mx-auto">
<div class="flashcard-container h-64 sm:h-72 mb-6">
<div class="flashcard" :class="{ 'is-flipped': wordCardFlipped }" @click="wordCardFlipped = !wordCardFlipped">
<!-- Front Face -->
<div class="flashcard-face flashcard-front">
<div class="text-4xl sm:text-5xl font-bold text-gray-900 mb-2" x-text="currentWordData.word"></div>
<div class="text-lg text-gray-600" x-text="currentWordData.phonetic"></div>
</div>
<!-- Back Face -->
<div class="flashcard-face flashcard-back">
<div class="w-full h-full flex flex-col">
<!-- 单词释义部分 -->
<div class="mb-4 p-4 bg-blue-50 rounded-lg">
<h3 class="text-lg font-semibold text-blue-800 mb-2">释义</h3>
<p class="text-gray-800" x-text="currentWordData.definition"></p>
</div>
<!-- 词根解析部分 -->
<template x-if="currentWordData.etymology">
<div class="mb-4 p-4 bg-purple-50 rounded-lg">
<h3 class="text-lg font-semibold text-purple-800 mb-2">词根解析</h3>
<p class="text-gray-800" x-text="currentWordData.etymology"></p>
</div>
</template>
<!-- 例句部分 -->
<div class="p-4 bg-green-50 rounded-lg">
<h3 class="text-lg font-semibold text-green-800 mb-2">例句</h3>
<p class="text-gray-800 italic" x-text="currentWordData.sentence"></p>
</div>
</div>
</div>
</div>
</div>
<!-- Navigation -->
<div class="flex justify-between items-center">
<button @click="prevWord()" :disabled="currentWordIndex === 0" class="flex items-center px-4 py-2 bg-gray-800 text-white rounded-md hover:bg-gray-900 disabled:opacity-50 disabled:cursor-not-allowed smooth-transition transform active:scale-95">
<i class="fas fa-chevron-left mr-2"></i> 上一个
</button>
<span class="text-sm text-gray-500" x-text="`${currentWordIndex + 1} / ${words.length}`"></span>
<template x-if="currentWordIndex < words.length - 1">
<button @click="nextWord()" class="flex items-center px-4 py-2 bg-gray-800 text-white rounded-md hover:bg-gray-900 disabled:opacity-50 disabled:cursor-not-allowed smooth-transition transform active:scale-95">
下一个 <i class="fas fa-chevron-right ml-2"></i>
</button>
</template>
<template x-if="currentWordIndex === words.length - 1">
<button @click="currentModule = 'reading'" class="flex items-center px-4 py-2 bg-gray-800 text-white rounded-md hover:bg-gray-900 smooth-transition transform active:scale-95">
开始阅读 <i class="fas fa-book-reader ml-2"></i>
</button>
</template>
</div>
</div>
<!-- Progress Bar -->
<div class="progress-bar-container">
<div class="progress-bar" :style="`width: ${((currentWordIndex + 1) / words.length) * 100}%`"></div>
</div>
</div>
<!-- Reading Comprehension Module -->
<div x-show="currentModule === 'reading'" x-transition:enter="module-fade-enter-active" x-transition:enter-start="module-fade-enter-from" x-transition:enter-end="module-fade-enter-to" x-transition:leave="module-fade-leave-active" x-transition:leave-start="module-fade-leave-from" x-transition:leave-end="module-fade-leave-to">
<h2 class="text-2xl font-semibold mb-4 text-gray-800 text-center">阅读学习</h2>
<!-- Reading Mode Selector -->
<div class="bg-white p-4 rounded-lg shadow-md mb-4">
<div class="flex justify-center space-x-4">
<button @click="readingMode = 'english'"
:class="{'bg-gray-800 text-white': readingMode === 'english', 'bg-gray-100 text-gray-800': readingMode !== 'english'}"
class="px-4 py-2 rounded-md transition-all duration-200 hover:bg-gray-900 hover:text-white">
<i class="fas fa-language mr-2"></i>英文
</button>
<button @click="readingMode = 'chinese'"
:class="{'bg-gray-800 text-white': readingMode === 'chinese', 'bg-gray-100 text-gray-800': readingMode !== 'chinese'}"
class="px-4 py-2 rounded-md transition-all duration-200 hover:bg-gray-900 hover:text-white">
<i class="fas fa-font mr-2"></i>中文
</button>
<button @click="readingMode = 'bilingual'"
:class="{'bg-gray-800 text-white': readingMode === 'bilingual', 'bg-gray-100 text-gray-800': readingMode !== 'bilingual'}"
class="px-4 py-2 rounded-md transition-all duration-200 hover:bg-gray-900 hover:text-white">
<i class="fas fa-exchange-alt mr-2"></i>双语
</button>
</div>
</div>
<!-- Reading Area -->
<div class="bg-white p-4 sm:p-6 rounded-lg shadow-md mb-8">
<!-- Content Area -->
<div class="swipe-area"
@touchstart="handleTouchStart"
@touchmove="handleTouchMove"
@touchend="handleTouchEnd('reading')">
<!-- Single Language Mode -->
<template x-if="readingMode !== 'bilingual'">
<div class="prose max-w-none text-base sm:text-lg leading-relaxed text-gray-800"
x-html="readingMode === 'english' ? formattedEnglishText : formattedChineseText"
@click="handleWordClick($event)">
</div>
</template>
<!-- Bilingual Mode -->
<template x-if="readingMode === 'bilingual'">
<div class="bilingual-text">
<template x-for="(paragraph, index) in getBilingualParagraphs()" :key="index">
<div class="bilingual-pair">
<div class="english" x-html="paragraph.english"></div>
<div class="chinese" x-html="paragraph.chinese"></div>
</div>
</template>
</div>
</template>
</div>
</div>
<!-- 跳转按钮 -->
<div class="mt-8 text-center">
<button @click="currentModule = 'quiz'"
class="px-6 py-3 bg-gray-800 text-white rounded-md hover:bg-gray-900 smooth-transition transform active:scale-95 shadow-lg">
<i class="fas fa-tasks mr-2"></i>已完成去测试
</button>
</div>
</div>
<!-- Learning Achievement Module -->
<div x-show="currentModule === 'achievement'" x-transition:enter="module-fade-enter-active" x-transition:enter-start="module-fade-enter-from" x-transition:enter-end="module-fade-enter-to" x-transition:leave="module-fade-leave-active" x-transition:leave-start="module-fade-leave-from" x-transition:leave-end="module-fade-leave-to">
<h2 class="text-2xl font-semibold mb-8 text-gray-800 text-center">学习成就</h2>
<div class="max-w-2xl mx-auto">
<!-- 成就卡片 -->
<div class="bg-white rounded-xl shadow-lg overflow-hidden">
<!-- 顶部信息区 -->
<div class="bg-gradient-to-r from-gray-800 to-gray-900 text-white p-6">
<div class="text-center">
<p class="text-lg opacity-90">学习日期</p>
<p class="text-2xl font-bold mt-1" x-text="currentDate"></p>
</div>
</div>
<!-- 统计数据区 -->
<div class="p-6">
<div class="grid grid-cols-2 gap-6">
<!-- 单词学习统计 -->
<div class="text-center p-4 bg-gray-50 rounded-lg">
<i class="fas fa-book text-2xl text-gray-800 mb-2"></i>
<p class="text-sm text-gray-600">学习单词</p>
<p class="text-2xl font-bold text-gray-800 mt-1" x-text="words.length"></p>
</div>
<!-- 测验成绩统计 -->
<div class="text-center p-4 bg-gray-50 rounded-lg">
<i class="fas fa-star text-2xl text-gray-800 mb-2"></i>
<p class="text-sm text-gray-600">测验得分</p>
<p class="text-2xl font-bold text-gray-800 mt-1">
<span x-text="quizScore"></span>
<span class="text-base font-normal text-gray-600">/ </span>
<span x-text="questions.length" class="text-base font-normal text-gray-600"></span>
</p>
</div>
</div>
<!-- 分享海报区 -->
<div class="mt-8">
<p class="text-center text-gray-600 mb-4">选择风格生成你的专属学习海报</p>
<div class="grid grid-cols-2 sm:grid-cols-4 gap-4">
<button @click="showPoster('bold-modern')"
class="py-2 px-3 bg-gray-800 text-white rounded-lg hover:bg-gray-900 smooth-transition transform hover:scale-105 active:scale-95 shadow-md">
<i class="fas fa-bold mb-1"></i>
<span class="block text-sm">大胆现代</span>
</button>
<button @click="showPoster('cyberpunk')"
class="py-2 px-3 bg-gray-800 text-white rounded-lg hover:bg-gray-900 smooth-transition transform hover:scale-105 active:scale-95 shadow-md">
<i class="fas fa-robot mb-1"></i>
<span class="block text-sm">赛博朋克</span>
</button>
<button @click="showPoster('elegant-vintage')"
class="py-2 px-3 bg-gray-800 text-white rounded-lg hover:bg-gray-900 smooth-transition transform hover:scale-105 active:scale-95 shadow-md">
<i class="fas fa-feather mb-1"></i>
<span class="block text-sm">优雅复古</span>
</button>
<button @click="showPoster('neo-futurism')"
class="py-2 px-3 bg-gray-800 text-white rounded-lg hover:bg-gray-900 smooth-transition transform hover:scale-105 active:scale-95 shadow-md">
<i class="fas fa-cube mb-1"></i>
<span class="block text-sm">新未来主义</span>
</button>
</div>
</div>
</div>
</div>
</div>
<!-- Poster Modal -->
<div x-show="posterVisible" class="poster-modal" @click="posterVisible = false" x-transition:enter="module-fade-enter-active" x-transition:leave="module-fade-leave-active">
<div class="poster-content" :class="'poster-' + selectedPosterStyle" @click.stop>
<!-- Content dynamically inserted based on style -->
<div :class="posterStyleClasses.container">
<h2 :class="posterStyleClasses.title" x-text="posterData.title">Learning Report</h2>
<p :class="posterStyleClasses.date" x-text="'Date: ' + currentDate"></p>
<div :class="posterStyleClasses.stats">
<p>Words Learned: <span x-text="words.length"></span></p>
<p>Quiz Score: <span x-text="quizScore"></span> / <span x-text="questions.length"></span></p>
</div>
<p :class="posterStyleClasses.quote" x-text="posterData.quote"></p>
</div>
<p class="absolute bottom-4 right-4 text-xs opacity-70 font-serif">乔木英语</p>
</div>
</div>
</div>
<!-- 添加理解测试模块 -->
<div x-show="currentModule === 'quiz'" x-transition:enter="module-fade-enter-active" x-transition:enter-start="module-fade-enter-from" x-transition:enter-end="module-fade-enter-to" x-transition:leave="module-fade-leave-active" x-transition:leave-start="module-fade-leave-from" x-transition:leave-end="module-fade-leave-to">
<h2 class="text-2xl font-semibold mb-6 text-gray-800 text-center">理解测试</h2>
<!-- 将原有的Quiz内容移动到这里 -->
<div x-show="!quizCompleted">
<div class="bg-white p-4 sm:p-6 rounded-lg shadow-md">
<div class="mb-4">
<p class="font-medium text-gray-800 mb-1" x-text="`问题 ${currentQuestionIndex + 1} / ${questions.length}:`"></p>
<p class="text-lg text-gray-900" x-text="currentQuestionData.question"></p>
</div>
<div class="space-y-3 mb-4">
<template x-for="(option, index) in currentQuestionData.options" :key="index">
<button
@click="selectAnswer(index)"
:disabled="userAnswers[currentQuestionIndex] !== null"
class="w-full text-left p-3 border rounded-md hover:bg-gray-50 smooth-transition option-button"
:class="{
'correct': userAnswers[currentQuestionIndex] !== null && index === currentQuestionData.correctAnswer && userAnswers[currentQuestionIndex] === index,
'incorrect': userAnswers[currentQuestionIndex] !== null && index !== currentQuestionData.correctAnswer && userAnswers[currentQuestionIndex] === index,
'border-blue-500 bg-blue-50': userAnswers[currentQuestionIndex] !== null && index === currentQuestionData.correctAnswer,
'border-gray-300': userAnswers[currentQuestionIndex] === null || (userAnswers[currentQuestionIndex] !== null && index !== userAnswers[currentIndex] && index !== currentQuestionData.correctAnswer)
}"
>
<span class="font-medium mr-2" x-text="String.fromCharCode(65 + index) + '.'"></span>
<span x-text="option"></span>
<template x-if="userAnswers[currentQuestionIndex] !== null && index === currentQuestionData.correctAnswer">
<i class="fas fa-check text-green-600 float-right"></i>
</template>
<template x-if="userAnswers[currentQuestionIndex] !== null && index === userAnswers[currentQuestionIndex] && index !== currentQuestionData.correctAnswer">
<i class="fas fa-times text-red-600 float-right"></i>
</template>
</button>
</template>
</div>
<div x-show="userAnswers[currentQuestionIndex] !== null" class="mt-4 p-4 bg-blue-50 border-l-4 border-blue-500 rounded-md" x-transition>
<div class="flex items-start">
<i class="fas fa-info-circle text-blue-500 mt-1 mr-3"></i>
<div>
<h4 class="font-semibold text-blue-800 mb-1">解析</h4>
<p class="text-blue-900" x-text="currentQuestionData.explanation"></p>
</div>
</div>
</div>
<!-- Quiz Navigation -->
<div class="mt-6 text-right">
<template x-if="currentQuestionIndex < questions.length - 1">
<button
@click="nextQuestion()"
:disabled="userAnswers[currentQuestionIndex] === null"
class="px-5 py-2 bg-gray-800 text-white rounded-md hover:bg-gray-900 disabled:opacity-50 disabled:cursor-not-allowed smooth-transition transform active:scale-95"
>
下一题 <i class="fas fa-chevron-right ml-1"></i>
</button>
</template>
<template x-if="currentQuestionIndex === questions.length - 1">
<button
@click="finishQuiz()"
:disabled="userAnswers[currentQuestionIndex] === null"
class="px-5 py-2 bg-gray-800 text-white rounded-md hover:bg-gray-900 disabled:opacity-50 disabled:cursor-not-allowed smooth-transition transform active:scale-95"
>
完成测验 <i class="fas fa-check-circle ml-1"></i>
</button>
</template>
</div>
</div>
</div>
<!-- Quiz Results -->
<div x-show="quizCompleted" class="text-center bg-white p-6 rounded-lg shadow-md" x-transition>
<h3 class="text-2xl font-semibold mb-4 text-green-600">测验完成!</h3>
<p class="text-xl mb-2 text-gray-800">你的得分: <strong x-text="quizScore" class="text-blue-600"></strong> / <span x-text="questions.length"></span></p>
<p class="text-gray-600 mb-6" x-text="getQuizFeedback()"></p>
<div class="flex justify-center space-x-4">
<button @click="retakeQuiz()" class="px-5 py-2 bg-gray-800 text-white rounded-md hover:bg-gray-900 smooth-transition transform active:scale-95">
<i class="fas fa-redo mr-1"></i> 重新测验
</button>
<button @click="currentModule = 'achievement'" class="px-5 py-2 bg-gray-800 text-white rounded-md hover:bg-gray-900 smooth-transition transform active:scale-95">
查看学习成就 <i class="fas fa-trophy ml-1"></i>
</button>
</div>
</div>
</div>
</main>
<script>
function app() {
return {
// App State
currentModule: 'words',
readingMode: 'english', // 'english', 'chinese', 'bilingual'
currentDate: new Date().toLocaleDateString('zh-CN'),
mobileMenuOpen: false,
touchStartX: 0,
touchEndX: 0,
touchStartY: 0,
touchEndY: 0,
// Word Learning State
words: [
// Extracted from the sample text - Needs to be CET4+ ideally
{ word: 'native', phonetic: '/ˈneɪtɪv/', definition: '本地的;天生的;土生植物', etymology: '来自拉丁语 nativus "天生的,自然的"', sentence: 'This is a truly AI Native browser.' },
{ word: 'browser', phonetic: '/ˈbraʊzər/', definition: '浏览器', etymology: '动词 browse + -er', sentence: 'You need an invitation code for the Dia browser.' },
{ word: 'invitation', phonetic: '/ˌɪnvɪˈteɪʃən/', definition: '邀请;请帖', etymology: '来自拉丁语 invitare "邀请"', sentence: 'Everyone should try to get an invitation code.' },
{ word: 'podcast', phonetic: '/ˈpɒdkɑːst/', definition: '播客', etymology: 'iPod + broadcast', sentence: 'I used NotebookLM for podcast summaries before.' },
{ word: '提炼', phonetic: '/tí liàn/', definition: 'to extract; refine', etymology: '中文词', sentence: '提炼所有故事 (Extract all stories).' }, // Added a Chinese example word for demo
{ word: 'encompass', phonetic: '/ɪnˈkʌmpəs/', definition: '包含;环绕', etymology: 'en- "使进入" + compass "范围"', sentence: 'Questions that encompass all the content.' },
{ word: 'default', phonetic: '/dɪˈfɔːlt/', definition: '默认;系统设定值', etymology: '来自古法语 defalte "缺点,缺少"', sentence: 'It\'s ad-free by default, amazing!' }
],
currentWordIndex: 0,
wordCardFlipped: false,
// Reading State
showEnglish: true,
rawEnglishText: `Oh wow! Everyone should definitely try to get an invitation code for the Dia browser.\n\nIt's a truly AI Native browser.\n\nUse Case: Podcast summaries. I used NotebookLM before.\n\nThe webpage directly asks: "Propose 20 questions about this content, such that the AI's answers will encompass all the text of this podcast."\n\nFollow-up question: "Answer the first question." And it actually answered!\n\nAsked again: "Extract all the stories." It delivered instantly.\n\nAd-free by default, awesome!`,
rawChineseText: `我去!大家一定要想办法搞个Dia浏览器的邀请码。\n\n真正AI Native浏览器。\n\nUse Case:播客总结,以前用NotebookLM。\n\n网页直接问:"针对这个内容提出20个问题,让AI回答后能涵盖这个播客文本的所有内容"\n\n追问:"回答第一个问题",真回答了!\n\n再问:"提炼所有故事",秒出。\n\n默认无广告,牛逼!`,
formattedEnglishText: '',
formattedChineseText: '',
highlightedWords: ['native', 'browser', 'invitation', 'podcast', 'encompass', 'default'], // Words to highlight
popupWord: '',
popupX: 0,
popupY: 0,
// Quiz State
questions: [
{
question: "What specific application is mentioned for the Dia browser?",
options: ["Video editing", "Podcast summaries", "Code development", "Social media management"],
correctAnswer: 1, // Index of the correct option
explanation: "The text explicitly mentions 'Use Case: Podcast summaries' in relation to using a tool like NotebookLM previously, implying Dia browser is used for similar tasks or webpage interaction related to it."
},
{
question: "What does the user seem impressed by regarding asking questions on the webpage?",
options: ["The speed of the browser", "The number of questions allowed", "The AI's ability to answer directly and extract information", "The design of the user interface"],
correctAnswer: 2,
explanation: "The user expresses surprise ('真回答了!', '秒出') at the AI's capability to answer specific questions and extract stories based on the webpage content."
},
{
question: "What is highlighted as a significant advantage of the Dia browser at the end?",
options: ["It's very fast", "It has better AI", "It's free", "It's ad-free by default"],
correctAnswer: 3,
explanation: "The text concludes with '默认无广告,牛逼!' which translates to 'Ad-free by default, awesome!', pointing this out as a key benefit."
},
{
question: "What term is used to describe the Dia browser's core technology?",
options: ["Web 3.0", "AI Native", "Cloud-Based", "Open Source"],
correctAnswer: 1,
explanation: "The text explicitly states '真正AI Native浏览器' (Truly AI Native browser)."
}
],
currentQuestionIndex: 0,
userAnswers: {}, // { 0: selectedIndex, 1: selectedIndex, ... }
quizScore: 0,
quizCompleted: false,
// Achievement State
posterVisible: false,
selectedPosterStyle: '', // 'bold-modern', 'cyberpunk', etc.
posterData: { // Default values
title: "Learning Report",
quote: "The journey of a thousand miles begins with a single step."
},
posterStyleClasses: { // Predefined classes for easier binding
container: '', title: '', date: '', stats: '', quote: ''
},
// --- METHODS ---
init() {
this.questions.forEach((_, index) => {
this.userAnswers[index] = null;
});
this.formatReadingText();
this.readingMode = 'english'; // 设置默认阅读模式
console.log("App initialized");
},
// Word Learning Methods
nextWord() {
if (this.currentWordIndex < this.words.length - 1) {
this.currentWordIndex++;
this.wordCardFlipped = false; // Reset flip state
}
},
prevWord() {
if (this.currentWordIndex > 0) {
this.currentWordIndex--;
this.wordCardFlipped = false; // Reset flip state
}
},
get currentWordData() {
if (this.words.length === 0) return { word: '', phonetic: '', definition: '', etymology: '', sentence: '' }; // Handle empty case
return this.words[this.currentWordIndex];
},
// Reading Methods
formatReadingText() {
// Use Marked.js to convert Markdown to HTML
const formatOptions = { breaks: true, gfm: true }; // Enable line breaks
let htmlEn = marked.parse(this.rawEnglishText, formatOptions);
let htmlZh = marked.parse(this.rawChineseText, formatOptions);
// Add highlighting spans to English text
this.highlightedWords.forEach(word => {
// Use regex to wrap the word, case-insensitive, ensuring it's a whole word
const regex = new RegExp(`\\b(${word})\\b`, 'gi');
htmlEn = htmlEn.replace(regex, `<span class="highlighted-word" data-word="${word.toLowerCase()}">$1</span>`);
});
this.formattedEnglishText = htmlEn;
this.formattedChineseText = htmlZh;
},
handleWordClick(event) {
const target = event.target;
if (target.classList.contains('highlighted-word')) {
const word = target.dataset.word;
const definition = this.getWordDefinition(word);
if (definition) {
this.popupWord = target.innerText; // Show the exact clicked word form
// Position popup near the clicked word
const rect = target.getBoundingClientRect();
this.popupX = rect.left + window.scrollX + rect.width / 2;
this.popupY = rect.top + window.scrollY;
}
} else {
//this.popupWord = ''; // Hide popup if clicking elsewhere
}
},
getWordDefinition(word) {
const lowerCaseWord = word.toLowerCase();
const foundWord = this.words.find(w => w.word.toLowerCase() === lowerCaseWord);
return foundWord ? foundWord.definition : '暂无释义';
},
// Quiz Methods
get currentQuestionData() {
if (this.questions.length === 0) return { question: '', options: [], correctAnswer: -1, explanation: '' };
return this.questions[this.currentQuestionIndex];
},
selectAnswer(index) {
if (this.userAnswers[this.currentQuestionIndex] === null) { // Only allow selection once
this.userAnswers[this.currentQuestionIndex] = index;
if (index === this.currentQuestionData.correctAnswer) {
// Correct answer logic (if needed immediately)
} else {
// Incorrect answer logic
}
}
},
nextQuestion() {
if (this.currentQuestionIndex < this.questions.length - 1) {
this.currentQuestionIndex++;
}
},
finishQuiz() {
this.calculateScore();
this.quizCompleted = true;
// Optionally: scroll to results or trigger achievement module
this.$nextTick(() => {
window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' });
// this.currentModule = 'achievement'; // Or jump directly
});
},
calculateScore() {
let score = 0;
this.questions.forEach((question, index) => {
if (this.userAnswers[index] === question.correctAnswer) {
score++;
}
});
this.quizScore = score;
},
retakeQuiz() {
this.currentQuestionIndex = 0;
this.quizCompleted = false;
this.quizScore = 0;
// Reset answers
this.questions.forEach((_, index) => {
this.userAnswers[index] = null;
});
window.scrollTo({ top: 0, behavior: 'smooth' });
},
getQuizFeedback() {
const percentage = (this.quizScore / this.questions.length) * 100;
if (percentage === 100) return "完美!你完全掌握了内容。";
if (percentage >= 75) return "很棒!对内容的理解非常到位。";
if (percentage >= 50) return "不错,还有提升空间,再接再厉!";
return "需要多加练习哦,重新测试或回顾原文吧!";
},
// Achievement Methods
showPoster(style) {
this.selectedPosterStyle = style;
this.setPosterStyleData(style); // Set text/styles based on theme
this.posterVisible = true;
},
setPosterStyleData(style) {
const quotes = {
'bold-modern': "Push beyond your limits, reach for the stars.",
'cyberpunk': "Knowledge is power, code is freedom.",
'elegant-vintage': "Education is not preparation for life; education is life itself.",
'neo-futurism': "The future belongs to those who learn more skills and combine them in creative ways."
};
const difficultWords = this.getDifficultWords();
const posterContent = document.querySelector('.poster-content');
if (posterContent) {
posterContent.innerHTML = `
<div class="h-full flex flex-col">
<div class="poster-header">
<h2 class="text-2xl font-bold mb-2">学习报告</h2>
<p class="text-sm opacity-80">${this.currentDate}</p>
</div>
<div class="poster-stats">
<div class="stat-card">
<div class="stat-number">${this.words.length}</div>
<div class="stat-label">今日单词</div>
</div>
<div class="stat-card">
<div class="stat-number">${this.quizScore}/${this.questions.length}</div>
<div class="stat-label">测验得分</div>
</div>
</div>
<div class="poster-words">
<h3 class="text-base font-semibold mb-3">今日挑战词汇</h3>
${difficultWords.map(word => `
<div class="word-card">
<div class="word-main">
<div class="word-text">${word.word}</div>
<div class="word-phonetic">${word.phonetic}</div>
</div>
<div class="word-definition">${word.definition}</div>
</div>
`).join('')}
</div>
<div class="poster-footer mt-auto">
<p class="poster-quote text-center text-sm mb-3">${quotes[style]}</p>
<div class="poster-branding text-center opacity-60">乔木英语</div>
</div>
</div>
`;
}
},
// Swipe Handling
handleTouchStart(event) {
this.touchStartX = event.touches[0].clientX;
this.touchStartY = event.touches[0].clientY;
},
handleTouchMove(event) {
this.touchEndX = event.touches[0].clientX;
this.touchEndY = event.touches[0].clientY;
},
handleTouchEnd(context) { // context = 'words' or 'reading'
const deltaX = this.touchEndX - this.touchStartX;
const deltaY = this.touchEndY - this.touchStartY;
// Only register as swipe if horizontal movement is significant and vertical is not
if (Math.abs(deltaX) > 50 && Math.abs(deltaY) < 50 && this.touchEndX !== 0) {
if (deltaX < -50) { // Swipe Left (Next)
if (context === 'words') {
if (this.currentWordIndex < this.words.length - 1) {
this.nextWord();
} else {
// Maybe show a small message "Last word, go to reading?" or automatically switch
this.currentModule = 'reading';
}
} else if (context === 'reading' && !this.quizCompleted) {
// Swipe left during reading could potentially navigate quiz questions if quiz is active?
// Or just switch language? Let's keep it simple: No swipe action during reading text itself for now.
// If quiz is active and an answer is selected:
if (this.userAnswers[this.currentQuestionIndex] !== null && this.currentQuestionIndex < this.questions.length - 1) {
this.nextQuestion();
} else if (this.userAnswers[this.currentQuestionIndex] !== null && this.currentQuestionIndex === this.questions.length - 1){
this.finishQuiz();
}
}
} else if (deltaX > 50) { // Swipe Right (Previous)
if (context === 'words') {
this.prevWord();
} else if (context === 'reading' && !this.quizCompleted) {
// Swipe right during reading/quiz: Go to previous question?
if (this.currentQuestionIndex > 0) {
this.currentQuestionIndex--;
// Maybe clear the answer for the previous question if re-visiting?
// this.userAnswers[this.currentQuestionIndex] = null; // Uncomment if needed
} else {
// At first question, maybe go back to words?
// this.currentModule = 'words';
}
}
}
}
// Reset touch coordinates
this.touchStartX = 0;
this.touchEndX = 0;
this.touchStartY = 0;
this.touchEndY = 0;
},
// 获取最难的5个单词
getDifficultWords() {
// 根据单词长度和定义长度综合评分
return this.words
.map(word => ({
...word,
difficulty: word.word.length + word.definition.length
}))
.sort((a, b) => b.difficulty - a.difficulty)
.slice(0, 3); // 只返回最难的3个单词
},
// 获取双语段落对照
getBilingualParagraphs() {
const englishParagraphs = this.rawEnglishText.split('\n\n');
const chineseParagraphs = this.rawChineseText.split('\n\n');
return englishParagraphs.map((english, index) => ({
english: this.formatParagraphWithHighlights(english),
chinese: chineseParagraphs[index] || ''
}));
},
// 格式化段落并添加高亮
formatParagraphWithHighlights(text) {
let formatted = text;
this.highlightedWords.forEach(word => {
const regex = new RegExp(`\\b(${word})\\b`, 'gi');
formatted = formatted.replace(regex, `<span class="highlighted-word" data-word="${word.toLowerCase()}">$1</span>`);
});
return formatted;
},
}
}
</script>
</body>
</html>
完整HTML(也是Prompt的一部分,用来当附件用)
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>乔木英语 - 高保真原型</title>
<link href="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
<link href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-100-M/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-100-M/marked/4.0.2/marked.min.js"></script>
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/alpinejs/3.9.0/cdn.min.js" defer></script>
<style>
body {
font-family: 'Noto Sans SC', sans-serif;
-webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}
.font-serif { font-family: 'Noto Serif SC', serif; }
.smooth-transition { transition: all 0.3s ease-in-out; }
.module-fade-enter-active, .module-fade-leave-active { transition: opacity 0.4s ease-in-out; }
.module-fade-enter-from, .module-fade-leave-to { opacity: 0; }
/* Flashcard 3D Flip */
.flashcard-container {
perspective: 1000px;
height: 480px; /* 增加高度 */
}
.flashcard {
position: relative;
width: 100%;
height: 100%;
transform-style: preserve-3d;
transition: transform 0.7s ease-in-out;
cursor: pointer;
}
.flashcard.is-flipped { transform: rotateY(180deg); }
.flashcard-face {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
-webkit-backface-visibility: hidden; /* Safari */
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 1.5rem; /* p-6 */
border-radius: 0.5rem; /* rounded-lg */
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); /* shadow-md */
}
.flashcard-front { background-color: white; }
.flashcard-back { background-color: #f0f9ff; /* sky-50 */ transform: rotateY(180deg); }
/* Progress Bar */
.progress-bar-container {
height: 4px;
background-color: #e5e7eb; /* gray-200 */
border-radius: 2px;
overflow: hidden;
position: fixed;
bottom: 0;
left: 0;
width: 100%;
z-index: 40; /* Below header */
}
.progress-bar {
height: 100%;
background-color: #1f2937; /* gray-800 */
transition: width 0.3s ease-in-out;
}
/* Reading Text Highlight */
.highlighted-word {
background-color: #fef9c3; /* yellow-100 */
cursor: pointer;
padding: 0 2px;
border-radius: 2px;
transition: background-color 0.2s ease;
}
.highlighted-word:hover { background-color: #fde047; /* yellow-400 */ }
/* Quiz Feedback */
.option-button.correct { background-color: #dcfce7; /* green-100 */ border-color: #22c55e; /* green-500 */ color: #166534; /* green-800 */ }
.option-button.incorrect { background-color: #fee2e2; /* red-100 */ border-color: #ef4444; /* red-500 */ color: #991b1b; /* red-800 */ }
.option-button:disabled { opacity: 0.7; cursor: not-allowed; }
/* Poster Modal */
.poster-modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
display: flex;
justify-content: center;
align-items: center;
z-index: 100;
cursor: pointer;
}
.poster-content {
width: 90%;
max-width: 400px;
aspect-ratio: 9 / 16;
background-color: white;
overflow: hidden;
position: relative;
display: flex;
flex-direction: column;
padding: 1.25rem;
}
@keyframes posterFadeIn {
from { opacity: 0; transform: scale(0.95); }
to { opacity: 1; transform: scale(1); }
}
@keyframes floatAnimation {
0% { transform: translateY(0); }
50% { transform: translateY(-10px); }
100% { transform: translateY(0); }
}
.poster-header {
text-align: center;
margin-bottom: 1rem;
}
.poster-header h2 {
font-size: 1.75rem;
margin-bottom: 0.25rem;
}
.poster-stats {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0.75rem;
margin-bottom: 1rem;
}
.stat-card {
padding: 0.75rem;
border-radius: 0.5rem;
text-align: center;
}
.stat-number {
font-size: 1.5rem;
font-weight: bold;
margin-bottom: 0.25rem;
}
.stat-label {
font-size: 0.75rem;
}
.poster-words {
margin-bottom: 1rem;
}
.poster-words h3 {
font-size: 1rem;
margin-bottom: 0.75rem;
}
.word-card {
margin-bottom: 0.75rem;
padding: 0.75rem;
border-radius: 0.5rem;
}
.word-text {
font-size: 1rem;
font-weight: bold;
margin-bottom: 0.125rem;
}
.word-phonetic {
font-size: 0.75rem;
margin-bottom: 0.25rem;
}
.word-definition {
font-size: 0.75rem;
line-height: 1.4;
}
.poster-footer {
margin-top: auto;
text-align: center;
padding-bottom: 0.5rem; /* 确保底部有足够空间 */
}
.poster-quote {
font-size: 0.75rem;
margin-bottom: 0.75rem;
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 3; /* 限制为3行 */
-webkit-box-orient: vertical;
overflow: hidden;
max-height: 3.6em; /* 约等于3行的高度 */
}
.poster-branding {
font-size: 0.75rem;
opacity: 0.6;
position: relative;
bottom: 0;
width: 100%;
padding: 0.25rem 0;
}
/* 大胆现代风格 */
.poster-bold-modern {
background: linear-gradient(135deg, #000 0%, #1a1a1a 100%);
color: #fff;
padding: 1.5rem;
position: relative;
overflow: hidden;
}
.poster-bold-modern::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(45deg,
rgba(255, 0, 128, 0.1) 0%,
rgba(255, 255, 0, 0.1) 100%);
transform: rotate(-15deg);
pointer-events: none;
}
.poster-bold-modern .poster-header {
margin-bottom: 2rem;
}
.poster-bold-modern .poster-header h2 {
font-size: 3.75rem;
font-weight: 900;
line-height: 1;
text-transform: uppercase;
letter-spacing: -0.02em;
margin-bottom: 0.5rem;
background: linear-gradient(90deg, #ff0080, #ff8c00);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
transform: skew(-5deg);
}
.poster-bold-modern .stat-card {
background: rgba(255, 255, 255, 0.1);
border: 2px solid rgba(255, 255, 255, 0.2);
backdrop-filter: blur(10px);
transform: skew(-5deg);
}
.poster-bold-modern .stat-number {
font-size: 2.5rem;
font-weight: 900;
color: #ff0080;
}
.poster-bold-modern .word-card {
background: rgba(0, 0, 0, 0.5);
border-left: 4px solid #ff0080;
padding: 0.5rem; /* 减小内边距 */
margin-bottom: 0.5rem; /* 减小外边距 */
transform: translateX(-0.5rem); /* 减小偏移 */
position: relative;
}
.poster-bold-modern .word-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(90deg,
rgba(255, 0, 128, 0.1),
transparent);
pointer-events: none;
}
.poster-bold-modern .word-text {
font-size: 0.875rem; /* 减小字体大小 */
font-weight: 700;
letter-spacing: 0.05em;
color: #fff;
margin-bottom: 0.125rem;
}
.poster-bold-modern .word-phonetic {
font-size: 0.625rem; /* 减小字体大小 */
color: rgba(255, 255, 255, 0.8);
margin-bottom: 0.125rem;
}
.poster-bold-modern .word-definition {
font-size: 0.625rem; /* 减小字体大小 */
line-height: 1.2;
color: rgba(255, 255, 255, 0.9);
}
/* 赛博朋克风格 */
.poster-cyberpunk {
background: #000020;
color: #0ff;
padding: 1.5rem;
position: relative;
overflow: hidden;
}
.poster-cyberpunk::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background:
linear-gradient(90deg,
rgba(0, 255, 255, 0.1) 1px,
transparent 1px
),
linear-gradient(
rgba(0, 255, 255, 0.1) 1px,
transparent 1px
);
background-size: 20px 20px;
pointer-events: none;
}
.poster-cyberpunk .poster-header {
position: relative;
z-index: 1;
}
.poster-cyberpunk .poster-header h2 {
font-family: 'Courier New', monospace;
font-size: 2.5rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.2em;
color: #0ff;
text-shadow:
2px 2px 0px #f0f,
-2px -2px 0px #0ff;
margin-bottom: 1rem;
}
.poster-cyberpunk .stat-card {
background: rgba(0, 255, 255, 0.05);
border: 1px solid #0ff;
box-shadow:
0 0 10px rgba(0, 255, 255, 0.3),
inset 0 0 20px rgba(0, 255, 255, 0.2);
position: relative;
}
.poster-cyberpunk .stat-card::before {
content: '';
position: absolute;
top: -1px;
left: -1px;
right: -1px;
bottom: -1px;
background: linear-gradient(45deg,
transparent 0%,
rgba(0, 255, 255, 0.2) 50%,
transparent 100%);
z-index: -1;
}
.poster-cyberpunk .word-card {
background: rgba(0, 0, 0, 0.7);
border: 1px solid #0ff;
box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
margin-bottom: 1rem;
position: relative;
overflow: hidden;
}
.poster-cyberpunk .word-text {
font-family: 'Courier New', monospace;
color: #fff;
text-transform: uppercase;
letter-spacing: 0.1em;
position: relative;
}
.poster-cyberpunk .word-phonetic {
color: #0ff;
font-style: italic;
}
.poster-cyberpunk .word-definition {
color: #0fc;
font-size: 0.875rem;
}
/* 优雅复古风格 */
.poster-elegant-vintage {
background: #f8f3e3;
color: #2c1810;
padding: 1.5rem;
position: relative;
border: 8px double #8b4513;
}
.poster-elegant-vintage::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image:
radial-gradient(circle at center, rgba(139, 69, 19, 0.05) 1px, transparent 1px),
radial-gradient(circle at center, rgba(139, 69, 19, 0.05) 1px, transparent 1px);
background-size: 20px 20px;
background-position: 0 0, 10px 10px;
pointer-events: none;
opacity: 0.5;
}
.poster-elegant-vintage .poster-header {
text-align: center;
margin-bottom: 1.5rem;
padding-bottom: 1rem;
border-bottom: 1px solid #8b4513;
position: relative;
}
.poster-elegant-vintage .poster-header::before,
.poster-elegant-vintage .poster-header::after {
content: '•';
position: absolute;
bottom: -0.5rem;
font-size: 1rem;
color: #8b4513;
background: #f8f3e3;
padding: 0 0.5rem;
}
.poster-elegant-vintage .poster-header::before {
left: 45%;
}
.poster-elegant-vintage .poster-header::after {
right: 45%;
}
.poster-elegant-vintage .poster-header h2 {
font-family: 'Noto Serif SC', serif;
font-size: 2rem;
color: #8b4513;
letter-spacing: 0.1em;
text-shadow: 1px 1px 0 #f8f3e3;
}
.poster-elegant-vintage .stat-card {
background: #fff;
border: 1px solid #8b4513;
box-shadow: 3px 3px 0 #8b4513;
position: relative;
}
.poster-elegant-vintage .word-card {
background: #fff;
border: 1px solid #8b4513;
box-shadow: 2px 2px 0 #8b4513; /* 减小阴影 */
padding: 0.5rem; /* 减小内边距 */
margin-bottom: 0.5rem; /* 减小外边距 */
position: relative;
}
.poster-elegant-vintage .word-text {
font-family: 'Noto Serif SC', serif;
color: #2c1810;
font-size: 0.875rem; /* 减小字体大小 */
font-weight: 600;
margin-bottom: 0.125rem;
}
.poster-elegant-vintage .word-phonetic {
font-style: italic;
color: #8b4513;
font-size: 0.625rem; /* 减小字体大小 */
margin-bottom: 0.125rem;
}
.poster-elegant-vintage .word-definition {
font-family: 'Noto Serif SC', serif;
color: #2c1810;
font-size: 0.625rem; /* 减小字体大小 */
line-height: 1.2;
}
/* 新未来主义风格 */
.poster-neo-futurism {
background: linear-gradient(135deg, #f5f5f7 0%, #ffffff 100%);
color: #1d1d1f;
padding: 1.5rem;
position: relative;
overflow: hidden;
}
.poster-neo-futurism::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background:
radial-gradient(
circle at 50% -20%,
rgba(0, 122, 255, 0.1),
transparent 70%
);
pointer-events: none;
}
.poster-neo-futurism .poster-header h2 {
font-weight: 300;
font-size: 2rem;
letter-spacing: -0.03em;
background: linear-gradient(90deg, #007aff, #5856d6);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-bottom: 0.75rem;
white-space: nowrap;
overflow: visible;
}
.poster-neo-futurism .stat-card {
background: rgba(255, 255, 255, 0.7);
backdrop-filter: blur(20px);
border: 1px solid rgba(0, 0, 0, 0.1);
box-shadow:
0 4px 6px rgba(0, 0, 0, 0.05),
inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}
.poster-neo-futurism .word-card {
background: rgba(255, 255, 255, 0.7);
backdrop-filter: blur(20px);
border: 1px solid rgba(0, 0, 0, 0.1);
box-shadow:
0 4px 6px rgba(0, 0, 0, 0.05),
inset 0 0 0 1px rgba(255, 255, 255, 0.5);
padding: 1rem;
margin-bottom: 1rem;
position: relative;
overflow: hidden;
}
.poster-neo-futurism .word-card::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(
45deg,
transparent,
rgba(0, 122, 255, 0.1),
transparent
);
transform: rotate(45deg);
pointer-events: none;
}
.poster-neo-futurism .word-text {
background: linear-gradient(90deg, #007aff, #5856d6);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-weight: 500;
font-size: 1.25rem;
}
.poster-neo-futurism .word-phonetic {
color: #86868b;
}
.poster-neo-futurism .word-definition {
color: #1d1d1f;
line-height: 1.6;
}
/* 移除赛博朋克动效 */
@keyframes cyberpunk-glitch {
0% { transform: none; text-shadow: none; }
100% { transform: none; text-shadow: none; }
}
@keyframes cyberpunk-scanlines {
0% { background-position: 0 0; }
100% { background-position: 0 0; }
}
/* 阅读区域样式优化 */
.prose {
max-width: none;
font-size: 1.125rem;
line-height: 2; /* 增加行高 */
color: #1f2937;
}
.bilingual-pair .english {
color: #1f2937;
font-size: 1.125rem;
line-height: 2; /* 增加行高 */
margin-bottom: 0.5rem;
}
.bilingual-pair .chinese {
color: #374151;
font-size: 1.125rem;
line-height: 2; /* 增加行高 */
padding-left: 1rem;
border-left: 2px solid #e5e7eb;
}
</style>
<meta name="code-type" content="html">
</head>
<body class="bg-gray-100" x-data="app()">
<!-- Top Navigation -->
<header class="bg-white shadow-md sticky top-0 z-50">
<nav class="container mx-auto px-4 sm:px-6 lg:px-8 py-3 flex justify-between items-center">
<div @click="currentModule = 'words'; currentWordIndex = 0; wordCardFlipped = false;" class="text-xl font-black text-gray-800 font-serif cursor-pointer hover:text-gray-900 transform hover:scale-105 transition-all duration-200">乔木英语</div>
<div class="hidden sm:flex ml-auto space-x-4">
<button @click="currentModule = 'words'" :class="{'text-gray-800 border-b-2 border-gray-800 font-semibold': currentModule === 'words', 'text-gray-500 hover:text-gray-700': currentModule !== 'words'}" class="py-2 px-1 smooth-transition">单词学习</button>
<button @click="currentModule = 'reading'" :class="{'text-gray-800 border-b-2 border-gray-800 font-semibold': currentModule === 'reading', 'text-gray-500 hover:text-gray-700': currentModule !== 'reading'}" class="py-2 px-1 smooth-transition">阅读学习</button>
<button @click="currentModule = 'quiz'" :class="{'text-gray-800 border-b-2 border-gray-800 font-semibold': currentModule === 'quiz', 'text-gray-500 hover:text-gray-700': currentModule !== 'quiz'}" class="py-2 px-1 smooth-transition">理解测试</button>
<button @click="currentModule = 'achievement'" :class="{'text-gray-800 border-b-2 border-gray-800 font-semibold': currentModule === 'achievement', 'text-gray-500 hover:text-gray-700': currentModule !== 'achievement'}" class="py-2 px-1 smooth-transition">学习成就</button>
</div>
<!-- Mobile Menu Button -->
<div class="sm:hidden">
<button @click="mobileMenuOpen = !mobileMenuOpen" class="text-gray-600 focus:outline-none">
<i class="fas fa-bars"></i>
</button>
</div>
</nav>
<!-- Mobile Menu -->
<div x-show="mobileMenuOpen" @click.away="mobileMenuOpen = false" class="sm:hidden absolute top-full left-0 right-0 bg-white shadow-lg py-2 z-40" x-transition>
<button @click="currentModule = 'words'; mobileMenuOpen = false" class="block w-full text-left px-4 py-2 text-sm" :class="{'text-gray-800 font-semibold': currentModule === 'words', 'text-gray-700': currentModule !== 'words'}">单词学习</button>
<button @click="currentModule = 'reading'; mobileMenuOpen = false" class="block w-full text-left px-4 py-2 text-sm" :class="{'text-gray-800 font-semibold': currentModule === 'reading', 'text-gray-700': currentModule !== 'reading'}">阅读学习</button>
<button @click="currentModule = 'quiz'; mobileMenuOpen = false" class="block w-full text-left px-4 py-2 text-sm" :class="{'text-gray-800 font-semibold': currentModule === 'quiz', 'text-gray-700': currentModule !== 'quiz'}">理解测试</button>
<button @click="currentModule = 'achievement'; mobileMenuOpen = false" class="block w-full text-left px-4 py-2 text-sm" :class="{'text-gray-800 font-semibold': currentModule === 'achievement', 'text-gray-700': currentModule !== 'achievement'}">学习成就</button>
</div>
</header>
<main class="container mx-auto p-4 sm:p-6 lg:p-8 pb-16"> <!-- Added padding-bottom for progress bar -->
<!-- Word Learning Module -->
<div x-show="currentModule === 'words'" x-transition:enter="module-fade-enter-active" x-transition:enter-start="module-fade-enter-from" x-transition:enter-end="module-fade-enter-to" x-transition:leave="module-fade-leave-active" x-transition:leave-start="module-fade-leave-from" x-transition:leave-end="module-fade-leave-to"
class="swipe-area"
@touchstart="handleTouchStart"
@touchmove="handleTouchMove"
@touchend="handleTouchEnd('words')">
<h2 class="text-2xl font-semibold mb-6 text-gray-800 text-center">单词学习</h2>
<div class="max-w-md mx-auto">
<div class="flashcard-container h-64 sm:h-72 mb-6">
<div class="flashcard" :class="{ 'is-flipped': wordCardFlipped }" @click="wordCardFlipped = !wordCardFlipped">
<!-- Front Face -->
<div class="flashcard-face flashcard-front">
<div class="text-4xl sm:text-5xl font-bold text-gray-900 mb-2" x-text="currentWordData.word"></div>
<div class="text-lg text-gray-600" x-text="currentWordData.phonetic"></div>
</div>
<!-- Back Face -->
<div class="flashcard-face flashcard-back">
<div class="w-full h-full flex flex-col">
<!-- 单词释义部分 -->
<div class="mb-4 p-4 bg-blue-50 rounded-lg">
<h3 class="text-lg font-semibold text-blue-800 mb-2">释义</h3>
<p class="text-gray-800" x-text="currentWordData.definition"></p>
</div>
<!-- 词根解析部分 -->
<template x-if="currentWordData.etymology">
<div class="mb-4 p-4 bg-purple-50 rounded-lg">
<h3 class="text-lg font-semibold text-purple-800 mb-2">词根解析</h3>
<p class="text-gray-800" x-text="currentWordData.etymology"></p>
</div>
</template>
<!-- 例句部分 -->
<div class="p-4 bg-green-50 rounded-lg">
<h3 class="text-lg font-semibold text-green-800 mb-2">例句</h3>
<p class="text-gray-800 italic" x-text="currentWordData.sentence"></p>
</div>
</div>
</div>
</div>
</div>
<!-- Navigation -->
<div class="flex justify-between items-center">
<button @click="prevWord()" :disabled="currentWordIndex === 0" class="flex items-center px-4 py-2 bg-gray-800 text-white rounded-md hover:bg-gray-900 disabled:opacity-50 disabled:cursor-not-allowed smooth-transition transform active:scale-95">
<i class="fas fa-chevron-left mr-2"></i> 上一个
</button>
<span class="text-sm text-gray-500" x-text="`${currentWordIndex + 1} / ${words.length}`"></span>
<template x-if="currentWordIndex < words.length - 1">
<button @click="nextWord()" class="flex items-center px-4 py-2 bg-gray-800 text-white rounded-md hover:bg-gray-900 disabled:opacity-50 disabled:cursor-not-allowed smooth-transition transform active:scale-95">
下一个 <i class="fas fa-chevron-right ml-2"></i>
</button>
</template>
<template x-if="currentWordIndex === words.length - 1">
<button @click="currentModule = 'reading'" class="flex items-center px-4 py-2 bg-gray-800 text-white rounded-md hover:bg-gray-900 smooth-transition transform active:scale-95">
开始阅读 <i class="fas fa-book-reader ml-2"></i>
</button>
</template>
</div>
</div>
<!-- Progress Bar -->
<div class="progress-bar-container">
<div class="progress-bar" :style="`width: ${((currentWordIndex + 1) / words.length) * 100}%`"></div>
</div>
</div>
<!-- Reading Comprehension Module -->
<div x-show="currentModule === 'reading'" x-transition:enter="module-fade-enter-active" x-transition:enter-start="module-fade-enter-from" x-transition:enter-end="module-fade-enter-to" x-transition:leave="module-fade-leave-active" x-transition:leave-start="module-fade-leave-from" x-transition:leave-end="module-fade-leave-to">
<h2 class="text-2xl font-semibold mb-4 text-gray-800 text-center">阅读学习</h2>
<!-- Reading Mode Selector -->
<div class="bg-white p-4 rounded-lg shadow-md mb-4">
<div class="flex justify-center space-x-4">
<button @click="readingMode = 'english'"
:class="{'bg-gray-800 text-white': readingMode === 'english', 'bg-gray-100 text-gray-800': readingMode !== 'english'}"
class="px-4 py-2 rounded-md transition-all duration-200 hover:bg-gray-900 hover:text-white">
<i class="fas fa-language mr-2"></i>英文
</button>
<button @click="readingMode = 'chinese'"
:class="{'bg-gray-800 text-white': readingMode === 'chinese', 'bg-gray-100 text-gray-800': readingMode !== 'chinese'}"
class="px-4 py-2 rounded-md transition-all duration-200 hover:bg-gray-900 hover:text-white">
<i class="fas fa-font mr-2"></i>中文
</button>
<button @click="readingMode = 'bilingual'"
:class="{'bg-gray-800 text-white': readingMode === 'bilingual', 'bg-gray-100 text-gray-800': readingMode !== 'bilingual'}"
class="px-4 py-2 rounded-md transition-all duration-200 hover:bg-gray-900 hover:text-white">
<i class="fas fa-exchange-alt mr-2"></i>双语
</button>
</div>
</div>
<!-- Reading Area -->
<div class="bg-white p-4 sm:p-6 rounded-lg shadow-md mb-8">
<!-- Content Area -->
<div class="swipe-area"
@touchstart="handleTouchStart"
@touchmove="handleTouchMove"
@touchend="handleTouchEnd('reading')">
<!-- Single Language Mode -->
<template x-if="readingMode !== 'bilingual'">
<div class="prose max-w-none text-base sm:text-lg leading-relaxed text-gray-800"
x-html="readingMode === 'english' ? formattedEnglishText : formattedChineseText"
@click="handleWordClick($event)">
</div>
</template>
<!-- Bilingual Mode -->
<template x-if="readingMode === 'bilingual'">
<div class="bilingual-text">
<template x-for="(paragraph, index) in getBilingualParagraphs()" :key="index">
<div class="bilingual-pair">
<div class="english" x-html="paragraph.english"></div>
<div class="chinese" x-html="paragraph.chinese"></div>
</div>
</template>
</div>
</template>
</div>
</div>
<!-- 跳转按钮 -->
<div class="mt-8 text-center">
<button @click="currentModule = 'quiz'"
class="px-6 py-3 bg-gray-800 text-white rounded-md hover:bg-gray-900 smooth-transition transform active:scale-95 shadow-lg">
<i class="fas fa-tasks mr-2"></i>已完成去测试
</button>
</div>
</div>
<!-- Learning Achievement Module -->
<div x-show="currentModule === 'achievement'" x-transition:enter="module-fade-enter-active" x-transition:enter-start="module-fade-enter-from" x-transition:enter-end="module-fade-enter-to" x-transition:leave="module-fade-leave-active" x-transition:leave-start="module-fade-leave-from" x-transition:leave-end="module-fade-leave-to">
<h2 class="text-2xl font-semibold mb-8 text-gray-800 text-center">学习成就</h2>
<div class="max-w-2xl mx-auto">
<!-- 成就卡片 -->
<div class="bg-white rounded-xl shadow-lg overflow-hidden">
<!-- 顶部信息区 -->
<div class="bg-gradient-to-r from-gray-800 to-gray-900 text-white p-6">
<div class="text-center">
<p class="text-lg opacity-90">学习日期</p>
<p class="text-2xl font-bold mt-1" x-text="currentDate"></p>
</div>
</div>
<!-- 统计数据区 -->
<div class="p-6">
<div class="grid grid-cols-2 gap-6">
<!-- 单词学习统计 -->
<div class="text-center p-4 bg-gray-50 rounded-lg">
<i class="fas fa-book text-2xl text-gray-800 mb-2"></i>
<p class="text-sm text-gray-600">学习单词</p>
<p class="text-2xl font-bold text-gray-800 mt-1" x-text="words.length"></p>
</div>
<!-- 测验成绩统计 -->
<div class="text-center p-4 bg-gray-50 rounded-lg">
<i class="fas fa-star text-2xl text-gray-800 mb-2"></i>
<p class="text-sm text-gray-600">测验得分</p>
<p class="text-2xl font-bold text-gray-800 mt-1">
<span x-text="quizScore"></span>
<span class="text-base font-normal text-gray-600">/ </span>
<span x-text="questions.length" class="text-base font-normal text-gray-600"></span>
</p>
</div>
</div>
<!-- 分享海报区 -->
<div class="mt-8">
<p class="text-center text-gray-600 mb-4">选择风格生成你的专属学习海报</p>
<div class="grid grid-cols-2 sm:grid-cols-4 gap-4">
<button @click="showPoster('bold-modern')"
class="py-2 px-3 bg-gray-800 text-white rounded-lg hover:bg-gray-900 smooth-transition transform hover:scale-105 active:scale-95 shadow-md">
<i class="fas fa-bold mb-1"></i>
<span class="block text-sm">大胆现代</span>
</button>
<button @click="showPoster('cyberpunk')"
class="py-2 px-3 bg-gray-800 text-white rounded-lg hover:bg-gray-900 smooth-transition transform hover:scale-105 active:scale-95 shadow-md">
<i class="fas fa-robot mb-1"></i>
<span class="block text-sm">赛博朋克</span>
</button>
<button @click="showPoster('elegant-vintage')"
class="py-2 px-3 bg-gray-800 text-white rounded-lg hover:bg-gray-900 smooth-transition transform hover:scale-105 active:scale-95 shadow-md">
<i class="fas fa-feather mb-1"></i>
<span class="block text-sm">优雅复古</span>
</button>
<button @click="showPoster('neo-futurism')"
class="py-2 px-3 bg-gray-800 text-white rounded-lg hover:bg-gray-900 smooth-transition transform hover:scale-105 active:scale-95 shadow-md">
<i class="fas fa-cube mb-1"></i>
<span class="block text-sm">新未来主义</span>
</button>
</div>
</div>
</div>
</div>
</div>
<!-- Poster Modal -->
<div x-show="posterVisible" class="poster-modal" @click="posterVisible = false" x-transition:enter="module-fade-enter-active" x-transition:leave="module-fade-leave-active">
<div class="poster-content" :class="'poster-' + selectedPosterStyle" @click.stop>
<!-- Content dynamically inserted based on style -->
<div :class="posterStyleClasses.container">
<h2 :class="posterStyleClasses.title" x-text="posterData.title">Learning Report</h2>
<p :class="posterStyleClasses.date" x-text="'Date: ' + currentDate"></p>
<div :class="posterStyleClasses.stats">
<p>Words Learned: <span x-text="words.length"></span></p>
<p>Quiz Score: <span x-text="quizScore"></span> / <span x-text="questions.length"></span></p>
</div>
<p :class="posterStyleClasses.quote" x-text="posterData.quote"></p>
</div>
<p class="absolute bottom-4 right-4 text-xs opacity-70 font-serif">乔木英语</p>
</div>
</div>
</div>
<!-- 添加理解测试模块 -->
<div x-show="currentModule === 'quiz'" x-transition:enter="module-fade-enter-active" x-transition:enter-start="module-fade-enter-from" x-transition:enter-end="module-fade-enter-to" x-transition:leave="module-fade-leave-active" x-transition:leave-start="module-fade-leave-from" x-transition:leave-end="module-fade-leave-to">
<h2 class="text-2xl font-semibold mb-6 text-gray-800 text-center">理解测试</h2>
<!-- 将原有的Quiz内容移动到这里 -->
<div x-show="!quizCompleted">
<div class="bg-white p-4 sm:p-6 rounded-lg shadow-md">
<div class="mb-4">
<p class="font-medium text-gray-800 mb-1" x-text="`问题 ${currentQuestionIndex + 1} / ${questions.length}:`"></p>
<p class="text-lg text-gray-900" x-text="currentQuestionData.question"></p>
</div>
<div class="space-y-3 mb-4">
<template x-for="(option, index) in currentQuestionData.options" :key="index">
<button
@click="selectAnswer(index)"
:disabled="userAnswers[currentQuestionIndex] !== null"
class="w-full text-left p-3 border rounded-md hover:bg-gray-50 smooth-transition option-button"
:class="{
'correct': userAnswers[currentQuestionIndex] !== null && index === currentQuestionData.correctAnswer && userAnswers[currentQuestionIndex] === index,
'incorrect': userAnswers[currentQuestionIndex] !== null && index !== currentQuestionData.correctAnswer && userAnswers[currentQuestionIndex] === index,
'border-blue-500 bg-blue-50': userAnswers[currentQuestionIndex] !== null && index === currentQuestionData.correctAnswer,
'border-gray-300': userAnswers[currentQuestionIndex] === null || (userAnswers[currentQuestionIndex] !== null && index !== userAnswers[currentIndex] && index !== currentQuestionData.correctAnswer)
}"
>
<span class="font-medium mr-2" x-text="String.fromCharCode(65 + index) + '.'"></span>
<span x-text="option"></span>
<template x-if="userAnswers[currentQuestionIndex] !== null && index === currentQuestionData.correctAnswer">
<i class="fas fa-check text-green-600 float-right"></i>
</template>
<template x-if="userAnswers[currentQuestionIndex] !== null && index === userAnswers[currentQuestionIndex] && index !== currentQuestionData.correctAnswer">
<i class="fas fa-times text-red-600 float-right"></i>
</template>
</button>
</template>
</div>
<div x-show="userAnswers[currentQuestionIndex] !== null" class="mt-4 p-4 bg-blue-50 border-l-4 border-blue-500 rounded-md" x-transition>
<div class="flex items-start">
<i class="fas fa-info-circle text-blue-500 mt-1 mr-3"></i>
<div>
<h4 class="font-semibold text-blue-800 mb-1">解析</h4>
<p class="text-blue-900" x-text="currentQuestionData.explanation"></p>
</div>
</div>
</div>
<!-- Quiz Navigation -->
<div class="mt-6 text-right">
<template x-if="currentQuestionIndex < questions.length - 1">
<button
@click="nextQuestion()"
:disabled="userAnswers[currentQuestionIndex] === null"
class="px-5 py-2 bg-gray-800 text-white rounded-md hover:bg-gray-900 disabled:opacity-50 disabled:cursor-not-allowed smooth-transition transform active:scale-95"
>
下一题 <i class="fas fa-chevron-right ml-1"></i>
</button>
</template>
<template x-if="currentQuestionIndex === questions.length - 1">
<button
@click="finishQuiz()"
:disabled="userAnswers[currentQuestionIndex] === null"
class="px-5 py-2 bg-gray-800 text-white rounded-md hover:bg-gray-900 disabled:opacity-50 disabled:cursor-not-allowed smooth-transition transform active:scale-95"
>
完成测验 <i class="fas fa-check-circle ml-1"></i>
</button>
</template>
</div>
</div>
</div>
<!-- Quiz Results -->
<div x-show="quizCompleted" class="text-center bg-white p-6 rounded-lg shadow-md" x-transition>
<h3 class="text-2xl font-semibold mb-4 text-green-600">测验完成!</h3>
<p class="text-xl mb-2 text-gray-800">你的得分: <strong x-text="quizScore" class="text-blue-600"></strong> / <span x-text="questions.length"></span></p>
<p class="text-gray-600 mb-6" x-text="getQuizFeedback()"></p>
<div class="flex justify-center space-x-4">
<button @click="retakeQuiz()" class="px-5 py-2 bg-gray-800 text-white rounded-md hover:bg-gray-900 smooth-transition transform active:scale-95">
<i class="fas fa-redo mr-1"></i> 重新测验
</button>
<button @click="currentModule = 'achievement'" class="px-5 py-2 bg-gray-800 text-white rounded-md hover:bg-gray-900 smooth-transition transform active:scale-95">
查看学习成就 <i class="fas fa-trophy ml-1"></i>
</button>
</div>
</div>
</div>
</main>
<script>
function app() {
return {
// App State
currentModule: 'words',
readingMode: 'english', // 'english', 'chinese', 'bilingual'
currentDate: new Date().toLocaleDateString('zh-CN'),
mobileMenuOpen: false,
touchStartX: 0,
touchEndX: 0,
touchStartY: 0,
touchEndY: 0,
// Word Learning State
words: [
// Extracted from the sample text - Needs to be CET4+ ideally
{ word: 'native', phonetic: '/ˈneɪtɪv/', definition: '本地的;天生的;土生植物', etymology: '来自拉丁语 nativus "天生的,自然的"', sentence: 'This is a truly AI Native browser.' },
{ word: 'browser', phonetic: '/ˈbraʊzər/', definition: '浏览器', etymology: '动词 browse + -er', sentence: 'You need an invitation code for the Dia browser.' },
{ word: 'invitation', phonetic: '/ˌɪnvɪˈteɪʃən/', definition: '邀请;请帖', etymology: '来自拉丁语 invitare "邀请"', sentence: 'Everyone should try to get an invitation code.' },
{ word: 'podcast', phonetic: '/ˈpɒdkɑːst/', definition: '播客', etymology: 'iPod + broadcast', sentence: 'I used NotebookLM for podcast summaries before.' },
{ word: '提炼', phonetic: '/tí liàn/', definition: 'to extract; refine', etymology: '中文词', sentence: '提炼所有故事 (Extract all stories).' }, // Added a Chinese example word for demo
{ word: 'encompass', phonetic: '/ɪnˈkʌmpəs/', definition: '包含;环绕', etymology: 'en- "使进入" + compass "范围"', sentence: 'Questions that encompass all the content.' },
{ word: 'default', phonetic: '/dɪˈfɔːlt/', definition: '默认;系统设定值', etymology: '来自古法语 defalte "缺点,缺少"', sentence: 'It\'s ad-free by default, amazing!' }
],
currentWordIndex: 0,
wordCardFlipped: false,
// Reading State
showEnglish: true,
rawEnglishText: `Oh wow! Everyone should definitely try to get an invitation code for the Dia browser.\n\nIt's a truly AI Native browser.\n\nUse Case: Podcast summaries. I used NotebookLM before.\n\nThe webpage directly asks: "Propose 20 questions about this content, such that the AI's answers will encompass all the text of this podcast."\n\nFollow-up question: "Answer the first question." And it actually answered!\n\nAsked again: "Extract all the stories." It delivered instantly.\n\nAd-free by default, awesome!`,
rawChineseText: `我去!大家一定要想办法搞个Dia浏览器的邀请码。\n\n真正AI Native浏览器。\n\nUse Case:播客总结,以前用NotebookLM。\n\n网页直接问:"针对这个内容提出20个问题,让AI回答后能涵盖这个播客文本的所有内容"\n\n追问:"回答第一个问题",真回答了!\n\n再问:"提炼所有故事",秒出。\n\n默认无广告,牛逼!`,
formattedEnglishText: '',
formattedChineseText: '',
highlightedWords: ['native', 'browser', 'invitation', 'podcast', 'encompass', 'default'], // Words to highlight
popupWord: '',
popupX: 0,
popupY: 0,
// Quiz State
questions: [
{
question: "What specific application is mentioned for the Dia browser?",
options: ["Video editing", "Podcast summaries", "Code development", "Social media management"],
correctAnswer: 1, // Index of the correct option
explanation: "The text explicitly mentions 'Use Case: Podcast summaries' in relation to using a tool like NotebookLM previously, implying Dia browser is used for similar tasks or webpage interaction related to it."
},
{
question: "What does the user seem impressed by regarding asking questions on the webpage?",
options: ["The speed of the browser", "The number of questions allowed", "The AI's ability to answer directly and extract information", "The design of the user interface"],
correctAnswer: 2,
explanation: "The user expresses surprise ('真回答了!', '秒出') at the AI's capability to answer specific questions and extract stories based on the webpage content."
},
{
question: "What is highlighted as a significant advantage of the Dia browser at the end?",
options: ["It's very fast", "It has better AI", "It's free", "It's ad-free by default"],
correctAnswer: 3,
explanation: "The text concludes with '默认无广告,牛逼!' which translates to 'Ad-free by default, awesome!', pointing this out as a key benefit."
},
{
question: "What term is used to describe the Dia browser's core technology?",
options: ["Web 3.0", "AI Native", "Cloud-Based", "Open Source"],
correctAnswer: 1,
explanation: "The text explicitly states '真正AI Native浏览器' (Truly AI Native browser)."
}
],
currentQuestionIndex: 0,
userAnswers: {}, // { 0: selectedIndex, 1: selectedIndex, ... }
quizScore: 0,
quizCompleted: false,
// Achievement State
posterVisible: false,
selectedPosterStyle: '', // 'bold-modern', 'cyberpunk', etc.
posterData: { // Default values
title: "Learning Report",
quote: "The journey of a thousand miles begins with a single step."
},
posterStyleClasses: { // Predefined classes for easier binding
container: '', title: '', date: '', stats: '', quote: ''
},
// --- METHODS ---
init() {
this.questions.forEach((_, index) => {
this.userAnswers[index] = null;
});
this.formatReadingText();
this.readingMode = 'english'; // 设置默认阅读模式
console.log("App initialized");
},
// Word Learning Methods
nextWord() {
if (this.currentWordIndex < this.words.length - 1) {
this.currentWordIndex++;
this.wordCardFlipped = false; // Reset flip state
}
},
prevWord() {
if (this.currentWordIndex > 0) {
this.currentWordIndex--;
this.wordCardFlipped = false; // Reset flip state
}
},
get currentWordData() {
if (this.words.length === 0) return { word: '', phonetic: '', definition: '', etymology: '', sentence: '' }; // Handle empty case
return this.words[this.currentWordIndex];
},
// Reading Methods
formatReadingText() {
// Use Marked.js to convert Markdown to HTML
const formatOptions = { breaks: true, gfm: true }; // Enable line breaks
let htmlEn = marked.parse(this.rawEnglishText, formatOptions);
let htmlZh = marked.parse(this.rawChineseText, formatOptions);
// Add highlighting spans to English text
this.highlightedWords.forEach(word => {
// Use regex to wrap the word, case-insensitive, ensuring it's a whole word
const regex = new RegExp(`\\b(${word})\\b`, 'gi');
htmlEn = htmlEn.replace(regex, `<span class="highlighted-word" data-word="${word.toLowerCase()}">$1</span>`);
});
this.formattedEnglishText = htmlEn;
this.formattedChineseText = htmlZh;
},
handleWordClick(event) {
const target = event.target;
if (target.classList.contains('highlighted-word')) {
const word = target.dataset.word;
const definition = this.getWordDefinition(word);
if (definition) {
this.popupWord = target.innerText; // Show the exact clicked word form
// Position popup near the clicked word
const rect = target.getBoundingClientRect();
this.popupX = rect.left + window.scrollX + rect.width / 2;
this.popupY = rect.top + window.scrollY;
}
} else {
//this.popupWord = ''; // Hide popup if clicking elsewhere
}
},
getWordDefinition(word) {
const lowerCaseWord = word.toLowerCase();
const foundWord = this.words.find(w => w.word.toLowerCase() === lowerCaseWord);
return foundWord ? foundWord.definition : '暂无释义';
},
// Quiz Methods
get currentQuestionData() {
if (this.questions.length === 0) return { question: '', options: [], correctAnswer: -1, explanation: '' };
return this.questions[this.currentQuestionIndex];
},
selectAnswer(index) {
if (this.userAnswers[this.currentQuestionIndex] === null) { // Only allow selection once
this.userAnswers[this.currentQuestionIndex] = index;
if (index === this.currentQuestionData.correctAnswer) {
// Correct answer logic (if needed immediately)
} else {
// Incorrect answer logic
}
}
},
nextQuestion() {
if (this.currentQuestionIndex < this.questions.length - 1) {
this.currentQuestionIndex++;
}
},
finishQuiz() {
this.calculateScore();
this.quizCompleted = true;
// Optionally: scroll to results or trigger achievement module
this.$nextTick(() => {
window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' });
// this.currentModule = 'achievement'; // Or jump directly
});
},
calculateScore() {
let score = 0;
this.questions.forEach((question, index) => {
if (this.userAnswers[index] === question.correctAnswer) {
score++;
}
});
this.quizScore = score;
},
retakeQuiz() {
this.currentQuestionIndex = 0;
this.quizCompleted = false;
this.quizScore = 0;
// Reset answers
this.questions.forEach((_, index) => {
this.userAnswers[index] = null;
});
window.scrollTo({ top: 0, behavior: 'smooth' });
},
getQuizFeedback() {
const percentage = (this.quizScore / this.questions.length) * 100;
if (percentage === 100) return "完美!你完全掌握了内容。";
if (percentage >= 75) return "很棒!对内容的理解非常到位。";
if (percentage >= 50) return "不错,还有提升空间,再接再厉!";
return "需要多加练习哦,重新测试或回顾原文吧!";
},
// Achievement Methods
showPoster(style) {
this.selectedPosterStyle = style;
this.setPosterStyleData(style); // Set text/styles based on theme
this.posterVisible = true;
},
setPosterStyleData(style) {
const quotes = {
'bold-modern': "Push beyond your limits, reach for the stars.",
'cyberpunk': "Knowledge is power, code is freedom.",
'elegant-vintage': "Education is not preparation for life; education is life itself.",
'neo-futurism': "The future belongs to those who learn more skills and combine them in creative ways."
};
const difficultWords = this.getDifficultWords();
const posterContent = document.querySelector('.poster-content');
if (posterContent) {
posterContent.innerHTML = `
<div class="h-full flex flex-col">
<div class="poster-header">
<h2 class="text-2xl font-bold mb-2">学习报告</h2>
<p class="text-sm opacity-80">${this.currentDate}</p>
</div>
<div class="poster-stats">
<div class="stat-card">
<div class="stat-number">${this.words.length}</div>
<div class="stat-label">今日单词</div>
</div>
<div class="stat-card">
<div class="stat-number">${this.quizScore}/${this.questions.length}</div>
<div class="stat-label">测验得分</div>
</div>
</div>
<div class="poster-words">
<h3 class="text-base font-semibold mb-3">今日挑战词汇</h3>
${difficultWords.map(word => `
<div class="word-card">
<div class="word-main">
<div class="word-text">${word.word}</div>
<div class="word-phonetic">${word.phonetic}</div>
</div>
<div class="word-definition">${word.definition}</div>
</div>
`).join('')}
</div>
<div class="poster-footer mt-auto">
<p class="poster-quote text-center text-sm mb-3">${quotes[style]}</p>
<div class="poster-branding text-center opacity-60">乔木英语</div>
</div>
</div>
`;
}
},
// Swipe Handling
handleTouchStart(event) {
this.touchStartX = event.touches[0].clientX;
this.touchStartY = event.touches[0].clientY;
},
handleTouchMove(event) {
this.touchEndX = event.touches[0].clientX;
this.touchEndY = event.touches[0].clientY;
},
handleTouchEnd(context) { // context = 'words' or 'reading'
const deltaX = this.touchEndX - this.touchStartX;
const deltaY = this.touchEndY - this.touchStartY;
// Only register as swipe if horizontal movement is significant and vertical is not
if (Math.abs(deltaX) > 50 && Math.abs(deltaY) < 50 && this.touchEndX !== 0) {
if (deltaX < -50) { // Swipe Left (Next)
if (context === 'words') {
if (this.currentWordIndex < this.words.length - 1) {
this.nextWord();
} else {
// Maybe show a small message "Last word, go to reading?" or automatically switch
this.currentModule = 'reading';
}
} else if (context === 'reading' && !this.quizCompleted) {
// Swipe left during reading could potentially navigate quiz questions if quiz is active?
// Or just switch language? Let's keep it simple: No swipe action during reading text itself for now.
// If quiz is active and an answer is selected:
if (this.userAnswers[this.currentQuestionIndex] !== null && this.currentQuestionIndex < this.questions.length - 1) {
this.nextQuestion();
} else if (this.userAnswers[this.currentQuestionIndex] !== null && this.currentQuestionIndex === this.questions.length - 1){
this.finishQuiz();
}
}
} else if (deltaX > 50) { // Swipe Right (Previous)
if (context === 'words') {
this.prevWord();
} else if (context === 'reading' && !this.quizCompleted) {
// Swipe right during reading/quiz: Go to previous question?
if (this.currentQuestionIndex > 0) {
this.currentQuestionIndex--;
// Maybe clear the answer for the previous question if re-visiting?
// this.userAnswers[this.currentQuestionIndex] = null; // Uncomment if needed
} else {
// At first question, maybe go back to words?
// this.currentModule = 'words';
}
}
}
}
// Reset touch coordinates
this.touchStartX = 0;
this.touchEndX = 0;
this.touchStartY = 0;
this.touchEndY = 0;
},
// 获取最难的5个单词
getDifficultWords() {
// 根据单词长度和定义长度综合评分
return this.words
.map(word => ({
...word,
difficulty: word.word.length + word.definition.length
}))
.sort((a, b) => b.difficulty - a.difficulty)
.slice(0, 3); // 只返回最难的3个单词
},
// 获取双语段落对照
getBilingualParagraphs() {
const englishParagraphs = this.rawEnglishText.split('\n\n');
const chineseParagraphs = this.rawChineseText.split('\n\n');
return englishParagraphs.map((english, index) => ({
english: this.formatParagraphWithHighlights(english),
chinese: chineseParagraphs[index] || ''
}));
},
// 格式化段落并添加高亮
formatParagraphWithHighlights(text) {
let formatted = text;
this.highlightedWords.forEach(word => {
const regex = new RegExp(`\\b(${word})\\b`, 'gi');
formatted = formatted.replace(regex, `<span class="highlighted-word" data-word="${word.toLowerCase()}">$1</span>`);
});
return formatted;
},
}
}
</script>
</body>
</html>
如果想给海报加风格,可以参考下面提示词
**可选设计风格:**
1. 极简主义风格 (Minimalist)
采用极简主义风格设计,遵循"少即是多"的理念。使用大量留白创造呼吸空间,仅保留最必要的元素。配色方案限制在2-3种中性色,主要为白色背景配以黑色或深灰色文字。排版应精确到像素级别,使用精心设计的网格系统和黄金比例。字体选择无衬线字体如Helvetica或Noto Sans,字重变化作为主要层次手段。装饰元素几乎为零,仅使用极细的分隔线和微妙的阴影。整体设计应呈现出克制、优雅且永恒的美学,让内容本身成为焦点。参考Dieter Rams的设计原则和日本无印良品(MUJI)的产品美学。
2. 大胆现代风格 (Bold Modern)
采用大胆现代风格设计,打破传统排版规则,创造强烈视觉冲击。使用鲜艳对比色如荧光粉、电子蓝、亮黄等,背景可使用深色或鲜艳色块。排版应不对称且动态,标题文字极大(至少60px),可使用极粗字重或压缩字体,甚至允许文字重叠和溢出。图形元素应用几何形状,边缘锐利,可添加不规则裁切效果。层次感通过大小、颜色和位置的极端对比创造。整体设计应充满张力和活力,像一张视觉宣言,参考Wired杂志和Pentagram设计工作室的作品。添加微妙动效如悬停放大或颜色变换,增强现代感。
3. 优雅复古风格 (Elegant Vintage)
采用优雅复古风格设计,重现20世纪初期印刷品的精致美学。使用米色或淡黄色纸张质感背景,配以深棕、暗红等老式印刷色。字体必须使用衬线字体如Baskerville或Noto Serif,标题可使用装饰性字体。排版应对称且庄重,遵循传统书籍设计原则。装饰元素包括精致的花纹边框、古典分隔线和角落装饰,可添加轻微做旧效果如纸张纹理和微妙污点。图像应用复古滤镜处理,呈现褪色照片效果。整体设计应散发出典雅、成熟且历经时间考验的气质,参考The New Yorker和老式法国时尚杂志的设计语言。
4. 未来科技风格 (Futuristic Tech)
采用未来科技风格设计,呈现高度发达的数字界面美学。背景必须使用深蓝或纯黑,配以霓虹蓝、电子紫等高饱和度荧光色。排版应模拟高科技显示界面,使用等宽字体如Space Mono,添加数据可视化元素如图表、网格和代码片段。装饰元素包括科技感线条、HUD界面框架和全息投影效果。必须添加动态元素如扫描线、数据流动效果和微妙闪烁。可使用半透明叠加层和模糊效果创造深度。整体设计应呈现出未来感、高科技和信息密集的视觉体验,仿佛来自几十年后的界面,参考《银翼杀手2049》和《攻壳机动队》的视觉设计。
5. 斯堪的纳维亚风格 (Scandinavian)
采用斯堪的纳维亚风格设计,体现北欧设计的简约与功能美学。使用纯白背景,配以特定的北欧色调如淡蓝、浅灰、原木色和淡粉。排版应极度克制且有序,使用大量留白,但与极简主义不同,应加入温暖质感。字体选择无衬线几何字体如Futura或Circular,字重轻盈。装饰元素应极少但精心选择,可使用简单几何图案如三角形和线条,参考马勒维奇的构成主义。图像应明亮、简洁且自然。整体设计应呈现出清爽、实用且温暖的北欧特质,平衡美学与功能性,参考Kinfolk杂志和丹麦设计品牌HAY的产品美学。
6. 艺术装饰风格 (Art Deco)
采用艺术装饰风格设计,重现1920-30年代的奢华与几何美学。必须使用黑金配色方案,金色应为真实金属色#D4AF37而非黄色。排版应严格对称,使用装饰性强的字体,特别是几何感强烈的字体如Broadway或现代变体。装饰元素是关键,必须包含扇形放射纹、锯齿形、几何图案和对称花纹。边框应华丽且具结构性,角落处理需特别精致。可添加仿金箔和大理石纹理增强奢华感。整体设计应呈现出大胆、奢华且充满时代特色的视觉效果,仿佛来自爵士时代的纽约或巴黎,参考克莱斯勒大厦和《了不起的盖茨比》电影海报的视觉语言。
7. 日式极简风格 (Japanese Minimalism)
采用日式极简风格设计,体现"侘寂"(Wabi-Sabi)美学——接受不完美、无常与不完整的哲学。使用极度克制的色彩,主要为白、灰、黑和淡墨色。留白(Ma)是核心元素,至少70%的设计应为空白,创造宁静感。排版应非对称且垂直,可使用垂直书写模式,体现日本传统排版。字体应极度简约,笔画轻盈。装饰元素几乎为零,但可添加一处墨迹、简单印章或单一线条作为点睛之笔。整体设计应呈现出深度宁静、精致且富有禅意的视觉体验,仿佛一页来自京都寺院的书页,参考原研哉的MUJI设计理念和日本传统水墨画的留白美学。
8. 后现代解构风格 (Postmodern Deconstruction)
采用后现代解构风格设计,彻底打破传统设计规则和网格系统。排版应故意不规则且混乱,使用多种字体、大小和方向,文字可重叠、倾斜或被切割。必须使用不和谐的色彩组合,打破传统配色规则。图形元素应包含随机几何形状、不完整图形和故意扭曲的元素。层次感通过混乱中的秩序创造,可使用碎片化图像和拼贴效果。装饰元素应看似随意但精心安排,如手绘线条、涂鸦和复印机错误效果。整体设计应挑战视觉常规,创造一种有控制的混乱美学,参考David Carson的Ray Gun杂志设计和Wolfgang Weingart的实验性排版作品。
9. 朋克风格 (Punk)
采用朋克风格设计,体现DIY精神和反叛文化。必须使用粗糙、手工制作的视觉效果,如剪贴报纸、复印机扭曲和胶带痕迹。色彩应高对比且原始,主要使用黑、白、红色,可添加荧光色点缀。排版必须粗暴且不规则,使用手写、喷漆或剪贴字体,文字可被切割或部分遮挡。装饰元素应包含安全别针、胶带、污渍和撕裂效果。图像应使用高对比度、粗颗粒处理,模拟劣质印刷。必须添加随机元素如涂鸦、X标记和感叹号。整体设计应呈现出原始、粗糙且充满能量的视觉冲击,仿佛一张来自70-80年代伦敦或纽约地下场景的传单,参考Sex Pistols的专辑封面和早期朋克杂志。
10. 英伦摇滚风格 (British Rock)
采用英伦摇滚风格设计,融合英国传统元素与反叛摇滚美学。色彩应使用英国国旗色系(红、白、蓝)或复古棕色调,可添加做旧效果。排版应混合经典与现代,使用衬线字体与手写字体的组合,标题可使用哥特式或维多利亚风格字体。装饰元素应包含英国符号的现代演绎,如Union Jack图案、皇家纹章或伦敦地标的抽象表现。图像应使用复古滤镜,模拟老式胶片效果。可添加唱片、吉他或音符等音乐元素作为点缀。整体设计应呈现出典雅中带有叛逆、传统中融入现代的独特英伦风格,参考Oasis、The Beatles专辑封面和NME杂志的视觉语言。
11. 黑金属风格 (Black Metal)
采用黑金属风格设计,体现极致黑暗美学和神秘主义。背景必须为纯黑或极深灰度,创造压抑氛围。排版应使用古老、难以辨认的哥特式字体或锋利的几何字体,文字可扭曲或被符号干扰。装饰元素必须包含神秘符号、倒五角星、古代符文和神秘学图案。图像应高度对比且单色,可添加噪点和划痕增强原始感。边框应使用中世纪风格或神秘学几何图案。可添加微妙的闪烁效果模拟烛光。整体设计应呈现出神秘、冷酷且具仪式感的视觉体验,仿佛一本古老的神秘学典籍或挪威黑金属乐队的专辑封面,参考Darkthrone和Mayhem的视觉风格以及中世纪魔法书的排版。
12. 孟菲斯风格 (Memphis Design)
采用孟菲斯风格设计,重现80年代意大利设计运动的前卫美学。必须使用鲜艳且不协调的色彩组合,如亮粉、青绿、鲜黄和橙色。几何形状是核心元素,应大量使用不规则图形、锯齿形、波浪线和彩色网格。排版应活泼且不拘一格,使用几何感强的无衬线字体,可添加阴影或3D效果。装饰元素应包含孟菲斯标志性的彩色条纹、圆点、Z字形和任意形状的色块。图像可使用几何框架或被几何形状切割。整体设计应呈现出夸张、活泼且反传统的视觉冲击,仿佛来自80年代的未来主义想象,参考Ettore Sottsass的作品和《拯救大兵瑞恩》片头的视觉风格。
13. 赛博朋克风格 (Cyberpunk)
采用赛博朋克风格设计,体现"高科技,低生活"的反乌托邦美学。背景必须为深色(黑色或深蓝),配以霓虹色彩如荧光粉、电子蓝和酸性绿,创造夜间都市氛围。排版应模拟故障效果,使用像素化字体或未来感等宽字体,添加字符错位、扫描线和数字噪点。装饰元素必须包含科技界面、数据流、电路板图案和全息投影效果。必须添加故障艺术(Glitch Art)效果如RGB分离、数据损坏和画面撕裂。图像应高对比且添加霓虹光效,模拟雨夜霓虹灯反射。整体设计应呈现出未来主义与复古科技的混搭,营造一种数字化衰败的氛围,参考《银翼杀手》、《神经漫游者》和《赛博朋克2077》的视觉语言。
14. 波普艺术风格 (Pop Art)
采用波普艺术风格设计,重现60年代艺术运动的大胆美学。必须使用亮丽原色(红、黄、蓝)和黑色轮廓线,色彩应平面且不含渐变。排版应大胆且戏剧化,使用漫画风格字体和夸张的感叹词,文字可放置在对话气泡中。图像处理是关键,应使用半调网点(Halftone)效果模拟印刷,将图像简化为点阵和色块。装饰元素应包含漫画风格的线条、爆炸形状和拟声词。可使用重复图案和网格排列增强视觉冲击。整体设计应呈现出鲜明、直接且充满流行文化引用的视觉效果,仿佛一页来自60年代漫画或安迪·沃霍尔的艺术作品,参考Roy Lichtenstein的绘画和经典漫画书的视觉语言。
15. 瑞士国际主义风格的解构版 (Deconstructed Swiss Style)
采用瑞士国际主义风格的解构版设计,在严格网格系统的基础上进行有意识的破坏和重组。排版应基于经典瑞士网格,但故意打破和扭曲,文字可越过栏格、重叠或被切割。色彩应保持瑞士风格的克制,主要使用黑白,但可添加一两种鲜艳原色作为点缀。字体必须使用无衬线几何字体如Helvetica或Akzidenz-Grotesk,但可通过极端的字重、间距和大小变化创造张力。图像应高对比且可被解构或重组。装饰元素几乎为零,但可使用解构的网格线和参考点。整体设计应呈现出理性与叛逆并存的视觉效果,像是经典瑞士设计被有意识地挑战和重新诠释,参考Wolfgang Weingart和April Greiman的实验性作品。
16. 蒸汽波美学 (Vaporwave Aesthetics)
采用蒸汽波美学设计,体现互联网亚文化的怀旧未来主义。色彩必须使用特定的渐变组合,主要为粉紫色到青蓝色,创造黄昏或霓虹效果。排版应混合英文和日文/中文字符,使用80-90年代风格的衬线字体或早期数字字体,可添加阴影和辉光效果。装饰元素是关键,必须包含以下至少三种:罗马柱、棕榈树、格子地面、早期3D渲染、古典雕塑、日落、老式电脑界面。背景应使用网格线或星空。图像处理应添加VHS效果、扫描线和轻微失真。整体设计应呈现出一种超现实、梦幻且怀旧的数字美学,仿佛来自平行宇宙的90年代互联网,参考Floral Shoppe专辑封面和Windows 95界面元素的后现代重组。
17. 新表现主义风格 (Neo-Expressionism)
采用新表现主义风格设计,体现80年代艺术运动的原始能量和情感表达。色彩应强烈且不协调,使用原始、未经调和的色彩组合,可包含泼溅和涂抹效果。排版应富有表现力且不规则,使用手写或笔刷字体,文字可被部分遮挡或融入背景。线条必须粗犷且富有动感,展现明显的笔触和手工感。图像应被重新诠释,可添加涂鸦、划痕或重绘效果。装饰元素应看似随意但富有象征性,如原始符号、面具图案或抽象人物。整体设计应呈现出强烈的情感张力和原始能量,仿佛一幅由情感驱动的表现主义画作,参考Jean-Michel Basquiat和Georg Baselitz的作品风格。
18. 极简主义的极端版本 (Extreme Minimalism)
采用极简主义的极端版本设计,将"少即是多"的理念推向极致。留白必须占据至少90%的设计空间,创造极度的空旷感。色彩应限制在黑、白、灰三色,可添加一种极其微妙的强调色。排版应极度精简,每个元素的位置必须精确到像素级别,使用极细字重的无衬线字体,字号可极小但必须保持可读性。装饰元素完全消除,仅保留极细的分隔线或几何点。图像如必须使用,应被简化为最基本的线条或轮廓。整体设计应呈现出一种近乎禅意的纯粹和克制,让每个元素都具有绝对的必要性和目的性,参考John Pawson的建筑设计和Kenya Hara的平面设计作品。
19. 新未来主义 (Neo-Futurism)
采用新未来主义风格设计,体现当代建筑和产品设计中的前沿美学。形态应强调流线型曲线和有机几何形状,避免直角和静态形式。色彩应使用金属色调如银色、钛白和铬黄,配以一两种高饱和度的强调色。材质表现是关键,应模拟高科技材料如拉丝金属、碳纤维和磨砂玻璃。排版应动态且流畅,使用现代无衬线字体,可沿曲线排列或呈放射状。装饰元素应包含参数化生成的图案、流体动力学形态和仿生学结构。整体设计应呈现出高度发达的技术美学和动态感,仿佛来自近未来的高端产品,参考扎哈·哈迪德的建筑、特斯拉Cybertruck和Apple产品的设计语言。
20. 超现实主义数字拼贴 (Surrealist Digital Collage)
采用超现实主义数字拼贴风格设计,创造梦境般的视觉叙事。图像处理是核心,应组合不相关元素创造意外联系,如古典雕塑与现代电子产品、自然元素与几何形状。比例应故意失调,创造视觉张力。色彩可使用梦幻般的组合,如暖日落色调或冷月光色调,添加轻微的色偏。排版应融入拼贴中,文字可环绕物体、穿过图像或成为构图的一部分。装饰元素应包含超现实符号如悬浮物体、不可能的建筑、变形的人物或动物。可添加微妙的阴影和光效增强立体感。整体设计应呈现出一种介于现实与梦境之间的视觉体验,引发观者的想象和潜意识联想,参考René Magritte的绘画和现代数字艺术家如Justin Peters的作品。
21. 新巴洛克数字风格 (Neo-Baroque Digital)
采用新巴洛克数字风格设计,将17世纪的华丽美学重新诠释为数字形式。装饰是核心元素,应使用极其丰富的数字化巴洛克花纹、卷轴和浮雕效果,每个角落都应有精致细节。色彩应奢华且戏剧性,主要使用金色、深红、皇家蓝和黑色,可添加金属光泽和渐变效果。排版应华丽且层次丰富,使用装饰性强的衬线字体,可添加花体字母和装饰性首字母。图像应添加华丽框架和装饰性边缘。光影效果是关键,应创造强烈的明暗对比,模拟巴洛克绘画的戏剧性光效。整体设计应呈现出极度奢华、复杂且充满戏剧性的视觉体验,仿佛数字时代的凡尔赛宫,参考巴洛克艺术大师如鲁本斯的作品和现代奢侈品牌的视觉语言。
22. 液态数字形态主义 (Liquid Digital Morphism)
采用液态数字形态主义风格设计,结合流体动力学与数字艺术创造超前卫视觉体验。背景必须使用高级流体渐变,如紫罗兰到深蓝的流动过渡,并添加半透明的液态气泡或波浪形态。排版应具有流动感,文字可沿着液体路径排列或被液态效果部分包裹。装饰元素应模拟液体物理特性,如水滴、波纹或流体飞溅。色彩应使用梦幻般的液态渐变,如霓虹紫到电子蓝。必须添加微妙的动态效果,元素间的转换如同液体融合,文字可有轻微的波动或流动效果。图像应添加液态边框或流体遮罩。整体设计应呈现出一种超现实且高度未来感的流动视觉体验,仿佛界面本身是液态的,参考Björk的数字专辑视觉和Apple最新的流体动画设计语言。
23. 超感官极简主义 (Hypersensory Minimalism)
采用超感官极简主义风格设计,将极简美学推向感官极限。表面上看似极简,但通过微妙的纹理、触觉暗示和动态响应创造深层次感官体验。背景必须使用纯白或极浅灰,但添加几乎不可见的纹理变化,只有在光线变化或视角移动时才能察觉。排版应精确到像素级别,使用极细字重的无衬线字体,文字间距和行高必须遵循严格的数学比例。色彩应使用近似色调的细微变化,如不同程度的灰白或极淡的单色调,创造需要仔细观察才能发现的层次感。装饰元素应极少且极其微妙,如几乎不可见的线条或点。必须添加微妙的交互响应,如悬停时的轻微透明度变化或极其缓慢的颜色过渡。整体设计应呈现出一种"安静但深刻"的视觉体验,参考日本建筑师安藤忠雄的作品和苹果设计团队Jonathan Ive的产品美学。
24. 新表现主义数据可视化 (Neo-Expressionist Data Visualization)
采用新表现主义数据可视化风格设计,将抽象表现主义艺术与数据可视化完美融合。必须使用看似随意的笔触、泼溅和涂抹效果,但实际上是由精确数据驱动生成的可视化图表。背景应使用白色或浅色,但添加微妙的纹理和抽象笔触。排版应融入数据可视化中,文字可成为数据表达的一部分,使用不同字重和大小表示数值变化。色彩应使用鲜明且情感化的组合,如蓝色、红色、黄色等原色,但每种颜色都应对应特定数据类别。图表元素如条形、线条或点应具有手绘质感,展现明显的笔触和不规则边缘。整体设计应在混沌中呈现秩序,在抽象中传达精确信息,参考Giorgia Lupi的"数据人文主义"作品和Bloomberg Businessweek的实验性数据页面。
25. 维多利亚风格 (Victorian Style)
采用维多利亚风格设计,重现19世纪英国维多利亚时期的华丽印刷美学。背景必须使用米色或淡黄色纸张质感,配以棕色、深红和金色等传统印刷色调。边框是核心元素,应使用繁复的装饰花纹和卷草图案环绕整个设计,角落处需添加精致的装饰性图案。排版应严格对称且庄重,标题使用华丽的衬线字体或哥特式字体,并添加装饰性首字母。必须使用传统的分隔线、花饰和维多利亚时期的装饰符号。图像应添加精致的装饰性框架,可使用椭圆形或方形边框配以繁复图案。色彩应模拟老式印刷效果,添加微妙的做旧纹理和褪色效果。文字排版应遵循传统书籍设计原则,段落首行缩进,引用文字使用斜体并添加装饰性引号。整体设计应呈现出典雅、华丽且富有历史感的视觉效果,仿佛一页来自19世纪精装书籍或杂志的印刷品,参考William Morris的装饰图案设计和《潘趣》(Punch)杂志的版面设计。
26. 包豪斯风格 (Bauhaus)
采用包豪斯风格设计,体现20世纪早期德国包豪斯学校的功能主义美学。必须使用基本几何形状作为核心设计元素,如方形、圆形和三角形,保持形状的纯粹性。色彩应限制在基本原色——红、黄、蓝,配以黑白灰,不使用过渡色或渐变。排版应清晰且理性,使用无衬线字体如Futura或Helvetica,文字排列需遵循严格的网格系统,强调水平和垂直线条。标题应大胆且直接,可使用全大写字母增强视觉冲击力。装饰元素应完全服务于功能,避免纯粹装饰性的图案。图像处理应简洁且具有几何感,可使用高对比度的摄影或简化的图形。必须体现"形式服从功能"的设计理念,每个元素都应有明确目的。整体设计应呈现出理性、前卫且具有工业美感的视觉效果,仿佛一页来自1920年代包豪斯学校的教材或海报,参考拉斯洛·莫霍利-纳吉(László Moholy-Nagy)的排版设计和赫伯特·拜耶(Herbert Bayer)的海报作品。
27. 构成主义风格 (Constructivism)
采用构成主义风格设计,体现20世纪早期俄国前卫艺术运动的革命性美学。必须使用大胆的几何形状和对角线元素创造动态张力,强调结构与构成。色彩应限制在红、黑两色为主,可辅以少量白色或灰色,体现革命色彩。排版是关键元素,文字应成为设计的一部分而非简单的内容载体,可使用不同大小、粗细和方向的文字创造视觉层次,标题应大胆且具冲击力,可斜向排列或分割成多行。必须使用几何形状如三角形、圆形、直线和对角线作为主要视觉元素,这些元素应相互重叠和交织。照片或图像应使用锐利的对比度和几何化处理,可使用照片蒙太奇技术。整体构图应不对称且充满张力,仿佛元素间存在力的相互作用。可添加工业元素如齿轮、工厂或机械部件的抽象表现。整体设计应呈现出前卫、动态且具有政治宣传性质的视觉效果,参考亚历山大·罗德琴科(Alexander Rodchenko)和埃尔·利西茨基(El Lissitzky)的海报设计,体现"艺术进入生活"的设计理念。
28. 孟菲斯风格 (Memphis Design)
采用孟菲斯风格设计,重现1980年代意大利孟菲斯设计小组的前卫美学。必须使用鲜艳且不协调的色彩组合,如亮粉、青绿、鲜黄和橙色,创造故意的视觉冲突。几何形状是核心元素,应大量使用不规则图形、锯齿形、波浪线和彩色网格,这些形状应随意排列且看似不遵循传统设计规则。纹理对比很重要,应混合使用点状图案、条纹和几何网格。排版应活泼且不拘一格,使用几何感强的无衬线字体,可添加阴影或3D效果增强视觉冲击力。装饰元素应包含孟菲斯标志性的彩色条纹、圆点、Z字形和任意形状的色块。必须打破传统的网格系统,元素可自由浮动且看似随意放置。可添加1980年代流行文化元素如霓虹灯、电视机或卡带的抽象表现。整体设计应呈现出夸张、活泼且反传统的视觉冲击,仿佛来自80年代的未来主义想象,参考埃托雷·索特萨斯(Ettore Sottsass)的作品和MTV早期的视觉风格,体现"反功能主义"的设计理念。
29. 德国表现主义风格 (German Expressionism)
采用德国表现主义风格设计,体现20世纪初期德国表现主义运动的强烈情感表达。背景应使用深色调如深蓝、黑色或暗红色,创造戏剧性氛围。必须使用强烈的明暗对比和扭曲变形的形态,线条应锐利且富有动感,呈现出内在情绪的外化。排版应不规则且具表现力,文字可呈现倾斜或不稳定感,标题应使用粗犷、锐利的哥特式字体或手写风格字体。色彩应强烈且具象征性,偏好使用黑色、深红、黄色和深绿等高对比度组合。图像处理应添加木刻版画效果,强调粗犷的线条和夸张的明暗对比。阴影是关键元素,应使用长而尖锐的投影创造紧张感和不安氛围。可添加象征性元素如尖塔、扭曲的人物剪影或锯齿状山脉。整体设计应呈现出强烈的情感张力和心理深度,仿佛一页来自德国表现主义电影《卡里加里博士的小屋》的场景设计或卡尔·施密特-罗特卢夫(Karl Schmidt-Rottluff)的木刻版画,体现"情感真实大于形式真实"的艺术理念。