Smart ESP32
Very beatutiful PCB's - Good Quality and Quick delivery
May 17,2025
27 viewsReport item
- Comments(0)
- Likes(0)
Upload photo
You can only upload 5 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
0 / 10000
0 /' + commentObj.max_count + '
';
html += '';
html += '
';
html += '';
$('#div-three-' + id).children('div').append(html).show();
commentObj.fn_uploader(id);
}
},
//取消添加留言
fn_cancel_msg: function (obj) {
$(obj).parents('.js-son-comments').hide();
},
//删除自己的留言
fn_del_msg: function (level, id) {
if (!commentObj.isLogin) {
//弹出登录框
layerLogin();
return false;
}
layer.confirm($('#JsA10').val(), function (index) {
$.getJSON(commentObj.fn_del_comment_url(), { msgid: id }, function (res) {
if (res.result) {
if (level == 1) {
//if (ispage > 0)
// window.location.reload();
$('#li' + id).remove();
commentObj.fn_up_level_msg_cnt(level, id, -1);
}
else {
var obj = $('#' + (level == 1 ? 'li' : 'div-three-') + id);
var num = parseInt(obj.parents('li').find('b').text());
num += -1;
if (num < 0) {
num = 0;
}
var parobj = $('#div-three-' + id).parent();
obj.parents('li').find('b').text(num);
$('#div-three-' + id).remove();
if (parobj.find('.sub-comment').length > 0) {
} else {
parobj.parent().hide();
}
}
commentObj.fn_up_msg_cnt(-1);
layer.close(index);
}
else if (res.msg == "nothing") {
layer.alert("error");
return;
}
else if (res.msg == "havereply") {
layer.alert($('#JsA11').val());
return;
}
else {
layer.alert($('#JsA12').val());
return;
}
});
})
},
//更新留言数量
fn_up_msg_cnt: function (val) {
var num = parseInt($('#MsgCount').text());
num += parseInt(val);
if (num < 0) {
num = 0;
}
$('#MsgCount').text(num);
},
//更新留言数量level
fn_up_level_msg_cnt: function (level, id, val) {
var obj = $('#' + (level == 1 ? 'li' : 'div-three-') + id);
var num = parseInt(obj.parents('li').find('b').text());
num += parseInt(val);
if (num < 0) {
num = 0;
}
obj.parents('li').find('b').text(num);
},
fn_mark_comment: function (obj, islike, commentid) {
if (logintype != 1) {
layerLogin();
return;
}
$.getJSON($('#memberurl').val() + '/Project/CommentMark?callback=?', { id: commentObj.obj_id, ProjectType: commentObj.obj_type, isLike: islike, commentid: commentid }, function (res) {
if (res.result) {
var markCnt = parseInt($('#commentMarkCnt' + commentid).text());
if ($(obj).hasClass('active')) {
$(obj).removeClass('active');
if (islike) {
$('#commentMarkCnt' + commentid).text(markCnt - 1);
}
else {
$('#commentMarkCnt' + commentid).text(markCnt + 1);
}
}
else {
if ($(obj).parent().find('dl').hasClass('active')) {
if (islike) {
$('#commentMarkCnt' + commentid).text(markCnt + 2);
}
else {
$('#commentMarkCnt' + commentid).text(markCnt - 2);
}
$(obj).parent().find('dl').removeClass('active');
}
else {
if (islike) {
$('#commentMarkCnt' + commentid).text(markCnt + 1);
}
else {
$('#commentMarkCnt' + commentid).text(markCnt - 1);
}
}
$(obj).addClass('active');
}
}
else if (res.msg == "nologin") {
//弹出登录框
layerLogin();
} else
layer.alert("error");
});
},
//加载数据
fn_load_data: function (page) {
$('#commentload').show();
$.ajax({
url: commentObj.fn_get_comment_url(),
dataType: 'jsonp',
data: { objid: commentObj.obj_id, objtype: commentObj.obj_type, page: page },
success: function (jason) {
var totalpage = jason.TotalCount / 20;
if (totalpage % 1 > 0)
totalpage = parseInt(totalpage) + 1;
if (page >= totalpage) {
$('#commentviewmore').parent().remove();
} else {
$('#commentviewmore').parent().show();
}
if (jason.TotalCount > 0) {
page = jason.PageIndex;
var msgList = jason.DataList;
var html = '';
if (msgList && msgList.length > 0) {
for (var item in msgList) {
html += '';
html += '
';
html += ' ';
html += ' ';
html += ' ';
html += ' ';
html += ' ';
html += ' ';
html += '
';
html += '';
html += '
';
html += ' ';
}
else {
html += '';
html += ''
html += '- ';
html += '';
html += '
- ' + msgList[item].MarkCnt + ' '; html += '
- ';
html += '';
html += '
'
var msgpicArr = msgList[item].MsgPic.split(',');
for (var i = 0; i < msgpicArr.length; i++) {
html += '
';
}
//
html += ' ';
html += ' ';
//
html += ''
html += "
';
}
html += ' ";
html += '';
html += '
';
html += '';
var ReplyList = msgList[item].ReplyList;
if (ReplyList && ReplyList.length > 0) {
for (var reply in ReplyList) {
html += '
';
if (msgList[item].ReplyList && msgList[item].ReplyList.length > 0) {
html += '';
}
html += '';
html += '
';
}
}
html += '';
html += '
';
html += '';
html += '' + ReplyList[reply].ContactName + ' ';
html += '' + ReplyList[reply].AddTimeStr + '';
html += '';
html += '' + $('#JsA13').val() + '';
if (ReplyList[reply].IsMy && ((new Date() - new Date(ReplyList[reply].AddTime)) / (1000 * 60 * 60)) <= 5 && (!ReplyList[reply].ReplyList || ReplyList[reply].ReplyList.length == 0)) {
html += ' ' + $('#JsA14').val() + '';
}
html += '';
html += '
';
html += '';
if (ReplyList[reply].ReplyCommentId > 0 && ReplyList[reply].ReplyCommentId != msgList[item].Id) {
html += '
';
html += '';
html += $('#JsA13').val() + '@ ' + ReplyList[reply].ReplyContactName + ':';
html += '
';
}
html += '' + ReplyList[reply].Note + '
'; if (ReplyList[reply].MsgPic && ReplyList[reply].MsgPic != '') { html += ''
var msgpicArr = ReplyList[reply].MsgPic.split(',');
for (var i = 0; i < msgpicArr.length; i++) {
html += '
';
}
html += ''
html += "
";
html += '
';
}
html += '';
if (msgList[item].MbId > 0) {
html += '' + $('#JsA13').val() + '';
}
//
if (msgList[item].IsMy && ((new Date() - new Date(msgList[item].AddTime)) / (1000 * 60 * 60)) <= 5 && (!msgList[item].ReplyList || msgList[item].ReplyList.Count == 0)) {
html += ' ' + $('#JsA14').val() + '';
}
html += '
';
html += '';
html += '
';
html += ' ';
} else {
html += '- ';
html += '';
html += '
- 0 '; html += '
- ';
html += '';
html += '
'
for (var i = 0; i < msgpicArr.length; i++) {
html += '
';
}
//
html += ' ';
html += ' ';
html += ' ';
html += ''
html += "
';
}
html += ' ";
html += '';
html += '' + $('#JsA13').val() + ' ';
html += '' + $('#JsA14').val() + '';
html += '
';
html += '';
html += '
';
if (level == 3) {
//第三级留言(回复第二级留言)
commentObj.fn_add_reply(3, id);
$('#div-three-' + id).parent('div').append(html);
}
else {
commentObj.fn_add_reply(2, id);
$('#div-two-' + id).show().children('div').append(html);
}
commentObj.fn_up_msg_cnt(1);
commentObj.fn_up_level_msg_cnt(level, res.msg.Id, 1);
}
commentObj.fn_uploader(id);
$('#error-tips').hide();
$('#msg-' + id).removeClass('form-error');
$('#error-tips-img' + id).hide();
$('#error-tips-img-size' + id).hide();
$('#error-tips-img-type' + id).hide();
}
else if (res.msg == "nologin") {
//弹出登录框
layerLogin();
}
else {
layer.alert("error");
}
$('body').removeClass('global-loading');
},
error: function (xhr, status, error) {
if (xhr.status == 403) {
layer.alert("Amazon Firewall Warning: 403 Forbidden - Content may contain sensitive or dangerous words.");
}
$('body').removeClass('global-loading');
}
});
} else {
$('#msg-' + id).addClass('form-error');
if (!$('#msg-' + id).hasClass('js-mention'))
$('#error-tips').show().Shake(4, 10);
return false;
}
},
//上传文件
fn_uploader: function (id) {
/*上传文件开始*/
var uploader = WebUploader.create({
// 选完文件后,是否自动上传。
auto: true,
// swf文件路径
swf: '/img/js/jqueryplus/webuploader-0.1.5/Uploader.swf',
// 文件接收服务端。
server: '/Common/UpFile',
// 选择文件的按钮。可选。
// 内部根据当前运行是创建,可能是input元素,也可能是flash.
pick: { id: '#msgFile' + id, multiple: false },
fileVal: 'FileData',
fileNumLimit: 5,
fileSingleSizeLimit: '2097152',//'10485760',5242880,2097152
accept: {
title: 'File',
extensions: 'bmp,png,gif,jpg,jpeg',
mimeTypes: 'image/*'
},
'formData': { 'uptype': "blogfile", 'key': "", 'checkcode': "", "getjson": true },
});
uploader.on('beforeFileQueued', function (file) {
$('#error-tips').hide();
$('#msg-' + id).removeClass('form-error');
$('#error-tips-img' + id).hide();
$('#error-tips-img-type' + id).hide()
$('#error-tips-img-size' + id).hide()
});
uploader.on('uploadStart', function (file, percentage) {
if (logintype != 1) {
layerLogin();
return;
}
$("#progress-box" + id).show();
});
uploader.on('uploadProgress', function (file, percentage) {
$('.progress').attr('data-percent', parseInt(percentage * 80))
});
uploader.on('uploadSuccess', function (file, data) {
if (data.state === "SUCCESS") {
var tempImg = '';
html += '
';
html += '';
html += '' + commentObj.fn_get_username(escape(res.msg.ContactName));
html += '';
html += ' ' + res.msg.AddTimeStr;
html += '';
html += '';
html += '' + $('#JsA13').val() + ' ';
html += '' + $('#JsA14').val() + '';
html += '';
html += '
';
html += '';
if (level == 3) {
//第三级留言(回复第二级留言)
html += '
';
html += '';
html += $('#JsA13').val() + '@ ' + commentObj.fn_get_username(escape(res.msg.ReplyContactName)) + ':';
html += '
';
}
html += '' + res.msg.Note + '
'; if (res.msg.MsgPic && res.msg.MsgPic != '') { html += ''
var msgpicArr = res.msg.MsgPic.split(',');
for (var i = 0; i < msgpicArr.length; i++) {
html += '
';
html += ''
html += "
';
}
}
html += ' ";
html += '';
tempImg += '
';
$('#js-views-example' + id).show().append(tempImg)
}
$('.progress').attr('data-percent', parseInt(0))
$("#progress-box" + id).hide();
// 上传图预览
$(document).on('click', '.js-views-example .del-pic', function () {
var fileid = $(this)[0].id;
var file = uploader.getFile(fileid)
if (file) {
uploader.removeFile(file, true); // 删除文件
}
$(this).parent().remove();
$('#error-tips').hide();
$('#msg-' + id).removeClass('form-error');
$('#error-tips-img' + id).hide();
$('#error-tips-img-size' + id).hide();
$('#error-tips-img-type' + id).hide();
})
});
uploader.on('error', function (str) {
if (str == "Q_EXCEED_NUM_LIMIT") {
$('#error-tips-img' + id).show().Shake(4, 10);
}
else if (str == "Q_TYPE_DENIED") {
$('#error-tips-img-type' + id).show().Shake(4, 10);
}
else if (str == "F_EXCEED_SIZE") {
$('#error-tips-img-size' + id).show().Shake(4, 10);
}
setTimeout(function () {
$('#error-tips-img' + id).hide();
$('#error-tips-img-size' + id).hide();
$('#error-tips-img-type' + id).hide();
}, 3000);
});
/*上传文件结束*/
},
// 文本域转html
convertToHTMLFn: function (text) {
return text.replace(/\n/g, ' ';
tempImg += '';
tempImg += '').replace(/ /g, ' '); }, getPicImgArr: function (id) { var imgpicarr = []; $("img[name='pig-img" + id + "']").each(function (i, e) { imgpicarr.push(e.src); }) return imgpicarr.length > 0 ? imgpicarr.join(',') : ""; } } commentObj.fn_init(); -->