huangdong 6 år sedan
förälder
incheckning
d496ffb565

+ 5 - 4
helper/room/tpl_group_home.php

@@ -118,17 +118,17 @@ class tpl_group_home
 
     public function show_group_activity()
     {
-        $html = "";
+        $html = "<div class=\"group_handle weui-flex\">";
         if(isset($this->participants[$this->cur_user])){
             $isManager = $this->isManager($this->cur_user) ? 1 : 0;
-            $notice = empty($this->room_info->notice()) ? 1 : 0;
+            $notice = empty($this->room_info->notice()) ? 0 : 1;
             $html.="<div class=\"weui-flex__item group_bonus\">
                         <a href=\"/mobile/index.php?act=member_talk&op=share_bonus&room_id={$this->room_id}\">
                             <img src=\"".RESOURCE_SITE_URL."/mobile/talk/images/group_bonus.png\" alt=\"\">
                         </a>
                     </div>
                     <div class=\"weui-flex__item group_notice\">
-                         <a id=\"view-group-notice\" data-has-notice='{$notice}' data-isManager='{$isManager}' href=\"javascript:void(0);\">
+                         <a id=\"view-group-notice\" data-has-notice={$notice} data-isManager={$isManager} href=\"javascript:void(0);\">
                         <img src=\"".RESOURCE_SITE_URL."/mobile/talk/images/group_notice.png\" alt=\"\">
                         </a>
                     </div>
@@ -143,6 +143,7 @@ class tpl_group_home
                         </a>
                     </div>";
         }
+        $html .= "</div>";
         echo $html;
     }
 
@@ -250,7 +251,7 @@ class tpl_group_home
                                             <span class=\"admin_label\">管理员</span>
                                         </div>
                                         <div>
-                                            <a href='javascript:void(0)' class=\"add\" data-member-id={$member['userid']}>
+                                            <a href='javascript:void(0)' id='add-member-btn' class=\"add\" data-member-id={$member['userid']}>
                                                 +好友
                                             </a>
                                         </div>

+ 1 - 0
mobile/control/member_talk.php

@@ -1388,6 +1388,7 @@ class member_talkControl extends mbMemberControl
                 $room = Model('room')->getRoom($talk_id);
                 $ajax_param['notice']   = isset($room['notice']) ? $room['notice'] : "";
                 $ajax_param['isManager'] = $isManager;
+                break;
             default:
                 $ajax_param = [];
         }

+ 45 - 47
mobile/templates/default/talk/homepage_room.php

@@ -23,9 +23,7 @@
 
     <?php //$output['tpl']->show_group_notice();  //删除群公告展示 ?>
 
-    <div class="group_handle weui-flex">
-        <?php $output['tpl']->show_group_activity(); ?>
-    </div>
+    <?php $output['tpl']->show_group_activity(); ?>
 
     <?php $output['tpl']->show_members(); ?>
 
@@ -424,46 +422,46 @@
                 });
             });
 
-            $('#edit_room_notice').on('click',function(){
-                $.prompt({
-                    title: '修改群公告',
-                    input: '请输入公告信息',
-                    empty: false, // 是否允许为空
-                    onOK: function (input) {
-                        if (input && input.trim().length <= 120) {
-                            //点击确认
-                            $.showLoading();
-                            $.get('/mobile/index.php?act=member_talk&op=change_room_notice',
-                                {
-                                    room_notice: input,
-                                    room_id: talk_id,
-                                    client_type: 'ajax'
-                                }, function (res) {
-                                    $.hideLoading();
-                                    var result = JSON.parse(res);
-                                    if (result.code != 200) {
-                                        $.alert(result.message);
-                                        return;
-                                    }
-                                    var new_notice = "【公告】"+ input.trim();
-                                    $('.group_notice_board p').text(new_notice);
-                                    $('#room-notice-btn').text("已设置");
-                                    $('.group_notice_board').show();
-                                    $.toast('修改成功',1000);
-                                });
-                        }
-                        else {
-                            $.alert('群公告不得超过120字');
-                        }
-
-                    },
-                    onCancel: function () {
-                        //点击取消
-                    }
-                });
-                $("#weui-prompt-input").remove(); //去除原始输入框
-                $(".weui-dialog__bd").append('<textarea  rows="8" style="height:110px;" class="weui_input weui-prompt-input" id="weui-prompt-input" value=""></textarea>');
-            });
+            // $('#edit_room_notice').on('click',function(){
+            //     $.prompt({
+            //         title: '修改群公告',
+            //         input: '请输入公告信息',
+            //         empty: false, // 是否允许为空
+            //         onOK: function (input) {
+            //             if (input && input.trim().length <= 120) {
+            //                 //点击确认
+            //                 $.showLoading();
+            //                 $.get('/mobile/index.php?act=member_talk&op=change_room_notice',
+            //                     {
+            //                         room_notice: input,
+            //                         room_id: talk_id,
+            //                         client_type: 'ajax'
+            //                     }, function (res) {
+            //                         $.hideLoading();
+            //                         var result = JSON.parse(res);
+            //                         if (result.code != 200) {
+            //                             $.alert(result.message);
+            //                             return;
+            //                         }
+            //                         var new_notice = "【公告】"+ input.trim();
+            //                         $('.group_notice_board p').text(new_notice);
+            //                         $('#room-notice-btn').text("已设置");
+            //                         $('.group_notice_board').show();
+            //                         $.toast('修改成功',1000);
+            //                     });
+            //             }
+            //             else {
+            //                 $.alert('群公告不得超过120字');
+            //             }
+            //
+            //         },
+            //         onCancel: function () {
+            //             //点击取消
+            //         }
+            //     });
+            //     $("#weui-prompt-input").remove(); //去除原始输入框
+            //     $(".weui-dialog__bd").append('<textarea  rows="8" style="height:110px;" class="weui_input weui-prompt-input" id="weui-prompt-input" value=""></textarea>');
+            // });
 
             $('#edit_room_desc').on('click',function(){
                 $.prompt({
@@ -768,10 +766,10 @@
 
 
             $("#view-group-notice").on('click',function () {
-                var has_notice = $(this).attr('data-has-notice');
-                var isManager  = $(this).attr('data-isManager');
-                if( has_notice || isManager ){
-                    window.location.href = "/mobile/index.php?act=member_talk&op=message_broad&type=3&isManager="+isManager;
+                var has_notice = parseInt($(this).attr('data-has-notice'));
+                var ismanager  = parseInt($(this).attr('data-ismanager'));
+                if( has_notice || ismanager){
+                    window.location.href = "/mobile/index.php?act=member_talk&op=message_board&type=3&isManager="+ismanager+"&talk_id="+talk_id;
                 }else{
                     $.alert("只有群主可以编辑公告");
                     return false;

+ 51 - 4
mobile/templates/default/talk/message_board.php

@@ -23,7 +23,7 @@
         <div class="weui-cells weui-cells_form">
             <div class="weui-cell">
                 <div class="weui-cell__bd">
-                    <textarea class="weui-textarea" placeholder="请输入文本" rows="3" id="add-group-msg"></textarea>
+                    <textarea class="weui-textarea" placeholder="我是..." rows="3" id="add-group-msg"></textarea>
                     <div class="weui-textarea-counter"><span>0</span>/30</div>
                 </div>
             </div>
@@ -42,22 +42,43 @@
         <div class="weui-cells weui-cells_form">
             <div class="weui-cell">
                 <div class="weui-cell__bd">
-                    <textarea class="weui-textarea" placeholder="请输入文本" rows="3" id="add-friends-msg"></textarea>
+                    <textarea class="weui-textarea" placeholder="我是..." rows="3" id="add-friends-msg"></textarea>
                     <div class="weui-textarea-counter"><span>0</span>/30</div>
                 </div>
             </div>
         </div>
-        <div class="weui-cells__tips"></div>
+        <div class="weui-cells__tips">你需要发送验证申请,等待对方通过</div>
 
         <div class="join_item_btn">
-            <div class="quit" id="#add-friends-btn">
+            <div class="quit" id="add-friends-btn">
                 <a href="javascript:void(0);" class="weui-btn weui-btn_primary">发送</a>
             </div>
         </div>
     </div>
 
     <div id = "page3" class="show-page">
+        <div class="weui-cells__title">群公告</div>
+        <div class="weui-cells weui-cells_form">
+            <div class="weui-cell">
+                <div class="weui-cell__bd">
+                    <?php if($output['ajax_param']['isManager'] > 0) { ?>
+                        <textarea class="weui-textarea" placeholder="请编辑群公告" rows="12" id="edit-notice-msg"></textarea>
+                        <div class="weui-textarea-counter"><span>0</span>/250</div>
+                    <?php } else {
+                        echo "<div style='min-height:250px'>".$output['ajax_param']['notice']."</div>";
+                    } ?>
+                </div>
+            </div>
+        </div>
+        <div class="weui-cells__tips"></div>
 
+        <?php if($output['ajax_param']['isManager'] > 0) { ?>
+            <div class="join_item_btn">
+                <div class="quit" id="edit-notice-btn">
+                    <a href="javascript:void(0);" class="weui-btn weui-btn_primary">确认</a>
+                </div>
+            </div>
+        <?php }  ?>
     </div>
 
 
@@ -141,6 +162,32 @@
             });
             
             $("#edit-notice-btn").click(function () {
+                var _href = "/mobile/index.php?act=member_talk&op=change_room_notice";
+                var input = $("#edit-notice-msg").val();
+                var talk_id = "<?php echo $output['ajax_param']['talk_id'] ?>";
+                if (input && input.trim().length <= 250) {
+                    $.showLoading();
+                    $.get(_href,
+                        {
+                            room_notice: input,
+                            room_id: talk_id,
+                            client_type: 'ajax'
+                        }, function (res) {
+                            $.hideLoading();
+                            var result = JSON.parse(res);
+                            if (result.code != 200) {
+                                $.alert(result.message);
+                                return;
+                            }
+                            $.toast('修改成功',500);
+                            setTimeout(function () {
+                                window.history.back();
+                            },1000)
+                        });
+                }
+                else {
+                    $.alert('群公告不得超过250个字符');
+                }
             });
         })
     </script>