feat: capture i18n

This commit is contained in:
KUN1007 2023-09-23 23:41:18 +08:00
parent f875b168e4
commit 506788fc76
6 changed files with 100 additions and 71 deletions

25
.vscode/settings.json vendored
View file

@ -1,11 +1,13 @@
{
"cSpell.words": [
"ACGNGAME",
"Akai",
"arpa",
"axios",
"azkhx",
"bangumi",
"Bilibili",
"Bishoujo",
"Codepen",
"cout",
"dompurify",
@ -14,9 +16,13 @@
"Galgame",
"Galworld",
"gsap",
"Hikari",
"Hitomi",
"iconify",
"INTLIFY",
"Irotoridori",
"kfmax",
"Koori",
"kungal",
"kungalgame",
"kungalgamer",
@ -24,36 +30,55 @@
"Licence",
"loli",
"majesticons",
"Mangekyou",
"Maniwa",
"mingcute",
"Mirai",
"mockjs",
"moemoe",
"moemoepoint",
"Murasame",
"Nanami",
"nawa",
"non-moe",
"okaidia",
"Otome",
"persistedstate",
"Pinia",
"prismjs",
"rdquo",
"Roka",
"Sahou",
"Sekai",
"Senren",
"shinnku",
"signin",
"sina",
"SMEE",
"tachi",
"tada",
"tdesign",
"templating",
"tencent",
"Tomotake",
"Tsubasa",
"Tsuki",
"Tsumugi",
"twotone",
"unplugin",
"unref",
"upid",
"Upvotes",
"Utsuru",
"VARCHAR",
"Vite",
"VNDB",
"vueup",
"weixin",
"Wenders",
"ymgal",
"Yorisou",
"Yoshino",
"Yuki",
"Yuuki",
"yuyu",

View file

@ -24,10 +24,16 @@ const emits = defineEmits<{
handleClose: [isShowValidate: boolean]
}>()
//
const randomizeQuestion = () => {
// 01
return Math.floor(Math.random() * questions.length)
}
//
const userAnswers = ref([])
const userAnswers = ref('')
//
const currentQuestionIndex = ref(0)
const currentQuestionIndex = ref(randomizeQuestion())
//
const currentQuestion = computed(() => questions[currentQuestionIndex.value])
//
@ -60,20 +66,26 @@ const checkKeyPress = (event: KeyboardEvent) => {
//
const submitAnswer = () => {
const userAnswer = userAnswers.value[currentQuestionIndex.value]
const correctOption = currentQuestion.value.correctOption
if (userAnswer === correctOption) {
if (userAnswers.value === correctOption) {
//
emits('handleVerify', true)
message(
'Human-machine identity verification successful ~',
'人机身份验证通过 ~',
'success'
)
} else {
//
errorCounter.value++
message('Wrong answer!', '回答错误!', 'warn')
//
nextQuestion()
//
const randomIndex = randomizeQuestion()
currentQuestionIndex.value = randomIndex
userAnswers.value = ''
//
if (errorCounter.value >= 3) {
@ -81,14 +93,6 @@ const submitAnswer = () => {
}
}
}
const nextQuestion = () => {
if (currentQuestionIndex.value < questions.length - 1) {
currentQuestionIndex.value++
} else {
message('', '已经没有问题了,杂鱼~♡', 'info')
}
}
</script>
<template>
@ -105,7 +109,7 @@ const nextQuestion = () => {
<!-- 标题 -->
<div class="title">
<!-- <span>{{ `` }}</span> -->
<h2>请回答下面的问题</h2>
<h2>{{ $tm('AlertInfo.capture.title') }}</h2>
<!-- <span>{{ `` }}</span> -->
</div>
<p class="question">{{ currentQuestion.text }}</p>
@ -116,38 +120,40 @@ const nextQuestion = () => {
v-for="(option, index) in currentQuestion.options"
:key="index"
>
<input
type="radio"
v-model="userAnswers[currentQuestionIndex]"
:value="option"
/>
<input type="radio" v-model="userAnswers" :value="option" />
{{ option }}
</label>
</div>
<!-- 提交按钮 -->
<div class="btn">
<button @click="submitAnswer">提交</button>
<button @click="emits('handleClose', false)">关闭</button>
<button @click="submitAnswer">
{{ $tm('AlertInfo.capture.submit') }}
</button>
<button @click="emits('handleClose', false)">
{{ $tm('AlertInfo.capture.close') }}
</button>
</div>
<!-- 提示 -->
<!-- tabindex 使得该元素可以被页面聚焦 -->
<div class="hint-container">
<div v-if="isShowHint" class="hint">
<div>真是杂鱼呢~这都答不出来~杂鱼~杂鱼~</div>
<div>{{ $tm('AlertInfo.capture.hint1') }}</div>
<div>
臭杂鱼试试在页面上敲击 <span>kun</span> 杂鱼~杂鱼~
{{ $tm('AlertInfo.capture.hint2') }}
<span>kun</span>
{{ $tm('AlertInfo.capture.hint3') }}
</div>
</div>
<div v-if="isShowAnswer" class="answer">
<div>杂鱼~杂鱼~你就看吧最后害的还是你自己</div>
<div>{{ $tm('AlertInfo.capture.hint4') }}</div>
<a
href="http://github.com/KUN1007/kun-galgame-vue"
target="_blank"
rel="noopener noreferrer"
>
答案
{{ $tm('AlertInfo.capture.answer') }}
</a>
</div>
</div>
@ -172,9 +178,8 @@ const nextQuestion = () => {
}
.validate {
height: 100%;
width: 300px;
height: 300px;
min-height: 300px;
margin: auto;
padding: 17px;
background-color: var(--kungalgame-trans-white-2);

View file

@ -10,9 +10,9 @@ interface Question {
export const questionsCN: Question[] = reactive([
{
id: 1,
text: '下列哪个不是《千恋万花》中的角色?',
options: ['丛雨', '芦花', '芳乃', '宁宁'],
correctOption: '宁宁',
text: '下列哪个不是《千恋万花》中的角色?',
options: ['丛雨', '芦花', '芳乃', '七海'],
correctOption: '七海',
},
{
id: 2,
@ -40,14 +40,14 @@ export const questionsCN: Question[] = reactive([
{
id: 5,
text: '以下哪部作品中男主没有女装?',
options: ['近月少女的礼仪', '少女领域', '美少女万华镜1', '我们没有翅膀'],
options: ['近月少女的礼仪', '少女 * 领域', '美少女万华镜1', '我们没有翅膀'],
correctOption: '美少女万华镜1',
},
{
id: 6,
text: '以下哪个作品是《SMEE》制作的?',
options: ['Friend to Lover', 'Dal Segno', 'Eden*', 'LOOPERS'],
correctOption: 'Friend to Lover',
options: ['~Friend to Lover~', 'Dal Segno', 'Eden*', 'LOOPERS'],
correctOption: '~Friend to Lover~',
},
{
id: 7,

View file

@ -10,54 +10,49 @@ interface Question {
export const questionsEN: Question[] = reactive([
{
id: 1,
text: 'Which one of the following is not a character in "Thousand Love Ten Thousand Flowers"?',
options: ['Congyu', 'Luhua', 'Fangna', 'Ningning'],
correctOption: 'Ningning',
text: 'Which one of the following is not a character in "Senren * Banka"?',
options: ['Murasame', 'Roka', 'Yoshino', 'Nanami'],
correctOption: 'Nanami',
},
{
id: 2,
text: 'What is the hair color of Tsudumeandesu in "Summer Pockets"?',
text: 'What is the hair color of Tsumugi Wenders in " Summer Pockets REFLECTION BLUE"?',
options: ['Red', 'Gold', 'Purple', 'White'],
correctOption: 'Gold',
},
{
id: 3,
text: 'What is "Galgame" known as?',
options: [
'Gay game',
'Beautiful girl game',
'Otome game',
'Ah, this is a starfish',
],
correctOption: 'Beautiful girl game',
text: 'What is "Visual Novel" known as?',
options: ['Gay game', 'Galgame', 'Otome game', 'Ah, this is a starfish'],
correctOption: 'Galgame',
},
{
id: 4,
text: 'Which of the following games does not belong to the "Colorful World" series?',
text: 'Which of the following games does not belong to the "Irotoridori" series?',
options: [
'Colorful World',
'Beautiful Girl Game',
'Colorful Dawn',
'Colorful Future',
'Irotoridori no Sekai',
'Irotoridori no Hikari',
'Akai Hitomi ni Utsuru Sekai',
'Irotoridori no Mirai',
],
correctOption: 'Colorful Future',
correctOption: 'Irotoridori no Mirai',
},
{
id: 5,
text: 'In which of the following works does the male protagonist not cross-dress?',
options: [
'Closer to the Moon Girl',
'Girl Territory',
'Beautiful Girl Kaleidoscope 1',
'We Have No Wings',
'Tsuki ni Yorisou Otome no Sahou',
'Otome * Domain',
'Bishoujo Mangekyou 1',
'Ore-tachi ni Tsubasa wa Nai',
],
correctOption: 'Beautiful Girl Kaleidoscope 1',
correctOption: 'Bishoujo Mangekyou 1',
},
{
id: 6,
text: 'Which of the following works was produced by "SMEE"?',
options: ['Friend to Lover', 'Dal Segno', 'Eden*', 'LOOPERS'],
correctOption: 'Friend to Lover',
options: ['~Friend to Lover~', 'Dal Segno', 'Eden*', 'LOOPERS'],
correctOption: '~Friend to Lover~',
},
{
id: 7,

View file

@ -197,12 +197,14 @@ export default {
'Invalid password format. Password must be 6 to 17 characters long and must include at least one letter and one number. It can optionally include special characters such as \\w!@#$%^&()-+=',
},
capture: {
click: 'Please click above to complete the human verification',
success: 'Human-machine identity verification successful',
text: 'abcdefghijklmnopqrstuvwxyz',
order: 'Please click the characters in order',
refresh: 'Refresh',
error: 'Click error, please click again',
title: 'Answer Question(s)',
submit: 'Submit',
close: 'Close',
hint1: `You're such a zako~♡ Can't even answer this~ zako~♡ zako~♡`,
hint2: 'Smelly zako ♡, try typing',
hint3: 'on the page, zako~♡ zako~♡',
hint4: `Za~~~ko~♡ zako~♡ Just you wait, you'll regret it in the end`,
answer: 'Answer',
},
},
}

View file

@ -196,12 +196,14 @@ export default {
'非法的密码格式,密码的长度为 6 到 17 位,必须包含至少一个英文字符和一个数字,可以选择性的包含 \\w!@#$%^&*()-+= 等特殊字符',
},
capture: {
click: '请点击上方完成人机身份验证',
success: '人机身份验证通过 ~ ',
text: '闭月羞花出水芙蓉亭亭玉立小只可爱软萌鲲',
order: '请按顺序点击以下字符',
refresh: '刷新',
error: '点击错误,请重新点击',
title: '请回答下面的问题',
submit: '提交',
close: '关闭',
hint1: '真是杂鱼呢~♡这都答不出来~杂鱼~♡杂鱼~♡',
hint2: '臭杂鱼♡,试试在页面上敲击',
hint3: '呢,杂鱼~♡杂鱼~♡',
hint4: '杂~~~鱼~♡杂鱼~♡你就看吧,最后害的还是你自己',
answer: '答案',
},
},
}