//关闭删除弹框
function delPop() {
$(".mask").hide();
$(".pop").remove();
}
//个人页内容列表删除评论功能
var comment_lock = 1;
function delCommentPop(obj) {
if (!islogin) {
window.location.href="/joefy/mphjo/joefy";
return false;
}
var cid = $(obj).attr("data-cid");
var _html = '
删除提示 ';
$(".mask").show();
$("body").append(_html);
}
function delComment(cid, obj) {
if (comment_lock == 1) {
$.ajax({
type: "post",
url: "/index/comment/comment_del",
data: {"cid": cid},
dataType: "json",
beforeSend: function () {
comment_lock = 0;
},
success: function (data) {
var status = data.status,
msg = data.msg;
if (status == 1) {
msgBox.show(msg, msgBox.ok);
delPop();
setTimeout(function () {
window.location.reload();
},1000)
} else {
msgBox.show(msg, msgBox.warn);
}
comment_lock = 1;
},
error: function () {
comment_lock = 1;
msgBox.show("网络错误请重试", msgBox.warn);
}
});
}
}
//个人页内容列表删除作品功能
var content_lock = 1;
function delContentPop(obj) {
if (!islogin) {
window.location.href="/joefy/mphjo/joefy";
return false;
}
var aid = $(obj).attr("data-aid");
var _html = '删除提示 ';
$(".mask").show();
$("body").append(_html);
}
function delContent(aid, obj) {
if (comment_lock == 1) {
$.ajax({
type: "post",
url: "/index/content/content_del",
data: {"aid": aid},
beforeSend: function () {
content_lock = 0;
},
success: function (data) {
var status = data.status,
msg = data.msg;
if (status == 1) {
msgBox.show(msg, msgBox.ok);
delPop();
setTimeout(function () {
window.location.reload();
},1000)
} else {
msgBox.show(msg, msgBox.warn);
}
content_lock = 1;
},
error: function () {
content_lock = 1;
msgBox.show("网络错误请重试", msgBox.warn);
}
});
}
}
//个人收藏页面管理分组
function modifyCollect() {
var _num = list.length;
var _html1 = '管理分组 ';
var _li = '';
var _lilast = '
+ 新建分组 ';
var _html2 = '确定 ';
if (_num <= 1) {
_li = '
';
} else {
for (var i = 0; i < _num - 1; i++) {
_li += '' + list[i].name + '
';
}
}
$(".collection_pop").hide();
if ($(".mgroup_pop").length > 0) {
$(".mgroup_pop").show();
$(".mgroup_pop ul").html(_li + _lilast);
} else {
$("body").append(_html1 + _li + _lilast + _html2);
}
}
//收到的私信和发出的私信
//关闭删除弹框
function delPop() {
$(".mask").hide();
$(".pop").remove();
}
$(".rc_message.rc_comment ul.commentList .cont .tit .del").on("click", function () {
var id = $(this).attr('data-id');
var type = $(this).attr('data-type');
var _html = '删除提示 ';
$(".mask").show();
$("body").append(_html);
});
function delPrivate(id, type) {
$.ajax({
url: '/index/message/del_private',
data: {id: id, type: type},
type: 'post',
dataType: 'json',
success: function (data) {
var status = data.status,
msg = data.msg;
if (status == 1) {
delPop();
msgBox.show("删除私信成功", msgBox.ok);
$(".rc_message.rc_comment ul.commentList .cont .tit .del[data-id='" + id + "']").parents("li").remove();
} else {
msgBox.show(msg, msgBox.warn);
}
}
});
}
//收到的私信回复私信功能
var msgReply_lock = 1;
function msgReply(obj) {
var toid = $(obj).attr("data-uid");
var title = "回复:" + $(obj).siblings(".title_msg").val().substring(0, 32);
var msg = $(obj).siblings("textarea").val();
if (msg.length < 1) {
msgBox.show("请输入私信内容", msgBox.warn);
return false;
}
if (msgReply_lock == 1) {
$.ajax({
type: "post",
url: "/index/message/send_msg",
dataType: "json",
data: {
"toid": toid,
"title": title,
"msg": msg
},
beforeSend: function () {
msgReply_lock = 0;
},
success: function (data) {
var status = data.status,
msg = data.msg;
if (status == 1) {
msgBox.show(msg, msgBox.ok);
setTimeout(function () {
window.location.reload();
}, 1500)
} else {
msgBox.show(msg, msgBox.warn);
}
msgReply_lock = 1;
},
error: function () {
msgReply_lock = 1;
msgBox.show("网络错误请重试", msgBox.warn);
}
});
}
}
//收到的评论回复功能
var comment_lock = 1;
$(document).on("click", ".rc_comment .commentList .replyForm .commentBtn", function () {
var fid = $(this).siblings("input[data-name='fid']").attr("data-fid");
var aid = $(this).siblings("input[data-name='aid']").attr("data-aid");
var cont = $(this).siblings("textarea").val();
if (cont.length < 1) {
msgBox.show("请输入评论内容", msgBox.warn);
return false;
}else if (cont.length > 1000){
msgBox.show("评论最多可输入1000字", msgBox.warn);
return false;
}
if (comment_lock == 1) {
$.ajax({
type: "post",
url: "/index/comment/comment_add",
data: {"aid": aid, "fid": fid, "content": cont},
beforeSend: function () {
comment_lock = 0;
},
success: function (data) {
var msg = data.msg,
status = data.status;
if (status == 1) {
msgBox.show(msg, msgBox.ok);
setTimeout(function () {
window.location.reload();
}, 1500)
} else {
msgBox.show(msg, msgBox.warn);
}
comment_lock = 1;
},
error: function () {
comment_lock = 1;
msgBox.show("网络错误请重试", msgBox.warn);
}
});
}
});
//个人主页删除作品点赞肌瘤
var content_zan_lock = 1;
function delContentZanTip(obj) {
if (!islogin) {
window.location.href="/joefy/mphjo/joefy";
return false;
}
var aid = $(obj).attr("data-aid");
var _html = '删除提示 ';
$(".mask").show();
$("body").append(_html);
}
function delContentZan(aid, obj) {
if (content_zan_lock == 1) {
$.ajax({
type: "post",
url: "/index/ajax/handle_zan",
data: {"aid": aid, 'type':2},
beforeSend: function () {
content_lock = 0;
},
success: function (data) {
var status = data.status,
msg = data.msg;
if (status == 1) {
msgBox.show(msg, msgBox.ok);
delPop();
setTimeout(function () {
window.location.reload();
},1000)
} else {
msgBox.show(msg, msgBox.warn);
}
content_zan_lock = 1;
},
error: function () {
content_zan_lock = 1;
msgBox.show("网络错误请重试", msgBox.warn);
}
});
}
}