From 25e81517ac49712ba4a80f5965b6d76e92afca32 Mon Sep 17 00:00:00 2001 From: changtong <2540919286@qq.com> Date: Tue, 11 Nov 2025 15:27:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=9E=8D=E5=AA=92=E4=BD=93?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/index.js | 4 +- .../components/mediaBigScreen/content.vue | 10 +- src/views/screen/media-screen.vue | 240 +++++++++++++----- 3 files changed, 184 insertions(+), 70 deletions(-) diff --git a/config/index.js b/config/index.js index 4313c98..e6dadb7 100644 --- a/config/index.js +++ b/config/index.js @@ -25,8 +25,8 @@ module.exports = { changeOrigin: true, }, '/socket.io': { - target: 'http://localhost:19990/', - // target: 'http://60.255.186.185:9024/', + // target: 'http://localhost:19990/', + target: 'http://60.255.186.185:9024/', changeOrigin: true, } }, diff --git a/src/views/screen/components/mediaBigScreen/content.vue b/src/views/screen/components/mediaBigScreen/content.vue index c03dd79..de28f77 100644 --- a/src/views/screen/components/mediaBigScreen/content.vue +++ b/src/views/screen/components/mediaBigScreen/content.vue @@ -13,14 +13,14 @@ :key="index" >
- +
{{ item.title }}
-
{{ item.pubDate || item.startTime }}
+
{{ item.publish_time }}
@@ -130,7 +130,8 @@ export default { }, }, created() {}, - mounted() {}, + mounted () { + }, methods: { closeVideo(data) { console.log(data); @@ -170,7 +171,8 @@ export default { }, // 点击切换详情 queryDetail (item) { - this.jumpWindow(item.url, item.title); + console.log(item) + this.jumpWindow('http://m.cuipingrongmei.cn/cms/content/' + item.id, item.title); }, getContentById(item) { let url = "/links/getImageTextContentById"; diff --git a/src/views/screen/media-screen.vue b/src/views/screen/media-screen.vue index f9a270d..8844411 100644 --- a/src/views/screen/media-screen.vue +++ b/src/views/screen/media-screen.vue @@ -16,9 +16,7 @@
- {{ - item.columnName - }} + {{ item.name }}
@@ -46,7 +44,7 @@ -
+
@@ -75,48 +73,49 @@ export default { pageSize: 20, total: 0, }, - tagTitle: [ - { - columnName: "翠屏", - columnId: "3f7adceb-fcf9-4adb-956d-7987b42cd10f", - }, - { - columnName: "部门动态", - columnId: "16653738-7af1-45d3-b6a3-ab13c49b2760", - }, - { - columnName: "电视新闻", - columnId: "9d3fe8a8-a994-475e-981c-aac2bce70c9b", - }, - { - columnName: "微视频", - columnId: "bdb2782e-eaba-4bd9-9f1e-09d85e32c73d", - }, - { - columnName: "镇村动态", - columnId: "28009c03-4766-40eb-b86d-fe09bb11ac21", - }, - { - columnName: "法治翠屏", - columnId: "1d15515f-e7d5-4efd-bcdb-12d65104c14d", - }, - { - columnName: "医保动态", - columnId: "972136f0-172f-436e-9fa9-332ea58fa3d4", - }, - { - columnName: "办事指南", - columnId: "cd775f6e-d6f5-4b10-a78f-80042e0aa6de", - }, - { - columnName: "医保政策", - columnId: "a914aa8c-27b9-4ff3-ba83-54811b41fe0b", - }, - { - columnName: "直播", - columnId: "08d99eb1-b653-4386-955a-53a43c5139c3", - }, - ], + // tagTitle: [ + // { + // columnName: "翠屏", + // columnId: "3f7adceb-fcf9-4adb-956d-7987b42cd10f", + // }, + // { + // columnName: "部门动态", + // columnId: "16653738-7af1-45d3-b6a3-ab13c49b2760", + // }, + // { + // columnName: "电视新闻", + // columnId: "9d3fe8a8-a994-475e-981c-aac2bce70c9b", + // }, + // { + // columnName: "微视频", + // columnId: "bdb2782e-eaba-4bd9-9f1e-09d85e32c73d", + // }, + // { + // columnName: "镇村动态", + // columnId: "28009c03-4766-40eb-b86d-fe09bb11ac21", + // }, + // { + // columnName: "法治翠屏", + // columnId: "1d15515f-e7d5-4efd-bcdb-12d65104c14d", + // }, + // { + // columnName: "医保动态", + // columnId: "972136f0-172f-436e-9fa9-332ea58fa3d4", + // }, + // { + // columnName: "办事指南", + // columnId: "cd775f6e-d6f5-4b10-a78f-80042e0aa6de", + // }, + // { + // columnName: "医保政策", + // columnId: "a914aa8c-27b9-4ff3-ba83-54811b41fe0b", + // }, + // { + // columnName: "直播", + // columnId: "08d99eb1-b653-4386-955a-53a43c5139c3", + // }, + // ], + tagTitle: [], scrollData: [], tenantDomainName: "", tabJumpId: "", @@ -131,10 +130,38 @@ export default { const { calcRate, windowDraw } = useIndex(this.$refs.appRef); calcRate(); windowDraw(); - this.onClick(this.tagTitle[0], 0); + this.queryFlData(); }, created() {}, methods: { + // 查询分类 + queryFlData() { + let url = "/convergenceMedia/getColumn"; + let params = { + columnId: "64525", + }; + + this.$http.post(url, this.common.request(params)).then((res) => { + if (res && res.data.code >= 200 && res.data.code < 400) { + let data = res.data.data; + if ( + data && + data.body && + data.body.blocks && + data.body.blocks.length >= 5 + ) { + this.tagTitle = + data.body.blocks[4].data_props && + data.body.blocks[4].data_props.length > 0 + ? data.body.blocks[4].data_props + : []; + this.onClick(this.tagTitle[0], 0); + } + } else { + this.$Message.error("获取数据失败"); + } + }); + }, openInfo(data) { this.infoState = data; }, @@ -146,35 +173,120 @@ export default { this.flog = index; this.dataFilter.page = 1; this.dataFilter.total = 0; - this.tabJumpId = item.columnId; + this.tabJumpId = + item.redirection && + item.redirection.related_data && + item.redirection.related_data.id; this.infoState = true; - this.currentColumnName = item.columnName; - this.queryScrollDataList(item); + this.currentColumnName = item.name; + this.queryScrollDataList(this.tabJumpId); }, // 查询列表 - queryScrollDataList(item) { - let url = "/convergenceMedia/selectByAppSpecial"; + queryScrollDataList (id) { + this.scrollData = [] + let url = "/convergenceMedia/syncNewsColumn"; let params = { - appInfoId: 516, - columnId: item.columnId, - pageNum: this.dataFilter.page - 1, - pageSize: 10, - url: "http://hongqi.wengegroup.com:9001/newNews/getNewsColumnData", - userId: "", + // appInfoId: 516, + columnId: id, + // pageNum: this.dataFilter.page - 1, + // pageSize: 10, + // url: "http://hongqi.wengegroup.com:9001/newNews/getNewsColumnData", + // userId: "", }; this.$http.post(url, this.common.request(params)).then((res) => { if (res && res.data.code >= 200 && res.data.code < 400) { this.loadState = false; - this.scrollData = res.data.data[0].list; - if (res.data.data[0].total) { - this.dataFilter.total = res.data.data[0].total - } + let data = + res.data.data && res.data.data.length > 0 && res.data.data.filter(item => { + if (item.name.includes("新闻列表") || item.name.includes("专题列表")) { + return true + } + }) + data.forEach(element => { + if (element.data_props && element.data_props.length > 0) { + this.scrollData.push(...element.data_props) + } + }); + + // data.data_props && data.data_props.length > 0 + // ? data.data_props + // : []; + this.scrollData = this.scrollData.map((item) => { + let contentData = + item.related_data && + item.related_data.thumbnails && + item.related_data.thumbnails.length > 0 && + item.related_data.thumbnails[0]; + return { + ...item, + url: contentData.url, + title: item.related_data && item.related_data.title, + publish_time: + item.related_data && + this.formatTime(item.related_data.publish_time), + }; + }); + } else { this.$Message.error("获取数据失败"); } }); }, + formatTime(timestamp) { + // 处理空值或非数字情况 + if (!timestamp || isNaN(Number(timestamp))) { + return "未知"; + } + + // 转换为毫秒级时间戳(确保输入为数字) + const targetTime = Number(timestamp) * 1000; + const now = Date.now(); + const diff = now - targetTime; // 时间差(毫秒) + + // 计算各类时间单位差(向下取整) + const seconds = Math.floor(diff / 1000); + const minutes = Math.floor(seconds / 60); + const hours = Math.floor(minutes / 60); + const days = Math.floor(hours / 24); + const years = Math.floor(days / 365); + + // 小于1分钟(60秒) + if (seconds < 60) { + return "刚刚"; + } + + // 1分钟到1小时内 + if (minutes < 60) { + return `${minutes}分钟前`; + } + + // 1小时到24小时内 + if (hours < 24) { + return `${hours}小时前`; + } + + // 24小时到3天内 + if (days >= 1 && days < 3) { + return `${days}天前`; + } + + // 处理日期格式化 + const date = new Date(targetTime); + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, "0"); + const day = String(date.getDate()).padStart(2, "0"); + const hour = String(date.getHours()).padStart(2, "0"); + const minute = String(date.getMinutes()).padStart(2, "0"); + + // 一年以上显示完整日期时间 + if (years >= 1) { + return `${year}-${month}-${day} ${hour}:${minute}`; + } + + // 3天到1年内显示月日时间 + return `${month}-${day} ${hour}:${minute}`; + }, // 分页查询列表 queryPageList() { this.scrollData = []; @@ -193,7 +305,7 @@ export default { this.loadState = false; this.scrollData = res.data.data[0].list; if (res.data.data[0].total) { - this.dataFilter.total = res.data.data[0].total + this.dataFilter.total = res.data.data[0].total; } } else { this.$Message.error("获取数据失败");