提现广告优化

This commit is contained in:
GaoHao
2025-01-09 15:27:39 +08:00
parent c686a02931
commit 381d801611

View File

@@ -25,7 +25,7 @@
</view> </view>
</view> </view>
<view class="witBtn" @click="goWithdraw"> {{!data.isWithdraw?'观看广告提现':'立即提现'}} </view> <view class="witBtn" @click="goWithdraw"> {{data.isWithdraw?'立即提现':'观看广告提现'}} </view>
<view class="tab" style=""> <view class="tab" style="">
<view @click="linkTo('/pages/me/withdraw/realName')">实名认证</view> <view @click="linkTo('/pages/me/withdraw/realName')">实名认证</view>
@@ -75,11 +75,13 @@
</up-modal> </up-modal>
<!-- 激励视频广告 --> <view style="width: 0;height: 0;overflow: hidden;">
<!-- <ad-rewarded-video v-if="data.adRewardedVideo" ref="adRewardedVideo" adpid="1531580352" :loadnext="true" v-slot:default="{loading, error}" <!-- 激励视频广告 -->
:url-callback="data.urlCallback" @load="onadload" @close="onadclose" @error="onaderror"> <ad-rewarded-video v-if="data.adRewardedShow" ref="adRewarded" adpid="1507000689" :loadnext="true"
<view class="ad-error" v-if="error">{{error}}</view> :url-callback="data.urlCallback" @load="onadload" @close="onadclose" @error="onaderror">
</ad-rewarded-video> --> </ad-rewarded-video>
</view>
</view> </view>
</template> </template>
@@ -116,26 +118,26 @@
limit: 10, limit: 10,
totalCount: 0, totalCount: 0,
cashMoney: 0, cashMoney: 0,
urlCallback: null, urlCallback: {},
adRewardedVideo: true, adRewardedShow: true,
adRewardedVideoloadNum: 0, adRewardedVideoloadNum: 0,
isWithdraw: false, isWithdraw: false,
userInfo: null, userInfo: null,
}) })
const adRewardedVideo = ref(null);
const adRewarded = ref(null);
onLoad(() => { onLoad(() => {
getExtractFei(); getExtractFei();
getMoneyDetail(); getMoneyDetail();
}) })
onShow(() => { onShow(() => {
console.log(uni.getStorageSync('userInfo'))
getcashMoney() getcashMoney()
getUserInfo(); getUserInfo();
}) })
onReady(() => { onReady(() => {
nextTick(()=>{ nextTick(()=>{
data.adRewardedVideoloadNum = 0 data.adRewardedVideoloadNum = 0
adRewardedVideo.value.load(); adRewarded.value.load();
}) })
getCanCash() getCanCash()
}) })
@@ -163,7 +165,7 @@
*/ */
async function getCanCash() { async function getCanCash() {
canCash().then(res => { canCash().then(res => {
// data.isWithdraw = res; data.isWithdraw = !res;
}) })
} }
@@ -172,7 +174,7 @@
* @param {Object} e * @param {Object} e
*/ */
function onadload(e) { function onadload(e) {
data.adRewardedVideo = true; data.adRewardedShow = true;
console.log('广告数据加载成功'); console.log('广告数据加载成功');
} }
@@ -182,12 +184,12 @@
*/ */
function onaderror(e) { function onaderror(e) {
if ( data.adRewardedVideoloadNum >=3 ) { if ( data.adRewardedVideoloadNum >=3 ) {
data.adRewardedVideo = false; data.adRewardedShow = false;
return return
} }
data.adRewardedVideoloadNum++ data.adRewardedVideoloadNum++
setTimeout(() => { setTimeout(() => {
// adRewardedVideo.value.load(); adRewarded.value.load();
}, 1000); // 10 }, 1000); // 10
console.log("广告加载失败") console.log("广告加载失败")
} }
@@ -224,7 +226,7 @@
userId: uni.getStorageSync('userInfo').userId, userId: uni.getStorageSync('userInfo').userId,
extra: 'cash:'+uni.getStorageSync('userInfo').userId + "" + new Date().getTime(), extra: 'cash:'+uni.getStorageSync('userInfo').userId + "" + new Date().getTime(),
} }
adRewardedVideo.value.show(); adRewarded.value.show();
} else { } else {
getOut() getOut()
} }
@@ -276,7 +278,6 @@
*/ */
function getcashMoney() { function getcashMoney() {
selectUserMoney().then(res => { selectUserMoney().then(res => {
console.log(res)
data.mayMoney = res.amount || 0 data.mayMoney = res.amount || 0
}) })
} }