Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
php
/
miniprogrem-webview
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
206fd06c
authored
Jul 25, 2020
by
doszhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dos
parent
77d85b63
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
58 deletions
+13
-58
Application/Home/View/default/layout.tpl
+13
-58
No files found.
Application/Home/View/default/layout.tpl
View file @
206fd06c
...
...
@@ -116,70 +116,25 @@
window
.
wx
&&
wx
.
ready
(
function
()
{
wx
.
onMenuShareAppMessage
(
wxFriendData
);
wx
.
onMenuShareTimeline
(
wxTimelineData
);
wx
.
checkJsApi
({
jsApiList
:
[
'scanQRCode'
,
'previewImage'
],
success
:
function
(
res
)
{
}
});
$
(
"img"
).
click
(
function
(){
var
url
=
$
(
this
).
attr
(
"src"
);
wx
.
previewImage
({
current
:
url
,
// 当前显示图片的http链接
urls
:
[
url
]
// 需要预览的图片http链接列表
});
});
});
</script>
<script
src=
"http://res.wx.qq.com/open/js/jweixin-1.2.0.js"
></script>
<script
type=
"text/javascript"
>
$
(
function
(){
var
returnData
=
false
;
$
.
ajax
({
type
:
"get"
,
url
:
'/index/wxconfig'
,
data
:
[],
async
:
false
,
success
:
function
(
data
,
textStatus
,
jqXHR
){
returnData
=
data
.
config
;
//console.log(returnData);
}
});
//end ajax
var
returnData
=
eval
(
'('
+
returnData
+
')'
);
console
.
log
(
returnData
);
var
appId
=
returnData
.
appId
;
var
timestamp
=
returnData
.
timestamp
;
var
nonceStr
=
returnData
.
nonceStr
;
var
signature
=
returnData
.
signature
;
wx
.
config
({
debug
:
true
,
//调试阶段建议开启
appId
:
appId
,
timestamp
:
timestamp
,
nonceStr
:
nonceStr
,
signature
:
signature
,
jsApiList
:
[
/*
* 所有要调用的 API 都要加到这个列表中
* 这里以图像接口为例
*/
"chooseImage"
,
"previewImage"
,
"uploadImage"
,
"downloadImage"
,
"scanQRCode"
]
});
wx
.
ready
(
function
()
{
//alert(3);
wx
.
checkJsApi
({
jsApiList
:
[
'scanQRCode'
,
'previewImage'
],
success
:
function
(
res
)
{
}
});
$
(
"img"
).
click
(
function
(){
var
url
=
$
(
this
).
attr
(
"src"
);
wx
.
previewImage
({
current
:
url
,
// 当前显示图片的http链接
urls
:
[
url
]
// 需要预览的图片http链接列表
});
});
});
wx
.
error
(
function
(
res
){
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
console
.
log
(
res
);
});
});
</script>
</body>
...
...
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