app-ad.js 3.5 KB

12345678910
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/page-component/app-ad/app-ad"],{"1da5":function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n={name:"app-ad",props:{type:String,unitId:String,picUrl:String,videoUrl:String,theme:{type:String,default:function(){return"white"}},couponUrl:String,couponParams:Object},data:function(){return{rewardedVideoAd:null,createInterstitialAd:null}},created:function(){this.init()},methods:{onAdLoad:function(t){console.log(t)},onAdPlay:function(t){console.log(t)},onAdClose:function(t){console.log(t)},onAdError:function(t){console.error(t)},init:function(){var t=this;switch(this.type){case"":break;case"rewarded-video":t.initRewardedVideoAd();break;case"interstitial":t.initInterstitialAd();break;case"video":break;case"before-video":break;case"grid":break}},initRewardedVideoAd:function(){var t=this;wx.createRewardedVideoAd&&(this.rewardedVideoAd=wx.createRewardedVideoAd({adUnitId:this.unitId}),this.rewardedVideoAd.onLoad((function(){console.log("rewardedVideoAd load")})),this.rewardedVideoAd.onError((function(t){console.error("rewardedVideoAd error",t)})),this.rewardedVideoAd.onClose((function(e){e&&e.isEnded?(console.log("领取"),t.getUserCoupon()):console.log("rewardedVideoAd emit",e)})))},initInterstitialAd:function(){wx.createInterstitialAd&&(this.interstitialAd=wx.createInterstitialAd({adUnitId:this.unitId}),this.interstitialAd.onLoad((function(){console.log("interstitialAd load")})),this.interstitialAd.onError((function(t){console.error("interstitialAd error",t)})),this.interstitialAd.onClose((function(t){console.log("interstitialAd close",t)})))},showRewardedVideoAd:function(){var e=this;this.rewardedVideoAd.show().catch((function(n){e.rewardedVideoAd.load().then((function(){return e.rewardedVideoAd.show()})).catch((function(e){t.showToast({title:e.errMsg,icon:"none"})}))}))},showInterstitialAd:function(){this.interstitialAd.show().catch((function(e){t.showToast({title:e.errMsg,icon:"none"})}))},getUserCoupon:function(){console.log(Object.assign({},this.couponParams));var e=this;e.$request({url:e.couponUrl,method:"POST",data:Object.assign({},this.couponParams)}).then((function(n){0===n.code?e.$store.dispatch("page/actionSetCoupon",{list:n.data.list,type:"award"}):t.showToast({title:n.msg,icon:"none"})}))}}};e.default=n}).call(this,n("543d")["default"])},"2b49":function(t,e,n){"use strict";n.r(e);var o=n("1da5"),i=n.n(o);for(var r in o)"default"!==r&&function(t){n.d(e,t,(function(){return o[t]}))}(r);e["default"]=i.a},"2e9d":function(t,e,n){"use strict";var o;n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return r})),n.d(e,"a",(function(){return o}));var i=function(){var t=this,e=t.$createElement;t._self._c},r=[]},aedf:function(t,e,n){"use strict";var o=n("f484"),i=n.n(o);i.a},c0fc:function(t,e,n){"use strict";n.r(e);var o=n("2e9d"),i=n("2b49");for(var r in i)"default"!==r&&function(t){n.d(e,t,(function(){return i[t]}))}(r);n("aedf");var d,a=n("f0c5"),s=Object(a["a"])(i["default"],o["b"],o["c"],!1,null,"6ec30d13",null,!1,o["a"],d);e["default"]=s.exports},f484:function(t,e,n){}}]);
  2. ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
  3. 'components/page-component/app-ad/app-ad-create-component',
  4. {
  5. 'components/page-component/app-ad/app-ad-create-component':(function(module, exports, __webpack_require__){
  6. __webpack_require__('543d')['createComponent'](__webpack_require__("c0fc"))
  7. })
  8. },
  9. [['components/page-component/app-ad/app-ad-create-component']]
  10. ]);