var galleryThumbs = new Swiper('.dtSwiper2', { spaceBetween: 6, slidesPerView: 4, freeMode: true, watchSlidesVisibility: true, watchSlidesProgress: true, navigation: { nextEl: '.Charity-button-next', prevEl: '.Charity-button-prev', }, breakpoints: { 640: { slidesPerView: 4, spaceBetween: 10 }, 750: { slidesPerView: 4, spaceBetween: 20 } } }); var galleryTop = new Swiper('.CharityimgBox_top', { spaceBetween: 10, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, pagination: { el: '.swiper-pagination', type: 'fraction', }, thumbs: { swiper: galleryThumbs }, on: { //swiper-slide init: function (swiper) { var txt = $(".CharityimgBox_top .swiper-slide").eq(this.activeIndex).attr("data-txt").substring(0, 40) $(".topSwiperTxt .t").html(txt) }, slideChangeTransitionEnd: function () { var txt = $(".CharityimgBox_top .swiper-slide").eq(this.activeIndex).attr("data-txt").substring(0, 40) $(".topSwiperTxt .t").html(txt) } } }); $(".Charity-button-prev").click(function () { galleryTop.slidePrev(); }) $(".Charity-button-next").click(function () { galleryTop.slideNext(); }) var shareModel = { sinaWeiBo: function (title, pic) { var param = { url: window.location.href, type: '3', count: '1', appkey: '2890110694', title: title || '', pic: pic || '', ralateUid: '', rnd: new Date().valueOf() } var temp = ''; for (var p in param) { if (p) { temp += p + "=" + encodeURIComponent(param[p]) || '' temp += "&" } } var targetUrl = 'http://service.weibo.com/share/share.php?' + temp; window.open(targetUrl, 'sinaweibo', 'height=430, width=400'); }, linkUrl: function () { //拿到想要复制的值 let url = window.location.href; //创建input元素 let copyInput = document.createElement('input'); copyInput.setAttribute('class', 'copyinput') //向页面底部追加输入框 document.body.appendChild(copyInput); //添加属性,将url赋值给input元素的value属性 copyInput.setAttribute('value', url); //选择input元素 copyInput.select(); //执行复制命令 document.execCommand("Copy"); //弹出提示信息,不同组件可能存在写法不同 // this.$message.success("链接已复制!"); // event.preventDefault(); // event.stopPropagation(); //复制之后再删除元素,否则无法成功赋值 //删除动态创建的节点 copyInput.remove(); return alert("链接已复制!") // return $.growl.notice({ // title: "", // message: "链接已复制!" // }); } } $(function () { preAndNext($(".rqpreNext")) // 二微码生成 var $win = $(window).width(); var qrcodeW = 100 if ($win <= 750) { qrcodeW = 64 } jQuery('#qrcode').qrcode({ width: qrcodeW, height: qrcodeW, text: window.location.href }); }) function getNowFormatDate(t) { var tStr = t.replace(/-/g, "/") console.log("tt", tStr) var date = new Date(tStr); var seperator1 = "-"; var year = date.getFullYear(); var month = date.getMonth() + 1; var strDate = date.getDate(); if (month >= 1 && month <= 9) { month = "0" + month; } if (strDate >= 0 && strDate <= 9) { strDate = "0" + strDate; } var currentdate = year + seperator1 + month + seperator1 + strDate; return currentdate; } function preAndNext(tar) { if (tar && tar != "") { $.ajax({ type: "POST", url: "/rcms-external-rest/content/getContentNext", data: { "id": $(".rqpreNext").attr("data-id"), "isPublish": $(".rqpreNext").attr("data-isPublish"), "currPath": $(".rqpreNext").attr("data-currPath"), "orderField": "editTime", "orderType": "desc" }, success: function (res) { if (res.code != "S1A00000") { return } console.log("r", res) if (res.data[0].id != null) { // var prev = res.data[0].publishDate.substring(0, 10); if (res.data[0].title && (res.data[0].title.length > 25)) { var prevTitle = res.data[0].title.substring(0, 25) + "..." } else { prevTitle = res.data[0].title } var prevTitle1 = '' + prevTitle + '' prevTitle1 += '' + getNowFormatDate(res.data[0].editTime) + '' } else { var prev = ""; var prevTitle1 = "暂无数据" } if (res.data[1].id != null) { // var next = res.data[1].publishDate.substring(0, 10); if (res.data[1].title && (res.data[1].title.length > 25)) { nextTitle = res.data[1].title.substring(0, 25) + "..." } else { nextTitle = res.data[1].title } var nextTitle1 = '' + nextTitle + '' nextTitle1 += '' + getNowFormatDate(res.data[1].editTime) + '' } else { var next = ""; var nextTitle1 = "暂无数据" } if (res.code === "S1A00000") { if (res.data[0].id != "null" && res.data[1].id != "null") { var strcontentprev = "

上一篇

" + '
' + prevTitle1 + '
'; var strcontentnext = "

下一篇

" + '
' + nextTitle1 + '
'; tar.html(strcontentprev + strcontentnext); } } } }) } }