From 58e28f70bb744376c30dbdddea87375804e416b6 Mon Sep 17 00:00:00 2001 From: zpc Date: Fri, 20 Jun 2025 19:20:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0111?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/platform/PlatformFactory.js | 18 ++++++++-------- common/server/news.js | 33 ++++++++++++++++++++++++++++++ pages.json | 2 +- pages/news/news.vue | 2 +- 4 files changed, 44 insertions(+), 11 deletions(-) create mode 100644 common/server/news.js diff --git a/common/platform/PlatformFactory.js b/common/platform/PlatformFactory.js index a664edf..7a0c280 100644 --- a/common/platform/PlatformFactory.js +++ b/common/platform/PlatformFactory.js @@ -5,19 +5,19 @@ import AppPlatform from './AppPlatform'; //#endif class PlatformFactory { - static create() { - console.log('获取平台获取平台获取平台获取平台获取平台获取平台'); + static create() { + console.log('获取平台获取平台获取平台获取平台获取平台获取平台'); - //#ifdef APP - return new AppPlatform(); - //#endif - // 默认返回 - return new AppPlatform(); - } + //#ifdef APP + return new AppPlatform(); + //#endif + // 默认返回 + return new AppPlatform(); + } } // 使用示例 const platform = PlatformFactory.create(); export { - platform + platform }; \ No newline at end of file diff --git a/common/server/news.js b/common/server/news.js new file mode 100644 index 0000000..701b63a --- /dev/null +++ b/common/server/news.js @@ -0,0 +1,33 @@ +import HttpRequest from "../system/request"; + +/** + * 获取推荐新闻列表 + * @param {Number} page 页码 + * @param {Number} pageSize 每页条数 + * @param {String} title 新闻标题 + * @returns {Promise} 推荐新闻列表 + */ +export const getFeaturedNewsList = async (page = 1, pageSize = 10, title = "") => { + const res = await HttpRequest.getOrCache('/get_featured_news_list', { page, limit: pageSize, title }, 300); + return res.data; +} +/** + * 获取热门新闻列表 + * @param {Number} page 页码 + * @param {Number} pageSize 每页条数 + * @param {String} title 新闻标题 + * @returns {Promise} 热门新闻列表 + */ +export const getHotNewsList = async (page = 1, pageSize = 10, title = "") => { + const res = await HttpRequest.getOrCache('/get_hot_news_list', { page, limit: pageSize, title }, 300); + return res.data; +} +/** + * 获取新闻详情 + * @param {Number} id 新闻id + * @returns {Promise} 新闻详情 + */ +export const getNewsDetail = async (id) => { + const res = await HttpRequest.getOrCache('/get_news_detail', { id }); + return res.data; +} diff --git a/pages.json b/pages.json index ac2b16c..1152dfc 100644 --- a/pages.json +++ b/pages.json @@ -39,7 +39,7 @@ "color": "#C6C6C6", "selectedColor": "#333333", "borderStyle": "black", - "height": "124.05rpx", + "height": "48px", "list": [ { "pagePath": "pages/news/news", diff --git a/pages/news/news.vue b/pages/news/news.vue index 8b98456..4ab3b4e 100644 --- a/pages/news/news.vue +++ b/pages/news/news.vue @@ -11,7 +11,7 @@ - + {{item.title}}