Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function devareComment() {
var $this = this;
var replyOid = $($this).parent().parent().parent().data('commentId');
// $.alert(111,function(){
// console.log(1111)
// });
$.confirm('确定删除吗?', function () {
$.post('https://mip.linkeddb.com/del_comment/', {
'reply_oid': replyOid
}, function (res) {
if (res.response === '1') {
// $.toast(res.message, 'text');
$.toptip(res.message, 'success');
$(ele).find('.review-cont').find('.review-title').remove(); // 删除评论区域头部
$(ele).find('.review-cont').find('.review-item').remove(); // 删除评论区域所有内容
getComment();
} else {
// $.toast(res.message, 'text');
$.toptip(res.message, 'error');
}
});
}, function () {
$('.review-cont').on('click', '.agree', function () {
var $this = this;
var pOid = $(this).parent().parent().parent().data('commentId');
// console.log(pOid);
if (!$($this).find('.icon-agree').hasClass('full')) {
setAgreeStatus(0, function (res) {
$.toast(res.message);
// console.log($($this).find('.num'));
$($this).find('.num').html(+$($this).find('.num').html() + 1);
$($this).find('.icon-agree').toggleClass('full');
});
} else {
$.confirm('确定取消点赞吗?', function () {
setAgreeStatus(-1, function () {
// $.toast(res.message);
// console.log($($this).find('.num'));
$($this).find('.num').html(+$($this).find('.num').html() - 1);
$($this).find('.icon-agree').toggleClass('full');
});
}, function () {
});
}
function setAgreeStatus(flag, fn) {
$.post('/reply_goods/', {
'reply_oid': pOid,
f: flag
}, function (res) {
if (res.response === '-2') {
}, function (res) {
if (res.response === '-2') {
$.confirm('请登录后操作', '登录提示', function () {
window.top.location.href = '/sign_in/?callUrl=' + window.top.location.pathname;
}, function () {
// $.toast('登录取消', 'text');
});
return false;
} else if (res.response === '1') {
fn(res);
} else {
$.toast(res.message, 'forbidden');
}
});
}
$.get('https://mip.linkeddb.com/check_user/', function (res) {
if (res.response === '-2') {
$.confirm('登录后评论', '登录提示', function () {
window.top.location.href = 'https://mip.linkeddb.com/sign_in/?callUrl='
+ window.top.location.pathname;
}, function () {
});
return false;
} else {
$(ele).find('.review-modal-overlay').toggleClass('review-modal-overlay-visible');
$(ele).find('.write-comment').toggleClass('show');
$(ele).parent().parent().parent().find('.content').toggleClass('z-index-11');
}
});
}
$($ele).on('click', function (event) {
event = event || window.event;
event.preventDefault();
$.confirm('登录后操作', '操作提示', function () {
window.location.href = sign + window.location.origin + window.location.pathname;
},
function () {
});
return false;
});
};