1 0 0

给消息加回复按键 免费教程

修罗之家
3小时前 23
<?php if($noticelist) { foreach($noticelist as &$_notice) { ?>
<li class="notice media text-small <?php echo $_notice['isread'] == 1 ? 'isread' : '';?>" data-nid="<?php echo $_notice['nid']?>" style="border: 1px solid #eee; border-radius: 8px; padding: 10px; margin-bottom: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.03);">

    <?php if($_notice['type'] == 1 || $_notice['type'] == 3 || $_notice['type'] == 99){?>
        <div tabindex="-1" class="ml-1 mt-1 mr-2"><img class="avatar-3" src="<?php echo $_notice['from_user_avatar_url'];?>" style="width: 30px; height: 30px;"></div>
    <?php }else{?>
        <div tabindex="-1" class="ml-1 mt-1 mr-2"><a href="<?php echo url("user-$_notice[fromuid]");?>"><img class="avatar-3" src="<?php echo $_notice['from_user_avatar_url'];?>" style="width: 30px; height: 30px;"></a></div>      
    <?php }?>

    <div class="media-body">
        <div class="d-flex justify-content-between small">
            <?php if($_notice['type'] == 1 || $_notice['type'] == 3 || $_notice['type'] == 99){?>
                <div>
                    <span class="username text-grey font-weight-bold mr-1"><?php echo $_notice['name'];?></span>
                    <span class="date text-grey"><?php echo $_notice['create_date_fmt'];?></span>          
                </div>
            <?php }else{?>
                <div>
                    <span class="username text-grey font-weight-bold mr-1"><a class="text-grey" href="<?php echo url("user-$_notice[fromuid]");?>"><?php echo $_notice['from_username'];?></a></span>
                    <span class="date text-grey"><?php echo $_notice['create_date_fmt'];?></span>        
                </div>
            <?php }?>
            <div class="d-flex">
                <?php echo $_notice['isread'] == 1 ? '<button type="button" class="notice-btn" style="border: 1px solid #ddd; border-radius: 4px; padding: 3px 6px; margin-right: 4px; font-size: 12px; line-height: 1; background-color: #fff; color: #666;">'.lang('notice_my_update_readed').'</button>' : '<button type="button" class="readbtn notice-btn" data-nid="'.$_notice['nid'].'" style="border: 1px solid #ddd; border-radius: 4px; padding: 3px 6px; margin-right: 4px; font-size: 12px; line-height: 1; background-color: #fff; color: #666;"><i class="icon icon-check"></i>'.lang('notice_my_marked_read').'</button>';?>
                <!--{hook my_notice_list_reply_button.htm}-->
                <button type="button" class="deletebtn notice-btn" data-nid="<?php echo $_notice['nid']?>" style="border: 1px solid #ddd; border-radius: 4px; padding: 3px 6px; margin-right: 4px; font-size: 12px; line-height: 1; background-color: #fff; color: #666;"><i class="icon-remove"></i> <?php echo lang('delete');?></button>
                <!-- 新增私信按钮,需确保 $uid 等用户身份标识及 $_notice 中发送者用户信息字段存在且正确 -->
                <?php if ($uid && $_notice['fromuid'] != $uid) { ?>
                <a  class="notice-btn" href="javascript:;" data-modal-url="<?php echo url('user-pm-' . $_notice['fromuid']); ?>" data-modal-title="<img style='width:16px;height:16px;border-radius:50%;' src='<?php echo $_notice['from_user_avatar_url'];?>'/>&nbsp;<?php echo $_notice['from_username']; ?>" style="border: 1px solid #ddd; border-radius: 4px; padding: 3px 6px; font-size: 12px; line-height: 1; background-color: #fff; color: #666; text-align: center; display: inline-block; text-decoration: none;">
                    <i class="icon-send"></i>回复
                </a>
                <?php } ?>
            </div>
        </div>
        <div class="message break-all mt-1">
          <span><i class="icon icon-circle text-danger"></i></span>  <?php 
          $message = $_notice['message'];
          // 将表情标签转换为图片
          $message = preg_replace_callback('/\[img=(\d+)\]/', function($matches) {
              $emoji_id = $matches[1];
              $emoji_path = 'plugin/ax_notice_sx/ppimg/';
              
              // 检查文件存在性
              $png_file = $emoji_path . $emoji_id . '.png';
              $bmp_file = $emoji_path . $emoji_id . '.bmp';
              $jpg_file = $emoji_path . $emoji_id . '.jpg';
              
              if(file_exists($png_file)) {
                  return '<img src="' . $png_file . '" alt="表情' . $emoji_id . '" style="width:16px;height:16px;vertical-align:middle;margin:0 2px;">';
              } elseif(file_exists($bmp_file)) {
                  return '<img src="' . $bmp_file . '" alt="表情' . $emoji_id . '" style="width:16px;height:16px;vertical-align:middle;margin:0 2px;">';
              } elseif(file_exists($jpg_file)) {
                  return '<img src="' . $jpg_file . '" alt="表情' . $emoji_id . '" style="width:16px;height:16px;vertical-align:middle;margin:0 2px;">';
              }
              return $matches[0]; // 如果文件不存在,返回原始标签
          }, $message);
          echo $message;
          ?>
        </div>
    </div>
</li>
 
<?php }} else { ?>

     <li style="border: 1px solid #eee; border-radius: 8px; padding: 10px; margin-bottom: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.03);">
            <div><?php echo lang('none');?></div>
    </li>
    
<?php } ?>
看过的人 (3)
  • 雨伞
  • 修罗之家
  • 笑笑
最新回复 (1)
  • 笑笑 3小时前 0
    2

    登录后可见回帖内容与附件。

请先登录后发表评论!

返回
请先登录后发表评论!