Commit 9db9a3ee by 田爽

资讯中心闪动问题

parent bda7f078
......@@ -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>
<li style=" height: 0;margin:0" v-for="(i,a) in 4" :key="'a'+a"></li>
......@@ -115,6 +115,7 @@ export default {
}
];
this.setMatche(matche);
// if(directpath&&directpath!==''&& directpath.length>0){
// this.clickDetailSave(id,directpath)
// }else{
......@@ -137,7 +138,7 @@ export default {
// window.open(directpath,'_blank');
}
},
async InfoFn(id) {
async InfoFn(id, href) {
const params = {
id: id,
token:this.$route.query.token ||''
......@@ -145,15 +146,21 @@ export default {
const listRes = await this.$api.news.newsInfo(params);
const { returnCode, data ,returnMsg} = listRes;
if (returnCode === "0" && data !=null) {
localStorage.setItem("msg"+id, JSON.stringify(data));
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{
this.$message.error(returnMsg)
window.open(href,'_blank')
}
},
},
......
......@@ -3,7 +3,7 @@
<div v-for="(tmp, i) in list" :key="i" class="row" @click="giveId(tmp.id,tmp.directpath)">
<div class="col-lg-10 list-left">
<span></span>
<span><a :href="tmp.href" v-html="tmp.title" target="_blank"></a></span>
<span><a :href="tmp.href" @click.prevent="InfoFn(tmp.id, tmp.href)" v-html="tmp.title" target="_blank"></a></span>
</div>
<div class="col-lg-2 list-right">{{tmp.showtime}}</div>
</div>
......@@ -16,7 +16,32 @@ export default {
methods:{
giveId(id,directpath){
this.$emit('getInfo',id,directpath)
},
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>
......
......@@ -218,26 +218,27 @@ export default {
Loading.service({customClass: 'el-loading-custom-class'});
},
created() {
if(JSON.parse(localStorage.getItem('isList'+this.id)) && JSON.parse(localStorage.getItem('isList'+this.id)) == 1){
let matche=[
{
name: "中心活动",
path: "/News/Center",
}
]
this.setMatche(matche);
let data = localStorage.getItem('msg'+this.id) ? JSON.parse(localStorage.getItem('msg'+this.id)) : null
this.content = data.content;
this.title = data.title;
this.showtime = data.showtime;
this.author = data.author;
this.source = data.source;
this.editor = data.editor;
this.xgljList(data.keyword);
}else{
this.InfoFn();
}
// if(JSON.parse(localStorage.getItem('isList'+this.id)) && JSON.parse(localStorage.getItem('isList'+this.id)) == 1){
// let matche=[
// {
// name: "中心活动",
// path: "/News/Center",
// }
// ]
// this.setMatche(matche);
// let data = localStorage.getItem('msg'+this.id) ? JSON.parse(localStorage.getItem('msg'+this.id)) : null
// this.content = data.content;
// this.title = data.title;
// this.showtime = data.showtime;
// this.author = data.author;
// this.source = data.source;
// this.editor = data.editor;
// this.xgljList(data.keyword);
// }else{
// this.InfoFn();
// }
this.newsTop10();
this.announceList();
......@@ -255,16 +256,21 @@ export default {
}),
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.newsInfo(params);
listRes = await this.$api.news.newsInfo(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");
}
// 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'){
matche = [
......
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