Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
llewan-weixin-sdk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
llewan
llewan-weixin-sdk
Commits
b452270a
Commit
b452270a
authored
Jan 14, 2019
by
测试账号
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加分享取消接口处理分享成功接口
parent
2fe5fb4d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
240 deletions
+4
-240
ad_sdk.js
assets/llewan-weixin-sdk/ad_sdk.js
+3
-3
sdk.js
assets/llewan-weixin-sdk/sdk.js
+1
-237
No files found.
assets/llewan-weixin-sdk/ad_sdk.js
View file @
b452270a
...
@@ -132,10 +132,10 @@ var adSdk = {
...
@@ -132,10 +132,10 @@ var adSdk = {
* bannerAd.show();
* bannerAd.show();
*
*
*/
*/
createBannerAd
(
obj
){
//
createBannerAd(obj){
return
sdk
.
createBannerAd
(
obj
);
//
return sdk.createBannerAd(obj);
},
//
},
/**
/**
...
...
assets/llewan-weixin-sdk/sdk.js
View file @
b452270a
...
@@ -1517,244 +1517,8 @@ var sdk = {
...
@@ -1517,244 +1517,8 @@ var sdk = {
},
},
/**
*
* @param {*} obj
* @param {*} bannerAdUnitId
* 多个banner广告id调用如下:
* sdk.createBannerAdByAdId({},bannerAdUnitId).destroy();
* sdk.BannerAd =null;
* var bannerAd =sdk.createBannerAdByAdId({},bannerAdUnitId2);
* bannerAd.show();
*
*/
createBannerAdByAdId
(
obj
,
bannerAdUnitId
){
var
self
=
this
;
if
(
cc
.
sys
.
platform
===
cc
.
sys
.
WECHAT_GAME
)
{
if
(
this
.
BannerAd
){
return
this
.
BannerAd
;
}
else
{
if
(
!
obj
.
style
){
obj
.
style
=
{};
var
phone
=
wx
.
getSystemInfoSync
();
this
.
w
=
phone
.
screenWidth
/
2
;
this
.
h
=
phone
.
screenHeight
;
obj
.
style
.
left
=
0
;
obj
.
style
.
top
=
0
;
obj
.
style
.
width
=
300
;
}
this
.
BannerAd
=
wx
.
createBannerAd
({
adUnitId
:
bannerAdUnitId
,
style
:
obj
.
style
,
})
this
.
BannerAd
.
onResize
(
function
(
res
){
console
.
log
(
"sdk BannerAd广告缩放事件:"
,
res
)
self
.
BannerAd
.
style
.
left
=
self
.
w
-
self
.
BannerAd
.
style
.
realWidth
/
2
+
0.1
;
self
.
BannerAd
.
style
.
top
=
self
.
h
-
self
.
BannerAd
.
style
.
realHeight
+
0.1
;
});
this
.
BannerAd
.
onLoad
(
function
(
res
){
console
.
log
(
"sdk BannerAd广告加载事件:"
,
res
)
});
this
.
BannerAd
.
onError
(
function
(
res
){
console
.
log
(
"sdk BannerAd广告错误事件:"
,
res
)
});
return
this
.
BannerAd
;
}
}
},
/**
* @apiGroup C
* @apiName createBannerAd
* @api {微信登录} 创建banner广告组件 createBannerAd(广告)
* @apiParam {String} adUnitId 广告单元id
* @apiParam {String} style banner 广告组件的样式
*
* @apiSuccessExample {json} 示例:
* //.参考文档:https://developers.weixin.qq.com/minigame/dev/document/ad/wx.createBannerAd.html
* //var bannerAd = sdk.createBannerAd({
* // style:{
* // left: 0,
* // top: 0,
* // width: 100,
* // height: 200
* // }
* //});
*
* //.极简版(默认底部Banner)
* var bannerAd = sdk.createBannerAd({});
* bannerAd.show()
*
*/
createBannerAd
(
obj
){
var
self
=
this
;
if
(
cc
.
sys
.
platform
===
cc
.
sys
.
WECHAT_GAME
)
{
if
(
this
.
BannerAd
){
return
this
.
BannerAd
;
}
else
{
if
(
!
obj
.
style
){
obj
.
style
=
{};
var
phone
=
wx
.
getSystemInfoSync
();
this
.
w
=
phone
.
screenWidth
/
2
;
this
.
h
=
phone
.
screenHeight
;
obj
.
style
.
left
=
0
;
obj
.
style
.
top
=
0
;
obj
.
style
.
width
=
300
;
}
this
.
BannerAd
=
wx
.
createBannerAd
({
adUnitId
:
this
.
getConfig4
().
bannerAdUnitId
,
style
:
obj
.
style
,
})
this
.
BannerAd
.
onResize
(
function
(
res
){
console
.
log
(
"sdk BannerAd广告缩放事件:"
,
res
)
self
.
BannerAd
.
style
.
left
=
self
.
w
-
self
.
BannerAd
.
style
.
realWidth
/
2
+
0.1
;
self
.
BannerAd
.
style
.
top
=
self
.
h
-
self
.
BannerAd
.
style
.
realHeight
+
0.1
;
});
this
.
BannerAd
.
onLoad
(
function
(
res
){
console
.
log
(
"sdk BannerAd广告加载事件:"
,
res
)
});
this
.
BannerAd
.
onError
(
function
(
res
){
console
.
log
(
"sdk BannerAd广告错误事件:"
,
res
)
});
return
this
.
BannerAd
;
}
}
},
/**
* @apiGroup C
* @apiName createRewardedVideoAd
* @api {微信登录} 创建banner广告组件 createRewardedVideoAd(广告)
* @apiParam {String} adUnitId 广告单元id
*
* @apiSuccessExample {json} 示例:
* //.参考文档:https://developers.weixin.qq.com/minigame/dev/document/ad/wx.createRewardedVideoAd.html
* sdk.videoSuccess = function(){
* //视频成功处理逻辑
* this.successFunction();
* };
* sdk.videoFail = function(){
* //视频失败处理逻辑
* this.failFunction();`
* };
* sdk.videoError = function(){
* //视频失败处理逻辑
* this.ErrorFunction();`
* };
* var videoAd = sdk.createRewardedVideoAd();
* videoAd.load().then(() => videoAd.show());
*
*/
createRewardedVideoAd
(){
let
self
=
this
;
if
(
cc
.
sys
.
platform
===
cc
.
sys
.
WECHAT_GAME
)
{
if
(
this
.
VideoAd
){
return
this
.
VideoAd
;
}
else
{
this
.
VideoAd
=
wx
.
createRewardedVideoAd
({
adUnitId
:
this
.
getConfig4
().
videoAdUnitId
})
this
.
VideoAd
.
onLoad
(
function
(
res
){
console
.
log
(
"sdk VideoAd广告加载事件:"
,
res
)
});
var
closeFun
=
function
(
res
){
// 用户点击了【关闭广告】按钮
// 小于 2.1.0 的基础库版本,res 是一个 undefined
if
(
res
&&
res
.
isEnded
||
res
===
undefined
)
{
console
.
log
(
"sdk 看视频成功"
);
self
.
videoSuccess
();
}
else
{
console
.
error
(
"sdk 看视频失败"
);
self
.
videoFail
();
}
};
this
.
VideoAd
.
onClose
(
closeFun
);
this
.
VideoAd
.
onError
(
function
(
res
){
//console.log("sdk VideoAd广告错误事件:", res)
// wx.showToast({
// title: '暂未开通,请谅解!',
// icon: 'none'
// });
if
(
self
.
videoError
)
{
self
.
videoError
();
}
});
return
this
.
VideoAd
;
}
}
},
/**
*
* @param {*} videoAdUnitId
*
*
*sdk.VideoAd =null;
*sdk.videoSuccess = function(){
* //视频成功处理逻辑
* this.successFunction();
* };
* sdk.videoFail = function(){
* //视频失败处理逻辑
* this.failFunction();`
* };
* sdk.videoError = function(){
* //视频失败处理逻辑
* this.ErrorFunction();`
* };
* 特别注意:下面这个videoAd为全局变量
* var videoAd = sdk.createRewardedVideoAd(videoAdUnitId2);
* videoAd.load().then(() => videoAd.show());
*
*/
createRewardedVideoAdByAdId
(
videoAdUnitId
){
let
self
=
this
;
if
(
cc
.
sys
.
platform
===
cc
.
sys
.
WECHAT_GAME
)
{
if
(
this
.
VideoAd
){
return
this
.
VideoAd
;
}
else
{
this
.
VideoAd
=
wx
.
createRewardedVideoAd
({
adUnitId
:
videoAdUnitId
})
this
.
VideoAd
.
onLoad
(
function
(
res
){
console
.
log
(
"sdk VideoAd广告加载事件:"
,
res
)
});
var
closeFun
=
function
(
res
){
// 用户点击了【关闭广告】按钮
// 小于 2.1.0 的基础库版本,res 是一个 undefined
if
(
res
&&
res
.
isEnded
||
res
===
undefined
)
{
console
.
log
(
"sdk 看视频成功"
);
self
.
videoSuccess
();
}
else
{
console
.
error
(
"sdk 看视频失败"
);
self
.
videoFail
();
}
};
this
.
VideoAd
.
onClose
(
closeFun
);
this
.
VideoAd
.
onError
(
function
(
res
){
//console.log("sdk VideoAd广告错误事件:", res)
// wx.showToast({
// title: '暂未开通,请谅解!',
// icon: 'none'
// });
if
(
self
.
videoError
)
{
self
.
videoError
();
}
});
return
this
.
VideoAd
;
}
}
},
/**
/**
* @apiGroup C
* @apiGroup C
* @apiName Screenshot
* @apiName Screenshot
...
...
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