mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 15:51:01 +08:00
Add Time into the news system & Add a new API keypoint into the home page.
This commit is contained in:
parent
c2ec1b6668
commit
3019c06ec1
@ -1,17 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
const pullTabsData = async () => {
|
||||
const req = await fetch("/api/cached/tabs");
|
||||
const data = await req.json();
|
||||
return data.data;
|
||||
}
|
||||
};
|
||||
const contentArray = ref([]);
|
||||
const errorr = ref(false);
|
||||
const switchTabs = ref(false);
|
||||
const tabs = ref([]);
|
||||
const primary = ref<string>("domestic");
|
||||
|
||||
|
||||
const updateContent = async (url: string, tabAction: boolean) => {
|
||||
if (tabAction === true) {
|
||||
primary.value = url;
|
||||
@ -44,7 +42,8 @@ const openNews = (url: string) => {
|
||||
|
||||
onMounted(async () => {
|
||||
tabs.value = await pullTabsData();
|
||||
primary.value = tabs.value.find((tab) => tab.default === true)?.url || "domestic";
|
||||
primary.value =
|
||||
tabs.value.find((tab) => tab.default === true)?.url || "domestic";
|
||||
await updateContent(primary.value, false);
|
||||
});
|
||||
</script>
|
||||
@ -78,6 +77,19 @@ onMounted(async () => {
|
||||
<button @click="openNews(item.url.hash)">
|
||||
<div class="p-2 bg-gray-200 rounded m-1 p-1">
|
||||
<h1 class="text-2xl text-bold">{{ item.title }}</h1>
|
||||
<p class="m-0 text-gray-600">
|
||||
{{ item.publisher }} --
|
||||
{{
|
||||
new Date(item.publishTimeUnix).toLocaleString("zh-TW", {
|
||||
year: "numeric",
|
||||
month: "2-digit",
|
||||
day: "2-digit",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
})
|
||||
}}
|
||||
</p>
|
||||
<p>{{ item.shortDescription }}</p>
|
||||
</div>
|
||||
</button>
|
||||
|
@ -39,13 +39,15 @@
|
||||
"find": "Find",
|
||||
"interface": "Interface",
|
||||
"documentation": "Documentation",
|
||||
"opensource": "Open Source"
|
||||
"opensource": "Open Source",
|
||||
"apis": "APIs"
|
||||
},
|
||||
"description": {
|
||||
"find": "You can easily find the same topic from different news sources.",
|
||||
"interface": "Use a desktop like interface, the one that you already got used to.",
|
||||
"documentation": "We provide a documentation for you to learn how to use the app.",
|
||||
"opensource": "This platform is open source! minus the database part, but I'm going to try!"
|
||||
"opensource": "This platform is open source! minus the database part, but I'm going to try!",
|
||||
"apis": "We develop apis that does not exist before, like the line today one, but it just needs some revese engineering to find the apis behind it."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -39,13 +39,15 @@
|
||||
"find": "尋找",
|
||||
"interface": "使用者介面",
|
||||
"documentation": "教學",
|
||||
"opensource": "開源"
|
||||
"opensource": "開源",
|
||||
"apis": "APIs"
|
||||
},
|
||||
"description": {
|
||||
"find": "你可以輕鬆地從不同的新聞來源找到相同的主題。",
|
||||
"interface": "這個網站使用類似 Xfce / MacOS / DSM 的介面,讓你可以簡單使用這個網站。",
|
||||
"documentation": "我做了一組教學,讓你可以學會如何使用這個網站 UI。",
|
||||
"opensource": "這個平台的所有程式碼都放在Github上,沒有開源的資料庫,我會想辦法把它用其他方式開源!"
|
||||
"opensource": "這個平台的所有程式碼都放在Github上,沒有開源的資料庫,我會想辦法把它用其他方式開源!",
|
||||
"apis": "我們使用LINE Today 的資訊來做出一個 API。"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -133,6 +133,8 @@ const associAppWindow = [
|
||||
id: "6",
|
||||
title: t("app.news"),
|
||||
component: NewsWindow,
|
||||
width: "800px",
|
||||
height: "600px",
|
||||
},
|
||||
{
|
||||
name: "starred",
|
||||
@ -166,8 +168,6 @@ const associAppWindow = [
|
||||
id: "11",
|
||||
title: t("app.newsview"),
|
||||
component: NewsViewWindow,
|
||||
width: "800px",
|
||||
height: "600px",
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -12,7 +12,7 @@ import {
|
||||
ViewfinderCircleIcon,
|
||||
DocumentDuplicateIcon,
|
||||
} from "@heroicons/vue/24/outline";
|
||||
import { GithubIcon } from "lucide-vue-next";
|
||||
import { GithubIcon, KeyIcon } from "lucide-vue-next";
|
||||
import { gsap } from "gsap";
|
||||
import { TextPlugin } from "gsap/TextPlugin";
|
||||
gsap.registerPlugin(TextPlugin);
|
||||
@ -45,6 +45,11 @@ const cards = [
|
||||
title: t("home.cards.title.opensource"),
|
||||
description: t("home.cards.description.opensource"),
|
||||
},
|
||||
{
|
||||
icon: KeyIcon,
|
||||
title: t("home.cards.title.apis"),
|
||||
description: t("home.cards.description.apis"),
|
||||
},
|
||||
];
|
||||
|
||||
const accordionItems = [
|
||||
|
@ -1,16 +1,16 @@
|
||||
export default defineEventHandler(async (event) => {
|
||||
return {
|
||||
data: [
|
||||
{
|
||||
text: "國內",
|
||||
url: "domestic",
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
text: "國外",
|
||||
url: "global",
|
||||
default: false,
|
||||
},
|
||||
]
|
||||
}
|
||||
})
|
||||
{
|
||||
text: "國內",
|
||||
url: "domestic",
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
text: "國外",
|
||||
url: "global",
|
||||
default: false,
|
||||
},
|
||||
],
|
||||
};
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user