From 47356f4f8f3b912a46d2788357f76b94f709ed75 Mon Sep 17 00:00:00 2001 From: xiongxiaoyang <773861846@qq.com> Date: Sat, 14 May 2022 14:39:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=9C=80=E6=96=B0=E6=96=B0=E9=97=BB=E5=88=97=E8=A1=A8=E7=BB=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/news.js | 5 +++ src/components/LatestNews.vue | 39 ++++++++++++++++++++ src/router/index.js | 5 +++ src/views/Home.vue | 67 +++++++++++++++-------------------- 4 files changed, 78 insertions(+), 38 deletions(-) create mode 100644 src/api/news.js create mode 100644 src/components/LatestNews.vue diff --git a/src/api/news.js b/src/api/news.js new file mode 100644 index 0000000..fb6e39d --- /dev/null +++ b/src/api/news.js @@ -0,0 +1,5 @@ +import request from '../utils/request' + +export function listLatestNews() { + return request.get('/news/latestList'); +} \ No newline at end of file diff --git a/src/components/LatestNews.vue b/src/components/LatestNews.vue new file mode 100644 index 0000000..7c68268 --- /dev/null +++ b/src/components/LatestNews.vue @@ -0,0 +1,39 @@ + + + \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index 4c57734..60fcdc9 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -15,6 +15,11 @@ const router = createRouter({ component: () => import('@/views/Home') }, + { + path: '/home', + name: 'newsContent', + component: () => import('@/views/Home') + }, { path: '/home', name: 'book', diff --git a/src/views/Home.vue b/src/views/Home.vue index cf2198e..6e1bb35 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -12,7 +12,7 @@ > @@ -27,7 +27,7 @@ :class="{ on: index == 0 }" > @@ -83,20 +83,7 @@ -
-
- [资讯]AI小说悄然流行:人类特有的创作力,已经被AI复制? -
-
- [行业]阅文推“单本可选新合同”:授权分级、免费或付费自选 -
-
+
@@ -120,7 +107,7 @@
@@ -141,27 +128,30 @@

热门推荐

@@ -346,31 +336,31 @@

精品推荐

- +
@@ -1198,10 +1188,12 @@ import { reactive, toRefs, onMounted } from "vue"; import { listHomeBooks } from "@/api/home"; import { ElMessage, ElLoading } from "element-plus"; import Header from "@/components/Header"; +import LatestNews from "@/components/LatestNews" export default { name: "home", components: { Header, + LatestNews }, setup() { const state = reactive({ @@ -1215,7 +1207,7 @@ export default { hotRecommend: [], // 精品推荐 goodRecommend: [], - imgBaseUrl: process.env.VUE_APP_BASE_IMG_URL + imgBaseUrl: process.env.VUE_APP_BASE_IMG_URL, }); onMounted(async () => { @@ -1297,8 +1289,7 @@ export default { }); return { - ...toRefs(state) - + ...toRefs(state), }; }, };