Commit 33485eb6 by 田爽

闪动问题

parent 9db9a3ee
......@@ -66,13 +66,13 @@ export default {
// 详情
getInfo(id,directpath){
const matche = [
{
name: "深度资讯",
path: "/News/DepthTopics",
}
];
this.setMatche(matche);
// const matche = [
// {
// name: "深度资讯",
// path: "/News/DepthTopics",
// }
// ];
// this.setMatche(matche);
this.clickDetailSave(id,directpath)
......
......@@ -21,6 +21,8 @@
<script>
import breadcrumb from "../comps/breadcrumb.vue";
import pages from "../comps/pages2.vue";
import { mapState,mapMutations } from "vuex";
import { Loading } from 'element-ui';
export default {
components: {
pages,
......@@ -34,43 +36,74 @@ export default {
title: "",
showtime: "",
author: "",
breadcrumb: [{ name: "资讯中心", path: "/News/index" }],
};
},
computed: {
routes() {},
},
beforeCreate() {
Loading.service({customClass: 'el-loading-custom-class'});
},
created() {
this.InfoFn();
},
mounted() {
console.log(2);
// 面包屑单独处理
window.onbeforeunload = () => {
localStorage.removeItem('msg'+this.id)
localStorage.removeItem('isList'+this.id)
}
},
methods: {
...mapMutations({
setMatche: "setMatche",
}),
// 详情
async InfoFn() {
this.loading=true
let listRes = {}
if(JSON.parse(localStorage.getItem('isList'+this.id)) && JSON.parse(localStorage.getItem('isList'+this.id)) == 1){
listRes = localStorage.getItem('msg'+this.id) ? JSON.parse(localStorage.getItem('msg'+this.id)) : null
} else {
const params = {
id: this.id,
token:this.$route.query.token ||''
};
const listRes = await this.$api.news.announInfo(params);
listRes = await this.$api.news.announInfo(params);
}
const { returnCode, data ,returnMsg} = listRes;
if (returnCode === "0") {
console.log(data, "公告详情");
if (returnCode === "0" && data !=null) {
if (data.directpath && data.directpath !== "" && data.directpath.length > 0) {
window.open(data.directpath, "_self");
}
// let matche = this.matcheList.filter((item) => item.classid ===data.classid)[0];
// if(typeof(matche)==='undefined'){
let matche = [
{
name: "公告通知",
path: "/News/Notice"
}
]
// }
this.setMatche(matche);
this.content = data.content;
this.title = data.title;
this.showtime = data.showtime;
this.author = data.author;
this.$store.commit("system/SET_BREADCRUMB", [
{ name: "资讯中心", path: "/News/index" },
{ name: "公告通知", path: "/News/Notice" },
{ name: this.title },
]);
console.log(matche)
this.breadcrumb = this.breadcrumb.concat(matche);
this.breadcrumb.push({
name: this.title,
});
this.$store.commit("system/SET_BREADCRUMB", this.breadcrumb);
}else{
this.$message.error(returnMsg)
}
this.loading=false
Loading.service().close();
},
},
};
......
......@@ -9,7 +9,7 @@
<img :src="tmp.picFile" alt="" />
</div>
<div class="picNews-li-bt">
<a :href="tmp.href" v-html="tmp.title" target="_blank"></a>
<a :href="tmp.href" @click.prevent="InfoFn(tmp.articleId, tmp.href)" v-html="tmp.title" target="_blank"></a>
</div>
</li>
</ul>
......@@ -141,6 +141,31 @@ export default {
// }
}
},
async InfoFn(id, href) {
const params = {
id: id,
token:this.$route.query.token ||''
};
const listRes = await this.$api.news.newsInfo(params);
const { returnCode, data ,returnMsg} = listRes;
if (returnCode === "0" && data !=null) {
localStorage.setItem("msg"+id, JSON.stringify(listRes));
localStorage.setItem("isList"+id, 1);
// let link = this.$router.resolve({
// path: `/News/msg?id=${id}`,
// });
// window.open(link.href,'_blank')
if (data.directpath && data.directpath !== "" && data.directpath.length > 0) {
window.open(data.directpath, "_blank");
localStorage.removeItem('msg'+this.id)
localStorage.removeItem('isList'+this.id)
} else {
window.open(href,'_blank')
}
}else{
window.open(href,'_blank')
}
},
},
};
</script>
......
......@@ -22,7 +22,28 @@ export default {
id: id,
token:this.$route.query.token ||''
};
const listRes = await this.$api.news.newsInfo(params);
let listRes = {}
console.log('看看路由', this.$route)
if (this.$route.name === 'DepthTopics') {
listRes = await this.$api.news.newsTopicInfo(params);
} else if (this.$route.name === 'Video'){
listRes = await this.$api.news.jcspiInfo(params);
} else {
listRes = await this.$api.news.newsInfo(params);
}
switch (this.$route.name) {
case 'DepthTopics':
listRes = await this.$api.news.newsTopicInfo(params)
break
case 'Video':
listRes = await this.$api.news.jcspiInfo(params)
break
case 'Notice':
listRes = await this.$api.news.announInfo(params)
break
default:
listRes = await this.$api.news.newsInfo(params)
}
const { returnCode, data ,returnMsg} = listRes;
if (returnCode === "0" && data !=null) {
localStorage.setItem("msg"+id, JSON.stringify(listRes));
......@@ -33,8 +54,8 @@ export default {
// window.open(link.href,'_blank')
if (data.directpath && data.directpath !== "" && data.directpath.length > 0) {
window.open(data.directpath, "_blank");
localStorage.removeItem('msg'+this.id)
localStorage.removeItem('isList'+this.id)
localStorage.removeItem('msg'+id)
localStorage.removeItem('isList'+id)
} else {
window.open(href,'_blank')
}
......
......@@ -268,9 +268,9 @@ export default {
}
const { returnCode, data ,returnMsg} = listRes;
if (returnCode === "0" && data !=null) {
// if (data.directpath && data.directpath !== "" && data.directpath.length > 0) {
// window.open(data.directpath, "_self");
// }
if (data.directpath && data.directpath !== "" && data.directpath.length > 0) {
window.open(data.directpath, "_blank");
}
let matche = this.matcheList.filter((item) => item.classid ===data.classid)[0];
if(typeof(matche)==='undefined'){
matche = [
......
<template>
<div class="msg container" v-loading="loading">
<div class="msg container">
<breadcrumb />
<div class="row">
<div class="col-lg-9">
......@@ -110,7 +110,8 @@
import breadcrumb from "../comps/breadcrumb.vue";
import list from "./comps/list.vue";
import list2 from "./comps/list2.vue";
import { mapState,mapMutations } from "vuex";
import { Loading } from 'element-ui';
export default {
components: {
breadcrumb,
......@@ -161,25 +162,52 @@ export default {
sharesinastring: null,
};
},
beforeCreate() {
Loading.service({customClass: 'el-loading-custom-class'});
},
created() {
this.InfoFn();
this.newsTop10();
this.announceList();
this.zttjList();
},
mounted() {
window.onbeforeunload = () => {
localStorage.removeItem('msg'+this.id)
localStorage.removeItem('isList'+this.id)
}
},
methods: {
...mapMutations({
setMatche: "setMatche",
}),
async InfoFn() {
this.loading=true
let listRes = {}
if(JSON.parse(localStorage.getItem('isList'+this.id)) && JSON.parse(localStorage.getItem('isList'+this.id)) == 1){
listRes = localStorage.getItem('msg'+this.id) ? JSON.parse(localStorage.getItem('msg'+this.id)) : null
} else {
const params = {
id: this.id,
token:this.$route.query.token ||''
};
const listRes = await this.$api.news.jcspiInfo(params);
listRes = await this.$api.news.jcspiInfo(params);
}
const { returnCode, data ,returnMsg} = listRes;
if (returnCode === "0") {
if (returnCode === "0" && data !=null) {
if (data.directpath && data.directpath !== "" && data.directpath.length > 0) {
window.open(data.directpath, "_self");
}
// let matche = this.matcheList.filter((item) => item.classid ===data.classid)[0];
// if(typeof(matche)==='undefined'){
let matche = [
{
name: "精彩视频",
path: "/News/Video"
}
]
// }
this.setMatche(matche);
this.content = data.brief;
this.title = data.title;
this.showtime = data.showtime;
......@@ -187,16 +215,19 @@ export default {
this.videoStr = data.wavname;
// this.source = data.source;
this.editor = data.editor;
this.$store.commit("system/SET_BREADCRUMB", [
{ name: "资讯中心", path: "/News/index" },
{ name: "精彩视频", path: "/News/Video" },
{ name: this.title },
]);
console.log(matche)
this.breadcrumb = this.breadcrumb.concat(matche);
this.breadcrumb.push({
name: this.title,
});
this.$store.commit("system/SET_BREADCRUMB", this.breadcrumb);
this.xgljList(data.keyword);
}else{
this.$message.error(returnMsg)
}
this.loading=false
Loading.service().close();
},
// top列表
async newsTop10() {
......
<template>
<div class="org container" v-loading="loading">
<div class="org container">
<breadcrumb />
<div class="row status-container">
<div class="showHtml" v-html="content"></div>
......@@ -9,9 +9,10 @@
</div>
</template>
<script>
import { mapState,mapMutations } from "vuex";
import breadcrumb from "../comps/breadcrumb.vue";
import pages from "../comps/pages2.vue";
import { Loading } from 'element-ui';
export default {
components: {
pages,
......@@ -24,7 +25,70 @@ export default {
content:'',
title:'',
showtime:'',
author:''
author:'',
breadcrumb: [{ name: "资讯中心", path: "/News/index" }],
matcheList:[
{
classid:4,
name: "图片资讯",
path: "/News/PicNews",
},
{
classid:5,
name: "综合报道",
path: "/News/Composite",
},
{
classid:6,
name: "中心活动",
path: "/News/Center",
},
{
classid:7,
name: "地方动态",
path: "/News/Local",
},
{
classid:8,
name: "国际追踪",
path: "/News/International",
},
{
classid:24,
name: "行业应用",
path: "/News/Application",
},
{
classid:14,
name: "零售",
path: "/News/Retail",
},
{
classid:15,
name: "物流",
path: "/News/Logistics",
},{
classid:16,
name: "食品安全追溯",
path: "/News/FoodSafety",
},
{
classid:31,
name: "标准科研动态",
path: "/News/Research",
},
{
classid:30,
name: "其他",
path: "/News/Other",
},
{
classid:35,
name: "深度专题",
path: "/News/DepthTopics",
},
]
};
},
computed: {
......@@ -32,6 +96,9 @@ export default {
},
},
beforeCreate() {
Loading.service({customClass: 'el-loading-custom-class'});
},
created() {
this.InfoFn();
},
......@@ -45,39 +112,63 @@ export default {
}
}
window.onbeforeunload = () => {
localStorage.removeItem('msg'+this.id)
localStorage.removeItem('isList'+this.id)
}
// 面包屑单独处理
},
methods:{
...mapMutations({
setMatche: "setMatche",
}),
// 详情
async InfoFn() {
this.loading=true
let listRes = {}
if(JSON.parse(localStorage.getItem('isList'+this.id)) && JSON.parse(localStorage.getItem('isList'+this.id)) == 1){
listRes = localStorage.getItem('msg'+this.id) ? JSON.parse(localStorage.getItem('msg'+this.id)) : null
} else {
const params = {
id:this.id,
id: this.id,
token:this.$route.query.token ||''
};
const listRes =
await this.$api.news.newsTopicInfo(params);
console.log(listRes)
const { returnCode, data,returnMsg } = listRes;
if (returnCode === "0") {
listRes = await this.$api.news.newsTopicInfo(params);
}
const { returnCode, data ,returnMsg} = listRes;
if (returnCode === "0" && data !=null) {
if (data.directpath && data.directpath !== "" && data.directpath.length > 0) {
window.open(data.directpath, "_self");
}
this.content=data.content;
this.title=data.title
this.showtime = data.showtime
this.author=data.author
this.$store.commit("system/SET_BREADCRUMB", [
{ name: "资讯中心", path: "/News/index" },
{ name: "深度资讯", path: "/News/DepthTopics" },
{ name: this.title },
]);
// let matche = this.matcheList.filter((item) => item.classid ===data.classid)[0];
// if(typeof(matche)==='undefined'){
let matche = [
{
name: "深度专题",
path: "/News/DepthTopics",
}
]
// }
this.setMatche(matche);
this.content = data.content;
this.title = data.title;
this.showtime = data.showtime;
this.author = data.author;
this.source = data.source;
this.editor = data.editor;
console.log(matche)
this.breadcrumb = this.breadcrumb.concat(matche);
this.breadcrumb.push({
name: this.title,
});
this.$store.commit("system/SET_BREADCRUMB", this.breadcrumb);
}else{
this.$message.error(returnMsg)
}
this.loading=false
Loading.service().close();
},
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment