_verifyPhone .verify_err').css('display', 'none'); }); if (len == 6) { $('.ipt-active-phone').css('left', (((i - 1) * 45 + 6) / 100) + 'rem'); try { //执行其他操作 // console.log('输入完整,执行操作'); let pwd = $val.trim(), fobj = sessionStorage.getItem('form_' + sign) ? JSON.parse(sessionStorage.getItem('form_' + sign)) : {}, params = sessionStorage.getItem('form_params_' + sign) ? JSON.parse(sessionStorage.getItem('form_params_' + sign)) : {}; if (pwd) params.code = pwd; if (fobj.name && params.code) ajaxForm(params, fobj); if (document.activeElement instanceof HTMLElement) document.activeElement.blur(); } catch (error) { } } } else { var arr = $val.match(/\d/g); $(this).val($val.slice(0, $val.lastIndexOf(arr[arr.length-1])+1)); } }) function verifyCountDown () { let second = 60; verifyTimer = setInterval(() => { second--; $('.verifyPhone_box .countdown .countdown_text').html(`(${second}s后)重新获取`); if (second == 0) { clearInterval(verifyTimer); $('.verifyPhone_box .countdown').css({color: '#141414'}); $('.verifyPhone_box .countdown .countdown_text').html('重新获取验证码'); } }, 1000); } } function subtSuccessContent(items) { let flag = items.autoplay && items.clickType == 2 let html = `
提交成功
您的信息已经成功提交!
${ flag ? `` : ''}
` $('#brick' + items.itemIndex).html(html); } for (i in commentslist) { let itmI = commentslist[i].itemIndex; let oflag = commentslist[i].currStyleClass == 'style-one'; let tflag = commentslist[i].currStyleClass == 'style-two'; let commentlist = commentslist[i].commentlist $(".linkes" + itmI).on('click', function () { let index = $(this).attr('data-linkIndex') || 1; index = parseInt(index) - 1; let list = commentlist[index]; if (!list.isZan) { list.zanInputNum += 1; list.isZan = true; if (oflag) $(this).children('.zan').addClass('icon-dianzanxuanzhong').removeClass('icon-dianzan'); if (tflag) $(this).css('color', '#f56c6c'); } else { list.zanInputNum -= 1; list.isZan = false; if (oflag) $(this).children('.zan').addClass('icon-dianzan').removeClass('icon-dianzanxuanzhong'); if (tflag) $(this).css('color', '#595959'); } let result = null if (oflag) result = list.zanInputNum < 1000 ? list.zanInputNum + '' : parseFloat((list.zanInputNum / 1000).toString().match(/^\d+(?:\.\d{0,1})?/)) + 'K'; if (tflag) result = list.zanInputNum; $(this).children('.lnk').text(result); }) for (t in commentlist) { let n=parseInt(t)+1; let replylist = commentlist[t] && commentlist[t].replylist || []; $(".likesp" + itmI + n).on('click', function () { let index = $(this).attr('data-linkIndex') || 1; index = parseInt(index) - 1; let list = replylist[index]; if (!list.isZan) { list.zanInputNum += 1; list.isZan = true; if (oflag) $(this).children('.zan').addClass('icon-dianzanxuanzhong').removeClass('icon-dianzan'); if (tflag) $(this).css('color', '#f56c6c'); } else { list.zanInputNum -= 1; list.isZan = false; if (oflag) $(this).children('.zan').addClass('icon-dianzan').removeClass('icon-dianzanxuanzhong'); if (tflag) $(this).css('color', '#595959'); } let result = null if (oflag) result = list.zanInputNum < 1000 ? list.zanInputNum + '' : parseFloat((list.zanInputNum / 1000).toString().match(/^\d+(?:\.\d{0,1})?/)) + 'K'; if (tflag) result = list.zanInputNum; $(this).children('.lnk').text(result); }) } } function reqFormat(type, jump) { if (wxMiniUrl) window.location.href = wxMiniUrl; isEnbleCopy = false; let custb = window.jQuery.custb || {} if (custb.configure_type == 4) { if (isWeixin && type == 1) { $('.weixqr').fadeIn(300); return; } let elelist = document.querySelectorAll('.wechat_number') copyw(elelist[0]) } let t = custb.configure_type != 4 ? jump : null; setTimeout(function() { straght(); backpass(1, t); save(); }, 16.6666666) } function cutUrl (url) { if (!url) return ''; if (url.indexOf('http://') == 0) return url.slice(5) if (url.indexOf('https://') == 0) return url.slice(6) } /* 关闭协议弹框 表单点击 */ $('.default-close-btn').on('click', function (e) { $('.default-modal').fadeOut(300); e.stopPropagation(); }); $('.privacy_box').on('click', function (event) { var evt = event.srcElement ? event.srcElement : event.target; if (evt.className == 'dialog-wrapper') $('.default-modal').fadeOut(300); }); /* 打开立即咨询弹框 */ $('.zxunbtn').on('click', function () { if (isWeixin) { $('.weixqr').fadeIn(300); } else { reqFormat(null, 'jump') } }); /* 关闭立即咨询弹框 */ $('.weixqr').on('click', function (evt) { var evt = event.srcElement ? event.srcElement : event.target; if (evt.className == 'alert-bg') $(this).fadeOut(300); }); $('.inputErrClose').on('click', function (evt) { $('.dialog_input').css('display', 'none'); }); $('.dialog_verfiy').on('click', function (event) { let evt = event.srcElement ? event.srcElement : event.target; if (['verfiyErrClose', 'verfiy-cancel'].includes(evt.className)) { $(this).css('display', 'none'); $("#captcha_code").val(''); $('.dialog_verfiy').removeAttr('data-verfiycls'); } if (evt.className == 'verfiy-primary') { let verify_timer = null; let verify_num = 60; let code = $("#captcha_code").val(); let formwp = $(this).attr('data-verfiycls'); let ele = $(`.${formwp} .phone-verify__btn`); if (!code) { alert('请输入验证码'); return; } ele.attr('disabled', true); ele.text(`重新获取(${verify_num})`); verify_timer = setInterval(function () { if (verify_num == 0) { ele.text('获取验证码'); ele.attr('disabled', false); clearInterval(verify_timer); verify_num = 60; } else { verify_num--; ele.text(`重新获取(${verify_num})`); } }, 1000); let phone = $(`.${formwp} input[name="store_phone"]`).val(); let url = baseUrl + '/admin/is_login/sendMsg'; let params = {type: 1, phone, code }; $.ajax({type: 'POST',url, data: params, dataType: 'json', complete: function(resp) { if (resp.status == 200 && resp.responseJSON && resp.responseJSON.code == 200) { $('.dialog_verfiy').css('display', 'none'); $("#captcha_code").val(''); $('.dialog_verfiy').removeAttr('data-verfiycls'); } else { alert('验证码错误'); ele.text('获取验证码'); ele.attr('disabled', false); clearInterval(verify_timer); verify_num = 60; } } }) } }); if (isIOS) { dialogScroll('.dialog_input'); dialogScroll('dialog_verfiy'); function dialogScroll (el) { let isReset; $(el).focusout(()=>{ isReset = true; setTimeout(() => { if (isReset) window.scroll(0, 0); }, 100); }).focusin(()=>{ isReset = false; }) } } /* 表单提交弹框 */ $('.alert-btn').on('click', function (e) { $('.alert-wrap').fadeOut(300); let type = $(this).attr('data-type'); let url = $(this).attr('data-url'); if (type== 'page' && url) window.location.href = url if (type == 'applet') reqFormat(null, 'jump') e.stopPropagation(); }) $('.alert-wrap').on('click', function (event) { var evt = event.srcElement ? event.srcElement : event.target; if (evt.className.includes('alert-mask')) $(this).fadeOut(300); }) // 链接跳转 function actLink(docu, item, name) { if (item.link && item.link.type == 'discern' && isWeixin ) { // longpress(docu) } else { $(docu).on('click', function () { if (name == "NgCarousel") { if (item.linksType == 'page' && item.linksUrl) window.location.href = item.linksUrl if (item.linksType == 'applet') { reqFormat(null, 'jump') } } else { if (item.link.type == 'page' && item.link.url) window.location.href = item.link.url if (item.link.type == 'applet') { reqFormat(name, 'jump') } } }) } } for (i in messageslist) { autoPlay(messageslist[i]) } function autoPlay(tl) { let that = this; let dm_json = tl.messageList; let dm_index = 0; let msgobj = {}; if (typeof danmuTimer != 'undefined') clearInterval(danmuTimer) danmuTimer = setInterval(() => { msgobj = dm_json[dm_index] if (!(msgobj && msgobj.nickname)) return; if (msgobj.nickname) msgobj.isSelected = true if (dm_index == dm_json.length - 1) { dm_index = 0; } else { dm_index++; } let html = `
${msgobj.nickname} ${msgobj.time} ${msgobj.typeName}添加了微信
`; $(`.message-holder${tl.itemIndex}`).html(html) setTimeout(() => { if (msgobj.nickname) { msgobj.isSelected = false if ($(`.message-holder${tl.itemIndex}`)) $(`#njmessage${tl.itemIndex}`).remove() msgobj = {} } }, 2000); }, 5000); } for (i in videolist) { let itmI = videolist[i].itemIndex; let list = videolist[i]; $('.vjsPlay'+itmI).on('click', function() { $(`.videoPreview${itmI}`).removeAttr('style'); $(`.videoPreview${itmI} .nostart`).remove(); $(`.videoPreview${itmI}`).append(``); initVideo("#videojs"+itmI, list.video_fields, list.srcs); }) if (list.video_fields.autoPlay) { let ch = document.body.offsetHeight; let docu = $(`.videoPreview${itmI}`); $(window).on('scroll', throttle(function(e) { let t = $(`.videoPreview${itmI} .vjs-fluid`).length; if (t) return; initDDVideo (itmI, list) })) initDDVideo (itmI, list) } } function initDDVideo (itmI, list) { let a = $("#brick"+itmI).offset().top; let flag = a >= $(window).scrollTop() && a < ($(window).scrollTop() + $(window).height()); if (flag) { $(`.videoPreview${itmI}`).removeAttr('style'); $(`.videoPreview${itmI} .nostart`).remove(); $(`.videoPreview${itmI}`).append(``); initVideo("#videojs"+itmI, list.video_fields, list.srcs); } } var recordVideoFlag = true; for (i in videogrouplist) { let itmI = videogrouplist[i].itemIndex; let list = videogrouplist[i]; let mySwiper = new Swiper(".mySwiper"+itmI, { autoplay: false, loop: false, observer:true, //监听 autoplayDisableOnInteraction : false,// 这样,即使我们滑动之后, 定时器也不会被清除 pagination: { el: ".swiper-group-pagination"+itmI, }, on: { slideChangeTransitionStart: function(swiper,event){ let index = this.realIndex + 1 if ($(`#videoGroupjs${itmI}${this.realIndex}`)[0]) { let vjs = videojs('videoGroupjs'+itmI+this.realIndex) vjs.pause() } }, touchEnd: function(swiper,event){ let index = this.realIndex + 1 if ($(`#videoGroupjs${itmI}${index}`)[0]) { let vjs = videojs('videoGroupjs'+itmI+index) recordVideoFlag = !recordVideoFlag; recordVideoFlag ? vjs.play() : vjs.pause() } }, tap: function(swiper,event){ let index = this.realIndex + 1 let docu = `.mySwiper${itmI} .swiper-slide-active .videoPreview${itmI}${index}`; let slt = list.videoList[this.realIndex] || {} if ($(`.videoPreview${itmI}${index} .vjs-fluid`).length) { // initVideo('#videoGroupjs'+itmI+this.realIndex, list.video_fields, slt); let vjs = videojs('videoGroupjs'+itmI+index); recordVideoFlag ? vjs.play() : vjs.pause() return; } $(docu).removeAttr('style'); $(`${docu} .nostart`).remove(); $(docu).append(``); initVideo('#videoGroupjs'+itmI+index, list.video_fields, slt); }, }, }); if (list.video_fields.autoPlay) { let docu = `.mySwiper${itmI} .swiper-slide-active .videoPreview${itmI}1`; let ch = document.body.offsetHeight; $(window).on('scroll', throttle(function(e) { let t = $(`.videoPreview${itmI}1 .vjs-fluid`).length; if (t) return; initDomVideo(docu, itmI, list, '#videoGroupjs'+itmI+'1') })) initDomVideo(docu, itmI, list, '#videoGroupjs'+itmI+'1') } } function initDomVideo (docu, itmI, list, vDoc) { let a = $("#brick"+itmI).offset().top; let flag = a >= $(window).scrollTop() && a < ($(window).scrollTop() + $(window).height()); if (flag) { $(docu).removeAttr('style'); $(`${docu} .nostart`).remove(); $(docu).append(``); initVideo(vDoc, list.video_fields, list.videoList[0]); } } function initVideo(dom, video_fields, data) { let vjs = videojs(document.querySelector(dom), { autoplay: false, // 如果true,浏览器准备好时开始回放。 muted: video_fields.isMuted, // 默认情况下将会消除任何音频。 loop: video_fields.loop, // 导致视频一结束就重新开始。 preload: "none", // 建议浏览器在