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
ad7b4738
Commit
ad7b4738
authored
Dec 05, 2018
by
liuxinjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
视频广告多次注册事件问题
parent
f4111a1a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
23 deletions
+35
-23
ad_sdk.js
assets/llewan-weixin-sdk/ad_sdk.js
+35
-23
No files found.
assets/llewan-weixin-sdk/ad_sdk.js
View file @
ad7b4738
...
...
@@ -9,6 +9,7 @@ var adSdk = {
bannerAd
:
null
,
isOnce
:
true
,
videoAd
:
null
,
videoAd1
:
null
,
videoAd2
:
null
,
...
...
@@ -136,31 +137,42 @@ var adSdk = {
createRewardedVideoAd
(
index
,
videoAdUnitId1
)
{
let
self
=
this
;
if
(
cc
.
sys
.
platform
===
cc
.
sys
.
WECHAT_GAME
)
{
let
videoAd
=
wx
.
createRewardedVideoAd
({
adUnitId
:
videoAdUnitId1
})
videoAd
.
onLoad
(
function
(
res
)
{
console
.
log
(
"sdk VideoAd广告加载事件:"
,
res
)
});
var
closeFun1
=
function
(
res
)
{
// 用户点击了【关闭广告】按钮
// 小于 2.1.0 的基础库版本,res 是一个 undefined
if
(
res
&&
res
.
isEnded
||
res
===
undefined
)
{
console
.
log
(
"sdk 看视频成功"
);
self
.
videoSuccess
();
}
else
{
console
.
error
(
"sdk 看视频失败"
);
self
.
videoFail
();
}
};
videoAd
.
onClose
(
closeFun1
);
videoAd
.
onError
(
function
(
res
)
{
if
(
self
.
videoError
)
{
self
.
videoError
();
}
});
if
(
self
.
isOnce
)
{
self
.
isOnce
=
false
;
videoAd
.
onLoad
(
function
(
res
)
{
console
.
log
(
"sdk VideoAd广告加载事件:"
,
res
)
});
var
closeFun1
=
function
(
res
)
{
// 用户点击了【关闭广告】按钮
// 小于 2.1.0 的基础库版本,res 是一个 undefined
if
(
res
&&
res
.
isEnded
||
res
===
undefined
)
{
console
.
log
(
"sdk 看视频成功"
);
self
.
videoSuccess
();
}
else
{
console
.
error
(
"sdk 看视频失败"
);
self
.
videoFail
();
}
};
videoAd
.
onClose
(
closeFun1
);
videoAd
.
onError
(
function
(
res
)
{
wx
.
showToast
({
title
:
'今日视频已上限,明日再来!'
,
icon
:
'none'
});
if
(
self
.
videoError
)
{
self
.
videoError
();
}
});
}
if
(
index
==
1
)
{
this
.
videoAd1
=
videoAd
;
...
...
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