function closePop() { $(".mask").hide(); $(".pop").hide(); } // 收藏 let favlock = 1; function ex1_fav(obj, aid, detail) { if (!islogin) { window.location.href="/joefy/mphjo/joefy"; return false; } let type = $(obj).data('fav') == 1 ? 2 : 1; if (favlock === 1) { $(".mask").show(); msgBox.show('请稍候……', msgBox.warn); $.ajax({ type: "post", url: "/index/ajax/handle_stow", data: { "aid": aid, "type": type, }, beforeSend: function () { favlock = 0; }, success: function (data) { let status = data.status, msg = data.msg; if (status == 1) { msgBox.show(msg, msgBox.ok); closePop(); } else { msgBox.show(msg, msgBox.warn); } favlock = 1; if (type == 1) { $(obj).data('fav', 1) if (detail) { $(obj).html('已收藏'); } else { $(obj).addClass('collected'); } } else { $(obj).data('fav', 0) if (detail) { $(obj).html('收藏'); } else { $(obj).removeClass('collected'); } } }, error: function () { favlock = 1; msgBox.show("网络错误请重试", msgBox.warn); } }); } } // 下载 let dllock = 1, dllock1 = 1; function ex1_down(aid) { if (!islogin) { window.location.href="/joefy/mphjo/joefy"; return false; } if (dllock == 1) { $.ajax({ type: "post", url: "/index/ex1/get_down_link", data: { "aid": aid }, beforeSend: function () { dllock = 0; }, success: function (data) { let html = ''; switch (data.code) { case 403: // 未购买 _html = '

下载提示关闭

' + data.msg + '

取消确定

'; $(".mask").show(); $("body").append(_html); break; case 401: // 余额不足 _html = '

下载提示关闭

您账户的像素不足,点击确认前往充值。

取消确定

'; $(".mask").show(); $("body").append(_html); break; case 0: // 正常 window.open(data.data.link); break; default: msgBox.show(data.msg, msgBox.warn); } dllock = 1; }, error: function () { dllock = 1; msgBox.show("网络错误请重试", msgBox.warn); } }); } } // 购买 function ex1_buy(aid) { if (dllock1 == 1) { $.ajax({ type: "post", url: "/index/consume/download_consume", data: { aid: aid, type: 0, }, beforeSend: function () { dllock1 = 0; }, success: function (data) { var status = data.status, list = data.list, msg = data.msg; $(".mask").hide(); $(".download_pop").hide(); if (status == 1) { window.open(list[0]); } else { msgBox.show(msg, msgBox.warn); } dllock1 = 1; }, error: function () { dllock1 = 1; msgBox.show("网络错误请重试", msgBox.warn); } }); } } //报错 var errors_lock = 1; $(".report[data-name = 'report']").on("click", function () { if (!islogin) { window.location.href="/joefy/mphjo/joefy"; return false; } var _this = $(this); var aid = $(this).attr("data-aid"); var _html = '

提交错误关闭

提交
'; if ($(".errors_pop").length > 0) { $(".mask").show(); $(".errors_pop").show(); } else { $(".mask").show(); $("body").append(_html); } }); function error(aid) { var aid = aid; var type = $(".errors_pop select option:selected").attr("data-type"); var content = $(".errors_pop textarea").val(); if (errors_lock == 1) { if (content.length < 1) { msgBox.show("请输入举报内容", msgBox.warn); return false; } $.ajax({ type: "post", dataType: "json", url: "/index/ajax/handle_report", data: { "aid": aid, "type": type, "content": content }, beforeSend: function () { errors_lock = 0; }, success: function (data) { var status = data.status, msg = data.msg; if (status == 1) { $(".mask").hide(); $(".errors_pop").hide(); $(".errors_pop textarea").val(""); msgBox.show(msg, msgBox.ok); } else { msgBox.show(msg, msgBox.warn); } errors_lock = 1; }, error: function () { errors_lock = 1; msgBox.show("网络错误请重试", msgBox.warn); } }); } }