{{ targetInfo.new_name }}
++ {{ targetInfo.subtitle }} +
{{ targetInfo.reporter }}
@@ -177,11 +180,13 @@ export default { }; }, mounted() { - var index = sessionStorage.getItem("index"); this.dataIndex = index ? index : 0; - - this.getCurrentDateMaxDay(); + this.getCurrentDateMaxDay(); + console.log(this.$route.query.id) + if(typeof (this.$route.query.id)!='undefined'){ + this.getInfo(this.$route.query.id); + } //document.title =this.data.list[this.dataIndex].editionName; // var newInfo = sessionStorage.getItem("newInfo"); // if (newInfo) { @@ -193,7 +198,7 @@ export default { }, methods: { - openType(item){ + openType(item) { console.log(item); this.typeId = item.id; this.getCurrentDateMaxDay(); @@ -261,28 +266,50 @@ export default { } }, getTypeList() { - axios.post("http://csdzb.hschool.com.cn/api/dzb/type/index") + axios.post("https://jinrigushi.gushitv.com/api/dzb/type/index") .then(response => { console.log(response); this.typeList = response.data.data; var typeId = sessionStorage.getItem("typeId"); - if(typeId){ - this.typeId=typeId; - }else{ + if (typeId) { + this.typeId = typeId; + } else { this.typeId = response.data.data[0].id; } this.getCurrentDateMaxDay(); }) .catch(error => console.error('Error loading the JSON file:', error)) }, + getInfo(item) { + axios.post("https://jinrigushi.gushitv.com/api/h5/news/find", {id: item}) + .then(response => { + // 使用导入的数据 + //activeDate.value = response.data; + var info = response.data.data; + //info.content = info.content.replace(/href="\/dist\//g, 'href="/h5/'); + //console.log(item.time); + //const targetData = response.data.list.find(data => data.numberDate == item.time); + //activeDate.value = info; + //console.log(activeDate.value) + this.targetInfo = info; + sessionStorage.setItem("newInfo", JSON.stringify(info)); + this.showInfo = true; + }) + .catch(error => console.error('Error loading the JSON file:', error)) + }, openBm(d) { this.dataIndex = d; sessionStorage.setItem("index", d); sessionStorage.removeItem("newInfo"); this.showInfo = false; - console.log(); - document.title = '固始电子报-' + this.data[d].bm_name; - window.location.reload(); + //document.title = '固始电子报-' + this.data[d].bm_name; + let url = window.location.href; + url = url.replace(/&id=\d+/, ''); + url = url.replace(/\?id=\d+/, ''); + window.location.href = url; + setTimeout(()=>{ + window.location.reload(); + },100) //var img=this.data.list[d].imageSrc; //$('#BantuTop').attr("src",img) //BantuTop @@ -296,54 +323,89 @@ export default { }, getCurrentDateMaxDay() { var activeDate = $('input[name="activeDate"]').val(); + var querySatus=''; var storageTimeYear = sessionStorage.getItem("year"); var storageTimeMonth = sessionStorage.getItem("month"); var storageTimeDay = sessionStorage.getItem("day"); if (storageTimeYear && storageTimeMonth && storageTimeDay) { activeDate = storageTimeYear + "-" + storageTimeMonth; } + console.log(this.$route.query.date); + if (typeof (this.$route.query.date) != 'undefined') { + activeDate = this.$route.query.date; + activeDate = activeDate.substring(0, 7); // + } + if (typeof (this.$route.query.status) != 'undefined') { + querySatus=this.$route.query.status; + } console.log(activeDate); - axios.post("http://csdzb.hschool.com.cn/api/dzb/date/index", {date: activeDate}) + axios.post("https://jinrigushi.gushitv.com/api/dzb/date/index", {date: activeDate,status:querySatus}) .then(response => { console.log(response); - if(response.data.data.length==0){ - alert('该分类没有数据'); + if (response.data.data.length == 0) { + alert('本月没有数据'); sessionStorage.removeItem("typeId"); sessionStorage.removeItem("DateIndex"); sessionStorage.removeItem("newInfo"); sessionStorage.removeItem("DateList"); - window.location.reload(); + window.location.href = "https://jinrigushi.gushitv.com/"; return; } // 使用导入的数据 var resIndex = response.data.data.length - 1; console.log('********', resIndex); sessionStorage.setItem('DateList', JSON.stringify(response.data.data)); + sessionStorage.setItem('DateIndex', resIndex); $('input[name="activeDate"]').val(response.data.data[resIndex].datetime); this.datetime = this.getCurrentDateFormatted(response.data.data[resIndex].datetime); + document.title = '《今日固始》电子版-' + this.datetime; this.getBm(); }) .catch(error => console.error('Error loading the JSON file:', error)) }, getBm() { - var list = JSON.parse(sessionStorage.getItem('DateList')); + + var seList=sessionStorage.getItem('DateList') + console.log('********',seList); + var list = JSON.parse(seList); + console.log('********',this.$route.query.date); var storageTimeYear = sessionStorage.getItem("year"); var storageTimeMonth = sessionStorage.getItem("month"); var storageTimeDay = sessionStorage.getItem("day"); - if (storageTimeYear && storageTimeMonth && storageTimeDay) { - var activeDate = storageTimeYear + "-" + storageTimeMonth + '-' + storageTimeDay; - const targetData = list.find(item => item.datetime == activeDate); + if (typeof (this.$route.query.date) != 'undefined') { + const targetData = list.find(item => item.datetime == this.$route.query.date); + console.log(targetData) + if(typeof (targetData)=='undefined'){ + alert('当日没有报纸!'); + sessionStorage.removeItem("typeId"); + sessionStorage.removeItem("DateIndex"); + sessionStorage.removeItem("newInfo"); + sessionStorage.removeItem("DateList"); + sessionStorage.removeItem("year"); + sessionStorage.removeItem("month"); + sessionStorage.removeItem("day"); + window.location.href = "https://jinrigushi.gushitv.com/"; + return; + } var id = targetData.id; - } else { - var index = sessionStorage.getItem('DateIndex'); - var id = list[index].id; + }else{ + if (storageTimeYear && storageTimeMonth && storageTimeDay) { + var activeDate = storageTimeYear + "-" + storageTimeMonth + '-' + storageTimeDay; + console.log(activeDate) + const targetData = list.find(item => item.datetime == activeDate); + console.log(targetData) + var id = targetData.id; + } else { + var index = sessionStorage.getItem('DateIndex'); + var id = list[index].id; + } } - axios.post("http://csdzb.hschool.com.cn/api/dzb/bm/index", {date_id: id}) + axios.post("https://jinrigushi.gushitv.com/api/dzb/bm/index", {date_id: id}) .then(response => { console.log(response); this.data = response.data.data; - document.title = '固始电子报-' + this.data[this.dataIndex].bm_name; + this.loadScripts([ '/dist/public/static/js/jquery.min.js', '/dist/public/static/js/jquery-ui.js', @@ -373,13 +435,36 @@ export default { }, Promise.resolve()); }, openNews(area) { - var info = this.data[this.dataIndex].news; - var targetInfo = info.find(item => item.id === area.id); - this.targetInfo = targetInfo; - sessionStorage.setItem("newInfo", JSON.stringify(targetInfo)); - this.showInfo = true; + //var info = this.data[this.dataIndex].news; + //var targetInfo = info.find(item => item.id === area.id); + //this.targetInfo = targetInfo; + //sessionStorage.setItem("newInfo", JSON.stringify(targetInfo)); + //this.getInfo(area.id); + //this.showInfo = true; // 实现日期搜索逻辑 + //this.showInfo = true; + let url = window.location.href; + //console.log(url) + if (url.indexOf("?") === -1) { + url += "?id=" + area.id; + } else { + // 检查是否已经包含了相同的参数 + if (url.indexOf("id=") === -1) { + //修改ID后面的参数 + url += "&id=" + area.id; + } else { + + // 如果已经包含了相同的参数,我们不做任何操作 + url = url.replace(/id=\d+/, 'id=' + area.id); + } + } + window.location.href = url; + console.log(url) + setTimeout(()=>{ + window.location.reload(); + },100) }, + goHome() { sessionStorage.removeItem("year"); sessionStorage.removeItem("month"); @@ -387,7 +472,13 @@ export default { sessionStorage.removeItem("index"); sessionStorage.removeItem("newInfo"); this.showInfo = false; - window.location.reload(); + let url = window.location.href; + url = url.replace(/&id=\d+/, ''); + url = url.replace(/\?id=\d+/, ''); + window.location.href = url; + setTimeout(()=>{ + window.location.reload(); + },100) }, } }; diff --git a/src/view/home/knowledge.vue b/src/view/home/knowledge.vue index d01929c..2d3fba8 100644 --- a/src/view/home/knowledge.vue +++ b/src/view/home/knowledge.vue @@ -132,7 +132,7 @@ onMounted(() => { }); const getInfo = () => { - axios.post("http://csdzb.hschool.com.cn/api/dzb/zsk/find", {id: infoId.value}) + axios.post("https://jinrigushi.gushitv.com/api/dzb/zsk/find", {id: infoId.value}) .then(response => { console.log(response) aiInfo.value=response.data.data;