generated from jstarter/vite-vue-starter
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
281 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
# 小猪佩奇学英语 | ||
# 挑战 52 天背完小猪佩奇 | ||
|
||
[](https://github.com/justorez/peppa/actions/workflows/deploy.yml) | ||
|
||
> Hurry up! Go dev. | ||
网站链接:[国内地址](https://justorez.gitee.io/peppa/) | [国外地址](https://justorez.github.io/peppa/) | ||
|
||
Vue3 + TS + Vue Router + Tailwind CSS + Daisy UI + Icones + Eruda | ||
一个 B 站英语学习教程的配套练习网站(友情提示:我不是 UP 主😊)。 | ||
|
||
B 站视频地址:[脑洞部长 / 挑战52天背完小猪佩奇,进来一起卷!](https://space.bilibili.com/33291981/channel/collectiondetail?sid=525129&ctype=0) | ||
|
||
 | ||
 | ||
|
||
## TODO | ||
|
||
- [ ] 记录练习进度 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
<script setup lang="ts"></script> | ||
|
||
<template> | ||
<RouterView /> | ||
</template> | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
<script setup lang="ts"> | ||
import data from '@/assets/data.json' | ||
import audioYesUrl from '/audio/yes.mp3' | ||
import audioNoUrl from '/audio/no.mp3' | ||
import { checkSentence } from '@/utils/index' | ||
const yesAudio = new Audio(audioYesUrl) | ||
const noAudio = new Audio(audioNoUrl) | ||
type Sentence = { | ||
CN: string | ||
EN: string | ||
} | ||
type Lines = { | ||
titleEN: string | ||
titleCN: string | ||
sentences: Sentence[] | ||
} | ||
const route = useRoute() | ||
const router = useRouter() | ||
const back = () => router.back() | ||
const epNum = Number(route.query.i) | ||
const episode = ref<Lines>(data[epNum - 1] as Lines) | ||
const total = episode.value.sentences.length | ||
const page = reactive({ | ||
current: 1, | ||
completed: new Array(total).fill(false), | ||
total | ||
}) | ||
const sentence = computed<Sentence>( | ||
() => episode.value.sentences[page.current - 1] | ||
) | ||
const completed = computed(() => page.completed.filter((x) => x).length) | ||
const input = ref('') | ||
const checkDisabled = computed(() => !input.value) | ||
const showResult = ref(false) | ||
const result = ref(false) | ||
function check() { | ||
result.value = checkSentence(input.value, sentence.value.EN) | ||
showResult.value = true | ||
if (result.value) { | ||
page.completed[page.current] = true | ||
yesAudio.play() | ||
} else { | ||
noAudio.play() | ||
} | ||
} | ||
function restore() { | ||
showResult.value = false | ||
result.value = false | ||
} | ||
function next() { | ||
restore() | ||
input.value = '' | ||
const current = page.current + 1 | ||
if (current <= page.total) { | ||
page.current = current | ||
} | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="vapp"> | ||
<div class="flex items-center gap-2"> | ||
<i-mdi:close | ||
class="text-xl" | ||
@click="back" | ||
/> | ||
<progress | ||
class="progress progress-success flex-1 h-4" | ||
:value="completed" | ||
:max="page.total" | ||
></progress> | ||
<span>{{ completed }}/{{ episode.sentences.length }}</span> | ||
</div> | ||
<div class="mt-5 flex justify-center items-center"> | ||
<!-- <i-mdi:chevron-left class="text-2xl" /> --> | ||
<div class="px-2 flex-1"> | ||
<h1 class="font-bold text-2xl"> | ||
第 {{ epNum }} 集:{{ episode.titleCN }} | ||
</h1> | ||
<div class="mt-5 mb-3 text-lg">“{{ sentence.CN }}”</div> | ||
<div | ||
v-show="showResult" | ||
class="mb-3 text-lg flex items-center" | ||
:class="{ | ||
'text-success': result, | ||
'text-error': !result | ||
}" | ||
> | ||
<span>"{{ sentence.EN }}"</span> | ||
| ||
<i-mdi:check v-show="result" /> | ||
<i-mdi:close v-show="!result" /> | ||
</div> | ||
<textarea | ||
v-model="input" | ||
class="textarea textarea-bordered w-full text-lg bg-gray-50" | ||
placeholder="请输入上述台词的英文" | ||
rows="8" | ||
></textarea> | ||
</div> | ||
<!-- <i-mdi:chevron-right class="text-2xl" /> --> | ||
</div> | ||
<div class="mt-5 px-2 flex justify-between items-center"> | ||
<div> | ||
<input | ||
v-model="page.current" | ||
type="number" | ||
class="input input-bordered input-sm" | ||
:min="1" | ||
:max="page.total" | ||
/> | ||
/ | ||
<span>{{ page.total }}</span> | ||
</div> | ||
<button | ||
v-show="!showResult" | ||
class="m-btn btn-neutral" | ||
:disabled="checkDisabled" | ||
@click="check" | ||
> | ||
检查 | ||
</button> | ||
<div v-show="showResult"> | ||
<button | ||
class="m-btn btn-outline mr-3" | ||
@click="restore" | ||
> | ||
取消 | ||
</button> | ||
<button | ||
class="m-btn" | ||
:class="{ | ||
'btn-success': result, | ||
'btn-error': !result | ||
}" | ||
@click="next" | ||
> | ||
继续 | ||
</button> | ||
</div> | ||
</div> | ||
<!-- <div class="btn-bar"> | ||
<button class="btn btn-outline">跳过</button> | ||
<button | ||
class="btn btn-neutral" | ||
:disabled="checkDisabled" | ||
@click="check" | ||
> | ||
检查 | ||
</button> | ||
</div> --> | ||
</div> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
.m-btn { | ||
@apply btn lg:w-32; | ||
} | ||
.btn-bar { | ||
position: fixed; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
padding: 2.5rem; | ||
padding-bottom: 3.5rem; | ||
border-top: 2px solid rgb(229, 229, 229); | ||
background-color: white; | ||
display: grid; | ||
grid-gap: 8px 16px; | ||
align-items: center; | ||
grid-auto-rows: 1fr; | ||
grid-template-columns: 100%; | ||
justify-items: stretch; | ||
> button { | ||
width: 100%; | ||
} | ||
} | ||
@media (min-width: 700px) { | ||
.btn-bar { | ||
align-items: center; | ||
grid-auto-rows: auto; | ||
grid-template-columns: repeat(5, 1fr); | ||
grid-template-rows: 100%; | ||
justify-content: space-between; | ||
button:first-child { | ||
justify-self: start; | ||
} | ||
button:last-child { | ||
grid-column: 5 / auto; | ||
justify-self: end; | ||
} | ||
} | ||
} | ||
</style> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.