Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
uc_card
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhoujun
uc_card
Commits
20397e79
Commit
20397e79
authored
Jun 07, 2021
by
liyadong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
83faac0e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
42 deletions
+82
-42
src/resources/views/card/index.blade.php
src/resources/views/card/index.blade.php
+82
-42
No files found.
src/resources/views/card/index.blade.php
View file @
20397e79
...
...
@@ -57,53 +57,93 @@
$
(
'
.btn-start
'
).
click
(
function
(){
card
.
handleGetServer
();
});
$
.
ajax
({
url
:
"
/wx/config
"
,
data
:
{
url
:
location
.
href
.
split
(
'
#
'
)[
0
]
},
type
:
'
GET
'
,
dataType
:
"
json
"
,
async
:
false
,
timeout
:
5000
,
error
:
function
(
XMLHttpRequest
,
textStatus
,
errorThrown
)
{
if
(
textStatus
==
"
timeout
"
)
{
// 请求超时
}
else
{
var
isWeixin
=
function
()
{
//判断是否是微信
var
ua
=
navigator
.
userAgent
.
toLowerCase
();
return
ua
.
match
(
/MicroMessenger/i
)
==
"
micromessenger
"
;
};
function
_wechatConfig
(
o
)
{
wx
.
config
({
debug
:
false
,
// 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId
:
o
.
appId
,
// 必填,公众号的唯一标识
timestamp
:
o
.
timestamp
,
// 必填,生成签名的时间戳
nonceStr
:
o
.
nonceStr
,
// 必填,生成签名的随机串
signature
:
o
.
signature
,
// 必填,签名,见附录1
jsApiList
:
[
'
onMenuShareTimeline
'
,
'
onMenuShareAppMessage
'
]
// 必填,需要使用的JS接口列表,所有JS接口列表见附录2
});
}
function
_getWechatJsSdkInfo
(
callback
)
{
$
.
ajax
({
type
:
"
GET
"
,
url
:
"
/wx/config
"
,
data
:{
url
:
location
.
href
},
async
:
false
,
success
:
function
(
data
){
callback
(
data
);
}
},
success
:
function
(
res
)
{
var
data
=
res
.
data
;
wx
.
config
({
debug
:
true
,
appId
:
data
.
appId
,
timestamp
:
data
.
timestamp
,
nonceStr
:
data
.
nonceStr
,
signature
:
data
.
signature
,
url
:
location
.
href
.
split
(
'
#
'
)[
0
],
jsApiList
:
[
'
onMenuShareAppMessage
'
,
'
onMenuShareTimeline
'
]
});
});
}
if
(
isWeixin
())
{
_getWechatJsSdkInfo
(
_wechatConfig
);
}
wx
.
ready
(
function
()
{
wx
.
onMenuShareAppMessage
({
title
:
'
阿拉德之怒
'
,
// 分享标题
desc
:
'
阿拉德之怒
'
,
// 分享描述
link
:
'
http://uc-signin2.srccwl.com
'
,
// 分享链接,该链接域名或路径必须与当前页面对应// 分享图标的公众号JS安全域名一致
imgUrl
:
'
https://static-platform.srccwl.com/ucSign/ald/sign/images/wx.png
'
,
});
});
wx
.
checkJsApi
({
jsApiList
:
[
'
onMenuShareTimeline
'
,
'
onMenuShareAppMessage
'
],
success
:
function
(
res
)
{
}
});
$
(
'
.btn-share
'
).
click
(
function
(){
wx
.
ready
(
function
()
{
wx
.
onMenuShareAppMessage
({
title
:
'
阿拉德之怒
'
,
// 分享标题
desc
:
'
阿拉德之怒
'
,
// 分享描述
link
:
'
http://uc-signin2.srccwl.com
'
,
// 分享链接,该链接域名或路径必须与当前页面对应// 分享图标的公众号JS安全域名一致
imgUrl
:
'
https://static-platform.srccwl.com/ucSign/ald/sign/images/wx.png
'
,
});
function
wx_share
(
title
,
link
,
imgurl
,
desc
)
{
//朋友圈
wx
.
onMenuShareTimeline
({
title
:
title
,
// 分享标题
link
:
link
,
// 分享链接
imgUrl
:
imgurl
,
// 分享图标
success
:
function
()
{
// 用户确认分享后执行的回调函数
},
cancel
:
function
()
{
// 用户取消分享后执行的回调函数
}
});
//微信好友
wx
.
onMenuShareAppMessage
({
title
:
title
,
// 分享标题
desc
:
desc
,
// 分享描述
link
:
link
,
// 分享链接
imgUrl
:
imgurl
,
// 分享图标
type
:
'
link
'
,
// 分享类型,music、video或link,不填默认为link
dataUrl
:
''
,
// 如果type是music或video,则要提供数据链接,默认为空
success
:
function
()
{
// 用户确认分享后执行的回调函数
},
cancel
:
function
()
{
// 用户取消分享后执行的回调函数
}
});
})
})
}
function
random
(
min
,
max
)
{
return
Math
.
floor
(
Math
.
random
()
*
(
max
-
min
))
+
min
;
}
wx
.
ready
(
function
()
{
var
title
=
'
阿拉德之怒
'
,
link
=
'
http://uc-signin2.srccwl.com
'
,
img
=
"
https://static-platform.srccwl.com/ucSign/ald/sign/images/wx.png
"
,
desc
=
"
Warning!阿拉德之怒
"
;
wx_share
(
title
,
link
,
img
,
desc
);
});
wx
.
error
(
function
(
res
)
{
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
//alert('error');
});
});
</script>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment