广告优化

This commit is contained in:
GaoHao 2025-01-09 18:08:26 +08:00
parent 92e53ae8b2
commit 5f1d2db2bd
4 changed files with 33 additions and 18 deletions

View File

@ -117,16 +117,21 @@
</scroll-view> </scroll-view>
</view> </view>
</u-modal> </u-modal>
<!-- 激励视频广告 -->
<ad-rewarded-video v-if="adRewardedVideo" ref="adRewardedVideo" adpid="1531580352" :loadnext="true" v-slot:default="{loading, error}"
:url-callback="urlCallback" @load="onadload" @close="onadclose" @error="onaderror"> <view style="width: 0;height: 0;overflow: overflow: hidden;;">
<view class="ad-error" v-if="error">{{error}}</view> <!-- 激励视频广告 -->
</ad-rewarded-video> <ad-rewarded-video v-if="adRewardedVideo" ref="adRewardedVideo" adpid="1531580352" :loadnext="true" v-slot:default="{loading, error}"
:url-callback="urlCallback" @load="onadload" @close="onadclose" @error="onaderror">
<view class="ad-error" v-if="error">{{error}}</view>
</ad-rewarded-video>
</view>
</view> </view>
</template> </template>
<script> <script>
import { $cache_config, $cache_index } from '@/store/cashe.js' import { $cache_config, $cache_index,$cache_rule } from '@/store/cashe.js'
import { init } from '@/utils/init.js' import { init } from '@/utils/init.js'
export default { export default {
data() { data() {
@ -173,7 +178,7 @@
isWithdraw: false, isWithdraw: false,
withdrawNum: $cache_config.withdrawNum, withdrawNum: $cache_config.withdrawNum,
ruleIndex: 0, ruleIndex: 0,
ruleList: $cache_config.ruleCash||[] ruleList: $cache_rule.ruleCash||[]
}; };
}, },
onLoad() { onLoad() {
@ -181,14 +186,14 @@
this.getMoneyDetail(); this.getMoneyDetail();
this.configInit() this.configInit()
if ($cache_config.ruleCash) { if ($cache_rule.ruleCash) {
this.ruleInit() this.ruleInit()
return return
} }
this.$Request.getT("app/announcement", {type: 1}).then(res => { this.$Request.getT("app/announcement", {type: 1}).then(res => {
if (res.code == 0 && res.data.length > 0) { if (res.code == 0 && res.data.length > 0) {
this.ruleList = res.data this.ruleList = res.data
$cache_config.set('ruleCash',this.ruleList) $cache_rule.set('ruleCash',this.ruleList)
this.ruleInit() this.ruleInit()
this.ruleShow = true this.ruleShow = true
} }

View File

@ -222,7 +222,7 @@
$cache_index $cache_index
} from '@/store/cashe.js' } from '@/store/cashe.js'
import { import {
$cache_config $cache_config,$cache_rule
} from '@/store/cashe.js' } from '@/store/cashe.js'
console.log($cache_index) console.log($cache_index)
export default { export default {
@ -281,7 +281,7 @@
rule_title: '', rule_title: '',
rule_content: '', rule_content: '',
ruleIndex: 0, ruleIndex: 0,
ruleList: $cache_config.ruleIndex || [] ruleList: $cache_rule.ruleIndex || []
}; };
}, },
onShareAppMessage(res) { onShareAppMessage(res) {
@ -434,7 +434,7 @@
}, },
onReady() { onReady() {
if ($cache_config.ruleIndex) { if ($cache_rule.ruleIndex) {
this.ruleShow = true this.ruleShow = true
this.ruleInit() this.ruleInit()
return return
@ -443,7 +443,7 @@
if (res.code == 0&&res.data.length > 0) { if (res.code == 0&&res.data.length > 0) {
this.ruleShow = true this.ruleShow = true
this.ruleList = res.data this.ruleList = res.data
$cache_config.set('ruleIndex',this.ruleList) $cache_rule.set('ruleIndex',this.ruleList)
this.ruleInit() this.ruleInit()
} }
}); });

View File

@ -89,11 +89,15 @@
</view> </view>
</view> </view>
</view> </view>
<!-- 激励视频广告 -->
<ad-rewarded-video v-if="adRewardedVideo" ref="adRewardedVideo" adpid="1531580352" :loadnext="true" v-slot:default="{loading, error}" <view style="width: 0;height: 0;overflow: overflow: hidden;;">
:url-callback="urlCallback" @load="onadload" @close="onadclose" @error="onaderror"> <!-- 激励视频广告 -->
<view class="ad-error" v-if="error">{{error}}</view> <ad-rewarded-video v-if="adRewardedVideo" ref="adRewardedVideo" adpid="1531580352" :loadnext="true" v-slot:default="{loading, error}"
</ad-rewarded-video> :url-callback="urlCallback" @load="onadload" @close="onadclose" @error="onaderror">
<view class="ad-error" v-if="error">{{error}}</view>
</ad-rewarded-video>
</view>
</view> </view>
</template> </template>

View File

@ -75,6 +75,11 @@ export const $cache_user = new CACHE({
...uni.getStorageSync('CACHE_user') ...uni.getStorageSync('CACHE_user')
}) })
export const $cache_rule = new CACHE({
_name: 'CACHE_rule',
...uni.getStorageSync('CACHE_rule')
})
class CACHE_config extends CACHE { class CACHE_config extends CACHE {
constructor(data) { constructor(data) {
super(data) super(data)
@ -113,6 +118,7 @@ const $cache={
renwu:$cache_renwu, renwu:$cache_renwu,
chasingDrama:$cache_chasingDrama, chasingDrama:$cache_chasingDrama,
user:$cache_user, user:$cache_user,
rule:$cache_rule,
config:$cache_config config:$cache_config
} }
export function cacheClearAll() { export function cacheClearAll() {