message_board.php 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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>好友申请</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="https://cdn.bootcss.com/jquery-weui/1.2.0/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"></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="https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js?<?php echo bonus_version(); ?>"></script>
  79. <script src="https://cdn.bootcss.com/jquery-weui/1.2.0/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=250;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 && input.trim().length <= 30) {
  99. $.showLoading();
  100. $.get(_href, {
  101. apply:1,
  102. msg :input,
  103. room_id: talk_id,
  104. client_type: 'ajax'
  105. }, function (res) {
  106. $.hideLoading();
  107. var result = JSON.parse(res);
  108. console.log(result);
  109. if (result.code != 200) {
  110. $.alert(result.message);
  111. return;
  112. }
  113. $.toast('发送成功',500);
  114. setTimeout(function () {
  115. window.history.back();
  116. },1000)
  117. });
  118. }
  119. else {
  120. $.alert('入群申请最长不得超过30个字符');
  121. }
  122. });
  123. $("#add-friends-btn").click(function () {
  124. var _href = "/mobile/index.php?act=member_talk&op=add_friends";
  125. var input = $("#add-friends-msg").val();
  126. var talk_id = "<?php echo $output['ajax_param']['talk_id'] ?>";
  127. if (input && input.trim().length <= 30) {
  128. $.showLoading();
  129. $.get(_href, {
  130. msg :input,
  131. user: talk_id,
  132. client_type: 'ajax'
  133. }, function (res) {
  134. $.hideLoading();
  135. var result = JSON.parse(res);
  136. console.log(result);
  137. if (result.code != 200) {
  138. $.alert(result.message);
  139. return;
  140. }
  141. $.toast('发送成功',500);
  142. setTimeout(function () {
  143. window.history.back();
  144. },1000)
  145. });
  146. }
  147. else {
  148. $.alert('自我介绍最长不得超过30个字符');
  149. }
  150. });
  151. $("#edit-notice-btn").click(function () {
  152. var _href = "/mobile/index.php?act=member_talk&op=change_room_notice";
  153. var input = $("#edit-notice-msg").val();
  154. var talk_id = "<?php echo $output['ajax_param']['talk_id'] ?>";
  155. if (input && input.trim().length <= 250) {
  156. $.showLoading();
  157. $.get(_href,
  158. {
  159. room_notice: input,
  160. room_id: talk_id,
  161. client_type: 'ajax'
  162. }, function (res) {
  163. $.hideLoading();
  164. var result = JSON.parse(res);
  165. if (result.code != 200) {
  166. $.alert(result.message);
  167. return;
  168. }
  169. $.toast('修改成功',500);
  170. setTimeout(function () {
  171. window.history.back();
  172. },1000)
  173. });
  174. }
  175. else {
  176. $.alert('群公告不得超过250个字符');
  177. }
  178. });
  179. $("textarea").on('input',function () {
  180. var input = $(this).val();
  181. var _length = input.trim().length;
  182. $(this).siblings("div").find('span').text(_length);
  183. if(_length >= letter_max){
  184. var input = input.substr(0,letter_max-1);
  185. $(this).val(input);
  186. $(this).siblings("div").find('span').text(letter_max);
  187. $(this).siblings("div").find('span').css("color","red");
  188. }
  189. })
  190. $("textarea").on('change',function () {
  191. var input = $(this).val();
  192. var _length = input.trim().length;
  193. $(this).siblings("div").find('span').text(_length);
  194. if(_length >= letter_max){
  195. var input = input.substr(0,letter_max-1);
  196. $(this).val(input);
  197. $(this).siblings("div").find('span').text(letter_max);
  198. $(this).siblings("div").find('span').css("color","red");
  199. }
  200. })
  201. })
  202. </script>
  203. </body>
  204. </html>