Commit 9316fefa by 田爽

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

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