| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <template>
- <view class="content">
- <ad-rewarded-video adpid="1372912966" :loadnext="true" v-slot:default="{loading, error}" @load="onadload" @close="onadclose" @error="onaderror"
- :url-callback="callbackData">
- <button :disabled="loading" :loading="loading">显示广告</button>
- <view v-if="error">{{error}}</view>
- </ad-rewarded-video>
- </view>
- </template>
- <script>
- import {
- mapState
- } from "vuex"
- export default {
-
- data() {
- return {
- callbackData:{
- 'userId':"",
- 'extra':{}
- }
- }
- },
- onLoad(){
- console.log(this.userInfo);
- this.callbackData.userId = this.userInfo.sysUser.id;
- },
- computed: {
- ...mapState(['userInfo', 'userCheckInfo']),
- },
- methods: {
- onadload(e) {
- },
- onCreateAd(){
-
- },
- onadclose(e) {
- const detail = e.detail
- // 用户点击了【关闭广告】按钮
- if (detail && detail.isEnded) {
-
- } else {
- // 播放中途退出
- console.log("onadclose " + detail.isEnded);
- }
- },
- onaderror(e) {
- // 广告加载失败
- this.$refs.uToast.show({
- title: '广告加载失败',
- type: 'default',
- })
- console.log("onaderror: ", e.detail);
- }
- }
- }
- </script>
|