Commit 33485eb6 by 田爽

闪动问题

parent 9db9a3ee
...@@ -66,13 +66,13 @@ export default { ...@@ -66,13 +66,13 @@ export default {
// 详情 // 详情
getInfo(id,directpath){ getInfo(id,directpath){
const matche = [ // const matche = [
{ // {
name: "深度资讯", // name: "深度资讯",
path: "/News/DepthTopics", // path: "/News/DepthTopics",
} // }
]; // ];
this.setMatche(matche); // this.setMatche(matche);
this.clickDetailSave(id,directpath) this.clickDetailSave(id,directpath)
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
<script> <script>
import breadcrumb from "../comps/breadcrumb.vue"; import breadcrumb from "../comps/breadcrumb.vue";
import pages from "../comps/pages2.vue"; import pages from "../comps/pages2.vue";
import { mapState,mapMutations } from "vuex";
import { Loading } from 'element-ui';
export default { export default {
components: { components: {
pages, pages,
...@@ -34,43 +36,74 @@ export default { ...@@ -34,43 +36,74 @@ export default {
title: "", title: "",
showtime: "", showtime: "",
author: "", author: "",
breadcrumb: [{ name: "资讯中心", path: "/News/index" }],
}; };
}, },
computed: { computed: {
routes() {}, routes() {},
}, },
beforeCreate() {
Loading.service({customClass: 'el-loading-custom-class'});
},
created() { created() {
this.InfoFn(); this.InfoFn();
}, },
mounted() { mounted() {
console.log(2); console.log(2);
// 面包屑单独处理 // 面包屑单独处理
window.onbeforeunload = () => {
localStorage.removeItem('msg'+this.id)
localStorage.removeItem('isList'+this.id)
}
}, },
methods: { methods: {
...mapMutations({
setMatche: "setMatche",
}),
// 详情 // 详情
async InfoFn() { async InfoFn() {
this.loading=true 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 = { const params = {
id: this.id, id: this.id,
token:this.$route.query.token ||'' 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; const { returnCode, data ,returnMsg} = listRes;
if (returnCode === "0") { if (returnCode === "0" && data !=null) {
console.log(data, "公告详情"); 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.content = data.content;
this.title = data.title; this.title = data.title;
this.showtime = data.showtime; this.showtime = data.showtime;
this.author = data.author; this.author = data.author;
this.$store.commit("system/SET_BREADCRUMB", [ console.log(matche)
{ name: "资讯中心", path: "/News/index" }, this.breadcrumb = this.breadcrumb.concat(matche);
{ name: "公告通知", path: "/News/Notice" },
{ name: this.title }, this.breadcrumb.push({
]); name: this.title,
});
this.$store.commit("system/SET_BREADCRUMB", this.breadcrumb);
}else{ }else{
this.$message.error(returnMsg) this.$message.error(returnMsg)
} }
this.loading=false this.loading=false
Loading.service().close();
}, },
}, },
}; };
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<img :src="tmp.picFile" alt="" /> <img :src="tmp.picFile" alt="" />
</div> </div>
<div class="picNews-li-bt"> <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> </div>
</li> </li>
</ul> </ul>
...@@ -141,6 +141,31 @@ export default { ...@@ -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> </script>
......
...@@ -22,7 +22,28 @@ export default { ...@@ -22,7 +22,28 @@ export default {
id: id, id: id,
token:this.$route.query.token ||'' 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; const { returnCode, data ,returnMsg} = listRes;
if (returnCode === "0" && data !=null) { if (returnCode === "0" && data !=null) {
localStorage.setItem("msg"+id, JSON.stringify(listRes)); localStorage.setItem("msg"+id, JSON.stringify(listRes));
...@@ -33,8 +54,8 @@ export default { ...@@ -33,8 +54,8 @@ export default {
// window.open(link.href,'_blank') // window.open(link.href,'_blank')
if (data.directpath && data.directpath !== "" && data.directpath.length > 0) { if (data.directpath && data.directpath !== "" && data.directpath.length > 0) {
window.open(data.directpath, "_blank"); window.open(data.directpath, "_blank");
localStorage.removeItem('msg'+this.id) localStorage.removeItem('msg'+id)
localStorage.removeItem('isList'+this.id) localStorage.removeItem('isList'+id)
} else { } else {
window.open(href,'_blank') window.open(href,'_blank')
} }
......
...@@ -268,9 +268,9 @@ export default { ...@@ -268,9 +268,9 @@ export default {
} }
const { returnCode, data ,returnMsg} = listRes; const { returnCode, data ,returnMsg} = listRes;
if (returnCode === "0" && data !=null) { if (returnCode === "0" && data !=null) {
// if (data.directpath && data.directpath !== "" && data.directpath.length > 0) { if (data.directpath && data.directpath !== "" && data.directpath.length > 0) {
// window.open(data.directpath, "_self"); window.open(data.directpath, "_blank");
// } }
let matche = this.matcheList.filter((item) => item.classid ===data.classid)[0]; let matche = this.matcheList.filter((item) => item.classid ===data.classid)[0];
if(typeof(matche)==='undefined'){ if(typeof(matche)==='undefined'){
matche = [ matche = [
......
<template> <template>
<div class="msg container" v-loading="loading"> <div class="msg container">
<breadcrumb /> <breadcrumb />
<div class="row"> <div class="row">
<div class="col-lg-9"> <div class="col-lg-9">
...@@ -110,7 +110,8 @@ ...@@ -110,7 +110,8 @@
import breadcrumb from "../comps/breadcrumb.vue"; import breadcrumb from "../comps/breadcrumb.vue";
import list from "./comps/list.vue"; import list from "./comps/list.vue";
import list2 from "./comps/list2.vue"; import list2 from "./comps/list2.vue";
import { mapState,mapMutations } from "vuex";
import { Loading } from 'element-ui';
export default { export default {
components: { components: {
breadcrumb, breadcrumb,
...@@ -161,25 +162,52 @@ export default { ...@@ -161,25 +162,52 @@ export default {
sharesinastring: null, sharesinastring: null,
}; };
}, },
beforeCreate() {
Loading.service({customClass: 'el-loading-custom-class'});
},
created() { created() {
this.InfoFn(); this.InfoFn();
this.newsTop10(); this.newsTop10();
this.announceList(); this.announceList();
this.zttjList(); this.zttjList();
}, },
mounted() {
window.onbeforeunload = () => {
localStorage.removeItem('msg'+this.id)
localStorage.removeItem('isList'+this.id)
}
},
methods: { methods: {
...mapMutations({
setMatche: "setMatche",
}),
async InfoFn() { async InfoFn() {
this.loading=true 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 = { const params = {
id: this.id, id: this.id,
token:this.$route.query.token ||'' 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; const { returnCode, data ,returnMsg} = listRes;
if (returnCode === "0") { if (returnCode === "0" && data !=null) {
if (data.directpath && data.directpath !== "" && data.directpath.length > 0) { if (data.directpath && data.directpath !== "" && data.directpath.length > 0) {
window.open(data.directpath, "_self"); 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.content = data.brief;
this.title = data.title; this.title = data.title;
this.showtime = data.showtime; this.showtime = data.showtime;
...@@ -187,16 +215,19 @@ export default { ...@@ -187,16 +215,19 @@ export default {
this.videoStr = data.wavname; this.videoStr = data.wavname;
// this.source = data.source; // this.source = data.source;
this.editor = data.editor; this.editor = data.editor;
this.$store.commit("system/SET_BREADCRUMB", [ console.log(matche)
{ name: "资讯中心", path: "/News/index" }, this.breadcrumb = this.breadcrumb.concat(matche);
{ name: "精彩视频", path: "/News/Video" },
{ name: this.title }, this.breadcrumb.push({
]); name: this.title,
});
this.$store.commit("system/SET_BREADCRUMB", this.breadcrumb);
this.xgljList(data.keyword); this.xgljList(data.keyword);
}else{ }else{
this.$message.error(returnMsg) this.$message.error(returnMsg)
} }
this.loading=false this.loading=false
Loading.service().close();
}, },
// top列表 // top列表
async newsTop10() { async newsTop10() {
......
<template> <template>
<div class="org container" v-loading="loading"> <div class="org container">
<breadcrumb /> <breadcrumb />
<div class="row status-container"> <div class="row status-container">
<div class="showHtml" v-html="content"></div> <div class="showHtml" v-html="content"></div>
...@@ -9,9 +9,10 @@ ...@@ -9,9 +9,10 @@
</div> </div>
</template> </template>
<script> <script>
import { mapState,mapMutations } from "vuex";
import breadcrumb from "../comps/breadcrumb.vue"; import breadcrumb from "../comps/breadcrumb.vue";
import pages from "../comps/pages2.vue"; import pages from "../comps/pages2.vue";
import { Loading } from 'element-ui';
export default { export default {
components: { components: {
pages, pages,
...@@ -24,7 +25,70 @@ export default { ...@@ -24,7 +25,70 @@ export default {
content:'', content:'',
title:'', title:'',
showtime:'', 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: { computed: {
...@@ -32,6 +96,9 @@ export default { ...@@ -32,6 +96,9 @@ export default {
}, },
}, },
beforeCreate() {
Loading.service({customClass: 'el-loading-custom-class'});
},
created() { created() {
this.InfoFn(); this.InfoFn();
}, },
...@@ -45,39 +112,63 @@ export default { ...@@ -45,39 +112,63 @@ export default {
} }
} }
window.onbeforeunload = () => {
localStorage.removeItem('msg'+this.id)
localStorage.removeItem('isList'+this.id)
}
// 面包屑单独处理 // 面包屑单独处理
}, },
methods:{ methods:{
...mapMutations({
setMatche: "setMatche",
}),
// 详情 // 详情
async InfoFn() { async InfoFn() {
this.loading=true 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 = { const params = {
id:this.id, id: this.id,
token:this.$route.query.token ||'' token:this.$route.query.token ||''
}; };
const listRes = listRes = await this.$api.news.newsTopicInfo(params);
await this.$api.news.newsTopicInfo(params); }
console.log(listRes) const { returnCode, data ,returnMsg} = listRes;
const { returnCode, data,returnMsg } = listRes; if (returnCode === "0" && data !=null) {
if (returnCode === "0") {
if (data.directpath && data.directpath !== "" && data.directpath.length > 0) { if (data.directpath && data.directpath !== "" && data.directpath.length > 0) {
window.open(data.directpath, "_self"); window.open(data.directpath, "_self");
} }
this.content=data.content; // let matche = this.matcheList.filter((item) => item.classid ===data.classid)[0];
this.title=data.title // if(typeof(matche)==='undefined'){
this.showtime = data.showtime let matche = [
this.author=data.author {
this.$store.commit("system/SET_BREADCRUMB", [ name: "深度专题",
{ name: "资讯中心", path: "/News/index" }, path: "/News/DepthTopics",
{ name: "深度资讯", path: "/News/DepthTopics" }, }
{ name: this.title }, ]
]); // }
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{ }else{
this.$message.error(returnMsg) this.$message.error(returnMsg)
} }
this.loading=false 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