require('../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages_course/components/treasureChest"],{1184:function(t,i,e){"use strict";e.r(i);var n=e(1185),o=e(1187);for(var u in o)["default"].indexOf(u)<0&&function(t){e.d(i,t,(function(){return o[t]}))}(u);e(1189);var s,r=e(34),c=Object(r["default"])(o["default"],n["render"],n["staticRenderFns"],!1,null,"5098c7b4",null,!1,n["components"],s);c.options.__file="pages_course/components/treasureChest.vue",i["default"]=c.exports},1185:function(t,i,e){"use strict";e.r(i);var n=e(1186);e.d(i,"render",(function(){return n["render"]})),e.d(i,"staticRenderFns",(function(){return n["staticRenderFns"]})),e.d(i,"recyclableRender",(function(){return n["recyclableRender"]})),e.d(i,"components",(function(){return n["components"]}))},1186:function(t,i,e){"use strict";var n;e.r(i),e.d(i,"render",(function(){return o})),e.d(i,"staticRenderFns",(function(){return s})),e.d(i,"recyclableRender",(function(){return u})),e.d(i,"components",(function(){return n}));var o=function(){var t=this,i=t.$createElement;t._self._c},u=!1,s=[];o._withStripped=!0},1187:function(t,i,e){"use strict";e.r(i);var n=e(1188),o=e.n(n);for(var u in n)["default"].indexOf(u)<0&&function(t){e.d(i,t,(function(){return n[t]}))}(u);i["default"]=o.a},1188:function(t,i,e){"use strict";(function(t){Object.defineProperty(i,"__esModule",{value:!0}),i.default=void 0;var e={props:{boxList:{type:Array,default:[]},isfull:{type:Boolean,default:!1},onHide:{type:Boolean,default:!1}},data:function(){return{showBox:!1,opening:!1,fadeOut:!1,dropIn:!1,swing:!1,count:20,timer:null,timeout:null,currentIdx:-1,flagTime:0,winAudio:null}},watch:{onHide:function(t){var i=this;if(this.showBox)if(t)clearInterval(this.timer),clearTimeout(this.timeout),this.timer=null,this.timeout=null;else if(!this.opening){var e=this.boxList.some((function(t){return i.flagTime>=t.time&&i.flagTime<=t.time+20}));e?(this.countDown(),this.setAutoHide()):(this.count=20,clearInterval(this.timer),clearTimeout(this.timeout),this.timer=null,this.timeout=null)}}},mounted:function(){this.initAudio()},methods:{initAudio:function(){this.winAudio=t.createInnerAudioContext(),this.winAudio.src="https://fs-1319721001.cos.ap-chongqing.myqcloud.com/audio/treasureChest.mp3",this.winAudio.volume=.6},close:function(){this.swing=!1,this.opening=!0,this.showBox=!1},showTreasure:function(i){this.flagTime=i;var e=this.boxList.findIndex((function(t){return t.time==i&&0==t.status}));-1!=e&&(this.currentIdx=e,this.showBox=!0,this.opening=!1,this.swing=!1,this.fadeOut=!1,this.dropIn=!0,this.count=20,this.isfull&&t.vibrateLong(),clearInterval(this.timer),clearTimeout(this.timeout),this.countDown(),this.setAutoHide())},countDown:function(){var t=this;clearInterval(this.timer),this.timer=setInterval((function(){t.count>0?t.count--:(clearInterval(t.timer),t.timer=null)}),1e3)},open:function(){this.opening||this.swing||(clearTimeout(this.timeout),clearInterval(this.timer),this.swing=!0,this.claim(1))},claimSuccess:function(t){var i=this;setTimeout((function(){i.swing=!1,i.opening=!0,1==t&&i.winAudio.play()}),400),this.boxList[this.currentIdx].status=t,setTimeout((function(){var t;null===(t=i.winAudio)||void 0===t||t.stop(),i.showBox=!1}),3e3)},setAutoHide:function(){var t=this;clearTimeout(this.timeout);var i=1e3*this.count;i<=0?this.autoHide():this.timeout=setTimeout((function(){return t.autoHide()}),i)},autoHide:function(){var t=this;clearInterval(this.timer),this.fadeOut=!0,this.isfull?this.claim(2):this.claim(0),setTimeout((function(){t.showBox=!1}),600)},claim:function(t){this.$emit("claimFun",{rewardId:this.boxList[this.currentIdx].rewardVideoRelation.rewardId,status:t,time:this.boxList[this.currentIdx].time})}},beforeDestroy:function(){this.winAudio&&(this.winAudio.stop(),this.winAudio.destroy(),this.winAudio=null),clearInterval(this.timer),clearTimeout(this.timeout)}};i.default=e}).call(this,e(2)["default"])},1189:function(t,i,e){"use strict";e.r(i);var n=e(1190),o=e.n(n);for(var u in n)["default"].indexOf(u)<0&&function(t){e.d(i,t,(function(){return n[t]}))}(u);i["default"]=o.a},1190:function(t,i,e){}}]);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages_course/components/treasureChest.js.map
;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
    'pages_course/components/treasureChest-create-component',
    {
        'pages_course/components/treasureChest-create-component':(function(module, exports, __webpack_require__){
            __webpack_require__('2')['createComponent'](__webpack_require__(1184))
        })
    },
    [['pages_course/components/treasureChest-create-component']]
]);
