提交 665894f9 编写于 作者: Anne_LXM's avatar Anne_LXM

uni-sign-in签到组件style加上scoped

上级 3254f020
## 1.0.5(2021-12-09) ## 1.0.6(2024-03-26)
修复插件没自动安装依赖的`uni-popup``uni-icons`组件的问题 支持支付宝小程序云
## 1.0.4(2021-11-29) ## 1.0.5(2021-12-09)
修复在某些情况下,签到不连续7天,也获得60积分的问题 修复插件没自动安装依赖的`uni-popup``uni-icons`组件的问题
## 1.0.3(2021-11-20) ## 1.0.4(2021-11-29)
新增支持看激励视频广告签到 修复在某些情况下,签到不连续7天,也获得60积分的问题
## 1.0.2(2021-08-25) ## 1.0.3(2021-11-20)
修复时区问题 新增支持看激励视频广告签到
## 1.0.1(2021-08-23) ## 1.0.2(2021-08-25)
调整签到逻辑,支持查出积分的收入支出历史记录 修复时区问题
## 1.0.0(2021-08-05) ## 1.0.1(2021-08-23)
1.0.0版本发布 调整签到逻辑,支持查出积分的收入支出历史记录
## 1.0.0(2021-08-05)
1.0.0版本发布
...@@ -82,7 +82,10 @@ ...@@ -82,7 +82,10 @@
let res = await this.getSignedInInfo(); let res = await this.getSignedInInfo();
console.log(res); console.log(res);
if (res && res.length == 0) { if (res && res.length == 0) {
let userId= uniCloud.getCurrentUserInfo().uid let {
_id: userId
} = uni.getStorageSync('userInfo')
console.log(userId, uni.getStorageSync('userInfo'));
if (!userId) { if (!userId) {
return uni.navigateTo({ return uni.navigateTo({
url: "/pages/ucenter/login-page/index/index" url: "/pages/ucenter/login-page/index/index"
...@@ -181,7 +184,7 @@ ...@@ -181,7 +184,7 @@
} }
</script> </script>
<style lang="scss"> <style lang="scss" scoped>
view { view {
display: flex; display: flex;
box-sizing: border-box; box-sizing: border-box;
......
{ {
"id": "uni-sign-in", "id": "uni-sign-in",
"displayName": "uni-starter签到插件 提升留存,激励视频变现", "displayName": "uni-starter签到插件 提升留存,激励视频变现",
"version": "1.0.5", "version": "1.0.6",
"description": "培养用户习惯,提升用户粘性,支持广告流量变现的签到得积分功能", "description": "培养用户习惯,提升用户粘性,支持广告流量变现的签到得积分功能",
"keywords": [ "keywords": [
"uni-sign-in", "uni-sign-in",
"签到", "签到",
"营销", "营销",
"变现", "变现",
"积分" "积分"
], ],
"repository": "", "repository": "",
"engines": { "engines": {
"HBuilderX": "^3.1.0" "HBuilderX": "^3.1.0"
}, },
"dcloudext": { "dcloudext": {
"category": [ "sale": {
"uniCloud", "regular": {
"云端一体页面模板" "price": "0.00"
], },
"sale": { "sourcecode": {
"regular": { "price": "0.00"
"price": "0.00" }
}, },
"sourcecode": { "contact": {
"price": "0.00" "qq": ""
} },
}, "declaration": {
"contact": { "ads": "无",
"qq": "" "data": "无",
}, "permissions": "无"
"declaration": { },
"ads": "无", "npmurl": "",
"data": "无", "type": "unicloud-template-page"
"permissions": "无" },
}, "uni_modules": {
"npmurl": "" "dependencies": ["uni-popup","uni-icons"],
}, "encrypt": [],
"uni_modules": { "platforms": {
"dependencies": ["uni-popup","uni-icons"], "cloud": {
"encrypt": [], "tcb": "y",
"platforms": { "aliyun": "y",
"cloud": { "alipay": "y"
"tcb": "y", },
"aliyun": "y" "client": {
}, "App": {
"client": { "app-vue": "y",
"App": { "app-nvue": "u"
"app-vue": "y", },
"app-nvue": "u" "H5-mobile": {
}, "Safari": "y",
"H5-mobile": { "Android Browser": "u",
"Safari": "y", "微信浏览器(Android)": "u",
"Android Browser": "u", "QQ浏览器(Android)": "u"
"微信浏览器(Android)": "u", },
"QQ浏览器(Android)": "u" "H5-pc": {
}, "Chrome": "y",
"H5-pc": { "IE": "u",
"Chrome": "y", "Edge": "u",
"IE": "u", "Firefox": "u",
"Edge": "u", "Safari": "u"
"Firefox": "u", },
"Safari": "u" "小程序": {
}, "微信": "y",
"小程序": { "阿里": "u",
"微信": "y", "百度": "u",
"阿里": "u", "字节跳动": "u",
"百度": "u", "QQ": "u"
"字节跳动": "u", },
"QQ": "u" "快应用": {
}, "华为": "u",
"快应用": { "联盟": "u"
"华为": "u", },
"联盟": "u" "Vue": {
}, "vue2": "y",
"Vue": { "vue3": "y"
"vue2": "y", }
"vue3": "y" }
} }
} }
}
}
} }
\ No newline at end of file
#### 简介:培养用户习惯,提升用户粘性,支持广告流量变现的签到得积分功能。 #### 简介:培养用户习惯,提升用户粘性,支持广告流量变现的签到得积分功能。
#### 功能支持: #### 功能支持:
1. 每日签到奖励 (支持:普通签到、看广告签到) 1. 每日签到奖励 (支持:普通签到、看广告签到)
2. 周期性连续7日签到,奖励翻倍 2. 周期性连续7日签到,奖励翻倍
### 使用看广告签到功能必读 ### 使用看广告签到功能必读
1.`普通签到`是通过clientDb实现,如果你要使用`看广告签到`的方式, 1.`普通签到`是通过clientDb实现,如果你要使用`看广告签到`的方式,
为了防止刷量需要修改`opendb-sign-in.schema``permission` -> `create` 的值设置为`false` 为了防止刷量需要修改`opendb-sign-in.schema``permission` -> `create` 的值设置为`false`
> 文件路径 :`uni_modules/uni-sign-in/uniCloud/database/opendb-sign-in.schema.json` > 文件路径 :`uni_modules/uni-sign-in/uniCloud/database/opendb-sign-in.schema.json`
示例: 示例:
```javascript ```javascript
{ {
"bsonType": "object", "bsonType": "object",
"required": [], "required": [],
"permission": { "permission": {
"read": "auth.uid == doc.user_id", "read": "auth.uid == doc.user_id",
"create": false, "create": false,
"update": false, "update": false,
"delete": false "delete": false
} }
} }
``` ```
2. 你需要看激励视频广告相关文档 2. 你需要看激励视频广告相关文档
详情:[https://uniapp.dcloud.net.cn/api/a-d/rewarded-video](https://uniapp.dcloud.net.cn/api/a-d/rewarded-video) 详情:[https://uniapp.dcloud.net.cn/api/a-d/rewarded-video](https://uniapp.dcloud.net.cn/api/a-d/rewarded-video)
##### 使用方式 ##### 使用方式
```js ```js
<template> <template>
<view> <view>
<uni-sign-in ref="signIn"></uni-sign-in> <uni-sign-in ref="signIn"></uni-sign-in>
<button type="default" @click="signIn">普通签到</button> <button type="default" @click="signIn">签到</button>
<button type="default" @click="signInByAd">看广告签到</button> </view>
</view> </template>
</template> <script>
<script> export default {
export default { methods: {
methods: { signIn() { //签到
signIn() { //普通签到
this.$refs.signIn.open() this.$refs.signIn.open()
}, }
signInByAd(){ //看激励视频广告签到 }
this.$refs.signIn.showRewardedVideoAd() }
}, </script>
} ```
}
</script> > 详情参考[uni-starter](https://ext.dcloud.net.cn/plugin?id=5057)
```
> 详情参考[uni-starter](https://ext.dcloud.net.cn/plugin?id=5057) ##### 插件组成
1. 前端组件
##### 插件组成 <img style="margin-left:30px;width:60vw;max-width:300px;" src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-f184e7c3-1912-41b2-b81f-435d1b37c7b4/ff94178d-6d67-4408-8dde-b06eee8212c9.jpg" />
1. 前端组件
2. `DB Schema`表结构,
<img style="margin-left:30px;width:60vw;max-width:300px;" src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-f184e7c3-1912-41b2-b81f-435d1b37c7b4/ff94178d-6d67-4408-8dde-b06eee8212c9.jpg" /> - 描述签到表字段及含义以及读写权限。
- 路径:`/uniCloud/database/opendb-sign-in.schema.json`
2. `DB Schema`表结构, > 更多表结构说明详情:[https://uniapp.dcloud.io/uniCloud/schema](https://uniapp.dcloud.io/uniCloud/schema)
- 描述签到表字段及含义以及读写权限。
- 路径:`/uniCloud/database/opendb-sign-in.schema.json` 3. `uni-clientDB-actions` 一个可编程的 `clientDB` 前置后置操作
> 更多表结构说明详情:[https://uniapp.dcloud.io/uniCloud/schema](https://uniapp.dcloud.io/uniCloud/schema) - 前置操作,添加操作时检查今日是否未签到,否则拦截
- 后置操作,判断是否已经连续签到7天,决定本次签到用户可得积分
3. `uni-clientDB-actions` 一个可编程的 `clientDB` 前置后置操作 - 后置操作,输出本轮已签到几天,当前积分,已签到的日期数组,本轮签到可得多少分
- 前置操作,添加操作时检查今日是否未签到,否则拦截 4. 两个api接口
- 后置操作,判断是否已经连续签到7天,决定本次签到用户可得积分 普通签到`this.$refs.signIn.open()`
- 后置操作,输出本轮已签到几天,当前积分,已签到的日期数组,本轮签到可得多少分 看激励视频广告签到`this.$refs.signIn.showRewardedVideoAd()`
4. 两个api接口
普通签到`this.$refs.signIn.open()` #### 常见问题
看激励视频广告签到`this.$refs.signIn.showRewardedVideoAd()` 1. 是否支持配置积分数
#### 常见问题 答:暂不支持,今后的版本有计划支持
1. 是否支持配置积分数
2. 有没有更多玩法
答:暂不支持,今后的版本有计划支持
答:计划今后推出
2. 有没有更多玩法 (2.1)需要看广告才能签到 --- 已支持
答:计划今后推出
(2.1)需要看广告才能签到 --- 已支持
(2.2)补签的玩法 (2.2)补签的玩法
\ No newline at end of file
{ {
"name": "rewarded-video-ad-notify-url", "name": "rewarded-video-ad-notify-url",
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"sign-in": "file:../common/sign-in", "sign-in": "file:../common/sign-in",
"uni-config-center": "file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center" "uni-config-center": "file:../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
} }
} }
// 开发文档:https://uniapp.dcloud.io/uniCloud/clientdb?id=action // 开发文档:https://uniapp.dcloud.io/uniCloud/clientdb?id=action
const db = uniCloud.database(); const db = uniCloud.database();
const dbCmd = db.command const dbCmd = db.command
const signInTable = db.collection('opendb-sign-in'); const signInTable = db.collection('opendb-sign-in');
const scoresTable = db.collection('uni-id-scores'); const scoresTable = db.collection('uni-id-scores');
module.exports = { module.exports = {
before: async (state, event) => { before: async (state, event) => {
// console.log({state}); // console.log({state});
if(state.type == 'create'){ if(state.type == 'create'){
let date = todayTimestamp() let date = todayTimestamp()
let {total} = await signInTable.where({ let {total} = await signInTable.where({
user_id:state.auth.uid, user_id:state.auth.uid,
date, date,
isDelete:false isDelete:false
}).count() }).count()
console.log(total); console.log(total);
if(total){ if(total){
throw new Error("今天已经签到") throw new Error("今天已经签到")
} }
state.newData.date = date state.newData.date = date
state.newData.isDelete = false state.newData.isDelete = false
} }
}, },
after: async (state, event, error, result) => { after: async (state, event, error, result) => {
if (error) { if (error) {
throw error throw error
} }
let date = todayTimestamp() let date = todayTimestamp()
//查最近7天的签到情况 //查最近7天的签到情况
let {data:signInData} = await signInTable.where({ let {data:signInData} = await signInTable.where({
user_id:state.auth.uid, user_id:state.auth.uid,
date:dbCmd.gte(date-3600*24*6*1000), date:dbCmd.gte(date-3600*24*6*1000),
isDelete:false isDelete:false
}).get() }).get()
let allDate = signInData.map(item=>item.date) let allDate = signInData.map(item=>item.date)
//今天是本轮签到的第几天 //今天是本轮签到的第几天
const n = ( date - Math.min(...allDate) )/3600/24/1000+1; const n = ( date - Math.min(...allDate) )/3600/24/1000+1;
//换成数字--第几天 //换成数字--第几天
let days = signInData.map(item=>{ let days = signInData.map(item=>{
return (n*10000 - (date - item.date)/3600/24/1000*10000)/10000 -1 return (n*10000 - (date - item.date)/3600/24/1000*10000)/10000 -1
}) })
//查出来用户当前有多少积分 //查出来用户当前有多少积分
let {data: [userScore]} = await scoresTable let {data: [userScore]} = await scoresTable
.where({user_id:state.auth.uid}) .where({user_id:state.auth.uid})
.orderBy("create_date", "desc") .orderBy("create_date", "desc")
.limit(1) .limit(1)
.get() .get()
let balance = 0 let balance = 0
if(userScore){ if(userScore){
balance = userScore.balance balance = userScore.balance
} }
if(state.type == 'create'){ if(state.type == 'create'){
if(n == 7){ //如果已经满一轮就软删除之前的内容 if(n == 7){ //如果已经满一轮就软删除之前的内容
let setIsDeleteRes = await signInTable.where({ let setIsDeleteRes = await signInTable.where({
user_id:state.auth.uid, user_id:state.auth.uid,
date:dbCmd.neq(date) date:dbCmd.neq(date)
}).update({isDelete:true}) }).update({isDelete:true})
console.log({setIsDeleteRes}); console.log({setIsDeleteRes});
} }
//给加积分 //给加积分
let score = n+days.length==14?60:10 //如果连续签到7天就多加50分,也就是60分 let score = n+days.length==14?60:10 //如果连续签到7天就多加50分,也就是60分
balance += score balance += score
let addScores = await scoresTable.add({ let addScores = await scoresTable.add({
user_id:state.auth.uid, user_id:state.auth.uid,
balance, balance,
score, score,
type:1, type:1,
create_date:Date.now() create_date:Date.now()
}) })
console.log({addScores}); console.log({addScores});
} }
return {...result,score:balance,signInData,n,days} return {...result,score:balance,signInData,n,days}
} }
} }
function todayTimestamp(){ function todayTimestamp(){
//时区 //时区
let timeZone = new Date().getTimezoneOffset()/60 let timeZone = new Date().getTimezoneOffset()/60
//获得相对于北京时间的时间戳 //获得相对于北京时间的时间戳
let timestamp = Date.now()+3600*1000*(8+timeZone) let timestamp = Date.now()+3600*1000*(8+timeZone)
//一天一共多少毫秒 //一天一共多少毫秒
const D = 3600*24*1000 const D = 3600*24*1000
//去掉余数,再减去东8区的8小时 得到当天凌晨的时间戳 //去掉余数,再减去东8区的8小时 得到当天凌晨的时间戳
return parseInt(timestamp/D)*D - 3600*1000*8 return parseInt(timestamp/D)*D - 3600*1000*8
} }
\ No newline at end of file
// 文档教程: https://uniapp.dcloud.net.cn/uniCloud/schema // 文档教程: https://uniapp.dcloud.net.cn/uniCloud/schema
{ {
"bsonType": "object", "bsonType": "object",
"required": [], "required": [],
"permission": { "permission": {
"read": "auth.uid == doc.user_id", "read": "auth.uid == doc.user_id",
"create": "auth.uid != null && 'signIn' in action", //如果你要使用`看广告签到`的方式请将这里的值改为:false "create": "auth.uid != null && 'signIn' in action", //如果你要使用`看广告签到`的方式请将这里的值改为:false
"update": false, "update": false,
"delete": false "delete": false
}, },
"properties": { "properties": {
"_id": { "_id": {
"description": "ID,系统自动生成" "description": "ID,系统自动生成"
}, },
"user_id":{ "user_id":{
"forceDefaultValue":{ "forceDefaultValue":{
"$env":"uid" "$env":"uid"
} }
}, },
"date":{ "date":{
"bsonType":"timestamp", "bsonType":"timestamp",
"description":"签到的日期时间戳", "description":"签到的日期时间戳",
"permission":{ "permission":{
"write":false "write":false
} }
}, },
"create_date":{ "create_date":{
"bsonType":"timestamp", "bsonType":"timestamp",
"description":"签到的时间戳", "description":"签到的时间戳",
"forceDefaultValue":{ "forceDefaultValue":{
"$env":"now" "$env":"now"
} }
}, },
"ip":{ "ip":{
"bsonType":"string", "bsonType":"string",
"forceDefaultValue":{ "forceDefaultValue":{
"$env":"clientIP" "$env":"clientIP"
} }
} }
} }
} }
\ No newline at end of file
// ad.js // ad.js
const ADType = { const ADType = {
RewardedVideo: "RewardedVideo", RewardedVideo: "RewardedVideo",
FullScreenVideo: "FullScreenVideo" FullScreenVideo: "FullScreenVideo"
} }
class AdHelper { class AdHelper {
constructor() { constructor() {
this._ads = {} this._ads = {}
} }
load(options, onload, onerror) { load(options, onload, onerror) {
let ops = this._fixOldOptions(options) let ops = this._fixOldOptions(options)
let { let {
adpid adpid
} = ops } = ops
if (!adpid || this.isBusy(adpid)) { if (!adpid || this.isBusy(adpid)) {
return return
} }
this.get(ops).load(onload, onerror) this.get(ops).load(onload, onerror)
} }
show(options, onsuccess, onfail) { show(options, onsuccess, onfail) {
let ops = this._fixOldOptions(options) let ops = this._fixOldOptions(options)
let { let {
adpid adpid
} = ops } = ops
if (!adpid) { if (!adpid) {
return return
} }
uni.showLoading({ uni.showLoading({
mask: true mask: true
}) })
var ad = this.get(ops) var ad = this.get(ops)
ad.load(() => { ad.load(() => {
uni.hideLoading() uni.hideLoading()
ad.show((e) => { ad.show((e) => {
onsuccess && onsuccess(e) onsuccess && onsuccess(e)
}) })
}, (err) => { }, (err) => {
uni.hideLoading() uni.hideLoading()
onfail && onfail(err) onfail && onfail(err)
}) })
} }
isBusy(adpid) { isBusy(adpid) {
return (this._ads[adpid] && this._ads[adpid].isLoading) return (this._ads[adpid] && this._ads[adpid].isLoading)
} }
get(options) { get(options) {
const { const {
adpid, adpid,
singleton = true singleton = true
} = options } = options
if (singleton === false) { if (singleton === false) {
if (this._ads[adpid]) { if (this._ads[adpid]) {
this._ads[adpid].destroy() this._ads[adpid].destroy()
delete this._ads[adpid] delete this._ads[adpid]
} }
} }
delete options.singleton delete options.singleton
if (!this._ads[adpid]) { if (!this._ads[adpid]) {
this._ads[adpid] = this._createAdInstance(options) this._ads[adpid] = this._createAdInstance(options)
} }
return this._ads[adpid] return this._ads[adpid]
} }
_createAdInstance(options) { _createAdInstance(options) {
const adType = options.adType || ADType.RewardedVideo const adType = options.adType || ADType.RewardedVideo
delete options.adType delete options.adType
let ad = null; let ad = null;
if (adType === ADType.RewardedVideo) { if (adType === ADType.RewardedVideo) {
ad = new RewardedVideo(options) ad = new RewardedVideo(options)
} else if (adType === ADType.FullScreenVideo) { } else if (adType === ADType.FullScreenVideo) {
ad = new FullScreenVideo(options) ad = new FullScreenVideo(options)
} }
return ad return ad
} }
_fixOldOptions(options) { _fixOldOptions(options) {
return (typeof options === "string") ? { return (typeof options === "string") ? {
adpid: options adpid: options
} : options } : options
} }
} }
const EXPIRED_TIME = 1000 * 60 * 30 const EXPIRED_TIME = 1000 * 60 * 30
const ProviderType = { const ProviderType = {
CSJ: 'csj', CSJ: 'csj',
GDT: 'gdt' GDT: 'gdt'
} }
const RETRY_COUNT = 1 const RETRY_COUNT = 1
class AdBase { class AdBase {
constructor(adInstance, options = {}) { constructor(adInstance, options = {}) {
this._isLoad = false this._isLoad = false
this._isLoading = false this._isLoading = false
this._lastLoadTime = 0 this._lastLoadTime = 0
this._lastError = null this._lastError = null
this._retryCount = 0 this._retryCount = 0
this._loadCallback = null this._loadCallback = null
this._closeCallback = null this._closeCallback = null
this._errorCallback = null this._errorCallback = null
const ad = this._ad = adInstance const ad = this._ad = adInstance
ad.onLoad((e) => { ad.onLoad((e) => {
this._isLoading = false this._isLoading = false
this._isLoad = true this._isLoad = true
this._lastLoadTime = Date.now() this._lastLoadTime = Date.now()
this.onLoad() this.onLoad()
}) })
ad.onClose((e) => { ad.onClose((e) => {
this._isLoad = false this._isLoad = false
this.onClose(e) this.onClose(e)
}) })
ad.onVerify && ad.onVerify((e) => { ad.onVerify && ad.onVerify((e) => {
// e.isValid // e.isValid
}) })
ad.onError(({ ad.onError(({
code, code,
message message
}) => { }) => {
this._isLoading = false this._isLoading = false
const data = { const data = {
code: code, code: code,
errMsg: message errMsg: message
} }
if (code === -5008) { if (code === -5008) {
this._loadAd() this._loadAd()
return return
} }
if (this._retryCount < RETRY_COUNT) { if (this._retryCount < RETRY_COUNT) {
this._retryCount += 1 this._retryCount += 1
this._loadAd() this._loadAd()
return return
} }
this._lastError = data this._lastError = data
this.onError(data) this.onError(data)
}) })
} }
get isExpired() { get isExpired() {
return (this._lastLoadTime !== 0 && (Math.abs(Date.now() - this._lastLoadTime) > EXPIRED_TIME)) return (this._lastLoadTime !== 0 && (Math.abs(Date.now() - this._lastLoadTime) > EXPIRED_TIME))
} }
get isLoading() { get isLoading() {
return this._isLoading return this._isLoading
} }
getProvider() { getProvider() {
return this._ad.getProvider() return this._ad.getProvider()
} }
load(onload, onerror) { load(onload, onerror) {
this._loadCallback = onload this._loadCallback = onload
this._errorCallback = onerror this._errorCallback = onerror
if (this._isLoading) { if (this._isLoading) {
return return
} }
if (this._isLoad) { if (this._isLoad) {
this.onLoad() this.onLoad()
return return
} }
this._retryCount = 0 this._retryCount = 0
this._loadAd() this._loadAd()
} }
show(onclose) { show(onclose) {
this._closeCallback = onclose this._closeCallback = onclose
if (this._isLoading || !this._isLoad) { if (this._isLoading || !this._isLoad) {
return return
} }
if (this._lastError !== null) { if (this._lastError !== null) {
this.onError(this._lastError) this.onError(this._lastError)
return return
} }
const provider = this.getProvider() const provider = this.getProvider()
if (provider === ProviderType.CSJ && this.isExpired) { if (provider === ProviderType.CSJ && this.isExpired) {
this._loadAd() this._loadAd()
return return
} }
this._ad.show() this._ad.show()
} }
onLoad(e) { onLoad(e) {
if (this._loadCallback != null) { if (this._loadCallback != null) {
this._loadCallback() this._loadCallback()
} }
} }
onClose(e) { onClose(e) {
if (this._closeCallback != null) { if (this._closeCallback != null) {
this._closeCallback({ this._closeCallback({
isEnded: e.isEnded isEnded: e.isEnded
}) })
} }
} }
onError(e) { onError(e) {
if (this._errorCallback != null) { if (this._errorCallback != null) {
this._errorCallback(e) this._errorCallback(e)
} }
} }
destroy() { destroy() {
this._ad.destroy() this._ad.destroy()
} }
_loadAd() { _loadAd() {
this._isLoad = false this._isLoad = false
this._isLoading = true this._isLoading = true
this._lastError = null this._lastError = null
this._ad.load() this._ad.load()
} }
} }
class RewardedVideo extends AdBase { class RewardedVideo extends AdBase {
constructor(options = {}) { constructor(options = {}) {
super(plus.ad.createRewardedVideoAd(options), options) super(plus.ad.createRewardedVideoAd(options), options)
} }
} }
class FullScreenVideo extends AdBase { class FullScreenVideo extends AdBase {
constructor(options = {}) { constructor(options = {}) {
super(plus.ad.createFullScreenVideoAd(options), options) super(plus.ad.createFullScreenVideoAd(options), options)
} }
} }
export default new AdHelper() export default new AdHelper()
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册