This commit is contained in:
2022-06-30 08:40:35 +08:00
18 changed files with 64183 additions and 24 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -11,10 +11,11 @@
}).then(res => {
if (res.update) {
uni.showModal({
title: "更新提示",
content: res.note || '版本更新信息',
confirmText: "更新",
success: modalRes => {
title : "更新提示",
content : res.note || '版本更新信息',
confirmText : "更新",
showCancel : false,
success : modalRes => {
if (modalRes.confirm) {
if (plus.os.name == "Android") {
uni.showToast({

View File

@@ -2,7 +2,7 @@
"name" : "共力生态",
"appid" : "__UNI__DE7B0E6",
"description" : "共力生态",
"versionName" : "1.0.30",
"versionName" : "1.0.31",
"versionCode" : 100,
"transformPx" : false,
/* 5+App */
@@ -81,7 +81,7 @@
"payment" : {
"weixin" : {
"__platform__" : [ "android" ],
"appid" : "wxcb85e48d044bc5ee",
"appid" : "wx466a4663da346e09",
"UniversalLinks" : ""
},
"alipay" : {
@@ -90,7 +90,7 @@
},
"share" : {
"weixin" : {
"appid" : "wxcb85e48d044bc5ee",
"appid" : "wx466a4663da346e09",
"UniversalLinks" : ""
}
},

View File

@@ -104,6 +104,7 @@
<script>
import { life, sign } from '@/apis/interfaces/life.js'
import AD from '@/utils/ad.js'
var account;
export default {
data() {
@@ -201,19 +202,38 @@
this.$Router.push({name: 'Capacity'})
return
}
uni.showLoading({
title: '签到中..'
})
sign().then(res => {
// 激励视频广告
AD.show({
adpid : 1428308887,
adType : 'RewardedVideo',
urlCallback : {
userId: 'TMMM',
}
},(res) => {
const detail = e.detail
if (detail && detail.isEnded) {
uni.showLoading({
title: '签到中..'
})
sign().then(res => {
uni.showToast({
title: '签到成功',
icon : 'none'
})
this.getLife()
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
} else {
console.log('用户主动关闭')
console.log("onadclose " + detail.isEnded);
}
},(err) => {
uni.showToast({
title: '签到成功',
icon : 'none'
})
this.getLife()
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
title: e.detail
})
})
},

BIN
static/rank/rank-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
static/rank/rank-2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
static/rank/rank-3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
static/rank/rank.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@@ -0,0 +1,8 @@
'use strict';
exports.main = async (event, context) => {
//event为客户端上传的参数
console.log('event : ', event)
//返回数据给客户端
return event
};

View File

@@ -0,0 +1,7 @@
{
"name": "gl-ad",
"dependencies": {},
"extensions": {
"uni-cloud-jql": {}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

37174
unpackage/dist/dev/app-plus/app-service.js vendored Normal file

File diff suppressed because one or more lines are too long

26687
unpackage/dist/dev/app-plus/app-view.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

253
utils/ad.js Normal file
View File

@@ -0,0 +1,253 @@
// ad.js
const ADType = {
RewardedVideo: "RewardedVideo",
FullScreenVideo: "FullScreenVideo"
}
class AdHelper {
constructor() {
this._ads = {}
}
load(options, onload, onerror) {
let ops = this._fixOldOptions(options)
let {
adpid
} = ops
if (!adpid || this.isBusy(adpid)) {
return
}
this.get(ops).load(onload, onerror)
}
show(options, onsuccess, onfail) {
let ops = this._fixOldOptions(options)
let {
adpid
} = ops
if (!adpid) {
return
}
uni.showLoading({
mask: true
})
var ad = this.get(ops)
ad.load(() => {
uni.hideLoading()
ad.show((e) => {
onsuccess && onsuccess(e)
})
}, (err) => {
uni.hideLoading()
onfail && onfail(err)
})
}
isBusy(adpid) {
return (this._ads[adpid] && this._ads[adpid].isLoading)
}
get(options) {
const {
adpid,
singleton = true
} = options
if (singleton === false) {
if (this._ads[adpid]) {
this._ads[adpid].destroy()
delete this._ads[adpid]
}
}
delete options.singleton
if (!this._ads[adpid]) {
this._ads[adpid] = this._createAdInstance(options)
}
return this._ads[adpid]
}
_createAdInstance(options) {
const adType = options.adType || ADType.RewardedVideo
delete options.adType
let ad = null;
if (adType === ADType.RewardedVideo) {
ad = new RewardedVideo(options)
} else if (adType === ADType.FullScreenVideo) {
ad = new FullScreenVideo(options)
}
return ad
}
_fixOldOptions(options) {
return (typeof options === "string") ? {
adpid: options
} : options
}
}
const EXPIRED_TIME = 1000 * 60 * 30
const ProviderType = {
CSJ: 'csj',
GDT: 'gdt'
}
const RETRY_COUNT = 1
class AdBase {
constructor(adInstance, options = {}) {
this._isLoad = false
this._isLoading = false
this._lastLoadTime = 0
this._lastError = null
this._retryCount = 0
this._loadCallback = null
this._closeCallback = null
this._errorCallback = null
const ad = this._ad = adInstance
ad.onLoad((e) => {
this._isLoading = false
this._isLoad = true
this._lastLoadTime = Date.now()
this.onLoad()
})
ad.onClose((e) => {
this._isLoad = false
this.onClose(e)
})
ad.onVerify && ad.onVerify((e) => {
// e.isValid
})
ad.onError(({
code,
message
}) => {
this._isLoading = false
const data = {
code: code,
errMsg: message
}
if (code === -5008) {
this._loadAd()
return
}
if (this._retryCount < RETRY_COUNT) {
this._retryCount += 1
this._loadAd()
return
}
this._lastError = data
this.onError(data)
})
}
get isExpired() {
return (this._lastLoadTime !== 0 && (Math.abs(Date.now() - this._lastLoadTime) > EXPIRED_TIME))
}
get isLoading() {
return this._isLoading
}
getProvider() {
return this._ad.getProvider()
}
load(onload, onerror) {
this._loadCallback = onload
this._errorCallback = onerror
if (this._isLoading) {
return
}
if (this._isLoad) {
this.onLoad()
return
}
this._retryCount = 0
this._loadAd()
}
show(onclose) {
this._closeCallback = onclose
if (this._isLoading || !this._isLoad) {
return
}
if (this._lastError !== null) {
this.onError(this._lastError)
return
}
const provider = this.getProvider()
if (provider === ProviderType.CSJ && this.isExpired) {
this._loadAd()
return
}
this._ad.show()
}
onLoad(e) {
if (this._loadCallback != null) {
this._loadCallback()
}
}
onClose(e) {
if (this._closeCallback != null) {
this._closeCallback({
isEnded: e.isEnded
})
}
}
onError(e) {
if (this._errorCallback != null) {
this._errorCallback(e)
}
}
destroy() {
this._ad.destroy()
}
_loadAd() {
this._isLoad = false
this._isLoading = true
this._lastError = null
this._ad.load()
}
}
class RewardedVideo extends AdBase {
constructor(options = {}) {
super(plus.ad.createRewardedVideoAd(options), options)
}
}
class FullScreenVideo extends AdBase {
constructor(options = {}) {
super(plus.ad.createFullScreenVideoAd(options), options)
}
}
export default new AdHelper()