feat: main page header i18n
This commit is contained in:
parent
a0e18f58d9
commit
230d4763d1
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
|
@ -6,14 +6,17 @@
|
||||||
"azkhx",
|
"azkhx",
|
||||||
"bangumi",
|
"bangumi",
|
||||||
"Bilibili",
|
"Bilibili",
|
||||||
|
"Codepen",
|
||||||
"cout",
|
"cout",
|
||||||
"dompurify",
|
"dompurify",
|
||||||
"fontawesome",
|
"fontawesome",
|
||||||
"galgame",
|
"galgame",
|
||||||
"Galgame",
|
"Galgame",
|
||||||
|
"Galworld",
|
||||||
"gsap",
|
"gsap",
|
||||||
"iconify",
|
"iconify",
|
||||||
"INTLIFY",
|
"INTLIFY",
|
||||||
|
"kfmax",
|
||||||
"kungal",
|
"kungal",
|
||||||
"kungalgame",
|
"kungalgame",
|
||||||
"kungalgamer",
|
"kungalgamer",
|
||||||
|
@ -43,6 +46,7 @@
|
||||||
"upid",
|
"upid",
|
||||||
"Upvotes",
|
"Upvotes",
|
||||||
"VARCHAR",
|
"VARCHAR",
|
||||||
|
"Vite",
|
||||||
"VNDB",
|
"VNDB",
|
||||||
"vueup",
|
"vueup",
|
||||||
"weixin",
|
"weixin",
|
||||||
|
|
|
@ -20,10 +20,6 @@ const inputValue = ref('')
|
||||||
const isShowSearchHistory = ref(false)
|
const isShowSearchHistory = ref(false)
|
||||||
// 输入框被激活之后的样式
|
// 输入框被激活之后的样式
|
||||||
const inputActiveClass = ref({})
|
const inputActiveClass = ref({})
|
||||||
// placeholder 的文字提示
|
|
||||||
const placeholder = computed(() => {
|
|
||||||
return showKUNGalgameLanguage.value === 'en' ? 'Search Topics' : '搜索话题'
|
|
||||||
})
|
|
||||||
|
|
||||||
// 定义 props,这里的作用是告诉输入框在哪个分类中搜索话题
|
// 定义 props,这里的作用是告诉输入框在哪个分类中搜索话题
|
||||||
const props = defineProps(['category'])
|
const props = defineProps(['category'])
|
||||||
|
@ -110,7 +106,7 @@ const handleDeleteHistory = (historyIndex: number) => {
|
||||||
type="search"
|
type="search"
|
||||||
class="input"
|
class="input"
|
||||||
:style="inputActiveClass"
|
:style="inputActiveClass"
|
||||||
:placeholder="placeholder"
|
:placeholder="`${$tm('mainPage.header.search')}`"
|
||||||
@focus="handleInputFocus"
|
@focus="handleInputFocus"
|
||||||
@blur="handleInputBlur"
|
@blur="handleInputBlur"
|
||||||
@input="debouncedSearch(inputValue)"
|
@input="debouncedSearch(inputValue)"
|
||||||
|
@ -126,8 +122,10 @@ const handleDeleteHistory = (historyIndex: number) => {
|
||||||
<div v-if="isShowSearchHistory" class="history">
|
<div v-if="isShowSearchHistory" class="history">
|
||||||
<!-- 搜索历史标题 -->
|
<!-- 搜索历史标题 -->
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<span>搜索历史</span>
|
<span>{{ $tm('mainPage.header.history') }}</span>
|
||||||
<span @click="clearSearchHistory">清除所有历史</span>
|
<span @click="clearSearchHistory">
|
||||||
|
{{ $tm('mainPage.header.clear') }}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<!-- 搜索历史 -->
|
<!-- 搜索历史 -->
|
||||||
<div class="history-container">
|
<div class="history-container">
|
||||||
|
|
|
@ -24,6 +24,20 @@ export default {
|
||||||
back: 'Back',
|
back: 'Back',
|
||||||
},
|
},
|
||||||
mainPage: {
|
mainPage: {
|
||||||
|
header: {
|
||||||
|
filter: 'Filter',
|
||||||
|
search: 'Search Topics',
|
||||||
|
all: 'All Topics',
|
||||||
|
history: 'Search History',
|
||||||
|
clear: 'Clear all history',
|
||||||
|
updated: 'Restore default',
|
||||||
|
time: 'Sort by time',
|
||||||
|
popularity: 'Sort by popularity',
|
||||||
|
views: 'Sort by views',
|
||||||
|
likes: 'Sort by likes',
|
||||||
|
replies: 'Sort by replies',
|
||||||
|
comments: 'Sort by comments',
|
||||||
|
},
|
||||||
asideActive: {
|
asideActive: {
|
||||||
fold: 'Fold Aside',
|
fold: 'Fold Aside',
|
||||||
create: 'CREATE NEW!',
|
create: 'CREATE NEW!',
|
||||||
|
|
|
@ -24,6 +24,20 @@ export default {
|
||||||
back: '返回',
|
back: '返回',
|
||||||
},
|
},
|
||||||
mainPage: {
|
mainPage: {
|
||||||
|
header: {
|
||||||
|
filter: '筛选',
|
||||||
|
search: '搜索话题',
|
||||||
|
all: '全部话题',
|
||||||
|
history: '搜索历史',
|
||||||
|
clear: '清除所有历史',
|
||||||
|
updated: '恢复默认排序',
|
||||||
|
time: '按照时间排序',
|
||||||
|
popularity: '按热度值排序',
|
||||||
|
views: '按浏览数排序',
|
||||||
|
likes: '按点赞数排序',
|
||||||
|
replies: '按回复数排序',
|
||||||
|
comments: '按评论数排序',
|
||||||
|
},
|
||||||
asideActive: {
|
asideActive: {
|
||||||
fold: '折叠左侧区域',
|
fold: '折叠左侧区域',
|
||||||
create: '发布话题',
|
create: '发布话题',
|
||||||
|
|
|
@ -17,7 +17,7 @@ const category = `["Galgame"]`
|
||||||
<KUNGalgameSearchBox :category="category" style="border: none" />
|
<KUNGalgameSearchBox :category="category" style="border: none" />
|
||||||
<!-- 交互区域进入全部话题 -->
|
<!-- 交互区域进入全部话题 -->
|
||||||
<RouterLink to="/pool/index" class="more">
|
<RouterLink to="/pool/index" class="more">
|
||||||
<span>全部话题</span>
|
<span>{{ $tm('mainPage.header.all') }}</span>
|
||||||
<Icon class="all-topic" icon="line-md:chevron-triple-right" />
|
<Icon class="all-topic" icon="line-md:chevron-triple-right" />
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
</div>
|
</div>
|
||||||
|
@ -62,6 +62,7 @@ const category = `["Galgame"]`
|
||||||
}
|
}
|
||||||
.all-topic {
|
.all-topic {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
|
margin-left: 7px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 1000px) {
|
@media (max-width: 1000px) {
|
||||||
|
|
|
@ -4,60 +4,11 @@ import { Icon } from '@iconify/vue'
|
||||||
import { useKUNGalgameHomeStore } from '@/store/modules/home'
|
import { useKUNGalgameHomeStore } from '@/store/modules/home'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
|
|
||||||
|
// 导入排序列表的字段
|
||||||
|
import { navSortItem } from './navSortItem'
|
||||||
|
|
||||||
const homeStore = storeToRefs(useKUNGalgameHomeStore())
|
const homeStore = storeToRefs(useKUNGalgameHomeStore())
|
||||||
|
|
||||||
interface Sort {
|
|
||||||
index: number
|
|
||||||
icon: string
|
|
||||||
name: string
|
|
||||||
sortField: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const navSortItem: Sort[] = [
|
|
||||||
{
|
|
||||||
index: 1,
|
|
||||||
icon: 'line-md:rotate-270',
|
|
||||||
name: '恢复默认排序',
|
|
||||||
sortField: 'updated',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
index: 2,
|
|
||||||
icon: 'svg-spinners:clock',
|
|
||||||
name: '按照时间排序',
|
|
||||||
sortField: 'time',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
index: 3,
|
|
||||||
icon: 'bi:fire',
|
|
||||||
name: '按热度值排序',
|
|
||||||
sortField: 'popularity',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
index: 4,
|
|
||||||
icon: 'ic:outline-remove-red-eye',
|
|
||||||
name: '按浏览数排序',
|
|
||||||
sortField: 'views',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
index: 5,
|
|
||||||
icon: 'line-md:thumbs-up-twotone',
|
|
||||||
name: '按点赞数排序',
|
|
||||||
sortField: 'likes',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
index: 6,
|
|
||||||
icon: 'ri:reply-line',
|
|
||||||
name: '按回复数排序',
|
|
||||||
sortField: 'replies',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
index: 7,
|
|
||||||
icon: 'fa-regular:comment-dots',
|
|
||||||
name: '按评论数排序',
|
|
||||||
sortField: 'comments',
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
const handleSortByField = (sortField: string) => {
|
const handleSortByField = (sortField: string) => {
|
||||||
homeStore.sortField.value = sortField
|
homeStore.sortField.value = sortField
|
||||||
}
|
}
|
||||||
|
@ -73,7 +24,7 @@ const orderDescending = () => {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<span>筛选</span>
|
<span>{{ $tm('mainPage.header.filter') }}</span>
|
||||||
<Icon class="filter" icon="bi:sort-down" />
|
<Icon class="filter" icon="bi:sort-down" />
|
||||||
<!-- 排序的二级菜单 -->
|
<!-- 排序的二级菜单 -->
|
||||||
<div class="sort-container">
|
<div class="sort-container">
|
||||||
|
@ -83,14 +34,17 @@ const orderDescending = () => {
|
||||||
:key="kun.index"
|
:key="kun.index"
|
||||||
@click="handleSortByField(kun.sortField)"
|
@click="handleSortByField(kun.sortField)"
|
||||||
>
|
>
|
||||||
<Icon class="icon-item" :icon="kun.icon" />{{ kun.name }}
|
<Icon class="icon-item" :icon="kun.icon" />{{
|
||||||
|
$tm(`mainPage.header.${kun.name}`)
|
||||||
|
}}
|
||||||
</div>
|
</div>
|
||||||
<div class="sort-order">
|
<div class="sort-order">
|
||||||
<span @click="orderAscending"
|
<span @click="orderAscending">
|
||||||
><Icon icon="tdesign:order-ascending" /></span
|
<Icon icon="tdesign:order-ascending" />
|
||||||
><span @click="orderDescending"
|
</span>
|
||||||
><Icon icon="tdesign:order-descending"
|
<span @click="orderDescending">
|
||||||
/></span>
|
<Icon icon="tdesign:order-descending" />
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -129,7 +83,7 @@ const orderDescending = () => {
|
||||||
}
|
}
|
||||||
.filter {
|
.filter {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
margin-left: 5px;
|
margin-left: 7px;
|
||||||
}
|
}
|
||||||
.sort-submenu {
|
.sort-submenu {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
interface Sort {
|
||||||
|
index: number
|
||||||
|
icon: string
|
||||||
|
name: string
|
||||||
|
sortField: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export const navSortItem: Sort[] = [
|
||||||
|
{
|
||||||
|
index: 1,
|
||||||
|
icon: 'line-md:rotate-270',
|
||||||
|
name: 'updated',
|
||||||
|
sortField: 'updated',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: 2,
|
||||||
|
icon: 'svg-spinners:clock',
|
||||||
|
name: 'time',
|
||||||
|
sortField: 'time',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: 3,
|
||||||
|
icon: 'bi:fire',
|
||||||
|
name: 'popularity',
|
||||||
|
sortField: 'popularity',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: 4,
|
||||||
|
icon: 'ic:outline-remove-red-eye',
|
||||||
|
name: 'views',
|
||||||
|
sortField: 'views',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: 5,
|
||||||
|
icon: 'line-md:thumbs-up-twotone',
|
||||||
|
name: 'likes',
|
||||||
|
sortField: 'likes',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: 6,
|
||||||
|
icon: 'ri:reply-line',
|
||||||
|
name: 'replies',
|
||||||
|
sortField: 'replies',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: 7,
|
||||||
|
icon: 'fa-regular:comment-dots',
|
||||||
|
name: 'comments',
|
||||||
|
sortField: 'comments',
|
||||||
|
},
|
||||||
|
]
|
|
@ -59,23 +59,27 @@ import KUNGalgameFooter from '@/components/KUNGalgameFooter.vue'
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<p>
|
<p>
|
||||||
我们的网站会秉承萌萌(美好)、开源、免费的<span class="skip"
|
我们的网站会秉承萌萌(美好)、开源、免费的
|
||||||
>建立原则</span
|
<span class="skip"> 建立原则</span>
|
||||||
>,不断完善和更新,您可以在 github 看到我们的项目:
|
,不断完善和更新,您可以在 github 看到我们的项目:
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<p>纯 HTML + CSS 实现:<span class="skip">kungalgame-pure-css</span></p>
|
<p>纯 HTML + CSS 实现:<span class="skip">kungalgame-pure-css</span></p>
|
||||||
<p>
|
<p>
|
||||||
Vue + Vite + ts + pinia 实现:<span class="skip">kungalgame-vue</span>
|
前端 Vue + Vite + ts + pinia 实现:
|
||||||
|
<span class="skip">kun-galgame-vue</span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
后端 Koa2 + redis + mongoose + mongodb 实现:
|
||||||
|
<span class="skip">kun-galgame-koa</span>
|
||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<p>后端由于安全因素,暂不开源,后续如果技术过硬,我们仍然会开源!</p>
|
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<p>
|
<p>
|
||||||
不嫌弃的话,您可以给上面两个 github 的项目点一个
|
不嫌弃的话,您可以给上面三个 github 的项目点一个
|
||||||
star,当作对我们的支持。
|
star,当作对我们的支持。
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue