Add I18N into the confirm quit option & you can now view articles from clicking on the "View article" button (but for now you can not view dynamic articles & also chnaged the path from /_assets/ to /n3a_assets/ & Made the title as the navbar thing

This commit is contained in:
yuanhau 2025-05-29 15:32:10 +08:00
parent 10158a390c
commit 937f8ad531
6 changed files with 87 additions and 46 deletions

View file

@ -18,9 +18,17 @@ async function CheckKidUnfriendlyContent(title: string, words: any[]) {
}
}
const emit = defineEmits(["close", "min", "restore"]);
const emit = defineEmits([
"openArticles",
"openNewsSourcePage",
"windowopener",
]);
const staticid = computed(() => props.staticid);
const openNewWindow = (itemId: string) => {
emit("windowopener", "aboutNewsOrg");
};
const contentArray = ref([]);
const errorr = ref(false);
const switchTabs = ref(false);
@ -163,11 +171,13 @@ const useArgFindRel = (title) => {
return similarities.sort((a, b) => b.similarity - a.similarity).slice(0, 3);
};
const openNews = (url: string) => {
console.log(url);
const openNews = (url: string, titleName: string) => {
emit("openArticles", url, titleName);
};
const openPublisher = (text: string) => {};
const openPublisher = (text: string) => {
emit("openNewsSourcePage", text);
};
</script>
<template>
<div class="justify-center align-center text-center">
@ -247,7 +257,7 @@ const openPublisher = (text: string) => {};
<Tooltip>
<TooltipTrigger>
<button
@click="openNews(item.url.hash)"
@click="openNews(item.url.hash, item.title)"
class="flex flex-row p-1 bg-sky-300/50 hover:bg-sky-400/50 shadow-lg backdrop-blur-sm rounded transition-all duration-200"
>
<ScanEyeIcon class="w-6 h-6 p-1" /><span>觀看文章</span>
@ -260,25 +270,27 @@ const openPublisher = (text: string) => {};
</TooltipProvider>
</div>
<div>
<div>
<h3 class="text-lg">類似文章</h3>
<div v-if="useArgFindRel(item.title).length > 0" class="space-y-2">
<div
v-for="similar in useArgFindRel(item.title)"
:key="similar.item.id"
class="p-2 bg-gray-100 rounded text-sm cursor-pointer hover:bg-gray-200"
@click="openNews(similar.item.url.hash)"
<div>
<h3 class="text-lg">類似文章</h3>
<div
v-if="useArgFindRel(item.title).length > 0"
class="space-y-2"
>
<div class="font-medium">{{ similar.title }}</div>
<div class="text-gray-500 text-xs">
相似度: {{ (similar.similarity * 100).toFixed(1) }}% | {{ similar.item.publisher }}
<div
v-for="similar in useArgFindRel(item.title)"
:key="similar.item.id"
class="p-2 bg-gray-100 rounded text-sm cursor-pointer hover:bg-gray-200"
@click="openNews(similar.item.url.hash, item.title)"
>
<div class="font-medium">{{ similar.title }}</div>
<div class="text-gray-500 text-xs">
相似度: {{ (similar.similarity * 100).toFixed(1) }}% |
{{ similar.item.publisher }}
</div>
</div>
</div>
<div v-else class="text-gray-500 text-sm">找不到類似文章</div>
</div>
<div v-else class="text-gray-500 text-sm">
找不到類似文章
</div>
</div>
<!--<div v-for="item in findRel(item.title)">
{{ item }}
</div>-->

View file

@ -44,7 +44,7 @@ const aiSummary = async () => {
<UserIcon class="w-7 h-7 p-1" />{{ data.author }}</span
>
</div>
<div class="p-4 w-full h-fit pt-0 mt-0">
<div class="p-4 w-full h-fit pt-0 mt-0">
<img v-if="data.images[0]" :src="data.images[0]" class="rounded" />
</div>
<div class="text-center" v-for="item in data.paragraph">{{ item }}</div>