Commit b452270a authored by 测试账号's avatar 测试账号

增加分享取消接口处理分享成功接口

parent 2fe5fb4d
...@@ -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);
}, // },
/** /**
......
...@@ -1518,243 +1518,7 @@ var sdk = { ...@@ -1518,243 +1518,7 @@ 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment