Commit 9316fefa by 田爽

推荐专题问题,政策法规闪动问题

parent b766981d
...@@ -65,7 +65,7 @@ export default { ...@@ -65,7 +65,7 @@ export default {
} }
}, },
getInfo(id,directpath){ async getInfo(id,directpath){
const matche = [ const matche = [
{ {
name: "标准文献", name: "标准文献",
...@@ -76,6 +76,16 @@ export default { ...@@ -76,6 +76,16 @@ export default {
if(directpath!==''&& directpath.length>0){ if(directpath!==''&& directpath.length>0){
window.open(directpath,'_blank'); window.open(directpath,'_blank');
}else{ }else{
const params = {
id: id,
token:this.$route.query.token ||''
};
const policyInfoRes = await this.$api.knowledge.policyInfo(params);
const { returnCode, data ,returnMsg} = policyInfoRes;
if (returnCode === "0") {
localStorage.setItem("statute"+id, JSON.stringify(policyInfoRes));
localStorage.setItem("isstaList"+id, 1);
}
let link = this.$router.resolve({ let link = this.$router.resolve({
path: `/Knowledge/Statuteinfo?id=${id}`, path: `/Knowledge/Statuteinfo?id=${id}`,
}); });
......
...@@ -116,7 +116,7 @@ export default { ...@@ -116,7 +116,7 @@ export default {
}, },
getInfo(id,directpath,type){ async getInfo(id,directpath,type){
// const matche=[] // const matche=[]
// if(type===1){ // if(type===1){
// matche = [ // matche = [
...@@ -140,6 +140,16 @@ export default { ...@@ -140,6 +140,16 @@ export default {
if(directpath&&directpath!==''&& directpath.length>0){ if(directpath&&directpath!==''&& directpath.length>0){
window.open(directpath,'_blank'); window.open(directpath,'_blank');
}else{ }else{
const params = {
id: id,
token:this.$route.query.token ||''
};
const policyInfoRes = await this.$api.knowledge.policyInfo(params);
const { returnCode, data ,returnMsg} = policyInfoRes;
if (returnCode === "0") {
localStorage.setItem("statute"+id, JSON.stringify(policyInfoRes));
localStorage.setItem("isstaList"+id, 1);
}
let link = this.$router.resolve({ let link = this.$router.resolve({
path: `/Knowledge/Statuteinfo?id=${id}`, path: `/Knowledge/Statuteinfo?id=${id}`,
}); });
......
<template> <template>
<div class="org container" v-loading="loading"> <div class="org container">
<breadcrumb /> <breadcrumb />
<div class="row status-container" v-loading="loading"> <div class="row status-container">
<p class="title-style" v-html="title"></p> <p class="title-style" v-html="title"></p>
<div class="showHtml" v-html="content"></div> <div class="showHtml" v-html="content"></div>
<div class="showHtml" v-if="content==''||content==null||content==undefined">没有可显示的内容!</div> <div class="showHtml" v-if="content==''||content==null||content==undefined">没有可显示的内容!</div>
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
import { mapState } from "vuex"; import { mapState } 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,
...@@ -34,16 +35,28 @@ export default { ...@@ -34,16 +35,28 @@ export default {
created() { created() {
this.policyInfoFn(); this.policyInfoFn();
}, },
mounted() {}, mounted() {
window.onbeforeunload = () => {
localStorage.removeItem('statute'+this.id)
localStorage.removeItem('isstaList'+this.id)
}
},
methods: { methods: {
// 政策法规列表 // 政策法规列表
async policyInfoFn() { async policyInfoFn() {
this.loading = true; this.loading = true;
let policyInfoRes = {}
if(JSON.parse(localStorage.getItem('isstaList'+this.id)) && JSON.parse(localStorage.getItem('isstaList'+this.id)) == 1){
policyInfoRes = localStorage.getItem('statute'+this.id) ? JSON.parse(localStorage.getItem('statute'+this.id)) : null
} else {
Loading.service({customClass: 'el-loading-custom-class'});
const params = { const params = {
id: this.id, id: this.id,
token:this.$route.query.token ||'' token:this.$route.query.token ||''
}; };
const policyInfoRes = await this.$api.knowledge.policyInfo(params); policyInfoRes = await this.$api.knowledge.policyInfo(params);
Loading.service().close();
}
const { returnCode, data ,returnMsg} = policyInfoRes; const { returnCode, data ,returnMsg} = policyInfoRes;
if (returnCode === "0") { if (returnCode === "0") {
if (data.directpath && data.directpath !== "" && data.directpath.length > 0) { if (data.directpath && data.directpath !== "" && data.directpath.length > 0) {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div v-for="(tmp, i) in list" :key="i" class="list-li" @click="giveId(tmp.id,tmp.directpath)"> <div v-for="(tmp, i) in list" :key="i" class="list-li" @click="giveId(tmp.id,tmp.directpath)">
<div> <div>
<span></span> <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, tmp.directpath)" v-html="tmp.title" target="_blank"></a></span>
</div> </div>
</div> </div>
</div> </div>
...@@ -14,7 +14,33 @@ export default { ...@@ -14,7 +14,33 @@ export default {
methods:{ methods:{
giveId(id,directpath){ giveId(id,directpath){
this.$emit('getInfo',id,directpath) this.$emit('getInfo',id,directpath)
},
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 = {}
listRes = await this.$api.news.newsTopicInfo(params)
const { returnCode, data ,returnMsg} = listRes;
if (returnCode === "0" && data !=null) {
localStorage.setItem("msg"+id, JSON.stringify(listRes));
localStorage.setItem("isList"+id, 1);
if (data.directpath && data.directpath !== "" && data.directpath.length > 0) {
window.open(data.directpath, "_blank");
localStorage.removeItem('msg'+id)
localStorage.removeItem('isList'+id)
} else {
window.open(href,'_blank')
}
}else{
window.open(href,'_blank')
}
},
} }
} }
</script> </script>
......
...@@ -353,7 +353,8 @@ export default { ...@@ -353,7 +353,8 @@ export default {
// if(item.directpath&&item.directpath!==''&& item.directpath.length>0){ // if(item.directpath&&item.directpath!==''&& item.directpath.length>0){
// item.href=item.directpath // item.href=item.directpath
// }else{ // }else{
item.href=`/News/msg?id=${item.id}` item.href=`/News/viewsub?id=${item.classid}`
item.id = item.classid
// } // }
}); });
......
...@@ -167,7 +167,7 @@ export default { ...@@ -167,7 +167,7 @@ export default {
this.$message.error(returnMsg) this.$message.error(returnMsg)
} }
this.loading=false this.loading=false
Loading.service().close(); // 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