123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- <template>
- <view class="content">
- <view class="top-bg">
- </view>
- <view class="top-wrap">
- <view class="tit">
- ·我的收益
- </view>
- <view class="val">
- {{userInfo.points || 0}}
- </view>
- <view class="">
- 累计收益
- </view>
- </view>
- <view class="gg-wrap flex" v-for="(item,index) in ggInfo.day_video_count" v-if="!isError">
- <image src="../../static/icon/jiang.png" mode=""></image>
- <view class="gg-tit">
- <view class="tit">
- 观看视频赚阅读积分
- </view>
- <view class="">
- 观看可获得阅读积分
- </view>
- </view>
- <view class="gg-btn pass" v-if="ggInfo.valid_bcount*1 > index">
- 已观看
- </view>
- <template v-if="ggInfo.valid_bcount < 3 && ggInfo.valid_bcount == index">
- <ad-rewarded-video adpid="1480651769" :loadnext="true" v-slot:default="{loading, error}"
- @load="onadload" @close="onadclose" @error="onaderror">
- <view class="gg-btn">
- 去观看
- </view>
- </ad-rewarded-video>
- </template>
- <!-- <view class="gg-btn pass" v-if="gInfo.valid_bcount*1 =< index">
- 去观看1
- </view> -->
- </view>
- <view class="gg-wrap flex" v-for="(item,index) in ggInfo.day_video_count" v-if="isError">
- <image src="../../static/icon/jiang.png" mode=""></image>
- <view class="gg-tit">
- <view class="tit">
- 观看视频赚阅读积分
- </view>
- <view class="">
- 观看可获得阅读积分
- </view>
- </view>
- <view class="gg-btn" :class="{pass: ggInfo.valid_bcount*1 > index}"
- @click="ggInfo.valid_bcount*1 > index? '': goLock(index)">
- {{ggInfo.valid_bcount*1 > index? '已观看': '去观看'}}
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex';
- import {
- getGG,
- createGG,
- ggGive
- } from '@/api/zero.js'
- import {
- getUserInfo,
- getLevelList
- } from '@/api/user.js';
- export default {
- data() {
- return {
- isError: false,
- ggInfo: {},
- id: 0,
- error: '',
- isLoading: false,
- }
- },
- computed: {
- ...mapState('user', ['userInfo', 'hasLogin'])
- },
- onLoad(opt) {
- this.id = opt.id
- },
- onShow() {
- this.loadBaseData()
- this.getGG()
- },
- onReachBottom() {
- },
- onReady() {
- },
- methods: {
- ...mapMutations('user', ['setUserInfo']),
- onadload(e) {
- console.log('广告数据加载成功',e);
- let that = this
-
- },
- onadclose(e) {
- let that = this
- const detail = e.detail
- // 用户点击了【关闭广告】按钮
- console.log('用户点击了【关闭广告】按钮')
- if (detail && detail.isEnded) {
- // 正常播放结束
- console.log("正常播放结束onadclose ", detail, detail.isEnded);
- createGG({
- ad_id: 0
- }).then(res => {
- ggGive({
- id: res.data.id
- }).then(ress => {
-
- that.loadBaseData()
- uni.showToast({
- title: '奖励发放成功',
- duration: 2000
- });
- that.getGG()
- })
-
- })
-
- } else {
- // 播放中途退出
- console.log("播放中途退出onadclose ", detail, detail.isEnded);
- }
- },
- onaderror(e) {
- // 广告加载失败
- console.log("onaderror: ", e.detail);
- this.isError = true
- // this.$api.msg(e.detail.errMsg)
- },
- loadBaseData() {
- const obj = this
- getUserInfo({})
- .then(({
- data
- }) => {
- obj.setUserInfo(data);
- // obj.getLevelList()
- })
- .catch(e => {
- console.log(e);
- });
- },
- getGG() {
- getGG().then(res => {
- console.log(res)
- this.ggInfo = res.data
- })
- },
- goLock() {
- createGG({
- ad_id: 0
- }).then(res => {
- uni.navigateTo({
- url:'/pages/zero/gg?id=' + res.data.id
- })
- })
-
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .top-bg {
- height: 210rpx;
- background-color: #f53935;
- }
- .top-wrap {
- width: 684rpx;
- height: 254rpx;
- background: linear-gradient(-70deg, #FF6362, #FF9465);
- box-shadow: 0rpx 11rpx 17rpx 4rpx rgba(255, 76, 76, 0.1);
- border-radius: 16rpx;
- margin: -180rpx auto 20rpx;
- text-align: center;
- font-size: 20rpx;
- font-weight: 500;
- color: #fff;
- padding: 30rpx;
- .tit {
- text-align: left;
- font-size: 28rpx;
- padding: 10rpx 0;
- }
- .val {
- padding-bottom: 15rpx;
- font-size: 80rpx;
- font-weight: bold;
- }
- }
- .gg-wrap {
- width: 660rpx;
- height: 140rpx;
- background: #FEFEFE;
- box-shadow: 0rpx 0rpx 29rpx 0rpx rgba(231, 71, 68, 0.09);
- border-radius: 4rpx;
- margin: 20rpx auto;
- padding: 30rpx 40rpx 40rpx 90rpx;
- position: relative;
- image {
- position: absolute;
- top: 0;
- left: 26rpx;
- width: 45rpx;
- height: 60rpx;
- }
- .gg-tit {
- font-size: 24rpx;
- font-weight: 500;
- color: #999999;
- .tit {
- padding-bottom: 20rpx;
- font-size: 32rpx;
- font-weight: bold;
- color: #333333;
- }
- }
- .gg-btn {
- width: 125rpx;
- height: 46rpx;
- background: linear-gradient(60deg, #FF8F3B, #FF3106);
- border-radius: 23rpx;
- font-size: 24rpx;
- font-weight: 500;
- color: #FFFFFF;
- text-align: center;
- line-height: 45rpx;
- }
- }
- .pass {
- background: #999 !important;
- }
- </style>
|