切换导航条
此项目
正在载入...
登录
景龙
/
xingqiu
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
jinglong
6 years ago
提交
c9bc130fae7b39e8567da82016b9be4a97774448
1 个父辈
58788098
1 个管道 的构建
通过
耗费 1 秒
分享
变更
1
构建
1
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
40 行增加
和
16 行删除
public/themes/simpleboot3_mobile/portal/login/wx_share.html
public/themes/simpleboot3_mobile/portal/login/wx_share.html
查看文件 @
c9bc130
...
...
@@ -9,25 +9,49 @@
</head>
<body>
<h1>
分享主题
</h1>
<button
data-mshare=
"0"
>
点击弹出原生分享面板
</button>
<button
data-mshare=
"1"
>
点击触发朋友圈分享
</button>
<button
data-mshare=
"2"
>
点击触发发送给微信朋友
</button>
</body>
</html>
<script
src=
"__TMPL__/public/assets/js/jquery-2.1.0.js"
></script>
<script
src=
"
__TMPL__/public/assets/js/mshare
.js"
></script>
<script
src=
"
http://res.wx.qq.com/open/js/jweixin-1.4.0
.js"
></script>
<script>
var
mshare
=
new
mShare
({
title
:
'Lorem ipsum dolor sit.'
,
url
:
'http://m.ly.com'
,
desc
:
'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quaerat inventore minima voluptates.'
,
img
:
'http://placehold.it/150x150'
});
$
(
'button'
).
click
(
function
()
{
// 1 ==> 朋友圈 2 ==> 朋友 0 ==> 直接弹出原生
mshare
.
init
(
+
$
(
this
).
data
(
'mshare'
));
});
</script>
$
(
function
()
{
wx
.
config
({
debug
:
true
,
appId
:
'{$data.appId}'
,
timestamp
:
'{$data.timestamp}'
,
nonceStr
:
'{$data.nonceStr}'
,
signature
:
'{$data.signature}'
,
jsApiList
:
[
'updateAppMessageShareData'
,
'updateTimelineShareData'
,
]
});
wx
.
ready
(
function
()
{
//需在用户可能点击分享按钮前就先调用
wx
.
updateAppMessageShareData
({
title
:
'分享标题'
,
// 分享标题
desc
:
'分享描述'
,
// 分享描述
link
:
'http://www.starplanet.cn/portal/enjoy/getEnjoyDetail?id=81'
,
// 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl
:
'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1562352770741&di=353c660582a6727a64cdfdc93c4fb0f0&imgtype=0&src=http%3A%2F%2Fpic.k73.com%2Fup%2Fsoft%2F2016%2F0102%2F092635_44907394.jpg'
,
// 分享图标
success
:
function
(
e
)
{
// 设置成功
alert
(
'分享朋友'
);
}
});
wx
.
updateTimelineShareData
({
title
:
'分享朋友圈'
,
// 分享标题
link
:
'http://www.starplanet.cn/portal/enjoy/getEnjoyDetail?id=81'
,
// 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl
:
''
,
// 分享图标
success
:
function
()
{
// 设置成功
alert
(
'分享朋友圈 '
);
}
});
});
wx
.
error
(
function
(
res
)
{
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
alert
(
res
);
});
});
</script>
...
...
请
注册
或
登录
后发表评论