commentinput.html 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="renderer" content="webkit|ie-comp|ie-stand">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  8. <meta http-equiv="Cache-Control" content="no-siteapp" />
  9. <LINK rel="Bookmark" href="/favicon.ico" >
  10. <LINK rel="Shortcut Icon" href="/favicon.ico" />
  11. <!-- 评论前台页面需要的js引入文件 -->
  12. <script type='text/javascript' src='${ctx}/assets/lib/jquery/1.9.1/jquery.min.js'></script>
  13. <script type='text/javascript' src='${ctx}/assets/lib/layer/3.0.3/layer.js'></script>
  14. <script type="text/javascript" src="${ctx}/assets/lib/jquery.form/jquery.form.min.js"></script>
  15. <script type="text/javascript" src="${ctx}/assets/lib/ueditor/1.4.3/ueditor.config.js"></script>
  16. <script type="text/javascript" src="${ctx}/assets/lib/ueditor/1.4.3/ueditor.all.js"> </script>
  17. <script type="text/javascript" src="${ctx}/assets/lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
  18. <!-- 评论前台页面需要的CSS引入文件 -->
  19. <link rel='stylesheet' type='text/css' href='${ctx}/assets/lib/comment/css/style.css' />
  20. <!-- 评论前台页面需要的javascript方法定义 -->
  21. <script type='text/javascript'>
  22. //对文章进行评论
  23. function commentData(){
  24. $('#form-comment').attr('action','${ctx}/myconsole/comment/articleComment');
  25. if($('#commentcontent').val()!=''&&$('#commentcontent').val()!='来说两句吧'){
  26. $('#form-comment').ajaxSubmit(resultHandle);
  27. }
  28. else
  29. {
  30. layer.alert('请先输入评论内容!', {skin: 'layui-layer-molv',closeBtn: 1},
  31. function(){
  32. layer.closeAll('dialog');
  33. });
  34. }
  35. }
  36. //文章进行评论信息提交后的返回结果,成功则关闭对话框刷新评论列表
  37. function resultHandle(data){
  38. var res=eval('(' + data + ')');
  39. if(res.flag){
  40. layer.alert(res.message, {skin: 'layui-layer-molv',closeBtn: 1},
  41. function(){
  42. $('#commentcontent').val('');
  43. layer.closeAll('dialog');
  44. $('#FirstPageComment').empty();
  45. getFirstPageComment();
  46. });
  47. }else{
  48. if(res.flag == false)
  49. {
  50. layer.alert(res.message, {skin: 'layui-layer-molv',closeBtn: 0}, function(){});
  51. }
  52. }
  53. }
  54. //对文章评论后取最新评论内容
  55. function getFirstPageComment(){
  56. $('#page').val('1');
  57. $('#form-comment').attr('action','${ctx}/myconsole/comment/getByPageNew');
  58. $('#form-comment').ajaxSubmit(setFirstData);
  59. }
  60. //对文章评论后最新评论内容显示
  61. function setFirstData(data){
  62. $('#FirstPageComment').prepend(data);
  63. }
  64. //调取更多评论数据
  65. function commentMore(){
  66. var iPage=parseInt($('#page').val());
  67. iPage=iPage+1;
  68. $('#page').val(iPage);
  69. $('#form-comment').attr('action','${ctx}/myconsole/comment/getByPageNew');
  70. $('#form-comment').ajaxSubmit(setData);
  71. }
  72. //把调取的更多评论数据显示到页面上
  73. function setData(data){
  74. if(data=='')
  75. {
  76. $('#MoreButton').text('没有更多评论数据了!');
  77. }
  78. else
  79. {
  80. $('#MoreData').prepend(data);
  81. }
  82. }
  83. //回复评论
  84. function replyData(commentID){
  85. $('#parentid').val(commentID);
  86. var replydataSize = $("textarea[name='replydata']").size();
  87. if(replydataSize>1) 
  88. {
  89. layer.alert('同时只能打开一条评论进行回复!', {skin: 'layui-layer-molv',closeBtn: 1},
  90. function(){
  91. layer.closeAll('dialog');
  92. });
  93. }   
  94. else
  95. {
  96. var replyContent=$('#replydata').val();
  97. $('#replycontent').val(replyContent);
  98. $('#form-comment').attr('action','${ctx}/myconsole/comment/commentReply');
  99. if(replyContent!=''&&replyContent!='来说两句吧'){
  100. $('#form-comment').ajaxSubmit(resultHandle);
  101. }
  102. else
  103. {
  104. layer.alert('请先输入回复内容!', {skin: 'layui-layer-molv',closeBtn: 1},
  105. function(){
  106. layer.closeAll('dialog');
  107. });
  108. }
  109. }
  110. }
  111. //打开取消回复评论框
  112. function openCloseReply(oSourceObj,commentID){
  113. if($('#'+commentID).css('display')=='block')
  114. {
  115. $('#'+commentID).hide();
  116. oSourceObj.innerHTML = '回复';
  117. $('#'+commentID).empty();
  118. }
  119. else
  120. {
  121. $('#'+commentID).show();
  122. oSourceObj.innerHTML = '取消回复';
  123. var replyField="\n\t<div class='liuyankua'>"
  124. +" \n\t <textarea id='replydata' name='replydata' cols='' rows='5' style='color:#ccc' onfocus=this.value='',this.style.color='#636363' >来说两句吧</textarea> "
  125. +"\n\t <div class='comment_input_fabu_bg'>"
  126. +"\n\t <div class='comment_input_fabu_left'>"
  127. +"\n\t <div class='comment_input_fabu_biaoq'></div>"
  128. +"\n\t <div class='comment_input_fabu_fapic'></div>"
  129. +"\n\t </div>"
  130. +"\n\t <div class='comment_input_liuyanbtn'><a onclick=replyData('"+commentID+"') href='javascript:;'>发&nbsp;&nbsp;布</a></div>"
  131. +"\n\t </div>"
  132. +"\n\t </div>";
  133. $('#'+commentID).prepend(replyField);
  134. }
  135. }
  136. </script>
  137. <!--具体前台评论页面定义-->
  138. <title>信息编辑</title>
  139. <meta name="keywords" content="">
  140. <meta name="description" content="">
  141. </head>
  142. <body style="line-height:1;">
  143. <div style='width:772px;margin:0 auto'>
  144. <form id='form-comment' method='post'>
  145. <div style='display: none'>
  146. <input type='hidden' id='articleid' name='articleid' value='123456789'/>
  147. <input type='hidden' id='userid' name='userid' value='admin' />
  148. <input type='hidden' id='page' name='page' value='1' />
  149. <input type='hidden' id='pagesize' name='pagesize' value='10' />
  150. <input type='hidden' id='parentid' name='parentid' />
  151. <input type='hidden' id='replycontent' name='replycontent' />
  152. </div>
  153. <div class='comment_input_tit'>
  154. <dl>
  155. <dt>我来说两句</dt>
  156. <dd><span>${UserAndCommentNum.UserNum!}</span>人参与,<span>${UserAndCommentNum.CommentNum!}</span>条评论</dd>
  157. </dl>
  158. </div>
  159. <div class='comment_input_pl_ly'>
  160. <div class='liuyankua'>
  161. <textarea id='commentcontent' name='commentcontent' cols='' rows='5' style='color:#ccc' onfocus="this.value='',this.style.color='#636363'" >来说两句吧</textarea>
  162. <div class='comment_input_fabu_bg'>
  163. <div class='comment_input_fabu_left'>
  164. <div class='comment_input_fabu_name'><img src='${ctx}/assets/lib/comment/images/pic_tx_sm.png' width='26' height='26' /><span>共产党员网网友</span></div>
  165. <div class='comment_input_fabu_biaoq'></div>
  166. <div class='comment_input_fabu_fapic'></div>
  167. </div>
  168. <div class='comment_input_liuyanbtn'><a onclick='commentData()' href='javascript:;'>发&nbsp;&nbsp;布</a></div>
  169. </div>
  170. </div>
  171. </div>
  172. </form>
  173. </div>
  174. <div style='width:772px;margin:0 auto'>
  175. <div class='comment_list_tit'>
  176. <dl>
  177. <dt>最新评论</dt>
  178. <dd></dd>
  179. </dl>
  180. </div>
  181. <div class='jiazai' id=FirstPageComment>
  182. ${ListComment}
  183. </div>
  184. </div>
  185. <div style='width:772px;margin:0 auto'>
  186. <div class='jiazai' id=MoreData>
  187. <div class='more' ><a id=MoreButton onclick='commentMore()' href='javascript:;'>点击查看更多精彩评论</a></div>
  188. </div>
  189. </div>
  190. </body>
  191. </html>