...
|
...
|
@@ -53,54 +53,60 @@ lazyLoad(); |
|
|
|
|
|
headerNavHammer = new Hammer(document.getElementById('yoho-header'));
|
|
|
|
|
|
headerNavHammer.on('tap', function(e) {
|
|
|
function submit() {
|
|
|
let suggestText = $('#suggest-textarea').val(),
|
|
|
textReg = /\S+/;
|
|
|
|
|
|
if (!textReg.test(suggestText)) {
|
|
|
diaLog.showDialog({
|
|
|
autoHide: true,
|
|
|
dialogText: '意见不能为空'
|
|
|
});
|
|
|
|
|
|
if ($(e.target).hasClass('nav-btn')) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (!textReg.test(suggestText)) {
|
|
|
$.ajax({
|
|
|
method: 'post',
|
|
|
url: '/home/savesuggest',
|
|
|
data: {
|
|
|
content: suggestText,
|
|
|
image: imgStr
|
|
|
}
|
|
|
}).then(function(data) {
|
|
|
if (data.code === 200) {
|
|
|
diaLog.showDialog({
|
|
|
autoHide: true,
|
|
|
dialogText: '意见不能为空'
|
|
|
dialogText: '提交成功'
|
|
|
});
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
method: 'post',
|
|
|
url: '/home/savesuggest',
|
|
|
data: {
|
|
|
content: suggestText,
|
|
|
image: imgStr
|
|
|
}
|
|
|
}).then(function(data) {
|
|
|
if (data.code === 200) {
|
|
|
diaLog.showDialog({
|
|
|
autoHide: true,
|
|
|
dialogText: '提交成功'
|
|
|
});
|
|
|
setTimeout(function() {
|
|
|
location.pathname = 'home/suggest';
|
|
|
}, 2000);
|
|
|
} else {
|
|
|
diaLog.showDialog({
|
|
|
autoHide: true,
|
|
|
dialogText: '提交失败~'
|
|
|
});
|
|
|
}
|
|
|
}).fail(function() {
|
|
|
|
|
|
setTimeout(function() {
|
|
|
location.pathname = 'home/suggest';
|
|
|
}, 2000);
|
|
|
} else {
|
|
|
diaLog.showDialog({
|
|
|
autoHide: true,
|
|
|
dialogText: '网络错误~'
|
|
|
dialogText: '提交失败~'
|
|
|
});
|
|
|
}
|
|
|
}).fail(function() {
|
|
|
|
|
|
diaLog.showDialog({
|
|
|
autoHide: true,
|
|
|
dialogText: '网络错误~'
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
headerNavHammer.on('tap', function(e) {
|
|
|
if ($(e.target).hasClass('nav-btn')) {
|
|
|
submit();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$('.submit').on('click', function() {
|
|
|
submit();
|
|
|
});
|
|
|
|
|
|
if (document.getElementById('img-form') !== null) {
|
|
|
formHammer = new Hammer(document.getElementById('img-form'));
|
|
|
|
...
|
...
|
|