//关闭弹框 function closePop() { $(".mask").hide(); $(".pop").hide(); } //下载 var download_lock = 1, download_lock1 = 1; $(".download_btn[data-name='download']").on("click", function () { var _num = $(this).data('price'); var aid = $(this).data('aid'); if (!islogin) { window.location.href="/joefy/mphjo/joefy"; return false; } if (download_lock == 1) { $.ajax({ type: "post", url: "/index/consume/download_link", data: { "aid": aid }, beforeSend: function () { download_lock = 0; }, success: function (data) { var status = data.status; var msg = data.msg; var list = data.list; var price = data.price; var remain = data.remain; //未购买 if (status == 0) { if (remain < price) { layer.open({ title: "下载提示", content: '您账户的像素不足,点击确认前往充值。', btn: ["确认", "取消"], btnAlign: "c", closeBtn: true, yes: function () { location.href="/joefy/sfdibshf/joefy"; }, }); } else { layer.open({ title: "下载提示", content: '
使用专线下载需要 ' + _num + ' 像素,请确认。
', btn: ["确认", "取消"], btnAlign: "c", yes: function () { determineDown(aid) }, }); } } else { layer.open({ title: "下载提示", content: '您购买过此资源,本次下载无需再次消费。', btn: ["确认", "取消"], btnAlign: "c", yes: function () { show_vip_download_links(aid, list) return true; }, }); } download_lock = 1; }, error: function () { download_lock = 1; msgBox.show("网络错误请重试", msgBox.warn); } }); } }); /** * 音频点击 */ let audio_down_lock = 1; $(".download_btn[data-name='download2']").on("click", function () { switch ($(this).data('state')) { case 1: // 下载音频 if (audio_down_lock !== 1) return false; if (!islogin) { window.location.href="/joefy/mphjo/joefy"; return false; } let _num = $(this).data('price'); $.ajax({ type: "post", url: "/index/consume/download_link", data: { aid: aid, type: 1, }, beforeSend: function () { audio_down_lock = 0; }, success: function (data) { var status = data.status; var msg = data.msg; var list = data.list; var price = data.price; var remain = data.remain; //未购买 if (status == 0) { if (remain < price) { layer.open({ title: "下载提示", content: '您账户的像素不足,点击确认前往充值。', btn: ["确认", "取消"], btnAlign: "c", closeBtn: true, yes: function () { location.href="/joefy/sfdibshf/joefy"; }, }); } else { layer.open({ title: "下载提示", content: '下载去水印版音频需要 ' + _num + ' 像素,请确认。
', btn: ["确认", "取消"], btnAlign: "c", yes: function () { determineDown(aid, 1) }, }); } } else { layer.open({ title: "下载提示", content: '您购买过此资源,本次下载无需再次消费。', btn: ["确认", "取消"], btnAlign: "c", yes: function () { show_vip_download_links(aid, list, 1) return true; }, }); } audio_down_lock = 1; }, error: function () { audio_down_lock = 1; msgBox.show("网络错误请重试", msgBox.warn); } }); break; case 2: case 4: // 申请音频去水印 window.open('/peiyue/', '_blank') // let _html = ''; // $(".mask").show(); // $("body").append(_html); break; } }); let audio_askfor_lock = 0; /** * 申请音频去水印 * * @param aid */ function askfor(aid) { if (audio_askfor_lock === 1) return; audio_askfor_lock = 1; $.ajax({ type: "post", url: "/index/ajax/audio_askfor", data: { "aid": aid }, success: function (data) { audio_askfor_lock = 0; if (data.status == 0) { msgBox.show(data.msg, msgBox.warn); } else { msgBox.show(data.msg, msgBox.success, 2000); setTimeout("closePop()", 2000); } }, error: function () { audio_askfor_lock = 0; msgBox.show("网络错误请重试", msgBox.warn); } }); } //展示下载链接 function show_vip_download_links(aid, links, type) { let cont = ""; type = type || 0; let title = '专线'; let key = 'vip'; if (type == 1) { title = '音频'; key = 'audio'; } console.log('links', links) if(links.length == 1){ stat_vip_download(aid,`${links[0]}`, type) return; } var content_html = ''; links.map((item, index) => { content_html += ` ${title}下载通道${index+1} `; }) layer.open({ title: "下载提示", content: `