mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-24 00:01:03 +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">
|
<script setup lang="ts">
|
||||||
|
|
||||||
const pullTabsData = async () => {
|
const pullTabsData = async () => {
|
||||||
const req = await fetch("/api/cached/tabs");
|
const req = await fetch("/api/cached/tabs");
|
||||||
const data = await req.json();
|
const data = await req.json();
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
};
|
||||||
const contentArray = ref([]);
|
const contentArray = ref([]);
|
||||||
const errorr = ref(false);
|
const errorr = ref(false);
|
||||||
const switchTabs = ref(false);
|
const switchTabs = ref(false);
|
||||||
const tabs = ref([]);
|
const tabs = ref([]);
|
||||||
const primary = ref<string>("domestic");
|
const primary = ref<string>("domestic");
|
||||||
|
|
||||||
|
|
||||||
const updateContent = async (url: string, tabAction: boolean) => {
|
const updateContent = async (url: string, tabAction: boolean) => {
|
||||||
if (tabAction === true) {
|
if (tabAction === true) {
|
||||||
primary.value = url;
|
primary.value = url;
|
||||||
@ -44,7 +42,8 @@ const openNews = (url: string) => {
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
tabs.value = await pullTabsData();
|
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);
|
await updateContent(primary.value, false);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -78,6 +77,19 @@ onMounted(async () => {
|
|||||||
<button @click="openNews(item.url.hash)">
|
<button @click="openNews(item.url.hash)">
|
||||||
<div class="p-2 bg-gray-200 rounded m-1 p-1">
|
<div class="p-2 bg-gray-200 rounded m-1 p-1">
|
||||||
<h1 class="text-2xl text-bold">{{ item.title }}</h1>
|
<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>
|
<p>{{ item.shortDescription }}</p>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
@ -39,13 +39,15 @@
|
|||||||
"find": "Find",
|
"find": "Find",
|
||||||
"interface": "Interface",
|
"interface": "Interface",
|
||||||
"documentation": "Documentation",
|
"documentation": "Documentation",
|
||||||
"opensource": "Open Source"
|
"opensource": "Open Source",
|
||||||
|
"apis": "APIs"
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"find": "You can easily find the same topic from different news sources.",
|
"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.",
|
"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.",
|
"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": "尋找",
|
"find": "尋找",
|
||||||
"interface": "使用者介面",
|
"interface": "使用者介面",
|
||||||
"documentation": "教學",
|
"documentation": "教學",
|
||||||
"opensource": "開源"
|
"opensource": "開源",
|
||||||
|
"apis": "APIs"
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"find": "你可以輕鬆地從不同的新聞來源找到相同的主題。",
|
"find": "你可以輕鬆地從不同的新聞來源找到相同的主題。",
|
||||||
"interface": "這個網站使用類似 Xfce / MacOS / DSM 的介面,讓你可以簡單使用這個網站。",
|
"interface": "這個網站使用類似 Xfce / MacOS / DSM 的介面,讓你可以簡單使用這個網站。",
|
||||||
"documentation": "我做了一組教學,讓你可以學會如何使用這個網站 UI。",
|
"documentation": "我做了一組教學,讓你可以學會如何使用這個網站 UI。",
|
||||||
"opensource": "這個平台的所有程式碼都放在Github上,沒有開源的資料庫,我會想辦法把它用其他方式開源!"
|
"opensource": "這個平台的所有程式碼都放在Github上,沒有開源的資料庫,我會想辦法把它用其他方式開源!",
|
||||||
|
"apis": "我們使用LINE Today 的資訊來做出一個 API。"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -133,6 +133,8 @@ const associAppWindow = [
|
|||||||
id: "6",
|
id: "6",
|
||||||
title: t("app.news"),
|
title: t("app.news"),
|
||||||
component: NewsWindow,
|
component: NewsWindow,
|
||||||
|
width: "800px",
|
||||||
|
height: "600px",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "starred",
|
name: "starred",
|
||||||
@ -166,8 +168,6 @@ const associAppWindow = [
|
|||||||
id: "11",
|
id: "11",
|
||||||
title: t("app.newsview"),
|
title: t("app.newsview"),
|
||||||
component: NewsViewWindow,
|
component: NewsViewWindow,
|
||||||
width: "800px",
|
|
||||||
height: "600px",
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import {
|
|||||||
ViewfinderCircleIcon,
|
ViewfinderCircleIcon,
|
||||||
DocumentDuplicateIcon,
|
DocumentDuplicateIcon,
|
||||||
} from "@heroicons/vue/24/outline";
|
} from "@heroicons/vue/24/outline";
|
||||||
import { GithubIcon } from "lucide-vue-next";
|
import { GithubIcon, KeyIcon } from "lucide-vue-next";
|
||||||
import { gsap } from "gsap";
|
import { gsap } from "gsap";
|
||||||
import { TextPlugin } from "gsap/TextPlugin";
|
import { TextPlugin } from "gsap/TextPlugin";
|
||||||
gsap.registerPlugin(TextPlugin);
|
gsap.registerPlugin(TextPlugin);
|
||||||
@ -45,6 +45,11 @@ const cards = [
|
|||||||
title: t("home.cards.title.opensource"),
|
title: t("home.cards.title.opensource"),
|
||||||
description: t("home.cards.description.opensource"),
|
description: t("home.cards.description.opensource"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
icon: KeyIcon,
|
||||||
|
title: t("home.cards.title.apis"),
|
||||||
|
description: t("home.cards.description.apis"),
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const accordionItems = [
|
const accordionItems = [
|
||||||
|
@ -11,6 +11,6 @@ export default defineEventHandler(async (event) => {
|
|||||||
url: "global",
|
url: "global",
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
]
|
],
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user