|
@@ -19,7 +19,31 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-const { data: articles } = await useFetch('/api/articles')
|
|
|
|
|
|
|
+// 获取原有文章数据
|
|
|
|
|
+const { data: originalArticles } = await useFetch('/api/articles')
|
|
|
|
|
+
|
|
|
|
|
+// 调用 Epic 免费游戏 API
|
|
|
|
|
+const { data: epicData } = await useFetch('https://uapis.cn/api/v1/game/epic-free')
|
|
|
|
|
+
|
|
|
|
|
+// 将 Epic 游戏数据转换为文章格式
|
|
|
|
|
+const epicArticles = computed(() => {
|
|
|
|
|
+ if (!epicData.value || !epicData.value.data) return []
|
|
|
|
|
+ return epicData.value.data
|
|
|
|
|
+ .filter(game => !game.title.includes('神秘游戏'))
|
|
|
|
|
+ .map(game => ({
|
|
|
|
|
+ id: game.id,
|
|
|
|
|
+ title: game.title,
|
|
|
|
|
+ briefContent: `${game.free_start}到${game.free_end}的EPIC免费游戏为${game.title}`,
|
|
|
|
|
+ coverImage: game.cover
|
|
|
|
|
+ }))
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+// 合并文章数据
|
|
|
|
|
+const articles = computed(() => {
|
|
|
|
|
+ const original = originalArticles.value || []
|
|
|
|
|
+ const epic = epicArticles.value || []
|
|
|
|
|
+ return [...epic, ...original]
|
|
|
|
|
+})
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus">
|
|
<style lang="stylus">
|