chengkun
2025-04-18 1bb985f32f2efe0f9dd69f3cf29a1c809b1cf96d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<!----如果是微信登录,引导微信自有分享------>
<script src="{yun:}$wap_style{/yun}/js/nativeshare/nativeshare.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<link rel="stylesheet" href="{yun:}$wap_style{/yun}/js/nativeshare/nativeshare.css?v={yun:}$config.cachecode{/yun}" type="text/css"/>
 
{yun:}if $isweixin{/yun}
 
{yun:}if strpos($config.sy_wapdomain, 'https://')!==false{/yun}
<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js?v={yun:}$config.cachecode{/yun}"></script>
{yun:}else{/yun}
<script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js?v={yun:}$config.cachecode{/yun}"></script>
{yun:}/if{/yun}
 
<script>
 
    $(function () {
 
        $('#shareClick').click(function () {
 
            var url = $(this).attr('data-url');
 
            if (new RegExp('http://').test(url)) {
                window.location.href = url;
            } else {
 
                var regurl = '{yun:}$reg_url{/yun}';
 
                if (regurl != '') {
                    wx.ready(function () {
                        var shareData = {
                            title: '邀请注册-{yun:}$config.sy_webname{/yun}',
                            desc: '{yun:}$description{/yun}',
                            link: regurl,
                            imgUrl: '{yun:}$config.sy_ossurl{/yun}/{yun:}$config.sy_wx_sharelogo{/yun}',
                            success: function () {
                                // 用户确认分享后执行的回调函数
                            },
                            cancel: function () {
                                // 用户取消分享后执行的回调函数
                            }
                        };
                        wx.updateAppMessageShareData(shareData);
                        wx.updateTimelineShareData(shareData);
                    });
                    wx.error(function (res) {
                        console.log(res.errMsg);
                    });
                }
                $("#weixinBrowser").show();
            }
        });
        $('#weixinBrowser').click(function () {
 
            $(this).hide();
        });
    });
</script>
 
{yun:}if $signPackage{/yun}
<script>
    var shareurl = '{yun:}$shareurl{/yun}';
    wx.config({
        appId: '{yun:}$signPackage.appId{/yun}',
        timestamp: '{yun:}$signPackage.timestamp{/yun}',
        nonceStr: '{yun:}$signPackage.nonceStr{/yun}',
        signature: '{yun:}$signPackage.signature{/yun}',
        jsApiList: [
            'updateAppMessageShareData',
            'updateTimelineShareData',
            'onMenuShareTimeline',
            'onMenuShareAppMessage',
            'onMenuShareQQ',
            'onMenuShareWeibo',
            'onMenuShareQZone'
        ]
    });
    if (shareurl != '') {
        var link = shareurl;
    } else {
        var link = '{yun:}$signPackage.url{/yun}';
    }
    wx.ready(function () {
        var shareData = {
            title: '{yun:}$title{/yun}',
            desc: '{yun:}$description{/yun}',
            link: link,
            imgUrl: '{yun:}if $job.logo{/yun}{yun:}$job.logo{/yun}{yun:}else if $Info.photo{/yun}{yun:}$Info.photo{/yun}{yun:}else if $Info.newsphoto_n{/yun}{yun:}$Info.newsphoto_n{/yun}{yun:}else if $row.logo{/yun}{yun:}$row.logo{/yun}{yun:}else{/yun}{yun:}$config.sy_ossurl{/yun}/{yun:}$config.sy_wx_sharelogo{/yun}{yun:}/if{/yun}',
            success: function () {
 
            }
        };
        wx.updateAppMessageShareData(shareData);
        wx.updateTimelineShareData(shareData);
    });
    wx.error(function (res) {
        console.log(res.errMsg);
    });
</script>
{yun:}/if{/yun}
 
{yun:}else{/yun}
 
<!----如果是UC QQ浏览器,弹出分享界面------>
<script src='{yun:}$wap_style{/yun}/js/appshare.js?v={yun:}$config.cachecode{/yun}' type='text/javascript'></script>
 
<div id="nativeShare"></div>
 
<script language="javascript">
    if (navigator.userAgent.indexOf('Html5Plus') > -1) {
 
        var shares = null;
 
        // 监听plusready事件
        document.addEventListener("plusready", function () {
            document.getElementById("shareClick").addEventListener("click", function () {
                var message = {
                    title: '{yun:}$title{/yun}',
                    content: '{yun:}$title{/yun}',
                    href: '{yun:}$shareurl{/yun}',
                    thumbs: ["{yun:}if $job.com_logo{/yun}{yun:}$config.sy_ossurl{/yun}/{yun:}$job.com_logo{/yun}{yun:}else if $Info.photo{/yun}{yun:}$Info.photo{/yun}{yun:}else if $row.logo{/yun}{yun:}$row.logo{/yun}{yun:}else{/yun}{yun:}$config.sy_ossurl{/yun}/{yun:}$config.sy_wx_sharelogo{/yun}{yun:}/if{/yun}"] //分享缩略图
                }
                plusShare(message, function (res) {
                    if (res) {
                        plus.nativeUI.toast("分享成功");
                    } else {
                        plus.nativeUI.toast("分享失败");
                    }
                })
            });
        });
    } else {
        $(function () {
            $('#shareClick').on('click', function () {
                new nativeShare('nativeShare', config);
            });
            $('#otherBrowser').click(function () {
                $(this).hide();
            });
            $('#nativeShare').click(function (evt) {
                if ($(evt.target).parents(".share_bgbox").length == 0) {
                    $(this).hide();
                }
            });
        });
    }
</script>
<!----如果是其他浏览器分享,则弹出分享指引------>
{yun:}/if{/yun}
 
<!--微信分享公共代码--->
 
<!--分享-->
<div id="otherBrowser" style="width:100%;height:100%; background:rgba(51,51,51,0.9); position:fixed;left:0px;top:0px ; z-index:100000001;display:none">
    <div class="yun_wap_share_tip" style="width:100%; position:absolute; z-index:100000001;top:50%; margin-top:-90px;">
        <div class="yun_wap_share_tip_p"><i class="yun_wap_share_n">1.</i>点击浏览器顶部或底部的<i class="yun_wap_share_tip_i3"></i>或<i class="yun_wap_share_tip_i4"></i></div>
        <div class="yun_wap_share_tip_p"><i class="yun_wap_share_n">2.</i>然后点击分享按钮<i class="yun_wap_share_tip_i"></i>或<i class="yun_wap_share_tip_i2"></i></div>
        <div class="yun_wap_share_tip_p"><i class="yun_wap_share_n">3.</i>分享给朋友或者朋友圈</div>
    </div>
</div>
<!--分享-->
<div id="weixinBrowser"
     style="width:100%;height:100%; background:rgba(51,51,51,0.9); position:fixed;left:0px;top:0px ; z-index:100000001;display:block;display:none">
    <div class="yun_wap_share_tip" style="width:100%; position:absolute; z-index:100000001;">
        <i class="yun_wap_share_tip_wxicon_more"></i>
        <i class="yun_wap_share_tip_wxicon"></i>
    </div>
</div>