分享
  • 收藏
  • 举报
    X
    判断关注状态 怎么写?
    • 新乐智享 消费3237.06元 2020-03-26 00:47 00:47
    562
    1

    {if $gid=="" /}
    <span id="ckguanzhu" class="join" onclick="joinGroup({$id})">+关注</span>
        {else /}

    {/if}   

    没有关注 就显示 关注字样,如果已关注 则显示: 已关注或者, 为空不显示, 或者退出。

    只能用官方 论坛的关注 改, 不知道有没有更好的办法。


    <em class="gzqun" data-id="{$info.id}">关注</em>



    <script type="text/javascript">
    //关注圈子
    $(document).ready(function () {
        $(".gzqun").each(function(){
            var id = $(this).data('id');
            var that = this;
            if("{$userdb.uid}"==""){    //游客点关注,就直接进入对应的__QUN__
                $(this).click(function(){
                    window.location.href = "{:urls('qun/content/show')}?id="+id;
                });
            }else{
                //检查是否已关注
                $.get("{:urls('qun/wxapp.member/ckjoin')}?id="+id,function(res){
                    if(res.code==1){    //还没关注
                        $(that).click(function(){    //添加关注点击事件
                            $.get("{:urls('qun/wxapp.member/join')}?id="+id,function(res){
                                if(res.code==1){    //关注失败
                                    layer.alert(res.msg);
                                }else if(res.code==0){    //关注成功
                                    layer.msg(','+res.msg);
                                    $(that).html('');
                                    $(that).click(function(){
                                        window.location.href = "{:urls('qun/content/show')}?id="+id;
                                    });
                                }
                            });                        
                        });
                    }else if(res.code==0){    //已关注
                        $(that).html('');
                        $(that).click(function(){
                            window.location.href = "{:urls('qun/content/show')}?id="+id;
                        });
                    }
                });
                
            }        
        });
    });
    </script>

    2
    赏礼
    赏钱
    收藏
    点击回复
        全部留言
    • 1
    • 利中 实战运营者 消费:916.02元 2020-03-26 07:10 07:10
      其他手机
      6楼
      学习学习
    0 赏钱 赏礼回复
    更多回复
        你可能感兴趣的主题
    恢复多功能编辑器
  • 3 1
  • 推荐内容
    扫一扫访问手机版
    请选择要切换的马甲:

     
    网页即时交流
    QQ咨询
    咨询热线
    020-28998648