Browse Source

修改融媒体对接

master
changtong 1 month ago
parent
commit
25e81517ac
  1. 4
      config/index.js
  2. 10
      src/views/screen/components/mediaBigScreen/content.vue
  3. 240
      src/views/screen/media-screen.vue

4
config/index.js

@ -25,8 +25,8 @@ module.exports = {
changeOrigin: true, changeOrigin: true,
}, },
'/socket.io': { '/socket.io': {
target: 'http://localhost:19990/', // target: 'http://localhost:19990/',
// target: 'http://60.255.186.185:9024/', target: 'http://60.255.186.185:9024/',
changeOrigin: true, changeOrigin: true,
} }
}, },

10
src/views/screen/components/mediaBigScreen/content.vue

@ -13,14 +13,14 @@
:key="index" :key="index"
> >
<div class="back"> <div class="back">
<img :src="item.image_url" @error="imageError($event, index)" /> <img :src="item.url || ''" @error="imageError($event, index)" />
</div> </div>
<div <div
class="content-box" class="content-box"
:class="{ 'special-box': item.jumpContentType == '15' }" :class="{ 'special-box': item.jumpContentType == '15' }"
> >
<div>{{ item.title }}</div> <div>{{ item.title }}</div>
<div>{{ item.pubDate || item.startTime }}</div> <div>{{ item.publish_time }}</div>
</div> </div>
</div> </div>
<div v-if="scrollData.length == 0 && !parentLoad" class="noData"> <div v-if="scrollData.length == 0 && !parentLoad" class="noData">
@ -130,7 +130,8 @@ export default {
}, },
}, },
created() {}, created() {},
mounted() {}, mounted () {
},
methods: { methods: {
closeVideo(data) { closeVideo(data) {
console.log(data); console.log(data);
@ -170,7 +171,8 @@ export default {
}, },
// //
queryDetail (item) { 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) { getContentById(item) {
let url = "/links/getImageTextContentById"; let url = "/links/getImageTextContentById";

240
src/views/screen/media-screen.vue

@ -16,9 +16,7 @@
<div class="box-icon-text"> <div class="box-icon-text">
<!-- 右边标题 --> <!-- 右边标题 -->
<div class="left-title"> <div class="left-title">
<span class="title-text">{{ <span class="title-text">{{ item.name }}</span>
item.columnName
}}</span>
</div> </div>
</div> </div>
</div> </div>
@ -46,7 +44,7 @@
</div> </div>
</Spin> </Spin>
</div> </div>
<div class="page" v-if="scrollData.length > 0 && infoState"> <!-- <div class="page" v-if="scrollData.length > 0 && infoState">
<Page <Page
:total="dataFilter.total" :total="dataFilter.total"
:current.sync="dataFilter.page" :current.sync="dataFilter.page"
@ -54,7 +52,7 @@
@on-change="pageChange" @on-change="pageChange"
show-elevator show-elevator
/> />
</div> </div> -->
</div> </div>
</div> </div>
</div> </div>
@ -75,48 +73,49 @@ export default {
pageSize: 20, pageSize: 20,
total: 0, total: 0,
}, },
tagTitle: [ // tagTitle: [
{ // {
columnName: "翠屏", // columnName: "",
columnId: "3f7adceb-fcf9-4adb-956d-7987b42cd10f", // columnId: "3f7adceb-fcf9-4adb-956d-7987b42cd10f",
}, // },
{ // {
columnName: "部门动态", // columnName: "",
columnId: "16653738-7af1-45d3-b6a3-ab13c49b2760", // columnId: "16653738-7af1-45d3-b6a3-ab13c49b2760",
}, // },
{ // {
columnName: "电视新闻", // columnName: "",
columnId: "9d3fe8a8-a994-475e-981c-aac2bce70c9b", // columnId: "9d3fe8a8-a994-475e-981c-aac2bce70c9b",
}, // },
{ // {
columnName: "微视频", // columnName: "",
columnId: "bdb2782e-eaba-4bd9-9f1e-09d85e32c73d", // columnId: "bdb2782e-eaba-4bd9-9f1e-09d85e32c73d",
}, // },
{ // {
columnName: "镇村动态", // columnName: "",
columnId: "28009c03-4766-40eb-b86d-fe09bb11ac21", // columnId: "28009c03-4766-40eb-b86d-fe09bb11ac21",
}, // },
{ // {
columnName: "法治翠屏", // columnName: "",
columnId: "1d15515f-e7d5-4efd-bcdb-12d65104c14d", // columnId: "1d15515f-e7d5-4efd-bcdb-12d65104c14d",
}, // },
{ // {
columnName: "医保动态", // columnName: "",
columnId: "972136f0-172f-436e-9fa9-332ea58fa3d4", // columnId: "972136f0-172f-436e-9fa9-332ea58fa3d4",
}, // },
{ // {
columnName: "办事指南", // columnName: "",
columnId: "cd775f6e-d6f5-4b10-a78f-80042e0aa6de", // columnId: "cd775f6e-d6f5-4b10-a78f-80042e0aa6de",
}, // },
{ // {
columnName: "医保政策", // columnName: "",
columnId: "a914aa8c-27b9-4ff3-ba83-54811b41fe0b", // columnId: "a914aa8c-27b9-4ff3-ba83-54811b41fe0b",
}, // },
{ // {
columnName: "直播", // columnName: "",
columnId: "08d99eb1-b653-4386-955a-53a43c5139c3", // columnId: "08d99eb1-b653-4386-955a-53a43c5139c3",
}, // },
], // ],
tagTitle: [],
scrollData: [], scrollData: [],
tenantDomainName: "", tenantDomainName: "",
tabJumpId: "", tabJumpId: "",
@ -131,10 +130,38 @@ export default {
const { calcRate, windowDraw } = useIndex(this.$refs.appRef); const { calcRate, windowDraw } = useIndex(this.$refs.appRef);
calcRate(); calcRate();
windowDraw(); windowDraw();
this.onClick(this.tagTitle[0], 0); this.queryFlData();
}, },
created() {}, created() {},
methods: { 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) { openInfo(data) {
this.infoState = data; this.infoState = data;
}, },
@ -146,35 +173,120 @@ export default {
this.flog = index; this.flog = index;
this.dataFilter.page = 1; this.dataFilter.page = 1;
this.dataFilter.total = 0; 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.infoState = true;
this.currentColumnName = item.columnName; this.currentColumnName = item.name;
this.queryScrollDataList(item); this.queryScrollDataList(this.tabJumpId);
}, },
// //
queryScrollDataList(item) { queryScrollDataList (id) {
let url = "/convergenceMedia/selectByAppSpecial"; this.scrollData = []
let url = "/convergenceMedia/syncNewsColumn";
let params = { let params = {
appInfoId: 516, // appInfoId: 516,
columnId: item.columnId, columnId: id,
pageNum: this.dataFilter.page - 1, // pageNum: this.dataFilter.page - 1,
pageSize: 10, // pageSize: 10,
url: "http://hongqi.wengegroup.com:9001/newNews/getNewsColumnData", // url: "http://hongqi.wengegroup.com:9001/newNews/getNewsColumnData",
userId: "", // userId: "",
}; };
this.$http.post(url, this.common.request(params)).then((res) => { this.$http.post(url, this.common.request(params)).then((res) => {
if (res && res.data.code >= 200 && res.data.code < 400) { if (res && res.data.code >= 200 && res.data.code < 400) {
this.loadState = false; this.loadState = false;
this.scrollData = res.data.data[0].list; let data =
if (res.data.data[0].total) { res.data.data && res.data.data.length > 0 && res.data.data.filter(item => {
this.dataFilter.total = res.data.data[0].total 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 { } else {
this.$Message.error("获取数据失败"); 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);
// 160
if (seconds < 60) {
return "刚刚";
}
// 11
if (minutes < 60) {
return `${minutes}分钟前`;
}
// 124
if (hours < 24) {
return `${hours}小时前`;
}
// 243
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}`;
}
// 31
return `${month}-${day} ${hour}:${minute}`;
},
// //
queryPageList() { queryPageList() {
this.scrollData = []; this.scrollData = [];
@ -193,7 +305,7 @@ export default {
this.loadState = false; this.loadState = false;
this.scrollData = res.data.data[0].list; this.scrollData = res.data.data[0].list;
if (res.data.data[0].total) { if (res.data.data[0].total) {
this.dataFilter.total = res.data.data[0].total this.dataFilter.total = res.data.data[0].total;
} }
} else { } else {
this.$Message.error("获取数据失败"); this.$Message.error("获取数据失败");

Loading…
Cancel
Save