• 分享


    <!DOCTYPE html>
    <html>
    <head>
        <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=2.0, user-scalable=no">
    </head>
    <body>
    <button id="weixin_share_to_friend">
        分享到微信好友
    </button>
    <button id="weixin_share_to_timeline">
        分享到微信朋友圈
    </button>
    <button id="share_link">
        点击调分享
    </button>
    <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
    <script type="text/javascript">
    share={
        'shareRead_link':"http://www.yongche.com/weixin/activity/2015060102/activity/2015/user-to-user/inviteguest.php?id=9chl533htsosow44",
        'shareRead_pics':"<{asset:images/app/i/user-to-user/wx_log.png}>",
        'shareRead_title':"专车券,送30太小气,领5折+70,才够爽!",
        'shareRead_content':"给好友发5折专车券+70元礼包,您的好友完成首单,您同样会获得5折专车券,多邀多赠!",
        'shareRead_sourceType':42,
        'titleBarShareButtonShow':1
        //1代表标题有分享文字;0代表没有
    };
    $('#weixin_share_to_friend').click(function(){
        ShareTools.shareThisPageToFriend();
    });
    $('#weixin_share_to_timeline').click(function(){
        ShareTools.shareThisPageToTimeline();
    });
    $('#share_link').click(function(){
        ShareTools.shareBase();
    });
    </script>
    <script type="text/javascript">
         // 分享变量设置
        var _protocolLinkBase = "yongche://share?";
        var _protocolLinkFriend = "yongche://shareToFriend?";
        var _protocolLinkTimeline = "yongche://shareToTimeline?";
        // 分享地址
        // var shareRead_link = encodeURIComponent("http://www.yongche.com/mobile/weixin/3/index.php?round=2");
        var shareRead_link = encodeURIComponent(share['shareRead_link']);
        // 分享的图片
        var shareRead_pics = encodeURIComponent(share['shareRead_pics']);
        // 分享的标题
        //var shareRead_title = encodeURIComponent("我是魏浩哲,快与我同坐5折专车,Give me five!");
        var shareRead_title = encodeURIComponent(share['shareRead_title']);
        // 分享的内容
        //var shareRead_content = encodeURIComponent("给好友发5折专车券,您的好友完成首单,您同样会获得5折专车券。多邀多赠!");
        var shareRead_content = encodeURIComponent(share['shareRead_content']);
        var shareRead_sourceType = share['shareRead_sourceType'];
        ShareTools = {
            shareThisPageToFriend:function(){
                var _str = "link="+shareRead_link+"&pics="+shareRead_pics+"&title="+shareRead_title+"&content="+shareRead_content+"&sourceType="+shareRead_sourceType;
                var _tmpOpenLink = _protocolLinkFriend + _str;
                window.location.href = _tmpOpenLink;
            },
            shareThisPageToTimeline:function(){
                var _str = "link="+shareRead_link+"&pics="+shareRead_pics+"&title="+shareRead_title+"&content="+shareRead_content+"&sourceType="+shareRead_sourceType;
                var _tmpOpenLink = _protocolLinkTimeline + _str;
                window.location.href = _tmpOpenLink;
            },
            shareBase:function(){
                var _str = "link="+shareRead_link+"&pics="+shareRead_pics+"&title="+shareRead_title+"&content="+shareRead_content+"&sourceType="+shareRead_sourceType;
                var _tmpOpenLink = _protocolLinkBase + _str;
                window.location.href = _tmpOpenLink;
            }
        };
        if(share['titleBarShareButtonShow']==1){
            $("body").append('<iframe frameborder="0" style="display: none;" id="share_iframe"></iframe>');
             var _str = "link="+shareRead_link+"&pics="+shareRead_pics+"&title="+shareRead_title+"&content="+shareRead_content+"&sourceType="+shareRead_sourceType+"&from=iframe";
            var _tmpOpenLink = _protocolLinkBase + _str;
            document.getElementById("share_iframe").src = _tmpOpenLink;
        }
    </script>
    </body>
    </html> 
  • 相关阅读:
    31天重构学习笔记9. 提取接口
    31天重构学习笔记4. 降低方法
    31天重构学习笔记8. 使用委派代替继承
    31天重构学习笔记11. 使用策略类
    31天重构学习笔记12. 分解依赖
    MyCat:第八章:MyCAT In Action中文版
    HDU 2041 超级楼梯
    CSU 1487 未覆盖顶点数量
    HDU 1712 ACboy needs your help
    HDU 2034 人见人爱AB
  • 原文地址:https://www.cnblogs.com/xiaoleidiv/p/4587837.html
Copyright © 2020-2023  润新知