message_board.php 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
  6. <title><?php echo $output['ajax_param']['title']; ?></title>
  7. <link type="text/css" rel="stylesheet"
  8. href="<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/css/weui.css?<?php echo bonus_version(); ?>"/>
  9. <link rel="stylesheet"
  10. href="<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/css/jquery-weui.min.css?<?php echo bonus_version(); ?>">
  11. <link type="text/css" rel="stylesheet"
  12. href="<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/css/homepage.css?<?php echo bonus_version(); ?>"/>
  13. <style type="text/css">
  14. .join_item_btn {
  15. margin-top: 62px;
  16. background: transparent;
  17. }
  18. </style>
  19. </head>
  20. <body>
  21. <div id = "page1" class="show-page">
  22. <div class="weui-cells__title">申请信息</div>
  23. <div class="weui-cells weui-cells_form">
  24. <div class="weui-cell">
  25. <div class="weui-cell__bd">
  26. <textarea class="weui-textarea" placeholder="我是..." rows="3" id="add-group-msg"></textarea>
  27. <div class="weui-textarea-counter"><span>0</span>/30</div>
  28. </div>
  29. </div>
  30. </div>
  31. <div class="weui-cells__tips">加群成功后,个人介绍将展示群友。</div>
  32. <div class="join_item_btn">
  33. <div class="quit" id="add-group-btn">
  34. <a href="javascript:void(0);" class="weui-btn weui-btn_primary">发送</a>
  35. </div>
  36. </div>
  37. </div>
  38. <div id = "page2" class="show-page">
  39. <div class="weui-cells__title">申请信息</div>
  40. <div class="weui-cells weui-cells_form">
  41. <div class="weui-cell">
  42. <div class="weui-cell__bd">
  43. <textarea class="weui-textarea" placeholder="我是..." rows="3" id="add-friends-msg"></textarea>
  44. <div class="weui-textarea-counter"><span>0</span>/30</div>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="weui-cells__tips">你需要发送验证申请,等待对方通过</div>
  49. <div class="join_item_btn">
  50. <div class="quit" id="add-friends-btn">
  51. <a href="javascript:void(0);" class="weui-btn weui-btn_primary">发送</a>
  52. </div>
  53. </div>
  54. </div>
  55. <div id = "page3" class="show-page">
  56. <div class="weui-cells__title">群公告</div>
  57. <div class="weui-cells weui-cells_form">
  58. <div class="weui-cell">
  59. <div class="weui-cell__bd">
  60. <?php if($output['ajax_param']['isManager'] > 0) { ?>
  61. <textarea class="weui-textarea" placeholder="请编辑群公告" rows="12" id="edit-notice-msg"><?php echo $output['ajax_param']['notice']; ?></textarea>
  62. <div class="weui-textarea-counter"><span>0</span>/250</div>
  63. <?php } else {
  64. echo "<div style='min-height:250px'>".$output['ajax_param']['notice']."</div>";
  65. } ?>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="weui-cells__tips"></div>
  70. <?php if($output['ajax_param']['isManager'] > 0) { ?>
  71. <div class="join_item_btn">
  72. <div class="quit" id="edit-notice-btn">
  73. <a href="javascript:void(0);" class="weui-btn weui-btn_primary">确认</a>
  74. </div>
  75. </div>
  76. <?php } ?>
  77. </div>
  78. <script src="<?php echo RESOURCE_SITE_URL; ?>/mobile/comm/jquery-1.11.0.min.js?<?php echo bonus_version(); ?>"></script>
  79. <script src="<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/js/jquery-weui.min.js?<?php echo bonus_version(); ?>"></script>
  80. <script type="text/javascript">
  81. $(function () {
  82. var _type = parseInt(<?php echo $output['ajax_param']['type'] ?>);
  83. var letter_max = 0;
  84. var show_page = function (_type) {
  85. $(".show-page").hide();
  86. switch (_type) {
  87. case 1:$("#page1").show();letter_max=30;break;
  88. case 2:$("#page2").show();letter_max=30;break;
  89. case 3:$("#page3").show();letter_max=300;break;
  90. default:
  91. }
  92. }
  93. show_page(_type);
  94. $("#add-group-btn").click(function () {
  95. var _href = "/mobile/index.php?act=member_talk&op=send_apply";
  96. var input = $("#add-group-msg").val();
  97. var talk_id = "<?php echo $output['ajax_param']['talk_id'] ?>";
  98. if (input.trim().length <= 30)
  99. {
  100. $.showLoading();
  101. $.get(_href, {
  102. apply:1,
  103. msg :input,
  104. room_id: talk_id,
  105. client_type: 'ajax'
  106. }, function (res) {
  107. $.hideLoading();
  108. var result = JSON.parse(res);
  109. console.log(result);
  110. if (result.code != 200) {
  111. $.alert(result.message);
  112. return;
  113. }
  114. $.toast('发送成功',500);
  115. setTimeout(function () {
  116. window.history.back();
  117. },1000)
  118. });
  119. }
  120. else {
  121. $.alert('入群申请最长不得超过30个字符');
  122. }
  123. });
  124. $("#add-friends-btn").click(function () {
  125. var _href = "/mobile/index.php?act=member_talk&op=add_friends";
  126. var input = $("#add-friends-msg").val();
  127. var talk_id = "<?php echo $output['ajax_param']['talk_id'] ?>";
  128. if (input.trim().length <= 30) {
  129. $.showLoading();
  130. $.get(_href, {
  131. msg :input,
  132. user: talk_id,
  133. client_type: 'ajax'
  134. }, function (res) {
  135. $.hideLoading();
  136. var result = JSON.parse(res);
  137. console.log(result);
  138. if (result.code != 200) {
  139. $.alert(result.message);
  140. return;
  141. }
  142. $.toast('发送成功',500);
  143. setTimeout(function () {
  144. window.history.back();
  145. },1000)
  146. });
  147. }
  148. else {
  149. $.alert('自我介绍最长不得超过30个字符');
  150. }
  151. });
  152. $("#edit-notice-btn").click(function () {
  153. var _href = "/mobile/index.php?act=member_talk&op=change_room_notice";
  154. var input = $("#edit-notice-msg").val();
  155. var talk_id = "<?php echo $output['ajax_param']['talk_id'] ?>";
  156. if(!input){
  157. $.alert('群公告不得为空');
  158. return;
  159. }
  160. if (input.trim().length <= 300) {
  161. $.showLoading();
  162. $.get(_href,
  163. {
  164. room_notice: input,
  165. room_id: talk_id,
  166. client_type: 'ajax'
  167. }, function (res) {
  168. $.hideLoading();
  169. var result = JSON.parse(res);
  170. if (result.code != 200) {
  171. $.alert(result.message);
  172. return;
  173. }
  174. $.toast('修改成功',500);
  175. setTimeout(function () {
  176. window.history.back();
  177. },1000)
  178. });
  179. }
  180. else {
  181. $.alert('群公告不得超过300个字符');
  182. }
  183. });
  184. $("textarea").on('input',function () {
  185. var input = $(this).val();
  186. var _length = input.trim().length;
  187. $(this).siblings("div").find('span').text(_length);
  188. if(_length >= letter_max){
  189. var input = input.substr(0,letter_max-1);
  190. $(this).val(input);
  191. $(this).siblings("div").find('span').text(letter_max);
  192. $(this).siblings("div").find('span').css("color","red");
  193. }
  194. })
  195. $("textarea").on('change',function () {
  196. var input = $(this).val();
  197. var _length = input.trim().length;
  198. $(this).siblings("div").find('span').text(_length);
  199. if(_length >= letter_max){
  200. var input = input.substr(0,letter_max-1);
  201. $(this).val(input);
  202. $(this).siblings("div").find('span').text(letter_max);
  203. $(this).siblings("div").find('span').css("color","red");
  204. }
  205. })
  206. })
  207. </script>
  208. </body>
  209. </html>