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 = '