var pdfUrl = ""; var puname = ""; var pulist = ""; (function (params) { var tmp_opern_id = $('.opern_name').attr('data-oid'); var new_opern_id = $('.opern_name').attr('data-id'); var audio = new ChongAudio(); var pid = ""; var mySwiper1; //乐谱显示模式 var puType = "1"; //默认播放速度 var speed = 1.0; var isVip = "0"; var has_buy = "0"; var is_pay = '0'; var pulist = ""; var price = "0.0"; var user_balance = "0.0"; var balance_list = ""; var viplist = ""; var simplifiedviplist = ""; var torder_id; var torderType; var balance_type_index = 0; var balance_paytype_data = "3"; var vip_type_index = 0; var vip_paytype_data = "3"; var newWindow = ''; var newH5Window = ''; var comment_page = 1; var comment_timer; var is_show_wechat_code = 0; var audition_longtime = 0; var isGudindiao = 0; //是否固定调 var adv_time = null; //app引导弹窗定时器 var adv_time_ai = null; //app引导弹窗定时器 var currencyCodeList = []; //货币列表 var couponList = null; //优惠劵列表 var is_lock_num = 0; var check_vip_type = 1; //选择vip类型 0=VIP,1=SVIP var initw = $('.swiper-pattern').width(); var is_login = false; function is_login_fun() { // 检查登录状态 var _cc_userid = identity.getServiceUid() var _isvip = identity.getIsVip() if(_cc_userid){ is_login = true; } } is_login_fun(); $('.opern-detail a').removeClass("download-btn"); window.addEventListener('message', function (event) { if (event.data.message == "onPlayerInited") { //初始化完成 if ($('#ai-score')[0]) { newWindow = $('#ai-score')[0].contentWindow; setSpeedNumber(); } if (isMobile() && $('#ai-score-h5')[0]) { newH5Window = $('#ai-score-h5')[0].contentWindow; setSpeedNumberH5(); } //结束loading $('.opern-detail .music-play').removeClass('loading'); $('.play_botton_ai').show(); $('.audio_loading').hide(); $('.audio_loading_ai').hide(); } else if (event.data.message == "yes-close") { is_show_wechat_code = 0; setCookie('yes_close', 1); $('.wechat-code').hide(); } else if (event.data.message == "close") { $('.wechat-code').hide(); $('.login-iframe').hide(); } else if (event.data.message == "down_app") { var tmp_opern_id = $('.opern_name').attr('data-oid'); loadInstall() } else if (event.data.message == "down_app_ipad") { window.location.href = 'http://apps.apple.com/cn/app/id1080634885'; } else if (event.data.method == "onUpdateState") { audio.pause(); if (event.data.data && event.data.data.data.inited == 2) { //初始化完成 if ($('#ai-score')[0]) { newWindow = $('#ai-score')[0].contentWindow; setSpeedNumber(); } if (isMobile() && $('#ai-score-h5')[0]) { newH5Window = $('#ai-score-h5')[0].contentWindow; setSpeedNumberH5(); } //结束loading $('.opern-detail .music-play').removeClass('loading'); $('.play_botton_ai').show(); $('.audio_loading').hide(); $('.audio_loading_ai').hide(); } } else if (event.data.message == "reload") { window.location.reload(); } }, false); if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) { addhit(2000000) } $('.search').click(function (e) { addhit(2000001) }) $('#type-switch').click(function (e) { e.stopPropagation(); /*if(this.innerText != "图片模式" && this.innerText != "AI模式"){ console.log(this.innerText); return; }*/ $(this).toggleClass('active'); swiperInit(); $('#line-spectrum-box').toggleClass('active'); audio.stop(); $('#audio_play').css('display', 'block'); $('#audio_pause').css('display', 'none'); if (this.innerText == "图片模式") { puType = "1"; $('.audio_ai_utils').css('display', 'flex'); $('.audio_mp3_utils').css('display', 'none'); } else if (this.innerText == "AI模式") { puType = "0"; $('.audio_ai_utils').css('display', 'none'); $('.audio_mp3_utils').css('display', 'flex'); if (newWindow.Player.isPlayerReady()) { newWindow.Player.resetPlay(); } } }); swiperInit(); function swiperInit(params) { mySwiper1 = new Swiper('#scoreSwiper', { loop: false, autoplay: false, observer: true, observeParents: true, // paginationClickable: true, }); $('#siwper1-prev').click(function (params) { if (is_show_wechat_code == 1) { // $("body").append(''); //$("body").append(''); // return; } if (!identity.getUid()) { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } return; } if (!identity.getIsVip()) { vip(); return; } var index = $('.opern-detail .tool-tab-box-page span:eq(0)').text(); if (isNaN(mySwiper1.activeIndex) && index != '') { index = index; } else { index = mySwiper1.activeIndex + 1; } $('.opern-detail .tool-tab-box-page span:eq(0)').text(index); mySwiper1.swipePrev(); }); $('#siwper1-next').click(function (params) { if (is_show_wechat_code == 1) { // $("body").append(''); //$("body").append(''); // return; } if (!identity.getUid()) { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } return; } if (!identity.getIsVip()) { vip(); return; } var index = $('.opern-detail .tool-tab-box-page span:eq(0)').text(); if (isNaN(mySwiper1.activeIndex) && index != '') { index = index; } else { index = mySwiper1.activeIndex + 1; } $('.opern-detail .tool-tab-box-page span:eq(0)').text(index); mySwiper1.swipeNext(); }); $('.tab-left').click(function (params) { if (is_show_wechat_code == 1) { $("body").append(''); //$("body").append(''); return; } if (!identity.getUid()) { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } return; } if (!identity.getIsVip()) { vip(); return; } var index = $('.opern-detail .tool-tab-box-page span:eq(0)').text(); if (isNaN(mySwiper1.activeIndex) && index != '') { index = index; } else { index = mySwiper1.activeIndex + 1; } $('.opern-detail .tool-tab-box-page span:eq(0)').text(index); mySwiper1.swipePrev(); }); swiperInit2(); function swiperInit2(params) { mySwiper2 = new Swiper('#scoreSwiper2', { loop: false, autoplay: false, observer: true, observeParents: true, // paginationClickable: true, }); $('#siwper1-prev2').click(function (params) { if (!identity.getUid()) { $("body").append(''); return; } var index = $('.opern-detail .tool-tab-box-page span:eq(0)').text(); if (isNaN(mySwiper2.activeIndex) && index != '') { index = index; } else { index = mySwiper2.activeIndex + 1; } if (index <= 1) { $('#siwper1-next2').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/siwper-right01.png'); $('#siwper1-prev2').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/siwper-left01-no.png'); } else if (index > 1 && index < mySwiper2.slides.length) { $('#siwper1-next2').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/siwper-right01.png'); $('#siwper1-prev2').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/siwper-left01.png'); } else if (index >= mySwiper2.slides.length) { $('#siwper1-next2').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/siwper-right01-no.png'); $('#siwper1-prev2').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/siwper-left01.png'); } $('.opern-detail .tool-tab-box-page span:eq(0)').text(index); mySwiper2.swipePrev(); }); $('#siwper1-next2').click(function (params) { if (!identity.getUid()) { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } return; } if (price > 0 && !identity.getIsVip() && has_buy != '1') { $("body").append(''); return; } if (is_lock_num == 1) { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } return; } var index = $('.opern-detail .tool-tab-box-page span:eq(0)').text(); if (isNaN(mySwiper2.activeIndex) && index != '') { index = index; } else { index = mySwiper2.activeIndex + 1; } if (index <= 1) { $('#siwper1-next2').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/siwper-right01.png'); $('#siwper1-prev2').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/siwper-left01-no.png'); } else if (index > 1 && index < mySwiper2.slides.length) { $('#siwper1-next2').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/siwper-right01.png'); $('#siwper1-prev2').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/siwper-left01.png'); } else if (index >= mySwiper2.slides.length) { $('#siwper1-next2').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/siwper-right01-no.png'); $('#siwper1-prev2').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/siwper-left01.png'); } $('.opern-detail .tool-tab-box-page span:eq(0)').text(index); mySwiper2.swipeNext(); }); $('.tab-left').click(function (params) { if (is_show_wechat_code == 1) { $("body").append(''); //$("body").append(''); return; } if (!identity.getUid()) { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } return; } if (price > 0 && !identity.getIsVip() && has_buy != '1') { vip(); return; } var index = $('.opern-detail .tool-tab-box-page span:eq(0)').text(); if (isNaN(mySwiper2.activeIndex) && index != '') { index = index; } else { index = mySwiper2.activeIndex + 1; } $('.opern-detail .tool-tab-box-page span:eq(0)').text(index); mySwiper2.swipePrev(); }); } $('.tab-right').click(function (params) { if (is_show_wechat_code == 1) { $("body").append(''); //$("body").append(''); return; } if (!identity.getUid()) { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } return; } if (!identity.getIsVip()) { vip(); return; } var index = $('.opern-detail .tool-tab-box-page span:eq(0)').text(); if (isNaN(mySwiper2.activeIndex) && index != '') { index = index; } else { index = mySwiper2.activeIndex + 1; } $('.opern-detail .tool-tab-box-page span:eq(0)').text(index); mySwiper2.swipeNext(); }); } $('.defalut.set_meal_list li').click(function (e) { e.stopPropagation(); var _value = $(this).data('money'); $(this).siblings().removeClass('active'); $(this).addClass('active'); $('#balance_moneyNum').html(_value); balance_type_index = $(this).data('index'); if (balance_list.length > 0) { placeOrderForWallet(balance_list[balance_type_index].balance_id, balance_paytype_data); } }); $('.vip.set_meal_list li').click(function (e) { e.stopPropagation(); var _value = $(this).data('money'); $(this).siblings().removeClass('active'); $(this).addClass('active'); vip_type_index = $(this).data('index'); if (vip_type_index != 0) { $('.dialog_box .content .vip_recharge_box .set_meal > ul li.active > span').hide(); } else { $('.dialog_box .content .vip_recharge_box .set_meal > ul li.active > span').show(); } setPayPrise(viplist); if (viplist.length > 0 && vip_paytype_data != 1003) { placeOrderForVip(viplist[vip_type_index].vip_id, vip_paytype_data); } if (vip_type_index != 0 || (vip_paytype_data != 3 && vip_paytype_data != 2)) { $('.coupon').hide(); $('.payment').css('margin-top', '0.5rem'); } else { if (couponList) { $('.coupon').show(); $('.payment').css('margin-top', '.166667rem'); } } }); $('.vip.set_meal_list2 li').click(function (e) { e.stopPropagation(); var _value = $(this).data('money'); $(this).siblings().removeClass('active'); $(this).addClass('active'); vip_type_index = $(this).data('index'); if (vip_type_index != 0) { $('.dialog_box .content .vip_recharge_box .set_meal > ul li.active > span').hide(); } else { $('.dialog_box .content .vip_recharge_box .set_meal > ul li.active > span').show(); } setPayPrise(simplifiedviplist); if (simplifiedviplist.length > 0 && vip_paytype_data != 1003) { placeOrderForVip(simplifiedviplist[vip_type_index].vip_id, vip_paytype_data); } if (vip_type_index != 0 || (vip_paytype_data != 3 && vip_paytype_data != 2)) { $('.coupon').hide(); $('.payment').css('margin-top', '0.5rem'); } else { if (couponList) { $('.coupon').show(); $('.payment').css('margin-top', '.166667rem'); } } }); $('.icon.close').click(function (e) { e.stopPropagation(); close(); }); $('.icon.close1').click(function (e) { e.stopPropagation(); close(); }); $('.tips_box_more').click(function (params) { $(this).toggleClass('active') if ($(this).hasClass('active')) { $(this).prev().css('-webkit-line-clamp', 'inherit') $(this).prev().css('ine-clamp', 'inherit') $(this).children('span').html('收起') } else { $(this).prev().css('-webkit-line-clamp', '2') $(this).prev().css('ine-clamp', '2') $(this).children('span').html('展开') } }) function close() { $('.dialog_box').removeClass('show'); boxType = ""; balance_list = ""; viplist = ""; simplifiedviplist = ""; balance_type_index = 0; balance_paytype_data = "3"; vip_type_index = 0; vip_paytype_data = "3"; clearTimeout(animate1); isCloseTime = false; } $('.deflut.payment_type li').click(function (e) { var arrow1 = $('#triangle'); e.stopPropagation(); var _value = $(this).data('value'); $(this).siblings().removeClass('active '); $(this).addClass('active'); if (_value == 'wx') { arrow1.css('top', '0.35rem'); balance_paytype_data = "3"; $('.balance_qr_code').css('display', 'initial'); $('.balance_pay_paypal').css('display', 'none'); } else if (_value == 'zfb') { balance_paytype_data = "2"; arrow1.css('top', '1.15rem'); $('.balance_qr_code').css('display', 'initial'); $('.balance_pay_paypal').css('display', 'none'); } else if (_value == 'PayPal') { arrow1.css('top', '2rem'); vip_paytype_data = "1001"; $('.vip_qr_code').css('display', 'none'); $('.vip_pay_unipin').css('display', 'none'); $('.vip_pay_paypal').css('display', 'initial'); orderstatetime = 60; clearTimeout(animate1); isCloseTime = false; } else if (_value == 'UniPin') { arrow1.css('top', '2.44rem'); vip_paytype_data = "1003"; $('.vip_qr_code').css('display', 'none'); $('.vip_pay_paypal').css('display', 'none'); $('.vip_pay_unipin').css('display', 'inline-block'); } if (balance_list.length > 0) { placeOrderForWallet(balance_list[balance_type_index].balance_id, balance_paytype_data); } }); $('.vip.payment_type li').click(function (e) { var arrow1 = $('#vip_triangle'); e.stopPropagation(); var _value = $(this).data('value'); $(this).siblings().removeClass('active '); $(this).addClass('active'); if (_value == 'wx') { arrow1.css('top', '0.35rem'); vip_paytype_data = "3"; $('.vip_pay_paypal').css('display', 'none'); $('.vip_pay_unipin').css('display', 'none'); $('.vip_pay_unipin_currency').css('display', 'none'); $('.vip_pay_unipin_text').css('display', 'none'); $('.vip_qr_code').css('display', 'initial'); $('.problem').css('display', 'inherit'); setVipPrise(''); } else if (_value == 'zfb') { arrow1.css('top', '1.15rem'); vip_paytype_data = "2"; $('.vip_pay_paypal').css('display', 'none'); $('.vip_pay_unipin').css('display', 'none'); $('.vip_pay_unipin_currency').css('display', 'none'); $('.vip_pay_unipin_text').css('display', 'none'); $('.vip_qr_code').css('display', 'initial'); $('.problem').css('display', 'inherit'); setVipPrise(''); } else if (_value == 'PayPal') { arrow1.css('top', '2rem'); vip_paytype_data = "1001"; $('.vip_qr_code').css('display', 'none'); $('.vip_pay_unipin').css('display', 'none'); $('.problem').css('display', 'none'); $('.vip_pay_unipin_currency').css('display', 'none'); $('.vip_pay_paypal').css('display', 'initial'); $('.vip_pay_unipin_text').css('display', 'block'); setVipPrise(''); orderstatetime = 60; clearTimeout(animate1); isCloseTime = false; } else if (_value == 'UniPin') { arrow1.css('top', '2.44rem'); vip_paytype_data = "1003"; $('.vip_qr_code').css('display', 'none'); $('.vip_pay_paypal').css('display', 'none'); $('.problem').css('display', 'none'); $('.vip_pay_unipin').css('display', 'inline-block'); $('.vip_pay_unipin_text').css('display', 'block'); $('.vip_pay_unipin_currency').css('display', 'block'); //设置货币 setUnipinPayCurrencyCode(); } if (check_vip_type == 1) { setPayPrise(viplist); if (viplist.length > 0 && vip_paytype_data != 1003) { placeOrderForVip(viplist[vip_type_index].vip_id, vip_paytype_data); } } else { setPayPrise(simplifiedviplist); if (simplifiedviplist.length > 0 && vip_paytype_data != 1003) { placeOrderForVip(simplifiedviplist[vip_type_index].vip_id, vip_paytype_data); } } if (vip_type_index != 0 || (vip_paytype_data != 3 && vip_paytype_data != 2)) { $('.coupon').hide(); $('.payment').css('margin-top', '0.5rem'); } else { if (couponList) { $('.coupon').show(); $('.payment').css('margin-top', '.166667rem'); } } }); function setUnipinPayCurrencyCode() { var currency = ''; var getBalanceListApi = ccgt_domain + '/?urlparam=common/vip/unipinPayCurrencyCode'; $.ajax({ type: "GET", dataType: "json", url: getBalanceListApi, data: { service_type: 'ccgq', platform: 'web-ccgq', service_uid: identity.getServiceUid(), service_key: identity.getServiceKey(), ccgq_uuid: identity.getCcgqUid(), service_type: identity.getServiceType(), uid: identity.getUid(), }, success: function (res) { if (res.returnCode == '0000') { currencyCodeList = res.list; $('#disabledSelect').empty(); for (var i = 0; i < currencyCodeList.length; i++) { var item = res.list[i]; $('#disabledSelect').append(""); } //默认选中货币 var currency = currencyCodeList[0].code; setVipPrise(currency); setPayChannel(currency); if (check_vip_type == 1) { setPayPrise(viplist); } else { setPayPrise(simplifiedviplist); } } else { isCloseTime = false; $.message({ message: res.returnMsg, type: 'error' }); } } }); } loadCollect() function loadCollect() { var uid = identity.getUid() if (!uid) { return } var getOpernCollectApi = domain_str + '/home/user/getOpernCollect'; $.ajax({ type: "GET", dataType: "json", url: getOpernCollectApi, data: { service_key: identity.getServiceKey(), ccgq_uuid: identity.getCcgqUid(), service_type: identity.getServiceType(), uid: uid, opern_id: new_opern_id, platform: 'web-ccgq', }, dataType: 'json', success: function (res) { if (res.returnCode == '0000') { if (res.datas.is_follow_collect == true) { $('.follow').css('background', '#CCCCCC') $('.follow').text('已关注') } else { $('.follow').css('background', '#201f1c') $('.follow').text('+ 关注') } if (res.datas.is_learning_collect == true) { $('#Collection').css('background-color', '#CCCCCC'); $('#Collection .collect-label').text('已收藏'); $('.Collection').addClass("no"); $('.Collection .collect-label').html('已收藏'); $('.play-collection').addClass('active'); $('.play-collection').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/play-collection-active.png'); } else { $('#Collection').css('background-color', '#FE7526'); $('#Collection .collect-label').text('收藏'); $('.Collection').removeClass("no"); $('.Collection .collect-label').html('收藏'); $('.play-collection').removeClass('active'); $('.play-collection').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/play-collection.png'); } if (res.datas.is_download == true) { $('.play-down').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/play-down-active.png'); } else { $('.play-down').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/play-down.png'); } } } }); } loadUser() function loadUser() { var userid = $('.user-info-box .name p').attr('data-id') var userid = userid ? userid : $('.s-d-m-b-auther p').attr('data-id') var userid = parseInt(userid) if (!userid) { return } var getUserApi = domain_str + '/home/user/stat'; $.ajax({ type: "GET", dataType: "json", url: getUserApi, data: { userid: userid, service_type: 'ccgq', platform: 'web-ccgq', ccgq_uuid: identity.getCcgqUid(), uid: identity.getUid(), }, dataType: 'json', success: function (res) { if (res.returnCode == '0000') { $('.total_opren_num').text(res.datas.userinfo.total_opren_num) $('.total_fans_num').text(res.datas.userinfo.total_fans_num) $('.total_follow_num').text(res.datas.userinfo.total_follow_num) $('.score_details_aside_box .name p').text(res.datas.userinfo.nickname) $('.info_box .name a').text(res.datas.userinfo.nickname) $('.score_details_h5_box .s_d_h_b_item5 .h5-title span').text(res.datas.userinfo.nickname + '还上传了') $('.score_details_aside_box .head-img img').attr('src', res.datas.userinfo.head_portrait_image) } } }); } //收藏 $('#Collection').click(function (e) { if (identity.getUid()) { var text = $('.collect-label').text() if (text == '收藏') { var collectApi = domain_str + '/cginfo/userinfo/usercollectionlearning' } else { var collectApi = domain_str + '/cginfo/userinfo/usercancelcollectionlearning' } var learning_id = $('.opern_name').attr('data-oid') if (!learning_id) { $.message({ message: '该谱子无效', type: 'info' }); return } $.ajax({ type: "GET", dataType: "json", url: collectApi, data: { service_key: identity.getServiceKey(), ccgq_uuid: identity.getCcgqUid(), service_type: identity.getServiceType(), uid: identity.getUid(), learning_id: learning_id, platform: 'web-ccgq', }, dataType: 'json', success: function (res) { if (res.returnCode == '0000') { var num = $('.collect-num').text() num = parseInt(num) if (text == '收藏') { $('#Collection').css('background-color', '#CCCCCC'); $('#Collection .collect-label').text('已收藏') $('.collect-num').text(num + 1) } else { $('#Collection').css('background-color', '#FE7526'); $('#Collection .collect-label').text('收藏') if (num - 1 > 0) { $('.collect-num').text(num - 1) } else { $('.collect-num').text(0) } } } else { $.message({ message: res.returnMsg, type: 'error' }); } } }); } else { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } } }); //收藏 $('.opern-detail .Collection').click(function (e) { if (identity.getUid()) { var text = $('.Collection').text() if (text.indexOf("已收藏") >= 0) { var collectApi = domain_str + '/cginfo/userinfo/usercancelcollectionlearning' } else { var collectApi = domain_str + '/cginfo/userinfo/usercollectionlearning' } var learning_id = $('.opern_name').attr('data-oid') if (!learning_id) { $.message({ message: '该谱子无效', type: 'info' }); return } $.ajax({ type: "GET", dataType: "json", url: collectApi, data: { service_key: identity.getServiceKey(), ccgq_uuid: identity.getCcgqUid(), service_type: identity.getServiceType(), uid: identity.getUid(), learning_id: learning_id, platform: 'web-ccgq', }, dataType: 'json', success: function (res) { if (res.returnCode == '0000') { var num = $('.collect-num').text() num = parseInt(num) if (text.indexOf("已收藏") >= 0) { $('#Collection').css('background-color', '#FE7526'); $('#Collection .collect-label').text('收藏') if (num - 1 > 0) { $('#Collection .collect-num').text(num - 1) } else { $('#Collection .collect-num').text(0) } } else { $('#Collection').css('background-color', '#CCCCCC'); $('#Collection .collect-label').text('已收藏') $('#Collection .collect-num').text(num + 1) } var num = $('.Collection .collect-num').text() num = parseInt(num) if (text.indexOf("已收藏") >= 0) { $('.Collection').removeClass("no") if (num - 1 > 0) { $('.Collection .collect-label').text('收藏') $('.Collection .collect-num').text(num - 1) } else { $('.Collection .collect-label').text('收藏') $('.Collection .collect-num').text('') } } else { $('.Collection').addClass("no") $('.Collection .collect-label').text('已收藏') $('.Collection .collect-num').text(num + 1) } } else { $.message({ message: res.returnMsg, type: 'error' }); } } }); } else { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } } }); //收藏 $('.play-collection').click(function (e) { if (identity.getUid()) { if (!$('.play-collection').hasClass('active')) { var collectApi = domain_str + '/cginfo/userinfo/usercollectionlearning'; } else { var collectApi = domain_str + '/cginfo/userinfo/usercancelcollectionlearning'; } var learning_id = $('.opern_name').attr('data-oid'); if (!learning_id) { $.message({ message: '该谱子无效', type: 'info' }); return; } $.ajax({ type: "GET", dataType: "json", url: collectApi, data: { service_key: identity.getServiceKey(), ccgq_uuid: identity.getCcgqUid(), service_type: identity.getServiceType(), uid: identity.getUid(), learning_id: learning_id, platform: 'web-ccgq', }, dataType: 'json', success: function (res) { if (res.returnCode == '0000') { if (!$('.play-collection').hasClass('active')) { $('.play-collection').addClass('active'); $('.play-collection').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/play-collection-active.png'); $.message({ message: '曲谱已收藏,可到个人主页查看', type: 'success' }); } else { $('.play-collection').removeClass('active'); $('.play-collection').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/play-collection.png'); $.message({ message: '已取消收藏,按钮状态还原', type: 'success' }); } } else { $.message({ message: res.returnMsg, type: 'error' }); } } }); } else { $("body").append(''); } }); //关注 $('.follow').click(function (e) { if (identity.getUid()) { var text = $(this).text() if (text == '已关注') { var collectApi = domain_str + '/home/user/delOneFollow' } else { var collectApi = domain_str + '/home/user/addOneFollow' } var urlParams = getUrlParamData() var uid_by = $('.user-info-box .name p').attr('data-id') var uid_by = uid_by ? uid_by : $('.s-d-m-b-auther p').attr('data-id') if (!uid_by) { $.message({ message: '该用户无效', type: 'info' }); return } $.ajax({ type: "GET", dataType: "json", url: collectApi, data: { service_key: identity.getServiceKey(), ccgq_uuid: identity.getCcgqUid(), service_type: identity.getServiceType(), uid: identity.getUid(), uid_by: uid_by, platform: 'web-ccgq', }, dataType: 'json', success: function (res) { if (res.returnCode == '0000') { if (text == '已关注') { $('.follow').css('color', '#ffffff') $('.follow').css('background', '#201f1c') $('.follow').text('+ 关注') } else { $('.follow').css('color', '#ffffff') $('.follow').css('background', '#CCCCCC') $('.follow').text('已关注') } } else { $.message({ message: res.returnMsg, type: 'error' }); } } }); } else { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } } }); //载入评论 loadComment(comment_page) function loadComment(page) { var page = page ? page : 1 var id = $('.opern_name').attr('data-oid') var getCommentListbyIdApi = domain_str + '/pad/detail/getOpernDetailComment' $.ajax({ type: "GET", dataType: "json", url: getCommentListbyIdApi, data: { service_key: identity.getServiceKey(), ccgq_uuid: identity.getCcgqUid(), service_type: identity.getServiceType(), platform: 'web-ccgq', uid: identity.getUid(), pageindex: page, pagesize: 20, id: id, }, dataType: 'json', success: function (res) { if (res.returnCode == '0000') { if (res.datas.list.length > 0) { comment_page++; $('.comment_num').text(res.datas.total_count); } else { clearInterval(comment_timer) $('.more-box a').text('没有更多内容了~'); $('.more-box a').css('background-color', '#bcbcbc'); } if (isMobile()) { res.datas.list = res.datas.list.length > 0 ? res.datas.list.slice(0, 2) : []; } setCommentShowList(res.datas.list, true); } else { $.message({ message: res.returnMsg, type: 'error' }); } } }); } function music_play() { if (!isMobile() && (!identity.getUid() || !identity.getIsVip()) && is_pay == '0') { // popup2(); // return; } if (puType == "1") {//AI谱模式 if (!newWindow.Player) { $.message({ message: 'AI曲谱还在加载中哟~', type: 'warning' }); return } if (newWindow.Player.isPlayerReady()) { // if (identity.getUid()) { if (identity.getIsVip()) { newWindow.Player.setLocked(false); } else { newWindow.Player.setLocked(true); } //是否正在播放 newWindow.Player.playOrPause(); if (newWindow.Player.isPlaying()) { $('#audio_play').css('display', 'none'); $('#audio_pause').css('display', 'block'); } else { $('#audio_play').css('display', 'block'); $('#audio_pause').css('display', 'none'); } // } // else { // newWindow.Player.setLocked(true); // if (isMobile()) { // $("body").append(''); // } else { // $("body").append(''); // } // } } } else { // if (identity.getUid()) { if (audio.isPalying) { audio.pause(); } else { audio.play(audition_longtime); } // } // else { // $("body").append(''); // } } } //播放 $('.music-play').on('click', function () { music_play(); }); //停止 $('.music-stop').on('click', function () { if (puType == "1") {//AI谱模式 if (newWindow.Player.isPlayerReady()) { $('#audio_play').css('display', 'block'); $('#audio_pause').css('display', 'none'); newWindow.Player.resetPlay(); } } else { audio.stop(); } }); //ai谱 - 工具栏 - 循环模式 $('#ai-cycle').click(function (e) { if (newWindow.Player.isPlayerReady()) { //是否循环 if (newWindow.Player.isLoopAll()) { newWindow.Player.setLoopAll(false); $(this).attr("src", "http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/loop.png"); $(this).find('img').attr("src", "http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/loop.png"); } else { newWindow.Player.setLoopAll(true); $(this).attr("src", "http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/loop_no.png") $(this).find('img').attr("src", "http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/loop_no.png") } } }); //ai谱 - 工具栏 - 节拍器开关 $('#ai-metronome').click(function (e) { if (!isMobile() && (!identity.getUid() || !identity.getIsVip()) && is_pay == '0') { popup2(); return; } if (newWindow.Player.isMetronomeOn()) { newWindow.Player.setMetronomeOn(false); $(this).attr("src", "http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/metronome.png"); $(this).find('img').attr("src", "http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/metronome.png"); } else { newWindow.Player.setMetronomeOn(true); $(this).attr("src", "http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/metronome_no.png"); $(this).find('img').attr("src", "http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/metronome_no.png"); } }); //ai谱 - 工具栏 - 调速减 $('#ai-speed-reduce').click(function (e) { if (!isMobile() && (!identity.getUid() || !identity.getIsVip()) && is_pay == '0') { popup2(); return; } if (speed > 0.1) { speed = operation.sub_p1(speed, 0.1); // 加 newWindow.Player.setSpeed(speed); setSpeedNumber(); } }); //ai谱 - 工具栏 - 调速加 $('#ai-speed-plus').click(function (e) { if (!isMobile() && (!identity.getUid() || !identity.getIsVip()) && is_pay == '0') { popup2(); return; } if (speed < 2.0) { speed = operation.add_p1(speed, 0.1); // 加 newWindow.Player.setSpeed(speed); setSpeedNumber(); } }); //ai谱 - 工具栏 - 固定调 $('#ai-c').click(function (e) { if (!isMobile() && (!identity.getUid() || !identity.getIsVip()) && is_pay == '0') { popup2(); return; } if (isGudindiao) { $(this).attr("src", "http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/c-icon.png"); isGudindiao = 0 newWindow.Player.setJianpuMode(1) } else { $(this).attr("src", "http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/c-icon-no.png"); isGudindiao = 1 newWindow.Player.setJianpuMode(2) } }); function setSpeedNumber() { speed = newWindow.Player.getSpeed(); if (speed == '1') { speed = "1.0"; } else if (speed == '2') { speed = "2.0"; } $('.adjust-speed').find('p').html('x' + speed); $('.tool-tab-box-m-bak .tool-tab-box-page').html('x' + speed); } function setSpeedNumberH5() { speed = newH5Window.Player.getSpeed(); if (speed == '1') { speed = "1.0"; } else if (speed == '2') { speed = "2.0"; } $('.adjust-speed').find('p').html('x' + speed); } //ai谱 - 工具栏 - 双手模式 $('#ai-bothhands').click(function (e) { $("body").append(''); }); //ai谱 - 工具栏 - 瀑布流 $('#ai-WaterfallFlow').click(function (e) { $("body").append(''); /* if(newWindow.Player.isMetronomeOn()){ newWindow.Player.setMetronomeOn(false); $(this).find('img').attr("src","http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/piano.png"); } else{ newWindow.Player.setMetronomeOn(true); $(this).find('img').attr("src","http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/piano_no.png"); } */ }); //购买曲谱 $('.openbuy').click(function () { if (identity.getUid()) { if (has_buy == "1" || identity.getIsVip()) { $.message({ message: '您已拥有使用本乐谱权限,可直接打印或下载!', type: 'warning' }); } else { var getBalanceListApi = ccgt_domain + "/?urlparam=" + 'home/user/InterfaceGetBalanceList'; $.ajax({ type: "GET", dataType: "json", url: getBalanceListApi, data: { service_type: 'ccgq', platform: 'web-ccgq', service_uid: identity.getServiceUid(), service_key: identity.getServiceKey(), ccgq_uuid: identity.getCcgqUid(), service_type: identity.getServiceType(), uid: identity.getUid(), }, success: function (res) { if (res.returnCode == '0000') { //判断是余额不足 user_balance = res.list.user_balance; if (parseFloat(user_balance) < parseFloat(price) || user_balance == 0) { $('.no-balance').show(); recharge(); } else { buy(); } } else { isCloseTime = false; $.message({ message: res.returnMsg, type: 'error' }); } } }); } } else { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } } }); $('.openvip').click(function () { if (identity.getUid()) { vip(); } else { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } } }); $('.openrecharge').click(function () { if (identity.getUid()) { recharge(); } else { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } } }); function buy() { balance_list = ""; balance_type_index = 0; balance_paytype_data = "3"; isCloseTime = false; initBalanceList('0'); $('.buy-paypal-content').hide(); $('.recharge_box').hide(); $('.vip_recharge_box').hide(); $('.buy_box').show(); $('.dialog_box').addClass('show'); } function vip() { if (!identity.getUid()) { $("body").append(''); return; } if (isMobile()) { window.location.href = "/sheetplayer/ccgq_h5.html"; return; } viplist = ""; simplifiedviplist = ""; vip_type_index = 0; vip_paytype_data = "3"; isCloseTime = false; var userPhoto = identity.getUserphoto(); var userName = identity.getCcUsername(); $('.account_photo').attr('src', userPhoto); $('.account_number').text(userName); if (identity.getIsVip()) { $('.account_desc').text('您的VIP将于' + identity.getVipDte() + '到期,电脑、手机、ipad均可使用~'); } else { $('.account_desc').text("购买会员,电脑、手机、ipad均可畅享高清AI乐谱~"); } loadCourseVipList(); $('.buy_box').hide(); $('.buy-paypal-content').hide(); $('.recharge_box').hide(); $('.vip_recharge_box').show(); $('.dialog_box').addClass('show'); //默认选中支付方式 $('.vip_recharge_box .payment_type li').siblings().removeClass('active '); $('.vip_recharge_box .payment_type li:eq(0)').addClass('active'); $('.vip_recharge_box .payment_type li[data-value="UniPin"]').hide();//隐藏unipin支付 $('.vip_pay_paypal').css('display', 'none'); $('.vip_pay_unipin').css('display', 'none'); $('.vip_pay_unipin_currency').css('display', 'none'); $('.vip_pay_unipin_text').css('display', 'none'); $('.vip_qr_code').css('display', 'initial'); } function recharge() { balance_list = ""; balance_type_index = 0; balance_paytype_data = "3"; isCloseTime = false; initBalanceList('1'); $('.buy_box').hide(); $('.buy-paypal-content').hide(); $('.vip_recharge_box').hide(); $('.recharge_box').show(); $('.dialog_box').addClass('show'); } function payPayPal() { $('.buy_box').hide(); $('.vip_recharge_box').hide(); $('.recharge_box').hide(); $('.buy-paypal-content').show(); $('.dialog_box').addClass('show'); } $('.vip_pay_paypal').click(function (e) { var url = $(this).attr('data-vip-jump-url'); window.open(url); }); $('.balance_pay_paypal').click(function (e) { if ($(this).attr('data-balance-jump-url')) { payPayPal(); payData($(this).attr('data-balance-orderNo'), balance_paytype_data); getOrderState(torder_id, 'balance'); addAnimate(); $('.buy-paypal-box').html(""); } else { } }); //打印 $('.Printing').click(function (e) { if (!isMobile() && (!identity.getUid() || !identity.getIsVip()) && is_pay == '0') { // popup2(); // return; } if (!!window.ActiveXObject || "ActiveXObject" in window) { $.message({ message: 'IE不支持打印,请前往APP查看', type: 'warning' }); $("body").append(''); return } if ((/Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent))) { $.message({ message: 'Safari不支持打印,请前往APP查看', type: 'warning' }); $("body").append(''); return } // 关注公众号弹窗 if (is_show_wechat_code == 1) { // $("body").append(''); //$("body").append(''); // return; } if (identity.getUid()) { if (is_lock_num == 1) { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } return; } if (identity.getIsVip()) { printJS({ printable: pulist, type: 'image', documentTitle: puname + " - 虫虫钢琴网 - 找曲谱 上虫钢" }) } else { vip(); return; } } else { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } } }); //下载 $('.download').click(function (e) { if (!isMobile() && (!identity.getUid() || !identity.getIsVip()) && is_pay == '0') { // popup2(); // return; } if (is_show_wechat_code == 1) { // $("body").append(''); //$("body").append(''); // return; } //判断是否ipad版本,如果是ipad版本,则点击后进入appstore。可调用 ccmusicAppStoreClick 方法 if (identity.getUid()) { if (is_lock_num == 1) { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } return; } if (price > 0) { if (identity.getIsVip()) { download_PuPdf(); } else { vip(); return; } } else { if (pdfUrl) { download_PuPdf(); } else { $.message({ message: '该乐谱暂未提供PDF下载,请尝试下载其他版本', type: 'info' }); } } } else { $("body").append(''); } }); function download_PuPdf() { window.open($('#ai-score').attr('src'), 'ai-score') } //获取零钱 function initBalanceList(type) { var getBalanceListApi = ccgt_domain + "/?urlparam=" + 'home/user/InterfaceGetBalanceList'; $.ajax({ type: "GET", dataType: "json", url: getBalanceListApi, data: { service_type: 'ccgq', platform: 'web-ccgq', service_uid: identity.getServiceUid(), service_key: identity.getServiceKey(), ccgq_uuid: identity.getCcgqUid(), service_type: identity.getServiceType(), uid: identity.getUid(), }, success: function (res) { if (res.returnCode == '0000') { bindUBalance(res.list, type); } else { isCloseTime = false; $.message({ message: res.returnMsg, type: 'error' }); } } }); } function bindUBalance(list, type) { user_balance = list.user_balance; balance_list = list.list_balance; //账户余额 $('.buy_box .account_information').html('我的账户余额:' + user_balance); if (parseFloat(user_balance) < parseFloat(price)) { $('.buy_box .bottom .buy_paypal').html('零钱不足 去充值'); } for (var i = 0; i < balance_list.length; i++) { if (i == balance_type_index) { $('.defalut.set_meal_list li:eq(' + i + ')').addClass("active"); } else { $('.defalut.set_meal_list li:eq(' + i + ')').removeClass("active"); } $('.defalut.set_meal_list li:eq(' + i + ')').attr('data-value', balance_list[i].balance_id); $('.defalut.set_meal_list li:eq(' + i + ')').attr('data-money', balance_list[i].money); $('.defalut.set_meal_list li:eq(' + i + ') p:eq(0)').text("¥" + balance_list[i].money); $('.defalut.set_meal_list li:eq(' + i + ') p:eq(1)').text(balance_list[i].balance + "零钱"); } $('#balance_moneyNum').text(balance_list[balance_type_index].money); if (type == '1') { placeOrderForWallet(balance_list[balance_type_index].balance_id, balance_paytype_data); } } //充值下单 function placeOrderForWallet(balance_id, paytype) { var placeOrderApi = ccgt_domain + "/?urlparam=" + 'pad/order/placeOrder'; $.ajax({ type: "GET", dataType: "json", url: placeOrderApi, data: { service_type: 'ccgq', platform: 'web-ccgq', service_uid: identity.getServiceUid(), service_key: identity.getServiceKey(), ccgq_uuid: identity.getCcgqUid(), service_type: identity.getServiceType(), uid: identity.getUid(), balance_id: balance_id, order_type: "rechange", payment_type: paytype, }, success: function (res) { if (res.returnCode == '0000') { if (paytype == "1001") { bindPlaceOrderInfo(res.order_id, paytype); } else { bindPlaceOrderInfo(res.list, paytype); } } else { isCloseTime = false; $.message({ message: res.returnMsg, type: 'error' }); } } }); } function bindPlaceOrderInfo(list, paytype) { var torder_id; if (paytype == "1001") { torder_id = list; $('.balance_pay_paypal').attr('data-balance-jump-url', res.list.ApprovalLink); $('.balance_pay_paypal').attr('data-balance-orderNo', torder_id); } else { torder_id = list.order_id; var payQRCode = list.qrcode; $('.balance_qr_code').attr('src', payQRCode); payData(torder_id, balance_paytype_data); getOrderState(torder_id, 'balance'); addAnimate(); } } //零钱支付 function placeOrderForCoin(puid) { layer.load(1, { shade: [0.5, '#000'] }); var placeOrderApi = ccgt_domain + "/?urlparam=" + 'pad/order/placeOrder'; $.ajax({ type: "GET", dataType: "json", url: placeOrderApi, data: { service_type: 'ccgq', platform: 'web-ccgq', service_uid: identity.getServiceUid(), service_key: identity.getServiceKey(), ccgq_uuid: identity.getCcgqUid(), service_type: identity.getServiceType(), uid: identity.getUid(), order_type: "opern", item_id: puid, extra: '[{"type_id":"0","value":["个人"]},{"value":["非盈利性教育/学习"],"type_id":"2"},{"value":["365"],"type_id":"3"}]', }, success: function (res) { if (res.returnCode == '0000') { var sorder_id = res.order_id; payData(sorder_id, '1'); getOrderState(sorder_id, 'coin'); addAnimate(); } else { layer.closeAll('loading'); isCloseTime = false; $.message({ message: res.returnMsg, type: 'error' }); } } }); } //获取VIP价格列表 function loadCourseVipList() { var getCourseVipList = ccgt_domain + "/?urlparam=" + 'common/vip/getCourseVipList202210'; $.ajax({ type: "GET", dataType: "json", url: getCourseVipList, data: { platform: 'web-ccgq', ccgq_uuid: identity.getCcgqUid(), service_type: identity.getServiceType(), service_uid: identity.getServiceUid(), service_key: identity.getServiceKey(), vtype: '1023', }, success: function (res) { if (res.returnCode == '0000') { bindCourseVipInfo(res.list); } else { isCloseTime = false; $.message({ message: res.returnMsg, type: 'error' }); } } }); } function bindCourseVipInfo(list) { //默认选中svip setTimeout(function () { $('.check-vip-type .item:eq(0)').click(); }, 200); // svip充值列表 viplist = list[0].sku_list; if (viplist.length > 0) { for (var i = 0; i < viplist.length; i++) { if (i == vip_type_index) { $('.vip.set_meal_list li:eq(' + i + ')').addClass("active"); } else { $('.vip.set_meal_list li:eq(' + i + ')').removeClass("active"); } $('.vip.set_meal_list li:eq(' + i + ')').attr('data-value', viplist[i].vip_id); $('.vip.set_meal_list li:eq(' + i + ')').attr('data-money', viplist[i].price); $('.vip.set_meal_list li:eq(' + i + ') h1:eq(0)').text(viplist[i].name); $('.vip.set_meal_list li:eq(' + i + ') p:eq(0)').html("¥" + viplist[i].price + ""); $('.vip.set_meal_list li:eq(' + i + ') p:eq(1)').text(viplist[i].desc); $('.vip.set_meal_list li:eq(' + i + ') div:eq(1)').text(viplist[i].second_desc); } $('.dialog_box .content .vip_recharge_box .set_meal > ul li:eq(2)').hide(); placeOrderForVip(viplist[0].vip_id, vip_paytype_data); } // vip充值列表 simplifiedviplist = list[1].sku_list; if (simplifiedviplist.length > 0) { for (var i = 0; i < simplifiedviplist.length; i++) { $('.vip.set_meal_list2 li:eq(' + i + ')').attr('data-value', simplifiedviplist[i].vip_id); $('.vip.set_meal_list2 li:eq(' + i + ')').attr('data-money', simplifiedviplist[i].price); $('.vip.set_meal_list2 li:eq(' + i + ') h1:eq(0)').text(simplifiedviplist[i].name); $('.vip.set_meal_list2 li:eq(' + i + ') p:eq(0)').html("¥" + simplifiedviplist[i].price + ""); $('.vip.set_meal_list2 li:eq(' + i + ') p:eq(1)').text(simplifiedviplist[i].desc); $('.vip.set_meal_list2 li:eq(' + i + ') div:eq(1)').text(simplifiedviplist[i].second_desc); } } } //VIP下单 function placeOrderForVip(vip_id, paytype, currency = '', uni_channel = '') { couponList = null; var placeOrderApi = ccgt_domain + "/?urlparam=" + 'pad/order/placeOrderForVip'; $.ajax({ type: "GET", dataType: "json", url: placeOrderApi, data: { service_type: 'ccgq', platform: 'web-ccgq', service_uid: identity.getServiceUid(), service_key: identity.getServiceKey(), ccgq_uuid: identity.getCcgqUid(), service_type: identity.getServiceType(), uid: identity.getUid(), vip_id: vip_id, order_type: "rechange", payment_type: paytype, currency: currency, uni_channel: uni_channel }, beforeSend: function () { layer.load(0, { shade: [0.01, '#fff'] }); }, success: function (res) { layer.closeAll(); if (res.returnCode == '0000') { var order_id = res.list.order_id; if (paytype == "1001") { $('.vip_pay_paypal').attr('data-vip-jump-url', res.list.ApprovalLink); $('.vip_pay_paypal').attr('data-vip-orderNo', order_id); if (check_vip_type == 1) { setPayPrise(viplist); } else { setPayPrise(simplifiedviplist); } getOrderState(order_id, 'vip'); } else if (paytype == "1003") { $('.vip_pay_unipin').attr('data-vip-jump-url', res.list.url); $('.vip_pay_unipin').attr('data-vip-orderNo', order_id); if (check_vip_type == 1) { setPayPrise(viplist); } else { setPayPrise(simplifiedviplist); } getOrderState(order_id, 'vip'); window.open(res.list.url); } else { // 先获取优惠券,在获取payData getCouponList(vip_id, order_id, vip_paytype_data); getOrderState(order_id, 'vip'); addAnimate(); } } else { isCloseTime = false; $.message({ message: res.returnMsg, type: 'error' }); } } }); } //支付接口 function payData(order_id, payment_type) { var payDataApi = ccgt_domain + "/?urlparam=" + 'pay/pay/payData202210'; var coupon_id = 0; if (couponList && couponList.id != undefined) { coupon_id = couponList.id; } $.ajax({ type: "GET", dataType: "json", url: payDataApi, data: { service_type: 'ccgq', platform: 'web-ccgq', service_uid: identity.getServiceUid(), service_key: identity.getServiceKey(), ccgq_uuid: identity.getCcgqUid(), service_type: identity.getServiceType(), uid: identity.getUid(), order_id: order_id, payment_type: payment_type, coupon_id: coupon_id, comefrom:"NATIVE" }, success: function (res) { if (res.returnCode == '0000') { var qrcode = res.list.qrcode; $('.vip_qr_code').attr('src', qrcode); } else { isCloseTime = false; $.message({ message: res.returnMsg, type: 'error' }); } } }); } //查询订单状态 function getOrderState(orderId, orderType) { var placeOrderApi = ccgt_domain + "/?urlparam=" + 'pay/pay/getOrderState'; $.ajax({ type: "GET", dataType: "json", url: placeOrderApi, data: { service_type: 'ccgq', platform: 'web-ccgq', service_uid: identity.getServiceUid(), service_key: identity.getServiceKey(), ccgq_uuid: identity.getCcgqUid(), service_type: identity.getServiceType(), uid: identity.getUid(), order_id: orderId, }, success: function (res) { if (res.returnCode == '0000') { torder_id = orderId; torderType = orderType; if (res.order_state == "3") { var service_uid = identity.getServiceUid(); var service_key = identity.getServiceKey(); var cdb_uid = identity.getCcgqUid(); var service_type = identity.getServiceType(); var uid = identity.getUid(); getMyNewCoupon(service_uid, service_key, cdb_uid, service_type, uid); isCloseTime = false; clearTimeout(animate1); if (orderType == "vip") { $.message({ message: '开通会员成功,畅享会员全部特权', type: 'success' }); setTimeout(function () { location.reload(); }, 3000); } else if (orderType == "balance") { $.message({ message: '充值成功,请使用零钱购买乐谱', type: 'success' }); setTimeout(function () { location.reload(); }, 3000); } else if (orderType == "coin") { layer.closeAll('loading'); $.message({ message: '购买乐谱成功,自动刷新后可预览完整版', type: 'success' }); setTimeout(function () { location.reload(); }, 3000); } //1、提示购买成功 //2、刷新整个曲谱详情界面 } } } }); } var orderstatetime = 60; var isCloseTime = false; var animate1; function getOrderStateTime() { if (!isCloseTime) { orderstatetime = 60; clearTimeout(animate1); return; } if (orderstatetime === 0) { orderstatetime = 60; //return } else { orderstatetime--; } animate1 = setTimeout(function () { getOrderStateTime(); getOrderState(torder_id, torderType); }, 1000) } function addAnimate() { orderstatetime = 60; clearTimeout(animate1); animate1 = setTimeout(function () { isCloseTime = true; getOrderStateTime(); }, 1000) } loadDetailInfo(); function loadDetailInfo() { var loc = $('#Collection').attr('data-opern-id') var loc = loc ? loc : $('.opern_name').attr('data-oid') if (!loc) { return } var channel = ''; if (isMobile()) { channel = 'h5'; } var getBalanceListApi = domain_str + '/home/user/getOpernDetail'; $.ajax({ type: "GET", dataType: "json", url: getBalanceListApi, data: { service_type: 'ccgq', platform: 'web-ccgq', channel: channel, service_uid: identity.getServiceUid(), service_key: identity.getServiceKey(), ccgq_uuid: identity.getCcgqUid(), service_type: identity.getServiceType(), uid: identity.getUid(), id: loc, }, success: function (res) { if (res.returnCode == '0000') { bindDetailInfo(res.list); } else { $.message({ message: res.returnMsg, type: 'error' }); } } }); } function bindDetailInfo(info) { if (!info.play_json) { var tmp_url = window.location.href; tmp_url = tmp_url.replace('jianpu', 'cchtml'); window.location.href = tmp_url; return; } puname = info.name; pid = info.id; has_buy = info.has_buy; is_pay = info.is_pay; pdfUrl = info.pdf; is_lock_num = info.is_lock_num; price = info.sale_price; pulist = info.image_list; collect_num = info.collect_num; hit_num = info.hit_num; total_image_num = info.total_image_num; audition_longtime = info.audition_longtime ? info.audition_longtime / 1000 : 0; audio.init(audition_longtime); $('.d-b-top h2 span:eq(4)').text(hit_num + ' 浏览'); $('.d-b-top h2 span:eq(6)').text(collect_num + ' 收藏'); $('.d-b-top h2 span:eq(10)').text(total_image_num + ' 页'); $('.top_hit_num').text(hit_num + ' 浏览'); $('.top_collect_num').text(collect_num + ' 收藏'); $('.collect-num').text(collect_num); $('.score_details_h5_box .s_d_h_b_item3 .info_box .img img').attr('src', info.author_photo); $('.s-u-b-buy-box .num').html(price); if (price > 0) { if (identity.getIsVip()) { //已是VIP用户 $("#siwper1-middle-play").remove(); if (isMobile()) { $('.to-vip').hide(); $('.to-qupu').show(); } appendWeiperSlide(pulist); } else { //未购买 $(".img-mask").show(); console.log("is_login:") console.log(is_login); if (is_login) { $(".img-mask p span.buy_whole").show(); $(".img-mask p span.load_whole").hide(); } if (isMobile()) { $('.to-vip').show(); $('.to-qupu').hide(); pulist.push('http://music.52jianpu.com/pianomusic/lib/lzjoys201/res/statics/fileupload/84ba877c7e25fc4969cf8b36e729fb83.jpg'); } appendWeiperSlide(pulist, 'no-buy'); } if (identity.getUid()) { if (!identity.getIsVip()) { if ($('#ai-score')[0]) { $('#ai-score').attr('scrolling', 'no'); } $(".opern-detail .s-d-m-b-buy").show(); } if (identity.getIsVip()) { $('.s-u-b-buy-box').css('background-image', 'url("http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/bac4.png")'); $('.s-u-b-buy-box .tips').css('color', 'rgba(255,255,255,.8)'); $('.s-u-b-buy-box .company').css('color', 'rgba(255,255,255,.8)'); $('.s-u-b-buy-box .tips-box').css('color', 'rgba(255,255,255,.8)'); $('.buy-button-box').css('display', 'none'); $('.free-button-box').css('display', 'block'); $('.s-d-m-b-buy').css('display', 'none'); $('.s-d-m-b-blockstyle p:eq(1) span').css('height', 'auto'); $('.s-d-m-b-blockstyle p:eq(1) span').css('max-height', '3.5rem'); } else if (has_buy == "1") { $('.buy-button-box .buy').html("已购买"); $('.buy-button-box .buy').css('border', '1px solid #C5C7C7'); $('.buy-button-box .buy').css('color', '#7C818A'); } } else { if ($('#ai-score')[0]) { $('#ai-score').attr('scrolling', 'no'); } } // //是否AI谱判断 // if (!info.play_json) { // window.location.href = 'http://music.52jianpu.com/pianomusic/cchtml/' + info.id + '.htm'; // } } else { if (identity.getUid()) { if (!identity.getIsVip()) { var yes_close = getCookie('yes_close'); if (yes_close != 1 && !isMobile()) { is_show_wechat_code = 1; } if ($('#ai-score')[0]) { $('#ai-score').attr('scrolling', 'no'); } // 隐藏,免费谱登录后直接可以看 // $(".img-mask span").text('当前为预览页面,前往APP查看全部'); $(".img-mask").hide(); } //免费乐谱 appendWeiperSlide(pulist); } else { var yes_close = getCookie('yes_close'); if (yes_close != 1 && !isMobile()) { is_show_wechat_code = 1; } if ($('#ai-score')[0]) { $('#ai-score').attr('scrolling', 'no'); } // $(".img-mask span").text('当前为预览页面,前往APP查看全部'); $(".img-mask").show(); //免费乐谱 appendWeiperSlide(pulist); } if (isMobile()) { $('.to-vip').hide(); $('.to-qupu').show(); } } //乐谱售卖金额 $('.SingleSale_Price').html(price + ' 虫豆'); } function appendWeiperSlide(list, is_buy = '') { //清楚swiper-wrapper所有图片 $('.swiper-wrapper').empty(); //渲染所有免费乐谱图片 for (var i = 0; i < list.length; i++) { $('.swiper-wrapper').append('
'); } //设置完整乐谱展示 /*$('.score_details_mian .score-utils-box .s-u-body .line-spectrum-box .defalut #scoreSwiper').css('height','15.466667rem'); if(identity.getIsVip()){ }*/ if (is_buy == '') { $('.score_details_mian .score-utils-box .s-u-body .line-spectrum-box .defalut #scoreSwiper').css('height', '15.466667rem'); $('.score_details_mian .score-utils-box .s-u-body .line-spectrum-box .ai iframe').css('height', '15.466667rem'); $('.openbuy').hide(); } swiperInit(); } /**********************单谱销售弹框数据填充**********************/ // 充值 || 支付 $('.buy_paypal').click(function (e) { if (parseFloat(user_balance) < parseFloat(price)) {//充值 recharge(); } else {//支付 //调用零钱支付接口 if (parseInt(pid) > 0) { placeOrderForCoin(pid); } } }); // 评论 $('.a_t_publish_btn').click(function (e) { if (isMobile()) { loadInstall() return } if (!identity.getUid()) { $("body").append(''); return } var opern_id = $('.opern_name').attr('data-oid') if (!opern_id) { return } var content = $('textarea[name=content]').val(); if (!content) { $.message({ message: '请输入评论内容', type: 'warning' }); return } var strlen = getByteLen(content) if (strlen > 100) { $.message({ message: '输入评论不得超过100个字符', type: 'warning' }); return } var addCollectApi = domain_str + '/cginfo/userinfo/usercomment'; $.ajax({ type: "GET", dataType: "json", url: addCollectApi, data: { uid: identity.getUid(), learning_id: opern_id, comment_content: content, comment_id: '', score_num: 5, platform: 'web-ccgq', ccgq_uuid: identity.getCcgqUid() }, dataType: 'json', success: function (res) { if (res.returnCode == '0000') { $('textarea[name=content]').val('') $.message({ message: '评论成功', type: 'success' }); setCommentShowList([res.datas], false) } else { $.message({ message: res.returnMsg, type: 'error' }); } } }); }); // 回复 $('.a_t_comment').on('click', '.reply_btn', function () { event.stopPropagation(); if (!identity.getUid()) { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } return } var that = this if (!identity.getUid()) { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } return } var opern_id = $('.opern_name').attr('data-oid') if (!opern_id) { return } var comment_id = $(that).parents('li').attr('data-comment-id') if (!comment_id) { return } var content = $(that).parents('li').find('input').val() if (!content) { $.message({ message: '请输入评论内容', type: 'warning' }); return } var strlen = getByteLen(content) if (strlen > 100) { $.message({ message: '输入评论不得超过100个字符', type: 'warning' }); return } var addCollectApi = domain_str + '/cginfo/userinfo/usercomment'; $.ajax({ type: "GET", dataType: "json", url: addCollectApi, data: { uid: identity.getUid(), learning_id: opern_id, comment_content: content, comment_id: comment_id, score_num: 5, platform: 'web-ccgq', ccgq_uuid: identity.getCcgqUid() }, dataType: 'json', success: function (res) { if (res.returnCode == '0000') { $.message({ message: '回复成功', type: 'success' }); reply(that) } else { $.message({ message: res.returnMsg, type: 'error' }); } } }); }) function ccmusicAppStoreClick() { var m = this; if (navigator.userAgent.match(/(iPad);?/i)) { window.location.href = "http://apps.apple.com/us/app/chong-chong-gang-qin/id1080634885?l=zh&ls=1"; return false; } else { m.wakeupOrInstall(); return false; } } function addDownload(opern_id = 0) { if (!opern_id) { $.message({ message: '该曲谱找不到了', type: 'error' }); return; } var getBalanceListApi = domain_str + '/home/shortvideo/addDownload'; $.ajax({ type: "GET", dataType: "json", url: getBalanceListApi, data: { service_type: 'ccgq', platform: 'web-ccgq', service_uid: identity.getServiceUid(), service_key: identity.getServiceKey(), ccgq_uuid: identity.getCcgqUid(), service_type: identity.getServiceType(), uid: identity.getUid(), orginal_key: opern_id, orginal_type: 2, }, success: function (res) { if (res.returnCode == '0000') { $.message({ message: '已下载,请在个人中心查看', type: 'success' }); $('.play-down').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/public/web_static/images/score_details/play-down-active.png'); } else { $.message({ message: res.returnMsg, type: 'error' }); } } }); } //popupVip(); function popupVip() { if (isMobile() && !identity.getIsVip()) { $("body").append(''); } } $('.to-vip').click(function () { if (!identity.getUid()) { $("body").append(''); return; } window.location.href = "/sheetplayer/ccgq_h5.html"; return; }); //陪练 var ladder_player_time = null; $('.ladder-player01').click(function () { $('.img_type').hide(); $('.ai_type').hide(); $('.pl').show(); ladder_player_time = setTimeout(function () { $("body").append(''); }, 5000); }); $('.plmain').click(function () { clearTimeout(ladder_player_time); $("body").append(''); }); //全屏 $('.to-qupu').click(function () { if (!identity.getUid()) { $("body").append(''); return; } if (is_lock_num == 1) { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } return; } if (price > 0) { if (has_buy == "1" || identity.getIsVip()) { $('#scoreSwiper2').addClass('full-screen'); $('.close-full-screen').show(); } else { vip(); return; } } else { $('#scoreSwiper2').addClass('full-screen'); $('.close-full-screen').show(); } }) $('.close-full-screen').click(function () { $('#scoreSwiper2').removeClass('full-screen'); $('.close-full-screen').hide(); }) //下载 $('.play-down').click(function () { if (!identity.getUid()) { $("body").append(''); return; } if (is_lock_num == 1) { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } return; } var opern_id = $('.opern_name').attr('data-oid'); if (price > 0) { if (has_buy == "1" || identity.getIsVip()) { addDownload(opern_id); } else { vip(); return; } } else { addDownload(opern_id); } }) //打印 $('.play-print').click(function () { if (!identity.getUid()) { $("body").append(''); return; } if (is_lock_num == 1) { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } return; } if (price > 0) { if (has_buy == "1" || identity.getIsVip()) { $('.play-print').attr('data-clipboard-text', pdfUrl); var clipboard = new Clipboard('.play-print'); clipboard.on('success', function (e) { $.message({ message: '已复制PDF地址,请在浏览器打开进行打印', type: 'success' }); }); clipboard.on('error', function (e) { window.location.href = pdfUrl; }); } else { vip(); return; } } else { if (pdfUrl) { $('.play-print').attr('data-clipboard-text', pdfUrl); var clipboard = new Clipboard('.play-print'); clipboard.on('success', function (e) { $.message({ message: '已复制PDF地址,请在浏览器打开进行打印', type: 'success' }); }); clipboard.on('error', function (e) { window.location.href = pdfUrl; }); } else { $.message({ message: '该乐谱暂未提供PDF下载,请尝试下载其他版本', type: 'error' }); } } }) //五线谱/简谱切换 $('.play-jianpu').click(function () { window.location.href = "/cchtml/" + new_opern_id + '.htm'; }) //分享 $('.s_d_shareBtn').click(function () { popup2(); return; //$('#c_d_dialog').show(); $("body").append(''); }); //弹窗隐藏 /*$("#c_d_dialog").click(function (event) { $('#c_d_dialog').hide(); $('.share_p_box_o').show(); $('.c_d_qr_code_box').hide() });*/ $(".closeBtn").click(function (event) { $('#c_d_dialog').hide(); $('.share_p_box_o').show(); $('.c_d_qr_code_box').hide() }); $('.share_toWO').click(function () { var title = $('.spectrum_details_left_detail_title span').text(); title = title ? title : '虫虫钢琴网'; shareModel.sinaWeiBo(title, window.location.href); }) $('.share_toQQ').click(function () { var title = $('.spectrum_details_left_detail_title span').text(); title = title ? title : '虫虫钢琴网'; shareModel.shareQQ(window.location.href, title, ''); }) $('.share_toQQKJ').click(function () { var title = $('.spectrum_details_left_detail_title span').text(); title = title ? title : '虫虫钢琴网'; shareModel.shareQQZone(window.location.href, title, ''); }) $('.share_toWX').click(function () { shareModel.weixin(); $('.share_p_box_o').css('display', 'none'); $('.c_d_qr_code_box').css('display', 'block') }) $('.comment-box').on('click', '.dz_box', function () { if (isMobile()) { $("body").append(''); return } $("body").append(''); }) if ($(window).width() < 1000) { $('.score_details_mian_box .audio-source-box').remove() } else { $('.s_d_h_b_item1 ').remove() } // 开始播放 $('#audio_play').click(function (e) { //audio.play(audition_longtime) }) // 暂停 $('#audio_pause').click(function (e) { //audio.pause() }) // 停止 $('#audio_reset').click(function (e) { //audio.stop() }) // H5开始播放 $('#play_botton').click(function (e) { addhit(2000005) if ($('.play-jianpu').hasClass('active')) { //AI谱模式 if (!newH5Window.Player) { $.message({ message: 'AI曲谱还在加载中哟~', type: 'warning' }); return } $('#play_botton').toggleClass('active') if (newH5Window.Player.isPlayerReady()) { if (identity.getUid()) { if (identity.getIsVip()) { newH5Window.Player.setLocked(false); } else { newH5Window.Player.setLocked(true); } //是否正在播放 newH5Window.Player.playOrPause(); if (newH5Window.Player.isPlaying()) { if (!identity.getIsVip()) { $.message({ message: '仅限VIP会员使用,开通VIP畅享全场AI谱练习模式', type: 'info' }); } } } else { newH5Window.Player.setLocked(true); if (isMobile()) { $("body").append(''); } else { $("body").append(''); } } } } else { //音频模式 $('#play_botton').toggleClass('active') if ($('#play_botton').hasClass('active')) { audio.play(audition_longtime); } else { audio.pause(); } } }) // H5开始播放[ai陪练] $('#play_botton1').click(function (e) { addhit(2000005) $(this).toggleClass('active') if ($(this).hasClass('active')) { audio.play(audition_longtime); if (!adv_time) { adv_time = setTimeout(function () { $("body").append(''); }, 3000); } } else { audio.pause(); } }) // H5开始播放[瀑布流] $('#play_botton2').click(function (e) { addhit(2000005) $(this).toggleClass('active') if ($(this).hasClass('active')) { audio.play(audition_longtime); if (!adv_time) { adv_time = setTimeout(function () { $("body").append(''); }, 3000); } } else { audio.pause(); } }) // AI播放 $('.play_botton_ai').click(function (e) { if (!newWindow.Player) { $.message({ message: 'AI曲谱还在加载中哟~', type: 'warning' }); return } addhit(2000004) $(this).toggleClass('active') if (newH5Window.Player.isPlayerReady()) { newH5Window.Player.setLocked(true); newH5Window.Player.playOrPause(); if (!adv_time_ai) { adv_time_ai = setTimeout(function () { $("body").append(''); }, 6000); } } }) $('.score_details_h5_box a').click(function (e) { addhit(2000002) loadInstall() return }) $('.score_details_h5_box .uitls_box .right').click(function (e) { addhit(2000003) loadInstall() return }) $('.info_box .name a').click(function (e) { addhit(2000006) }) $('.info_box .name2 a').click(function (e) { addhit(2000007) }) $('.types_box a:eq(0)').click(function (e) { addhit(2000008) }) $('.types_box a:eq(0)').click(function (e) { addhit(2000009) }) // 加载评论 $('.more-box a').click(function () { $(this).html('加载中...') comment_timer = setTimeout(function () { $(this).html('查看更多') }, 1000); loadComment(comment_page) }) $('ul.tabs-box').click(function (e) { $('#play_botton').removeClass('active') $('.play_botton_ai').removeClass('active') audio.pause() if (newH5Window.Player.isPlayerReady()) { newH5Window.Player.setLocked(true); newH5Window.Player.pausePlay(); } }) loadPlaydoing() function loadPlaydoing() { $('.type-switch .defalut').before('
AI陪练
'); $('.s-u-b-buy-box .tips-box').after('
新用户下载app,注册即送70元红包
'); } $(".type-switch-play").on('click', function (e) { e.stopPropagation(); $("body").append(''); }); $(".ladder-player").on('click', function (e) { e.stopPropagation(); $("body").append(''); }); $('.s-d-m-b-blockstyle .more').on('click', function (e) { $('.opern-introduce').css({ "height": "auto" }); $('.opern-introduce').css({ "overflow": "auto" }); $('.opern-introduce').css({ "-webkit-line-clamp": "inherit" }); $('.opern-introduce').css({ "-webkit-box-orient": "inherit" }); $(this).hide(); }); $(".img-mask").on('click', function (e) { if (price <= 0) { // popup2(); // return; } $(".openvip").click(); }); $(".ai-btn").on('click', function (e) { if (!!window.ActiveXObject || "ActiveXObject" in window) { $.message({ message: 'IE不支持AI模式,请前往APP查看', type: 'warning' }); $("body").append(''); return } $(this).toggleClass('active'); swiperInit(); $('#line-spectrum-box').toggleClass('active'); audio.stop(); $('#audio_play').css('display', 'block'); $('#audio_pause').css('display', 'none'); puType = "1"; $('.audio_ai_utils').css('display', 'flex'); $('.audio_mp3_utils').css('display', 'none'); $('.img-btn').css('right', '.25rem'); $('.jianpu-btn').css('right', '.75rem'); $('.ladder-player').css('right', '1.25rem'); $('.tool-tab-box').css('width', '58.3333%'); $(this).hide(); $('.tool-tab-box-m').hide(); $('.s_d_fullBtn').hide(); $('.tool-audio-box span').hide(); $('.img-btn').show(); $('.tool-tab-box-m-bak').show(); }); $(".img-btn").on('click', function (e) { $(this).toggleClass('active'); swiperInit(); $('#line-spectrum-box').toggleClass('active'); audio.stop(); $('#audio_play').css('display', 'block'); $('#audio_pause').css('display', 'none'); puType = "0"; $('.audio_ai_utils').css('display', 'none'); $('.audio_mp3_utils').css('display', 'flex'); $('.ladder-player').css('right', '1.75rem'); $('.jianpu-btn').css('right', '1.25rem'); $('.img-btn').css('right', '.9rem'); $('.tool-tab-box').css('width', '33.333333%'); $(this).hide(); $('.tool-tab-box-m-bak').hide(); $('.tool-tab-box-m').show(); $('.s_d_fullBtn').show(); $('.ai-btn').show(); $('.tool-audio-box span').show(); $('.ladder-player').show(); if (newWindow.Player.isPlayerReady()) { newWindow.Player.resetPlay(); } }); $('.jianpu-btn').on('click', function (e) { if (!isMobile() && (!identity.getUid() || !identity.getIsVip()) && is_pay == '0') { popup2(); return; } window.open("/cchtml/" + new_opern_id + '.htm'); }); // 全屏 const element = document.getElementById('line-spectrum-box'); document.getElementById('s_d_fullBtn').addEventListener('click', function () { if (!isMobile() && (!identity.getUid() || !identity.getIsVip()) && is_pay == '0') { popup2(); return; } if (!!window.ActiveXObject || "ActiveXObject" in window) { $.message({ message: 'IE不支持全屏,请前往APP查看', type: 'warning' }); $("body").append(''); return } if (!identity.getUid()) { if (is_lock_num == 1) { if (isMobile()) { $("body").append(''); } else { $("body").append(''); } return; } if (isMobile()) { $("body").append(''); } else { $("body").append(''); } return; } if (!identity.getIsVip()) { vip(); return; } if (element.requestFullscreen) { element.requestFullscreen(); } else if (element.mozRequestFullScreen) { element.mozRequestFullScreen(); } else if (element.webkitRequestFullscreen) { element.webkitRequestFullscreen(); } else if (element.msRequestFullscreen) { element.msRequestFullscreen(); } }); // 退出全屏 $(".type-switch-play").on('click', function (e) { if (element.exitFullscreen) { element.exitFullscreen(); } else if (element.mozCancelFullScreen) { element.mozCancelFullScreen(); } else if (element.webkitCancelFullScreen) { element.webkitCancelFullScreen(); } else if (element.msCancelFullScreen) { element.msCancelFullScreen(); } }); var fullarr = ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange']; for (var i = 0; i < fullarr.length; i++) { var item = fullarr[i]; window.addEventListener(item, function (e) { if (!screenfull.isFullscreen) { //推出全屏 $('.line-spectrum-box').css({ "padding": "0 .266667rem", "padding-bottom": ".266667rem" }); $('.ai').css({ "height": "inherit" }); $('#ai-score').css({ "height": "9.07rem !important", "width": "100%", "margin": "0" }); } else { //点击全屏 $('.line-spectrum-box').css({ "padding": "0", "padding-bottom": "0" }); $('.ai').css({ "height": "100%" }); $('#ai-score').css({ "height": "100% !important", "width": "50%", "margin": "0 auto" }); } }); } $('.ladder-player').pt({ position: 'b', content: 'AI陪练', width: 70, align: 'c', }); $('.ai-btn').pt({ position: 'b', content: 'AI模式', width: 70, align: 'c', }); $('.img-btn').pt({ position: 'b', content: '图片模式', width: 80, align: 'c', }); $('.s_d_fullBtn').pt({ position: 'b', content: '全屏', width: 60, align: 'c', }); $('#ai-cycle').pt({ position: 'b', content: '循环', width: 60, align: 'c', }); $('#ai-metronome').pt({ position: 'b', content: '节拍器', width: 70, align: 'c', }); $('#ai-bothhands').pt({ position: 'b', content: '合手', width: 60, align: 'c', }); $('#ai-WaterfallFlow').pt({ position: 'b', content: '瀑布流', width: 70, align: 'c', }); $('#ai-speed-plus').pt({ position: 'b', content: '加速', width: 60, align: 'c', }); $('#ai-speed-reduce').pt({ position: 'b', content: '减速', width: 60, align: 'c', }); $('.jianpu-btn').pt({ position: 'b', content: '五线谱', width: 70, align: 'c', }); $('#ai-c').pt({ position: 'b', content: '固定调', width: 70, align: 'c', }); $("#disabledSelect").change(function () { var currency = $(this).val(); setVipPrise(currency); setPayChannel(currency); if (check_vip_type == 1) { setPayPrise(viplist); } else { setPayPrise(simplifiedviplist); } }); function setVipPrise(currency = '') { if (currency) { var rate = 0; var is_float = true; for (var i = 0; i < currencyCodeList.length; i++) { if (currencyCodeList[i].code == currency) { rate = currencyCodeList[i].rate; is_float = currencyCodeList[i].is_float; } } if (rate <= 0) { $.message({ message: '汇率获取失败', type: 'warning' }); return; } if (check_vip_type == 1) { $('.vip_recharge_box .set_meal_list > ul li').each(function () { var index = $(this).index(); if (viplist[index]) { if (is_float == true) { var price = accDiv(viplist[index].price, rate); var price = Math.ceil(price * 100) / 100; } else { var price = accDiv(viplist[index].price, rate); var price = Math.ceil(price * 1) / 1; } $(this).find('p.num1').html('' + price + '(' + currency + ')'); $(this).find('p.num2').html(''); $(this).find('.tips').css('display', 'none'); $(this).find('.line').css('display', 'none'); $(this).find('p.num1').css('margin-top', '0.2rem'); $(this).find('p.num1 span').css('font-size', '.213333rem'); } }); } else { $('.vip_recharge_box .set_meal_list2 > ul li').each(function () { var index = $(this).index(); if (simplifiedviplist[index]) { if (is_float == true) { var price = accDiv(simplifiedviplist[index].price, rate); var price = Math.ceil(price * 100) / 100; } else { var price = accDiv(simplifiedviplist[index].price, rate); var price = Math.ceil(price * 1) / 1; } $(this).find('p.num1').html('' + price + '(' + currency + ')'); $(this).find('p.num2').html(''); $(this).find('.tips').css('display', 'none'); $(this).find('.line').css('display', 'none'); $(this).find('p.num1').css('margin-top', '0.2rem'); $(this).find('p.num1 span').css('font-size', '.213333rem'); } }); } } else { if (check_vip_type == 1) { $('.vip_recharge_box .set_meal_list > ul li').each(function () { var index = $(this).index(); if (viplist[index]) { var price = viplist[index].price; $(this).find('p.num1').html('¥' + price + ''); $(this).find('p.num2').html(viplist[index].desc); $(this).find('.tips').css('display', 'block'); $(this).find('.line').css('display', 'block'); $(this).find('p.num1').css('margin-top', '0'); $(this).find('p.num1 span').css('font-size', '.413333rem'); } }); } else { $('.vip_recharge_box .set_meal_list > ul li').each(function () { var index = $(this).index(); if (simplifiedviplist[index]) { var price = simplifiedviplist[index].price; $(this).find('p.num1').html('¥' + price + ''); $(this).find('p.num2').html(simplifiedviplist[index].desc); $(this).find('.tips').css('display', 'block'); $(this).find('.line').css('display', 'block'); $(this).find('p.num1').css('margin-top', '0'); $(this).find('p.num1 span').css('font-size', '.413333rem'); } }); } } } function setPayChannel(currency = '') { var unipinPayChannel = ccgt_domain + '/?urlparam=common/vip/unipinPayChannel'; $.ajax({ type: "GET", dataType: "json", url: unipinPayChannel, data: { service_type: 'ccgq', platform: 'web-ccgq', service_uid: identity.getServiceUid(), service_key: identity.getServiceKey(), ccgq_uuid: identity.getCcgqUid(), service_type: identity.getServiceType(), uid: identity.getUid(), currency_code: currency, }, beforeSend: function () { layer.load(0, { shade: [0.01, '#fff'] }); }, success: function (res) { layer.closeAll(); if (res.returnCode == '0000') { var channelList = res.list; $('.vip_pay_unipin ul').empty(); for (var i = 0; i < channelList.length; i++) { var item = res.list[i]; $('.vip_pay_unipin ul').append("
  • " + item.name + " 结账
  • "); } } else { $.message({ message: res.returnMsg, type: 'error' }); } } }); } //unipin下单 $(document).on('click', '.vip_pay_unipin ul li', function () { var channelCode = $(this).attr('data-code'); var currency = $('#disabledSelect').val(); if (check_vip_type == 1) { placeOrderForVip(viplist[vip_type_index].vip_id, vip_paytype_data, currency, channelCode); } else { placeOrderForVip(simplifiedviplist[vip_type_index].vip_id, vip_paytype_data, currency, channelCode); } }); function setPayPrise(tmpviplist) { $('.money .num1').hide(); if (check_vip_type == 1) { var h = $('.vip_recharge_box .set_meal_list li.active .num1').html(); } else { var h = $('.vip_recharge_box .set_meal_list2 li.active .num1').html(); } if (couponList) { h = '¥' + couponList.goods_show_price; if (couponList.discount_price_desc > 0) { $('.money .num1').show(); $('.money .num1').text("已优惠¥" + couponList.discount_price_desc); } } else { var prise = tmpviplist[vip_type_index].price; h = '¥' + prise; $('.money .num1').hide(); } $('#vipMoneyNum').html(h); } $('.problem span').click(function (params) { $("body").append(''); }) $('.error-top').click(function (params) { $("body").append(''); }) function getCouponList(vip_id, order_id, vip_paytype_data) { var getMyCouponList = domain_str + '/pay/pay/GetGoodsPayInfo'; $.ajax({ type: "GET", dataType: "json", url: getMyCouponList, data: { service_type: 'ccgq', platform: 'web-ccgq', service_uid: identity.getServiceUid(), service_key: identity.getServiceKey(), ccgq_uuid: identity.getCcgqUid(), service_type: identity.getServiceType(), uid: identity.getUid(), vip_id: vip_id }, success: function (res) { if (res.returnCode == '0000') { couponList = res.datas.list.length > 0 ? res.datas.list[0] : null; if (couponList) { if (couponList.vtype == '10002') { $('.coupon .right p label').text(couponList.title + ' ¥' + couponList.discount_price_desc + ' 红包'); } else { $('.coupon .right p label').text(couponList.title + ' ¥' + couponList.discount_price_desc + ' 红包'); setCookie('ccgq_new_coupon', 0); } $('.coupon .right p span').text('有效期至:' + couponList.expire_time); $('.coupon').show(); $('.payment').css('margin-top', '.166667rem'); } else { $('.coupon').hide(); $('.payment').css('margin-top', '0.5rem'); setCookie('ccgq_new_coupon', 0); } if (check_vip_type == 1) { setPayPrise(viplist); } else { setPayPrise(simplifiedviplist); } payData(order_id, vip_paytype_data); } } }); } function timeFn(dateBegin) { //获取过期时间差 dateBegin = dateBegin.replace(/-/g, "/"); var dateEnd = new Date(); var dateBegin = new Date(dateBegin); var dateDiff = dateBegin.getTime() - dateEnd.getTime(); var dayDiff = Math.floor(dateDiff / (24 * 3600 * 1000)); var leave1 = dateDiff % (24 * 3600 * 1000); var hours = Math.floor(leave1 / (3600 * 1000)); hours = hours < 10 ? '0' + hours : hours; //计算相差分钟数 var leave2 = leave1 % (3600 * 1000); var minutes = Math.floor(leave2 / (60 * 1000)); minutes = minutes < 10 ? '0' + minutes : minutes; //计算相差秒数 var leave3 = leave2 % (60 * 1000); var seconds = Math.round(leave3 / 1000); seconds = seconds < 10 ? '0' + seconds : seconds; var timeFn = hours + ":" + minutes + ":" + seconds; return timeFn; } $('.top-print').click(function (e) { addhit(2000003) loadInstall() return }) $('.top-down').click(function (e) { addhit(2000003) loadInstall() return }) //SVIP $('.check-vip-type .item:eq(0)').click(function (e) { check_vip_type = 1; $(this).find('img').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/res/statics/fileupload/b8569a8031af6a7448bb3a0c34040546.png'); $('.check-vip-type .item:eq(1) img').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/res/statics/fileupload/12474d48f0cb95eca20f04cd662c914c.png'); $('#vip_recharge_box .set_meal_list').css('display', 'flex'); $('#vip_recharge_box .set_meal_list2').css('display', 'none'); $('#vip_recharge_box .set_meal_list li:eq(0)').click(); if (simplifiedviplist.length > 0) { for (var i = 0; i < simplifiedviplist.length; i++) { $('.vip.set_meal_list2 li:eq(' + i + ')>span').css('display', 'none') } } for (var i = 0; i < viplist.length; i++) { if (viplist[i].icon != undefined && viplist[i].icon != '') { $('.dialog_box .content .vip_recharge_box .set_meal>ul li:eq(' + i + ')>span').css('background-image', 'url(' + viplist[i].icon + ')') $('.dialog_box .content .vip_recharge_box .set_meal>ul li:eq(' + i + ')>span').css('width', '1.27rem') $('.dialog_box .content .vip_recharge_box .set_meal>ul li:eq(' + i + ')>span').css('display', 'block') } else { $('.dialog_box .content .vip_recharge_box .set_meal>ul li:eq(' + i + ')>span').css('display', 'none') } } }) //VIP $('.check-vip-type .item:eq(1)').click(function (e) { check_vip_type = 0; $(this).find('img').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/res/statics/fileupload/1d31b465ad5c7ba0957120c297632d9a.png'); $('.check-vip-type .item:eq(0) img').attr('src', 'http://music.52jianpu.com/pianomusic/lib/lzjoys201/res/statics/fileupload/0e6facb795dda6e28058123d1b0cf2a3.png'); $('#vip_recharge_box .set_meal_list').css('display', 'none'); $('#vip_recharge_box .set_meal_list2').css('display', 'flex'); $('#vip_recharge_box .set_meal_list2 li:eq(0)').click(); for (var i = 0; i < viplist.length; i++) { $('.dialog_box .content .vip_recharge_box .set_meal>ul li:eq(' + i + ')>span').css('display', 'none') } if (simplifiedviplist.length > 0) { for (var i = 0; i < simplifiedviplist.length; i++) { if (simplifiedviplist[i].icon != undefined && simplifiedviplist[i].icon != '') { $('.dialog_box .content .vip_recharge_box .set_meal_list2 > li:eq(' + i + ') > span').css('background-image', 'url(' + simplifiedviplist[i].icon + ')') $('.dialog_box .content .vip_recharge_box .set_meal_list2 > li:eq(' + i + ') > span').css('width', '1.27rem') $('.dialog_box .content .vip_recharge_box .set_meal_list2 > li:eq(' + i + ') > span').css('display', 'block') } else { $('.dialog_box .content .vip_recharge_box .set_meal_list2 > li:eq(' + i + ') > span').css('display', 'none') } } } }) $("#siwper1-middle-play").on("click", function () { // audio.play(audition_longtime); // $(".music-play").trigger("click"); music_play(); $(this).remove(); }); })();