Commit 74e84621 by 田爽

闪动优化

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