This commit is contained in:
Air 2025-01-23 09:35:55 +08:00
parent 131f50c052
commit a0b8620836
11 changed files with 816 additions and 133 deletions

View File

@ -62,6 +62,17 @@
<script type="module" src="/src/main.js"></script> <script type="module" src="/src/main.js"></script>
<script> <script>
window.addEventListener('popstate', handlePopState);
function handlePopState() {
var isLogin = sessionStorage.getItem("isShow");
//alert(isLogin);
if(isLogin && isLogin==1){
sessionStorage.setItem("isShow",0);
setTimeout(()=>{
window.location.reload();
},50)
}
}
initPhonePage(); initPhonePage();
function initPhonePage() { function initPhonePage() {
var userAgentInfo = navigator.userAgent; var userAgentInfo = navigator.userAgent;
@ -70,7 +81,8 @@
var local_url = window.location.href; var local_url = window.location.href;
for (var v = 0; v < Agents.length; v++) { for (var v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) { if (userAgentInfo.indexOf(Agents[v]) > 0) {
var sURL2 = local_url.replace("/h5/", "/dist/"); var sURL2 = local_url.replace("/h5/#/", "/#/");
sURL2 = sURL2.replace("info", "");
console.log(sURL2); console.log(sURL2);
sessionStorage.removeItem('DateIndexH5'); sessionStorage.removeItem('DateIndexH5');
sessionStorage.removeItem('DateIndex'); sessionStorage.removeItem('DateIndex');
@ -81,6 +93,7 @@
sessionStorage.removeItem('day'); sessionStorage.removeItem('day');
sessionStorage.removeItem('index'); sessionStorage.removeItem('index');
sessionStorage.removeItem('newInfo'); sessionStorage.removeItem('newInfo');
sessionStorage.removeItem('H5Index');
window.location.href = sURL2; window.location.href = sURL2;
} }
} }

View File

@ -0,0 +1,339 @@
body,p,ul,ol,dl,dd,h1,h2,h3,h4,h5,h6,td,input,select,textarea,figure{
margin:0;
padding:0;
}
body{
font-family:"微软雅黑",Arial;
background:#fff;
position: relative;
-webkit-text-size-adjust: 100% !important;
}
html,body{
width:100%;
}
a{
text-decoration:none;
}
img{
border:none;
display:block;
}
html{
font-size:16px !important;
}
.header{
height:45px;
background-color: #ededed;
display: flex;
align-items: center;
justify-content: space-between;
padding:0 16px;
font-size: 17px !important;
}
.header img:first-child{
display: block;
width:14px;
height:14px;
}
.header img:last-child{
display: block;
width:20px;
}
#min{
min-height:100vh;
}
.content {
height: 100%;
padding: 0 15px 35px;
overflow-y: auto;
background-color: #ffffff;
margin-bottom: 2%;
}
.content h2{
font-size: 20px;
color:#333333;
line-height: 35px;
}
.content span{
font-size:15px;
color:#999999;
/*display: block;*/
line-height: 20px;
padding-top:12px;
}
#pageInfo{
margin-bottom:10px;
text-align: center;
}
.content em{
font-style: normal;
font-size:12px;
color:#999999;
line-height: 26px;
display: inline-block;
}
.content em{
margin-right:13px;
}
.content img{
display: block;
max-width: 100%;
width: auto;
height: auto;
margin: 0 auto 15px auto;
}
.content p{
font-size: 16px;
color: #333333;
letter-spacing: 0px;
line-height:30px;
margin-bottom:10px;
/*text-indent: 2em;*/
}
.content .post{
font-size: 16px;
color: #333333;
letter-spacing: 0;
line-height:30px;
}
.MenuBox{
position: fixed;
bottom:0;
right:20px;
z-index:99;/*图片轮播新增样式*/
}
.MenuBox img{
display: block;
width:40px;
height:40px;
margin-bottom:16px;
cursor: pointer;
border-radius: 50%;
}
.MenuBox a{
display: block;
width:40px;
height:40px;
margin-bottom:16px;
cursor: pointer;
border-radius: 50%;
background-size: cover;
}
.remark{
font-size: 26px;
color: red;
font-weight: bold;
display: none;
}
#fullPage{
display: none;
background: black;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 19930428;
}
#fullPage img{
display: block;
width: 100%;
}
#canvas{
width: 100%;
height: 100%;
background: none;
display: block;
}
/* 遮罩层 */
.Mask_box{
position: relative;
display: none;
}
.Mask{
position: fixed;
top: 0;
background: rgba(0,0,0,.5);
height: 100%;
width: 100%;
}
.shareBox{
position: fixed;
bottom: 0;
z-index: 111;
display: flex;
align-items: center;
justify-content: space-around;
width: 100%;
height:100px;
background: white;
}
.shareBox img{
display: block;
width:35px;
height:35px;
}
.shareBox a{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.shareBox span{
display: block;
color: #333;
font-size: 12px;
text-align: center;
text-decoration: none;
line-height:30px;
}
#min .optTips{
width: 160px;
height: 22px;
position: fixed;
bottom: 25px;
left: 50%;
margin-left: -80px;
background: url('../image20/detailsIptTips.png')no-repeat center / 100% 100%;
opacity: 0.8;
display:none;
}
.codeWraper{
width:100%;
height:auto;
margin-top:20px;
margin-bottom: 42px;
}
.codeWraper .codeTxt{
width: 90%;
text-align: center;
font-size: 12px;
color: #fff;
background-color: #03499e;
line-height: 30px;
border-radius: 5px;
margin:0 auto;
display: block;
}
.codeWraper .codeImg{
max-width: 70%;
height: auto;
margin-top: 20px;
}
/* 为文章内容前添加版面图显示 */
.contentLayoutImg {
width: 100%;
padding: 5px;
background: rgba(0,0,0,0.1);
box-sizing: border-box;
margin-bottom: 10px; /*图片轮播新增样式*/
}
.contentLayoutImg .layoutImgbox{
width:100%;
height:100%;
position:relative;
}
.contentLayoutImg .layoutImgbox canvas{
position:absolute;
/* width:100%;
height:100%; */
top:0;
left:0;
}
.contentLayoutImg img{
width:auto;
max-width:100%;
height:auto;
margin:0 auto;
}
.contentLayoutImg p{
text-align: center;
font-size: 12px;
margin-bottom: 0;
margin-top: 10px;
}
.contentLayoutImg+#imgBox>img:first-child{margin-top:10px;}
#synthWrap .synthHeadContent{
display: flex;
justify-content: space-between;
color: #8F8F8F;
height: 20px;
margin-bottom: 10px;
font-size: 12px;
line-height: 20px;
font-weight: 500;
}
/*图片轮播新增样式*/
/*内容详情图片轮播 swiper*/
.swiper {
height: 2rem;
}
.swiper-slide {
text-align: center;
font-size: 18px;
/* Center slide text vertically */
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
}
.swiper-slide img {
display: block;
width:auto;
max-height:220px;
object-fit: inherit !important;
position: relative;
}
.content .bannerDes {
position: absolute;
left: 0;
bottom: 0;
padding: 10px 10px 20px 10px;
box-sizing: border-box;
width: 100%;
background: linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.3));
text-indent: 0rem;
color: #fff;
font-size: 14px;
line-height: 20px;
text-align: justify;
}
.swiper-pagination {
color: #fff;
text-align:right;
}
.content .swiper-pagination span {
position: absolute;
text-align: center;
transition: .3s opacity;
transform: translate3d(0,0,0);
z-index: 10;
color: #fff;
font-size: 14px;
display: contents;
}
/*图片轮播新增样式*/
#articleAuthor{display:none;}
/*造字样式*/
.zaozi{border-style: none!important;display:inline!important;margin:0px!important;}

View File

@ -0,0 +1,211 @@
function ImgInfo(params){
this.pageW=params.pageW;
this.pageH=params.pageH;
this.pageScale=this.pageH/this.pageW;
}
ImgInfo.prototype={
constructor:ImgInfo,
reset:function(el){ //重置选中的图片,获取该图片以及它的宽高
this.img=el;
var boundClient=this.img.getBoundingClientRect();
this.scale=boundClient.height/boundClient.width;
this.ifFullByHeight=this.scale>this.pageScale; //true:高度铺满屏幕 false:宽度铺满屏幕
this.ifFullByHeight ? this.setHeight(this.pageH) : this.setWidth(this.pageW);
this.startAnitScale=0.2;
},
setWidth:function(w){ //缩放时候设置宽度
this.w=w;
this.h=this.w*this.scale;
this.x=(this.pageW-this.w)/2;
this.y=(this.pageH-this.h)/2;
},
setHeight:function(w){ //缩放时候设置宽度
this.h=this.pageH;
this.w=this.h/this.scale;
this.y=0;
this.x=(this.pageW-this.w)/2;
},
endScale:function(){
if(this.w>this.pageW||this.h>this.pageH){
return;
}
this.ifFullByHeight ? this.setHeight(this.pageH) : this.setWidth(this.pageW);
},
moveX:function(distX){
//X轴方向的移动
if(this.x>0 || (this.x+this.w)<this.pageW){ //超出屏幕时候弹性回收
this.x+=distX/5;
}
else{
this.x+=distX;
}
},
moveY:function(distY){
//Y轴方向的移动
if(this.h<=this.pageH){
return;
}
if((this.h>this.pageH && this.y>0) || (this.h>this.pageH && (this.y+this.h)<this.pageH)){
this.y+=distY/5;
}
else{
this.y+=distY;
}
},
move:function(distX,distY){
this.moveX(distX);
this.moveY(distY);
},
endMove:function(){
//手指松开的时候X轴回弹
if(this.x>0){
this.x=this.ifFullByHeight&&this.w<this.pageW ? (this.pageW-this.w)/2 : 0;
}
else if((this.x+this.w)<this.pageW){
this.x=this.ifFullByHeight&&this.w<this.pageW ? (this.pageW-this.w)/2 : (this.pageW-this.w);
}
//手指松开的时候Y轴回弹
if(this.h>this.pageH && this.y>0){
this.y=0;
}
else if(this.h>this.pageH && (this.y+this.h)<this.pageH){
this.y=this.pageH-this.h;
}
},
startAnit:function(ctx){ //点击图片放大的动画
var _this=this;
this.startAnitScale+=0.05;
this.startAnitDraw(ctx);
if(this.startAnitScale>=1){
this.startAnitScale=1;
this.startAnitDraw(ctx);
this.startAnitScale=0.2;
return;
}
requestAnimationFrame(function(){
_this.startAnit(ctx);
})
},
startAnitDraw:function(ctx){
ctx.clearRect(0,0,this.pageW,this.pageH);
ctx.save();
var w=this.w*this.startAnitScale;
var h=this.h*this.startAnitScale;
ctx.translate((this.pageW-w)/2,(this.pageH-h)/2);
ctx.beginPath();
ctx.drawImage(this.img,0,0,w,h);
ctx.closePath();
ctx.restore();
},
draw:function(ctx){
ctx.clearRect(0,0,this.pageW,this.pageH);
ctx.save();
ctx.beginPath();
ctx.drawImage(this.img,this.x,this.y,this.w,this.h);
ctx.closePath();
ctx.restore();
}
}
function WxScale(params){
this.moveData={ //单指移动数据
ifStart:false, //是否开始移动
startX:1, //手指开始接触的x坐标
startY:1, //手指开始接触的y坐标
};
this.scaleData={ //双指缩放数据
ifStart:false, //是否开始移动
startDist:1, //手机开始接触时双指的距离,用来计算缩放比例
};
this.init(params);
this.bindEvent();
}
WxScale.prototype={
constructor:WxScale,
init:function(params){
this.fullPage=params.fullPage;
this.canvas=params.canvas;
this.fullPage.style.display="block"; //如果不先显示出fullpage那么会获取不到fullpage的宽高
var clientRect=this.canvas.getBoundingClientRect();
this.w=this.canvas.width=clientRect.width;
this.h=this.canvas.height=clientRect.height;
this.ctx=canvas.getContext("2d");
this.img=new ImgInfo({
pageW:this.w,
pageH:this.h
});
this.fullPage.style.display="none";
},
start:function(el){
this.fullPage.style.display="block";
this.img.reset(el);
this.img.startAnit(this.ctx);
},
bindEvent:function(){
var _this=this;
this.fullPage.addEventListener("touchstart",function(e){
_this.touchstart(e);
},false)
this.fullPage.addEventListener("touchmove",function(e){
_this.touchmove(e);
},false)
this.fullPage.addEventListener("touchend",function(e){
_this.touchend(e);
},false)
this.fullPage.addEventListener("click",function(){
this.style.display="none";
},false)
},
touchstart:function(e){
if(e.touches.length==1){ //单指移动
this.moveData.ifStart=true;
this.moveData.startX=e.touches[0].pageX;
this.moveData.startY=e.touches[0].pageY;
}
else if(e.touches.length>=2){ //双指缩放
this.scaleData.ifStart=true;
this.scaleData.startDist=this.getDistance(e.touches[0],e.touches[1]);
this.imgBaseWidth=this.img.w;
}
},
touchmove:function(e){
e.preventDefault();
if(this.moveData.ifStart&&e.touches.length==1){ //单指移动
var distX=e.touches[0].pageX-this.moveData.startX;
var distY=e.touches[0].pageY-this.moveData.startY;
this.moveData.startX=e.touches[0].pageX;
this.moveData.startY=e.touches[0].pageY;
this.img.move(distX,distY);
}
else if(this.scaleData.ifStart&&e.touches.length>=2){ //双指缩放
var moveDist=this.getDistance(e.touches[0],e.touches[1]);
var scale=(moveDist/this.scaleData.startDist).toFixed(2); //得到缩放比例
this.img.setWidth(this.imgBaseWidth*scale);
}
this.img.draw(this.ctx);
},
touchend:function(e){
if(this.scaleData.ifStart){ //双指缩放
this.scaleData.ifStart=false;
this.moveData.ifStart=false;
this.img.endScale();
this.img.draw(this.ctx);
}
else if(this.moveData.ifStart){ //单指移动
this.moveData.ifStart=false;
this.img.endMove();
this.img.draw(this.ctx);
}
},
getDistance:function(p1, p2){
var x=p2.pageX-p1.pageX,
y=p2.pageY-p1.pageY;
return Math.sqrt(x*x+y*y);
}
}

View File

@ -0,0 +1,11 @@
// 图片预览
var wxScale = new WxScale({
fullPage: document.querySelector("#fullPage"),
canvas: document.querySelector("#canvas")
});
var imgBox = document.querySelectorAll("#imgBox img");
for (var i = 0; i < imgBox.length; i++) {
imgBox[i].onclick = function (e) {
wxScale.start(this); //这里的this指向需要放大的这张图片
}
}

View File

@ -116,8 +116,8 @@ $(function () {
month = month < 10 ? ("0" + month) : month; month = month < 10 ? ("0" + month) : month;
var day = date.getDate(); var day = date.getDate();
day = day < 10 ? ("0" + day) : day; day = day < 10 ? ("0" + day) : day;
var url = "http://csdzb.hschool.com.cn/h5/#/?date="+`${year}-${month}-${day}`; var url = "https://jinrigushi.gushitv.com/h5/#/?date="+`${year}-${month}-${day}`;
sessionStorage.setItem('isShow',1);
//var curDate = year+""+appendZero(month)+""+appendZero(day); //var curDate = year+""+appendZero(month)+""+appendZero(day);
//if (curDate<=20191231){ //if (curDate<=20191231){
// location.href = "https://epaper.guanhai.com.cn/qdrb/"+curDate; // location.href = "https://epaper.guanhai.com.cn/qdrb/"+curDate;
@ -460,7 +460,7 @@ function getPaper(date) {
var data = { 'day': [], 'url': [] }; var data = { 'day': [], 'url': [] };
$.ajax({ $.ajax({
data:{'date':date}, data:{'date':date},
url: "http://csdzb.hschool.com.cn/api/dzb/date/index", url: "https://jinrigushi.gushitv.com/api/dzb/date/index",
type: 'POST', type: 'POST',
dataType: 'json', dataType: 'json',
async: false, async: false,

View File

@ -55,17 +55,22 @@ $(function () {
month = month < 10 ? ("0" + month) : month; month = month < 10 ? ("0" + month) : month;
var day = date.getDate(); var day = date.getDate();
day = day < 10 ? ("0" + day) : day; day = day < 10 ? ("0" + day) : day;
var url = "#"; //var url = "#";
var url = "https://jinrigushi.gushitv.com/h5/#/list/?time="+`${year}-${month}-${day}`;
//var curDate = year+""+appendZero(month)+""+appendZero(day); //var curDate = year+""+appendZero(month)+""+appendZero(day);
//if (curDate<=20191231){ //if (curDate<=20191231){
// location.href = "https://epaper.guanhai.com.cn/qdrb/"+curDate; // location.href = "https://epaper.guanhai.com.cn/qdrb/"+curDate;
//} //}
var isUseful = checkUrl(url); //var isUseful = checkUrl(url);
if (isUseful) {
//if (isUseful) {
location.href = url; location.href = url;
}
hideAll(); hideAll();
setTimeout(()=>{
window.location.reload();
},100)
//}
//$('.mask').removeClass('active'); //$('.mask').removeClass('active');
}); });
//导航栏日期显示 //导航栏日期显示
@ -166,8 +171,9 @@ $(function () {
month = date[1] + "-12"; month = date[1] + "-12";
break; break;
} }
console.log('111111111111',month) const cleanedString = month.replace(/[^0-9-]/g, '');
displayDate(month); console.log('111111111111',cleanedString)
displayDate(cleanedString);
i = -1; i = -1;
} }
i++; i++;
@ -240,12 +246,13 @@ function getDate(str) {
//获取当前月份报纸xml数据 //获取当前月份报纸xml数据
function getPaper(date) { function getPaper(date) {
var myXmlUrl = `/public/static/data/${date}.json`; //var myXmlUrl = `/public/static/data/${date}.json`;
var data = { 'day': [], 'url': [] }; var data = { 'day': [], 'url': [] };
$.ajax({ $.ajax({
url: myXmlUrl, data:{'date':date},
type: 'GET', url: "https://jinrigushi.gushitv.com/api/dzb/date/index",
dataType: 'xml', type: 'POST',
dataType: 'json',
async: false, async: false,
timeout: 1000, timeout: 1000,
error: function (xml) { error: function (xml) {
@ -254,14 +261,19 @@ function getPaper(date) {
var date = new Array(); var date = new Array();
var day = new Array(); var day = new Array();
var url = new Array(); var url = new Array();
$(xml).find("date").each(function () { // $(xml).find("date").each(function () {
date.push($(this).text()); // date.push($(this).text());
day.push(parseInt($(this).text().split("-")[2])) // day.push(parseInt($(this).text().split("-")[2]))
// });
// $(xml).find("url").each(function () {
// url.push($(this).text());
// });
// data = { "day": day, "url": url }
xml.data.forEach(function (item) {
date.push(item.datetime);
day.push(parseInt(item.datetime.split("-")[2]));
}); });
$(xml).find("url").each(function () { data = {"day": day, "url": url, "date": date};
url.push($(this).text());
});
data = { "day": day, "url": url }
} }
}); });
console.log('获取当前月份报纸xml数据:',date) console.log('获取当前月份报纸xml数据:',date)
@ -270,10 +282,13 @@ function getPaper(date) {
//需要黑色显示的日期数组 //需要黑色显示的日期数组
function displayDate(date) { function displayDate(date) {
date = date.replace(/[^0-9-]/g, '');
console.log('需要黑色显示的日期数组:',date) console.log('需要黑色显示的日期数组:',date)
var data = getPaper(date); var data = getPaper(date);
console.log('*******',data)
var day = 1, count = 0, count2 = 0; var day = 1, count = 0, count2 = 0;
$(".datetimepicker-days .day").each(function (i) { $(".datetimepicker-days .day").each(function (i) {
//console.log('////',$(this).text())
if (parseInt($(this).text()) > day) { if (parseInt($(this).text()) > day) {
$(this).html(""); $(this).html("");
count++ count++

View File

@ -9,25 +9,25 @@ const router = createRouter({
routes: [{ routes: [{
path: "/", path: "/",
meta: { meta: {
title: '今日固始' //title配置 title: '今日固始》电子版' //title配置
}, },
component: () => import("../view/home/index.vue") component: () => import("../view/home/index.vue")
},{ },{
path: "/info", path: "/info",
meta: { meta: {
title: '今日固始' //title配置 title: '今日固始》电子版-详情' //title配置
}, },
component: () => import("../view/home/info.vue") component: () => import("../view/home/info.vue")
},{ },{
path: "/list", path: "/list",
meta: { meta: {
title: '今日固始' //title配置 title: '今日固始》电子版-今日总览' //title配置
}, },
component: () => import("../view/home/list.vue") component: () => import("../view/home/list.vue")
},{ },{
path: "/knowledge", path: "/knowledge",
meta: { meta: {
title: '今日固始' //title配置 title: '今日固始》电子版-知识库' //title配置
}, },
component: () => import("../view/home/knowledge.vue") component: () => import("../view/home/knowledge.vue")
} }

View File

@ -171,23 +171,29 @@ export default {
// //
} }
}, },
created() { // created() {
// popstate // window.addEventListener('popstate', this.handlePopState);
window.addEventListener('popstate', this.handlePopState); // },
}, // beforeDestroy() {
beforeDestroy() { // //
// // window.removeEventListener('popstate', this.handlePopState);
window.removeEventListener('popstate', this.handlePopState); // },
}, // activated() {
// console.log('Component activated+++++++++++++++');
// //
// },
// deactivated() {
// console.log('Component deactivated++++++++++++++++');
// },
mounted() { mounted() {
//window.addEventListener('popstate', this.handlePopState);
console.log(this.data);
if (this.$route.query) { if (this.$route.query) {
console.log(this.$route.query.date)
if (this.$route.query.date) { if (this.$route.query.date) {
$('#activeDate').val(this.$route.query.date); $('#activeDate').val(this.$route.query.date);
var time = new Date(this.$route.query.date); var time = new Date(this.$route.query.date);
var initYear = time.getFullYear(); var initYear = time.getFullYear();
var initMonth = time.getMonth() + 1; var initMonth = String(time.getMonth() + 1).padStart(2, '0');
var initDay = String(time.getDate()).padStart(2, '0'); var initDay = String(time.getDate()).padStart(2, '0');
sessionStorage.setItem("year", initYear); sessionStorage.setItem("year", initYear);
sessionStorage.setItem("month", initMonth); sessionStorage.setItem("month", initMonth);
@ -196,28 +202,25 @@ export default {
if (this.$route.query.index) { if (this.$route.query.index) {
this.dataIndex = this.$route.query.index; this.dataIndex = this.$route.query.index;
} }
if (typeof (this.$route.query.id) != 'undefined') {
router.push('/info?id=' + this.$route.query.id);
}
} }
this.getCurrentDateMaxDay(); this.getCurrentDateMaxDay();
//this.getTypeList();
// //
window.addEventListener('dataIndexChanged', (event) => { window.addEventListener('dataIndexChanged', (event) => {
console.log('dataIndex changed to', event); console.log('dataIndex changed to', event);
this.dataIndex = event.detail; // dataIndex this.dataIndex = event.detail; // dataIndex
document.title = '今日固始-' + this.data[event.detail].bm_name; sessionStorage.setItem("index", event.detail);
//document.title = '-' + this.data[event.detail].bm_name;
}); });
this.hideAll(); this.hideAll();
setTimeout(() => { setTimeout(() => {
this.lo = false; this.lo = false;
}, 1500); }, 1500);
}, },
methods: { methods: {
handlePopState(event) {
//
console.log('返回事件被触发', event);
//
// this.$router.go(-1);
window.location.reload();
},
hideAll() { hideAll() {
$('.layoutList').removeClass('active'); $('.layoutList').removeClass('active');
$('.footerWrap .item .text').removeClass('active') $('.footerWrap .item .text').removeClass('active')
@ -229,7 +232,8 @@ export default {
openBm(d) { openBm(d) {
this.dataIndex = d; this.dataIndex = d;
sessionStorage.setItem("index", d); sessionStorage.setItem("index", d);
document.title = '今日固始-' + this.data[d].bm_name; sessionStorage.setItem("H5Index", d);
// document.title = '-' + this.data[d].bm_name;
window.swiper.slideTo(d) window.swiper.slideTo(d)
this.hideAll(); this.hideAll();
}, },
@ -253,14 +257,21 @@ export default {
// } // }
router.push('/info?id=' + d.id) router.push('/info?id=' + d.id)
}, },
removeScripts() {
const scripts = document.querySelectorAll('script[src^="/h5/public/static/js/"]');
const styles = document.querySelectorAll('style[src^="/public/static/css/"]');
styles.forEach(styles => styles.remove());
scripts.forEach(script => script.remove());
},
openZongLan() { openZongLan() {
//window.addEventListener('popstate', this.handlePopState);
var info = this.dataInfo; var info = this.dataInfo;
router.push('/list?id=' + info.id + '&time=' + info.datetime).then(() => { //this.removeScripts();
window.location.reload(); sessionStorage.setItem("ListShow", 1);
}); router.push('/list?time=' + info.datetime);
}, },
getTypeList() { getTypeList() {
axios.post("http://csdzb.hschool.com.cn/api/dzb/type/index") axios.post("https://jinrigushi.gushitv.com/api/dzb/type/index")
.then(response => { .then(response => {
console.log(response); console.log(response);
this.typeList = response.data.data; this.typeList = response.data.data;
@ -276,14 +287,18 @@ export default {
}, },
getCurrentDateMaxDay() { getCurrentDateMaxDay() {
var activeDate = $('input[name="activeDate"]').val(); var activeDate = $('input[name="activeDate"]').val();
var querySatus = '';
var storageTimeYear = sessionStorage.getItem("year"); var storageTimeYear = sessionStorage.getItem("year");
var storageTimeMonth = sessionStorage.getItem("month"); var storageTimeMonth = sessionStorage.getItem("month");
var storageTimeDay = sessionStorage.getItem("day"); var storageTimeDay = sessionStorage.getItem("day");
if (storageTimeYear && storageTimeMonth && storageTimeDay) { if (storageTimeYear && storageTimeMonth && storageTimeDay) {
activeDate = storageTimeYear + "-" + storageTimeMonth; activeDate = storageTimeYear + "-" + this.getMd(storageTimeMonth);
}
if (typeof (this.$route.query.status) != 'undefined') {
querySatus = this.$route.query.status;
} }
console.log(activeDate); 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 => { .then(response => {
// 使 // 使
var resIndex = response.data.data.length - 1; var resIndex = response.data.data.length - 1;
@ -291,19 +306,22 @@ export default {
sessionStorage.setItem('DateListH5', JSON.stringify(response.data.data)); sessionStorage.setItem('DateListH5', JSON.stringify(response.data.data));
sessionStorage.setItem('DateIndexH5', resIndex); sessionStorage.setItem('DateIndexH5', resIndex);
console.log(response.data.data[resIndex]); console.log(response.data.data[resIndex]);
this.datetime = this.getCurrentDateFormatted(response.data.data[resIndex].datetime);
console.log(this.datetime) document.title = '《今日固始》电子版-' + this.datetime;
this.getBm(); this.getBm();
}) })
.catch(error => console.error('Error loading the JSON file:', error)) .catch(error => console.error('Error loading the JSON file:', error))
}, },
getMd(num) {
return ('0' + num).slice(-2);
},
getBm() { getBm() {
var list = JSON.parse(sessionStorage.getItem('DateListH5')); var list = JSON.parse(sessionStorage.getItem('DateListH5'));
var storageTimeYear = sessionStorage.getItem("year"); var storageTimeYear = sessionStorage.getItem("year");
var storageTimeMonth = sessionStorage.getItem("month"); var storageTimeMonth = sessionStorage.getItem("month");
var storageTimeDay = sessionStorage.getItem("day"); var storageTimeDay = sessionStorage.getItem("day");
if (storageTimeYear && storageTimeMonth && storageTimeDay) { if (storageTimeYear && storageTimeMonth && storageTimeDay) {
var activeDate = storageTimeYear + "-" + storageTimeMonth + '-' + storageTimeDay; var activeDate = storageTimeYear + "-" + this.getMd(storageTimeMonth) + '-' + this.getMd(storageTimeDay);
var targetData = list.find(item => item.datetime == activeDate); var targetData = list.find(item => item.datetime == activeDate);
} else { } else {
var index = sessionStorage.getItem('DateIndexH5'); var index = sessionStorage.getItem('DateIndexH5');
@ -313,37 +331,16 @@ export default {
$('input[name="activeDate"]').val(targetData.datetime); $('input[name="activeDate"]').val(targetData.datetime);
this.datetime = this.getCurrentDateFormatted(targetData.datetime); this.datetime = this.getCurrentDateFormatted(targetData.datetime);
this.datetimeNumber = targetData.datetime; this.datetimeNumber = targetData.datetime;
this.dataInfo =targetData; this.dataInfo = targetData;
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 => { .then(response => {
console.log(response); console.log(response);
this.data = response.data.data; this.data = response.data.data;
document.title = '固始电子报-' + this.data[this.dataIndex].bm_name; //document.title = '-' + this.data[this.dataIndex].bm_name;
this.loadScripts([ // if(typeof (swiper) == 'undefined'){
'/h5/public/static/js/jquery.min.js', // this.getScript();
'/h5/public/static/js/jquery.mobile.custom.min.js', // }
'/h5/public/static/js/swiper.min.js', this.getScript();
'/h5/public/static/js/jquery.rwdImageMaps.min.js',
'/h5/public/static/js/bootstrap.min.js',
'/h5/public/static/js/bootstrap-datetimepicker.min.js',
'/h5/public/static/js/bootstrap-datetimepicker.zh-CN.js',
'/h5/public/static/js/jquery.qrcode.min.js',
'/h5/public/static/js/pinchzoom.min.js',
'/h5/public/static/js/html2canvas.min.js',
'/h5/public/static/js/index.js',
'/h5/public/static/js/qfstatH5.js',
'/h5/public/static/js/posterShare.js',
'/h5/public/static/js/bigHaiBao.js'
]).then(() => {
if (window.swiper) {
window.swiper.slideTo(this.dataIndex);
} else {
setTimeout(() => {
window.swiper.slideTo(this.dataIndex);
}, 500);
}
document.title = '今日固始-' + this.data[this.dataIndex].bm_name;
});
}) })
.catch(error => console.error('Error loading the JSON file:', error)) .catch(error => console.error('Error loading the JSON file:', error))
}, },
@ -354,6 +351,32 @@ export default {
const day = String(date.getDate()).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0');
return `${year}${month}${day}`; return `${year}${month}${day}`;
}, },
getScript() {
this.loadScripts([
'/h5/public/static/js/jquery.min.js',
'/h5/public/static/js/jquery.mobile.custom.min.js',
'/h5/public/static/js/swiper.min.js',
'/h5/public/static/js/jquery.rwdImageMaps.min.js',
'/h5/public/static/js/bootstrap.min.js',
'/h5/public/static/js/bootstrap-datetimepicker.min.js',
'/h5/public/static/js/bootstrap-datetimepicker.zh-CN.js',
'/h5/public/static/js/jquery.qrcode.min.js',
'/h5/public/static/js/pinchzoom.min.js',
'/h5/public/static/js/html2canvas.min.js',
'/h5/public/static/js/index.js',
'/h5/public/static/js/qfstatH5.js',
'/h5/public/static/js/posterShare.js',
'/h5/public/static/js/bigHaiBao.js'
]).then(() => {
if (window.swiper) {
window.swiper.slideTo(this.dataIndex);
} else {
setTimeout(() => {
window.swiper.slideTo(this.dataIndex);
}, 500);
}
});
},
loadScripts(urls) { loadScripts(urls) {
const loadScript = (url) => { const loadScript = (url) => {
return new Promise((resolve) => { return new Promise((resolve) => {
@ -378,9 +401,8 @@ export default {
<style src="/public/static/css/bootstrap.min.css"></style> <style src="/public/static/css/bootstrap.min.css"></style>
<style src="/public/static/css/bootstrap-datetimepicker.min.css"></style> <style src="/public/static/css/bootstrap-datetimepicker.min.css"></style>
<style src="/public/static/css/global.css"></style> <style src="/public/static/css/global.css"></style>
<style> <style src="/public/static/css/index.css"></style>
@import url(/public/static/css/index.css); <style scoped>
#_copy { #_copy {
align-items: center; align-items: center;
background: #4494d5; background: #4494d5;

View File

@ -1,8 +1,9 @@
<template> <template>
<div class="content" v-if="activeDate"> <div class="content" v-if="activeDate">
<div style="font-size: 20px;color: #333333;font-weight: 600">{{ activeDate.new_name }}</div> <div style="font-size: 20px;color: #333333;font-weight: 600;text-align: center">{{ activeDate.new_name }}</div>
<div style="text-align: center;font-size: 17px;margin-top: 10px;">{{ activeDate.subtitle }}</div>
<div class="em">{{ activeDate.reporter }}</div> <div class="em">{{ activeDate.reporter }}</div>
<div :class="'font' + fontSize" style="line-height: 30px;" v-html="activeDate.content"></div> <div id="imgBox" :class="'font' + fontSize" style="line-height: 30px;" v-html="activeDate.content"></div>
<div id="PageBtn"> <div id="PageBtn">
<div class="MenuBox"> <div class="MenuBox">
<a id="Haibao_share" @click="copy()" href="javascript:(-1);" <a id="Haibao_share" @click="copy()" href="javascript:(-1);"
@ -20,11 +21,18 @@
<a @click.prevent="openTop()"><img src="/public/static/goTop.png" alt="" id="Menu_Top"></a> <a @click.prevent="openTop()"><img src="/public/static/goTop.png" alt="" id="Menu_Top"></a>
</div> </div>
</div> </div>
<div id="fullPage">
<canvas id="canvas"></canvas>
</div>
<div id="shareList"> <div id="shareList">
<audio ref="audioPlayer" @ended="readEnd" controls <audio ref="audioPlayer" @ended="readEnd" controls
:src="'http://csdzb.hschool.com.cn/'+activeDate.mp_url" :src="'https://jinrigushi.gushitv.com/'+activeDate.mp_url"
@canplaythrough="onAudioLoaded" @canplaythrough="onAudioLoaded"
style='width:100%;display:none;'></audio> style='width:100%;display:none;'></audio>
<!-- <audio ref="audioPlayer" @ended="readEnd" controls-->
<!-- src="https://jinrigushi.gushitv.com/public/uploads/mp/1214.mp3"-->
<!-- @canplaythrough="onAudioLoaded"-->
<!-- style='width:100%;display:none;'></audio>-->
</div> </div>
</div> </div>
</template> </template>
@ -51,6 +59,11 @@ const copy = () => {
const audioPlayer = ref(null); const audioPlayer = ref(null);
const isPlay = ref(false); const isPlay = ref(false);
const readMp3 = () => { const readMp3 = () => {
console.log(audioPlayer.value.error);
if (audioPlayer.value.error != null) {
alert('音频生成中,请稍候再试!');
return;
}
if (isPlay.value) { if (isPlay.value) {
audioPlayer.value.pause(); audioPlayer.value.pause();
} else { } else {
@ -88,23 +101,63 @@ const fallbackCopyTextToClipboard = (text) => {
document.body.removeChild(textArea); document.body.removeChild(textArea);
} }
const getList = (item) => { const getList = (item) => {
axios.post("http://csdzb.hschool.com.cn/api/h5/news/find",{id:item.id}) axios.post("https://jinrigushi.gushitv.com/api/h5/news/find", {id: item.id})
.then(response => { .then(response => {
// 使 // 使
//activeDate.value = response.data; //activeDate.value = response.data;
var info =response.data.data; var info = response.data.data;
info.content = info.content.replace(/href="\/dist\//g, 'href="/h5/'); info.content = info.content.replace(/href="\/dist\//g, 'href="/h5/');
//console.log(item.time); //console.log(item.time);
//const targetData = response.data.list.find(data => data.numberDate == item.time); //const targetData = response.data.list.find(data => data.numberDate == item.time);
activeDate.value = info; activeDate.value = info;
//console.log(activeDate.value) //console.log(activeDate.value)
loadScripts([
'/h5/public/static/js/Phototoys.js',
'/h5/public/static/js/PhototoysDsg.js',
]).then(() => {
});
}) })
.catch(error => console.error('Error loading the JSON file:', error)) .catch(error => console.error('Error loading the JSON file:', error))
} }
const loadScripts = (urls) => {
const loadScript = (url) => {
return new Promise((resolve) => {
const script = document.createElement('script');
script.src = url;
script.type = 'text/javascript';
script.onload = resolve; //
document.head.appendChild(script);
});
};
//
// Promise
return urls.reduce((promise, url) => {
return promise.then(() => loadScript(url));
}, Promise.resolve());
}
const removeScripts = () => {
const scripts = document.querySelectorAll('script[src^="/h5/public/static/js/"]');
const styles = document.querySelectorAll('style');
styles.forEach(styles => styles.remove());
scripts.forEach(script => script.remove());
};
const openUrl = () => { const openUrl = () => {
router.push('/').then(() => { //
window.location.reload(); const year = sessionStorage.getItem('year');
}); const month = sessionStorage.getItem('month');
const day = sessionStorage.getItem('day');
sessionStorage.setItem('isShow', 1);
//router.push('/');
setTimeout(() => {
window.history.back();
}, 50)
// if (year && month && day) {
// window.history.back();
// } else {
// router.push('/').then(() => {
// window.location.reload();
// });
// }
} }
const addFontSize = (type) => { const addFontSize = (type) => {
if (type == 'da') { if (type == 'da') {
@ -128,6 +181,7 @@ const openTop = () => {
}); });
} }
</script> </script>
<style scoped src="/public/static/css/content.css"></style>
<style scoped> <style scoped>
.content { .content {
height: 100%; height: 100%;

View File

@ -64,7 +64,7 @@ onMounted(() => {
}); });
const getInfo = () => 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 => { .then(response => {
console.log(response) console.log(response)
aiInfo.value=response.data.data; aiInfo.value=response.data.data;

View File

@ -2,12 +2,12 @@
<div> <div>
<input type="hidden" id="activeDate" value=""/> <input type="hidden" id="activeDate" value=""/>
<div class="topBox" v-if="data !== ''"> <div class="topBox" v-if="data !== ''">
<div class="cp">{{ timeInfo }} 版面总览</div> <div class="cp">{{ timeInfo }} 版面总览</div>
<div class="divider"></div> <div class="divider"></div>
<div class="divider"></div> <div class="divider"></div>
<div class="thumbnail-left-left clearfix"> <div class="thumbnail-left-left clearfix">
<ul> <ul>
<li v-for="(item, index) in data" class="shortjpg"> <li v-for="(item, index) in data.bm" class="shortjpg">
<p><span class="title">{{ item.bm_name }}</span></p> <p><span class="title">{{ item.bm_name }}</span></p>
<a href="#" @click.prevent="openBm(index)"> <a href="#" @click.prevent="openBm(index)">
<img class="paperImg" :src="item.bm_img" border="0" style="width: 100%;"> <img class="paperImg" :src="item.bm_img" border="0" style="width: 100%;">
@ -47,18 +47,18 @@
</div> </div>
<div class="mask"></div> <div class="mask"></div>
<div style="display:none;" id="publishDateTime">{{ timeInfo }}</div> <div style="display:none;" id="publishDateTime">{{ timeInfo }}</div>
<!-- <table style="display: none;">--> <!-- <table style="display: none;">-->
<!-- <tbody>--> <!-- <tbody>-->
<!-- <tr>--> <!-- <tr>-->
<!-- <td>--> <!-- <td>-->
<!-- <span id="NewsPaperName">今日固始</span> <span id="NewsEditionName">#current-ed-name#</span>--> <!-- <span id="NewsPaperName">今日固始</span> <span id="NewsEditionName">#current-ed-name#</span>-->
<!-- <span id="NewsEditionNumber">#current-ed-no#</span> <span id="NewsArticleTitle"></span>--> <!-- <span id="NewsEditionNumber">#current-ed-no#</span> <span id="NewsArticleTitle"></span>-->
<!-- <span id="NewsArticleAuthor"></span><span id="NewsArticleTime">2024-12-17</span><span id="Class">1</span>--> <!-- <span id="NewsArticleAuthor"></span><span id="NewsArticleTime">2024-12-17</span><span id="Class">1</span>-->
<!-- <span id="jbdata">2024年12月17日 星期二</span>--> <!-- <span id="jbdata">2024年12月17日 星期二</span>-->
<!-- </td>--> <!-- </td>-->
<!-- </tr>--> <!-- </tr>-->
<!-- </tbody>--> <!-- </tbody>-->
<!-- </table>--> <!-- </table>-->
</div> </div>
</template> </template>
@ -72,42 +72,60 @@ export default {
return { return {
timeId: '', timeId: '',
data: '', data: '',
timeInfo:'' timeInfo: ''
}; };
}, },
mounted() { mounted() {
//$('#activeDate').val(newTime.time); //$('#activeDate').val(newTime.time);
this.loadScripts([ var ListShow = sessionStorage.getItem('ListShow');
'/h5/public/static/js/jquery.min.js', //alert( webview);
'/h5/public/static/js/jquery.mobile.custom.min.js', if (ListShow && ListShow == 1) {
'/h5/public/static/js/bootstrap.min.js', sessionStorage.setItem('ListShow', 0);
'/h5/public/static/js/bootstrap-datetimepicker.min.js', setTimeout(() => {
'/h5/public/static/js/bootstrap-datetimepicker.zh-CN.js', window.location.reload();
'/h5/public/static/js/jquery.qrcode.min.js', }, 100)
'/h5/public/static/js/pinchzoom.min.js', }
'/h5/public/static/js/html2canvas.min.js', // this.timeId = this.$route.query.id;
'/h5/public/static/js/navi.js', this.timeInfo = this.$route.query.time;
'/h5/public/static/js/qfstatH5.js', // sessionStorage.setItem("timeId", this.timeId);
'/h5/public/static/js/posterShare.js',
'/h5/public/static/js/bigHaiBao.js'
]);
this.timeId = this.$route.query.id;
this.timeInfo=this.$route.query.time;
this.getJson(); this.getJson();
}, },
methods: { methods: {
openBm(index){ removeScripts() {
const scripts = document.querySelectorAll('script[src^="/h5/public/static/js/"]');
const styles = document.querySelectorAll('style[src^="/public/static/css/"]');
styles.forEach(styles => styles.remove());
scripts.forEach(script => script.remove());
},
openBm(index) {
sessionStorage.setItem("index", index); sessionStorage.setItem("index", index);
router.push('/').then(() => { sessionStorage.setItem('isShow', 1);
window.location.reload(); //router.push('/');
}); setTimeout(() => {
window.history.back();
}, 50)
}, },
getJson() { getJson() {
axios.post("http://csdzb.hschool.com.cn/api/dzb/bm/index", {date_id: this.timeId}) axios.post("https://jinrigushi.gushitv.com/api/h5/date/search", {date: this.timeInfo})
.then(response => { .then(response => {
//var resIndex = response.data.list.length - 1; //var resIndex = response.data.list.length - 1;
this.data = response.data.data; this.data = response.data.data;
console.log(response); console.log(response);
$('#activeDate').val(this.timeInfo);
this.loadScripts([
'/h5/public/static/js/jquery.min.js',
'/h5/public/static/js/jquery.mobile.custom.min.js',
'/h5/public/static/js/bootstrap.min.js',
'/h5/public/static/js/bootstrap-datetimepicker.min.js',
'/h5/public/static/js/bootstrap-datetimepicker.zh-CN.js',
'/h5/public/static/js/jquery.qrcode.min.js',
'/h5/public/static/js/pinchzoom.min.js',
'/h5/public/static/js/html2canvas.min.js',
'/h5/public/static/js/navi.js',
'/h5/public/static/js/qfstatH5.js',
'/h5/public/static/js/posterShare.js',
'/h5/public/static/js/bigHaiBao.js'
]);
}) })
.catch(error => console.error('Error loading the JSON file:', error)); .catch(error => console.error('Error loading the JSON file:', error));
}, },
@ -137,7 +155,7 @@ export default {
<style src="/public/static/css/index_list.css"></style> <style src="/public/static/css/index_list.css"></style>
<style src="/public/static/css/global.css"></style> <style src="/public/static/css/global.css"></style>
<style src="/public/static/css/navi.css"></style> <style src="/public/static/css/navi.css"></style>
<style> <style scoped>
.cp { .cp {
height: 42px; height: 42px;
font-size: 30px; font-size: 30px;