Commit 74e84621 by 田爽

闪动优化

parent 8dc17740
......@@ -24,18 +24,32 @@
export default {
props: ["list"],
methods: {
handelMsg(obj) {
if(obj.directpath && obj.directpath!=''){
window.open(obj.directpath, "_blank");
}else{
async handelMsg(obj) {
const params = {
id: obj.id,
token:this.$route.query.token ||''
};
let routeData = this.$router.resolve({
path: "/News/Msg",
query: {
id: obj.id,
},
});
let listRes = await this.$api.news.newsInfo(params)
const { returnCode, data ,returnMsg} = listRes;
if (returnCode === "0" && data !=null) {
localStorage.setItem("msg"+obj.id, JSON.stringify(listRes));
localStorage.setItem("isList"+obj.id, 1);
if (data.directpath && data.directpath !== "" && data.directpath.length > 0) {
window.open(data.directpath, "_blank");
localStorage.removeItem('msg'+obj.id)
localStorage.removeItem('isList'+obj.id)
} else {
window.open(routeData.href, "_blank");
}
}else{
window.open(routeData.href,'_blank')
}
},
handelMore() {
......
......@@ -1534,14 +1534,39 @@ export default {
}
},
// 党建文化列表点击
djwhReceive(msg) {
async djwhReceive(msg) {
// let routeData = this.$router.resolve({
// path: "/News/Msg",
// query: {
// id: msg.id,
// },
// });
// window.open(routeData.href, "_blank");
const params = {
id: msg.id,
token:this.$route.query.token ||''
};
let routeData = this.$router.resolve({
path: "/News/Msg",
query: {
id: msg.id,
},
});
let listRes = await this.$api.news.newsInfo(params)
const { returnCode, data ,returnMsg} = listRes;
if (returnCode === "0" && data !=null) {
localStorage.setItem("msg"+msg.id, JSON.stringify(listRes));
localStorage.setItem("isList"+msg.id, 1);
if (data.directpath && data.directpath !== "" && data.directpath.length > 0) {
window.open(data.directpath, "_blank");
localStorage.removeItem('msg'+msg.id)
localStorage.removeItem('isList'+msg.id)
} else {
window.open(routeData.href, "_blank");
}
}else{
window.open(routeData.href,'_blank')
}
},
// 专题聚焦列表点击
ztjjReceive(msg) {
......
......@@ -40,7 +40,7 @@
<ul >
<li v-for="(tmp, i) in tableResult.list" :key="i" @click="getInfo(tmp.id,tmp.directpath)"><span>
<a :href="tmp.href" v-html="tmp.title" target="_blank"></a></span></li>
<a :href="tmp.href" @click.prevent="InfoFn(tmp.id, tmp.href)" v-html="tmp.title" target="_blank"></a></span></li>
</ul>
</div>
......@@ -252,7 +252,32 @@ export default {
this.$router.push({
path: path,
});
},
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')
}
},
},
};
......
......@@ -23,7 +23,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>
......
......@@ -49,7 +49,7 @@
</p>
<ul>
<li v-for="(value, index) in item.list" :key="index" @click="lookDetail(value.id, item.title)">
<a :href="value.href" v-html="value.title" target="_blank"></a>
<a :href="value.href" @click="goInfo(value.id, value.href, item.title)" v-html="value.title" target="_blank"></a>
</li>
</ul>
</div>
......@@ -316,6 +316,21 @@ export default {
}
});
},
async goInfo(id, href, title) {
const params = {
id: id
};
let listRes = {}
if(title === '商品条码在零售领域应用指南') {
listRes = await this.$api.sell.geGuideDetailById(params);
} else {
console.log(222);
listRes = await this.$api.sell.geDetailById(params);
}
localStorage.setItem("msgRetail"+id, JSON.stringify(listRes));
localStorage.setItem("isRetailList"+id, 1);
window.open(href,'_blank')
},
goRetailCode(){
this.$router.push({
path: '/News/Retailcode',
......
......@@ -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" @click.prevent="InfoFn(tmp.id, tmp.href)" v-html="tmp.title" target="_blank"></a></span>
<span><a :href="tmp.href" @click.prevent="InfoFn(tmp.id, tmp.href, tmp.directpath)" v-html="tmp.title" target="_blank"></a></span>
</div>
<div class="col-lg-2 list-right">{{tmp.showtime}}</div>
</div>
......@@ -17,20 +17,16 @@ export default {
giveId(id,directpath){
this.$emit('getInfo',id,directpath)
},
async InfoFn(id, href) {
async InfoFn(id, href, directpath) {
if (id === undefined && href) {
window.open(directpath, "_blank");
return
}
const params = {
id: id,
token:this.$route.query.token ||''
};
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)
......
......@@ -457,7 +457,7 @@ export default {
}
},
// 详情
goInfo(id,directpath,name){
async goInfo(id,directpath,name){
if(directpath&&directpath!==''&& directpath.length>0){
window.open(directpath,'_blank');
}else{
......@@ -470,6 +470,12 @@ export default {
}
this.setMatche(matche);
const params = {
id: id,
token:this.$route.query.token ||''
};
let listRes = {}
if(name=='医疗'){
let link = this.$router.resolve({
path: `/News/HealthDetail?id=${id}`,
......@@ -479,11 +485,17 @@ export default {
let link = this.$router.resolve({
path: `/Sell/detail?id=${id}&preTitle=最新动态`,
});
listRes = await this.$api.sell.geDetailById(params)
localStorage.setItem("msgRetail"+id, JSON.stringify(listRes));
localStorage.setItem("isRetailList"+id, 1);
window.open(link.href,'_blank')
}else{
let link = this.$router.resolve({
path: `/News/msg?id=${id}`,
});
listRes = await this.$api.news.newsInfo(params)
localStorage.setItem("msg"+id, JSON.stringify(listRes));
localStorage.setItem("isList"+id, 1);
window.open(link.href,'_blank')
}
......@@ -504,7 +516,7 @@ export default {
}
},
getVideoInfo(id,directpath){
async getVideoInfo(id,directpath){
if(directpath&&directpath!==''&& directpath.length>0){
window.open(directpath,'_blank');
}else{
......@@ -515,6 +527,15 @@ export default {
}
];
this.setMatche(matche);
const params = {
id: id,
token:this.$route.query.token ||''
};
let listRes = {}
listRes = await this.$api.news.jcspiInfo(params)
const { returnCode, data ,returnMsg} = listRes;
localStorage.setItem("msg"+id, JSON.stringify(listRes));
localStorage.setItem("isList"+id, 1);
let link = this.$router.resolve({
path: `/News/msgVideo?id=${id}`,
});
......
......@@ -37,6 +37,10 @@ export default {
this.curPath = '/Sell/pictureList';
}
this.geDetailById();
window.onbeforeunload = () => {
localStorage.removeItem('msg'+this.id)
localStorage.removeItem('isList'+this.id)
}
},
methods: {
// 列表
......@@ -45,6 +49,9 @@ export default {
id: this.id,
};
let listRes = null;
if(JSON.parse(localStorage.getItem('msgRetail'+this.id)) && JSON.parse(localStorage.getItem('isRetailList'+this.id)) == 1){
listRes = localStorage.getItem('msgRetail'+this.id) ? JSON.parse(localStorage.getItem('msgRetail'+this.id)) : null
} else {
if(this.preTitle === '商品条码在零售领域应用指南') {
console.log(111)
listRes = await this.$api.sell.geGuideDetailById(params);
......@@ -61,6 +68,7 @@ export default {
console.log(222);
listRes = await this.$api.sell.geDetailById(params);
}
}
const { returnCode, data } = listRes;
if (returnCode === "0") {
......
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