Authored by lore-w

code review by kai.bi

Conflicts:
	static/js/me/suggest.js
@@ -64,11 +64,21 @@ lazyLoad(); @@ -64,11 +64,21 @@ lazyLoad();
64 headerNavHammer = new Hammer(document.getElementById('yoho-header')); 64 headerNavHammer = new Hammer(document.getElementById('yoho-header'));
65 65
66 headerNavHammer.on('tap', function(e) { 66 headerNavHammer.on('tap', function(e) {
67 - var suggestText = $('#suggest-textarea').val(); 67 + var suggestText = $('#suggest-textarea').val(),
  68 + textReg = /\S+/;
68 69
69 70
70 if ($(e.target).hasClass('nav-btn')) { 71 if ($(e.target).hasClass('nav-btn')) {
71 72
  73 + if (!textReg.test(suggestText)) {
  74 + diaLog.showDialog({
  75 + autoHide: true,
  76 + dialogText: '意见不能为空'
  77 + });
  78 +
  79 + return;
  80 + }
  81 +
72 $.ajax({ 82 $.ajax({
73 method: 'post', 83 method: 'post',
74 url: '/home/savesuggest', 84 url: '/home/savesuggest',
@@ -85,10 +95,18 @@ headerNavHammer.on('tap', function(e) { @@ -85,10 +95,18 @@ headerNavHammer.on('tap', function(e) {
85 setTimeout(function() { 95 setTimeout(function() {
86 location.pathname = 'home/suggest'; 96 location.pathname = 'home/suggest';
87 }, 2000); 97 }, 2000);
  98 + } else {
  99 + diaLog.showDialog({
  100 + autoHide: true,
  101 + dialogText: '提交失败~'
  102 + });
88 } 103 }
89 }).fail(function() { 104 }).fail(function() {
90 105
91 - //TODO 106 + diaLog.showDialog({
  107 + autoHide: true,
  108 + dialogText: '网络错误~'
  109 + });
92 }); 110 });
93 } 111 }
94 }); 112 });