{"version":3,"sources":["components/activity/newyear-2019/common/system-bullet-screen/index.js"],"names":["SystemBulletScreen","count","state","showNotices","initializeSwiper","_this","swiper","Swiper","allowTouchMove","direction","loop","on","init","Array","from","this","slides","forEach","item","querySelector","addEventListener","transitionEnd","slideChangeTransitionEnd","slideHorizontal","el","previousIndex","style","transition","transform","activeIndex","content","contentWidth","offsetWidth","wrapperWidth","clientWidth","setTimeout","len","props","bullets","length","sysNotice","height","destroyed","slideNext","removeSystemNotices","e","persist","target","setState","destroy","id","onTransitionEnd","ref","className","src","alt","map","index","key","Component"],"mappings":"0LAMMA,G,2NAGJC,MAAQ,E,EAGRC,MAAQ,CACNC,aAAa,G,EAWfC,iBAAmB,WACjB,IAAMC,EAAK,eACX,EAAKC,OAAS,IAAIC,IAAO,sCAAuC,CAC9DC,gBAAgB,EAChBC,UAAW,WACXC,MAAM,EACNC,GAAI,CACFC,KADE,WAEAC,MAAMC,KAAKC,KAAKC,QAAQC,SAAQ,SAAAC,GAC9BA,EAAKC,cAAc,QAAQC,iBAAiB,gBAAiBf,EAAMgB,mBAGvEC,yBANE,WAOAjB,EAAMkB,gBAAgBR,OAExBM,cATE,WAUA,IAAMG,EAAKT,KAAKC,OAAOD,KAAKU,eAAeN,cAAc,QACzDK,EAAGE,MAAMC,WAAa,QACtBH,EAAGE,MAAME,UAAY,0B,EAM7BL,gBAAkB,SAACjB,GACjB,IAAIkB,EAAKlB,EAAOU,OAAOV,EAAOuB,aAC5BC,EAAUN,EAAGL,cAAc,QAC3BY,EAAeD,EAAQE,YACvBC,EAAeT,EAAGU,YAIpB,GAAIH,EAAeE,EACjBH,EAAQJ,MAAMC,WAAd,oBAAwCI,EAH/B,OAGT,YACAI,YAAW,WACTL,EAAQJ,MAAME,UAAd,wBAA2CG,EAAeE,GAAgB,GAA1E,aACC,SACE,CAAC,IAEAG,EAAuB,EADX,EAAKC,MAAhBC,QACaC,OACpBJ,YAAW,aACH,EAAKlC,QAAUmC,IACnB,EAAKI,UAAUd,MAAMe,OAArB,OAEDnC,IAAWA,EAAOoC,WAAcpC,EAAOqC,cACvC,O,EAIPtB,cAAgB,WAAO,IAGfe,EAAuB,EAFX,EAAKC,MAAhBC,QAEaC,SACd,EAAKtC,QAAUmC,EACnBD,YAAW,WACT,EAAKK,UAAUd,MAAMe,OAArB,QACC,KAEHN,YAAW,WACT,EAAK7B,QAAU,EAAKA,OAAOqC,cAC1B,M,EAIPC,oBAAsB,SAAAC,GACpBA,EAAEC,UACED,EAAEE,SAAW,EAAKP,WACpB,EAAKQ,SAAS,CACZ7C,aAAa,K,kEA3EjBY,KAAKX,qB,6CAILW,KAAKT,QAAUS,KAAKT,OAAO2C,Y,+BA4EnB,IAAD,OAELX,EACEvB,KAAKsB,MADPC,QAEF,OACEvB,KAAKb,MAAMC,aACX,yBAAK+C,GAAG,uBAAuBC,gBAAiBpC,KAAK6B,oBAAqBQ,IAAK,SAAA5B,GAAE,OAAI,EAAKgB,UAAYhB,IACpG,yBAAK6B,UAAU,SACVC,IAAI,mFAAmFC,IAAI,KAChG,yBAAKF,UAAU,sCACb,wBAAIA,UAAU,kBAETf,GAAWA,EAAQC,OAAUD,EAAQkB,KAAI,SAACtC,EAAMuC,GAC7C,OACE,wBAAIJ,UAAU,eAAeK,IAAKD,GAChC,8BAAOvC,OAIX,Y,GA9GeyC,cAwHlB3D,a","file":"mrstaticjs/system-notices.871b5154.chunk.js","sourcesContent":["import React, { Component } from 'react'\nimport Swiper from 'swiper'\nimport 'swiper/dist/css/swiper.min.css'\nimport './system-bullet-screen.scss'\n\n\nclass SystemBulletScreen extends Component {\n\n swiper\n count = 0\n sysNotice\n\n state = {\n showNotices: true\n }\n\n componentDidMount() {\n this.initializeSwiper()\n }\n\n componentWillUnmount() {\n this.swiper && this.swiper.destroy()\n }\n\n initializeSwiper = () => {\n const _this = this\n this.swiper = new Swiper('.sys-bullet-screen-swiper-container', {\n allowTouchMove: false,\n direction: 'vertical',\n loop: true,\n on: {\n init() {\n Array.from(this.slides).forEach(item => {\n item.querySelector('span').addEventListener('transitionend', _this.transitionEnd)\n })\n },\n slideChangeTransitionEnd() {\n _this.slideHorizontal(this)\n },\n transitionEnd() {\n const el = this.slides[this.previousIndex].querySelector('span')\n el.style.transition = 'unset'\n el.style.transform = 'translate3d(0,0,0)'\n }\n }\n })\n }\n\n slideHorizontal = (swiper) => {\n let el = swiper.slides[swiper.activeIndex],\n content = el.querySelector('span'),\n contentWidth = content.offsetWidth,\n wrapperWidth = el.clientWidth\n\n const co = 131.25\n\n if (contentWidth > wrapperWidth) {\n content.style.transition = `transform ${contentWidth / co}s linear`\n setTimeout(() => {\n content.style.transform = `translate3d(${-(contentWidth - wrapperWidth) - 10}px,0,0)`\n }, 1000)\n } else {\n const {bullets} = this.props\n const len = bullets.length * 3\n setTimeout(() => {\n if (++this.count === len) {\n this.sysNotice.style.height = `0px`\n }\n (swiper && !swiper.destroyed) && swiper.slideNext()\n }, 3000)\n }\n }\n\n transitionEnd = () => {\n const {bullets} = this.props\n\n const len = bullets.length * 3\n if (++this.count === len) {\n setTimeout(() => {\n this.sysNotice.style.height = `0px`\n }, 2000)\n } else {\n setTimeout(() => {\n this.swiper && this.swiper.slideNext()\n }, 1000)\n }\n }\n\n removeSystemNotices = e => {\n e.persist()\n if (e.target === this.sysNotice) {\n this.setState({\n showNotices: false\n })\n }\n }\n\n render() {\n const {\n bullets\n } = this.props\n return (\n this.state.showNotices &&\n <div id=\"system-bullet-screen\" onTransitionEnd={this.removeSystemNotices} ref={el => this.sysNotice = el}>\n <img className='avatar'\n src='https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/newyear20/system-notice-icon.png' alt=\"\"/>\n <div className='sys-bullet-screen-swiper-container'>\n <ul className=\"swiper-wrapper\">\n {\n (bullets && bullets.length) ? bullets.map((item, index) => {\n return (\n <li className=\"swiper-slide\" key={index}>\n <span>{item}</span>\n </li>\n )\n })\n : null\n }\n </ul>\n </div>\n </div>\n\n )\n }\n}\n\nexport default SystemBulletScreen\n"],"sourceRoot":""}