luck-draw.vue 109 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396
  1. <!-- 红包任务页面 -->
  2. <template>
  3. <div class="content">
  4. <!-- global-tip -->
  5. <global-tip :type="'1'"></global-tip>
  6. <!-- open -->
  7. <div v-show="state.status == 'opened'" class="opened">
  8. <div class="header"
  9. :style="{ 'backgroundImage': `url(${require('@/assets/subject/002-back-head-top-1.svg')})` }">
  10. <!-- -->
  11. <img :src="require('@/assets/subject/001-icon-red-packet.svg')" alt="">
  12. <div class="txt">
  13. <p>Complete tasks</p>
  14. <p>to Draw Prizes</p>
  15. </div>
  16. </div>
  17. <div class="list">
  18. <template v-for="item, i in state.detail.taskCondition" v-bind:key="i">
  19. <div class="item" v-if="item.type == 1 && item.relatedUsers && item.relatedUsers.length > 0">
  20. <div class="item-content">
  21. <div class="item-follow-title">
  22. <img :src="require('@/assets/svg/icon-task-twitter.svg')" alt />
  23. <!-- <img :src="require('@/assets/svg/icon-follow.svg')" alt /> -->
  24. <div class="item-title">Follow</div>
  25. <img :src="require('@/assets/gif/red-right.gif')" alt class="red-right"
  26. v-show="!state.done.follow && state.done.follow_red" />
  27. <img v-if="state.done.follow" :src="require('@/assets/svg/icon-true.svg')" alt />
  28. <div v-else class="btn" @click="clickFollowAll(item.relatedUsers, 'all')">Follow All
  29. </div>
  30. </div>
  31. <div class="item-follow-area">
  32. <template v-for="item2, i in item.relatedUsers" v-bind:key="i">
  33. <div class="item-follow" v-if="item2.finished">
  34. <span :class="{ finished: item2.finished }">@{{ item2.name }}</span>
  35. <img :src="require('@/assets/svg/icon-true-ed.svg')" alt />
  36. </div>
  37. <div class="item-follow" v-else @click="clickFollowAll([item2])">
  38. <span :class="{ finished: item2.finished }">@{{ item2.name }}</span>
  39. <img :src="require('@/assets/svg/icon-add.svg')" alt />
  40. </div>
  41. </template>
  42. </div>
  43. </div>
  44. </div>
  45. <div class="item" v-if="item.type == 2">
  46. <img :src="require('@/assets/svg/icon-task-twitter.svg')" alt />
  47. <!-- <img :src="require('@/assets/svg/icon-like.svg')" alt /> -->
  48. <div class="item-content">
  49. <div class="item-title">Like</div>
  50. </div>
  51. <img :src="require('@/assets/gif/red-right.gif')" alt class="red-right"
  52. v-show="!state.done.like && state.done.like_red" />
  53. <img v-if="state.done.like" :src="require('@/assets/svg/icon-true.svg')" alt />
  54. <div v-else class="btn" @click="clickLikeBtn">Like</div>
  55. </div>
  56. <div class="item" v-if="item.type == 3">
  57. <img :src="require('@/assets/svg/icon-task-twitter.svg')" alt />
  58. <!-- <img :src="require('@/assets/svg/icon-retweet.svg')" alt /> -->
  59. <div class="item-content">
  60. <div class="item-title">Retweet</div>
  61. </div>
  62. <img :src="require('@/assets/gif/red-right.gif')" alt class="red-right"
  63. v-show="!state.done.retweet && state.done.retweet_red" />
  64. <img v-if="state.done.retweet" :src="require('@/assets/svg/icon-true.svg')" alt />
  65. <div v-else class="btn" @click="clickRetweetBtn">Retweet</div>
  66. </div>
  67. <!-- Comment、艾特 friends -->
  68. <div class="item" v-if="item.type == 9">
  69. <img :src="require('@/assets/svg/icon-task-twitter.svg')" alt />
  70. <div class="item-content">
  71. <div class="item-title">Comment and Tag 3 friends</div>
  72. </div>
  73. <img :src="require('@/assets/gif/red-right.gif')" alt class="red-right"
  74. v-show="!state.done.reply && state.done.reply_red" />
  75. <img v-if="state.done.reply" :src="require('@/assets/svg/icon-true.svg')" alt />
  76. <div v-else class="btn" @click="clickReply(item)">Comment</div>
  77. </div>
  78. <!-- repost feacebook -->
  79. <div class="item" v-if="item.type == 8">
  80. <img :src="require('@/assets/svg/icon-task-facebook.svg')" alt />
  81. <div class="item-content">
  82. <div class="item-title">Repost to Facebook</div>
  83. </div>
  84. <img :src="require('@/assets/gif/red-right.gif')" alt class="red-right"
  85. v-show="!state.done.repost_facebook && state.done.repost_facebook_red" />
  86. <img v-if="state.done.repost_facebook" :src="require('@/assets/svg/icon-true.svg')" alt />
  87. <div v-else class="btn" @click="clickRepostFacebook(item)">Repost</div>
  88. </div>
  89. <!-- join discord -->
  90. <div class="item" v-if="item.type == 7">
  91. <img :src="require('@/assets/svg/icon-discord-mini.svg')" alt />
  92. <div class="item-content">
  93. <div class="item-title">Join Discord</div>
  94. </div>
  95. <img :src="require('@/assets/gif/red-right.gif')" alt class="red-right"
  96. v-show="!state.done.join_discord && state.done.join_discord_red" />
  97. <img v-if="state.done.join_discord" :src="require('@/assets/svg/icon-true.svg')" alt />
  98. <template v-else>
  99. <div v-if="joinDiscordIng" class="loading-wrapper">
  100. <img class="icon-loading" :src="require('@/assets/svg/icon-loading-gray.svg')" />
  101. </div>
  102. <div v-else class="btn" @click="joinDiscord">
  103. Join
  104. </div>
  105. </template>
  106. </div>
  107. </template>
  108. </div>
  109. <!-- <div class="people" @click="clickRoad">
  110. <div class="txt">
  111. {{ state.detail.receiveCount || 0 }}/{{ state.detail.totalCount || 0 }} Winners,{{
  112. state.detail.receiveAmountValue
  113. }}/{{ state.detail.amountValue }} {{ state.detail.currencySymbol }}</div>
  114. <div class="right" v-if="state.detail.allReceived">
  115. <img :src="require('@/assets/svg/icon-right.svg')" alt class="road" />
  116. </div>
  117. </div> -->
  118. <div class="footer">
  119. <div class="btn" @click="clickGetGiveaways">Complete</div>
  120. </div>
  121. </div>
  122. <!-- success -->
  123. <div v-if="state.status == 'success'" class="success">
  124. <div class="header" v-if="state.detail.rewardType === RewardType.money"
  125. :style="{ 'backgroundImage': `url(${require('@/assets/subject/002-back-head-top-180.svg')})` }">
  126. <div class="success-title">
  127. 🎉 Awesome! You are Winner!
  128. </div>
  129. <div class="money">
  130. <img :src="state.detail.currencyIconPath" alt />
  131. <font-amount :amount="state.receiveAmount" class="big" :fontSize="46"></font-amount>
  132. <!-- <span class="small">{{ state.detail.currencySymbol }}</span> -->
  133. </div>
  134. <div class="done" @click="clickDone">
  135. <img :src="require('@/assets/subject/001-icon-done.svg')" alt class="icon-done" />
  136. <span>View Rewards In Wallet</span>
  137. <img :src="require('@/assets/svg/icon-right.svg')" alt class="icon-right" />
  138. </div>
  139. </div>
  140. <div class="header header-custom-prize" v-else
  141. :style="{ 'backgroundImage': `url(${successTopBgCpd})`, 'minHeight': '150px' }">
  142. <div class="success-title">
  143. 🎉 Awesome! You are the Winner!
  144. </div>
  145. <div class="custom-prize-show">
  146. <component-zoom width="340" fontSize="22" class="custom-prise-name">
  147. <img :src="require('@/assets/subject/icon-gift-inline.svg')" alt />
  148. <span>{{ state.detail.customizedReward }}</span>
  149. </component-zoom>
  150. <!-- <font-zoom :amount="state.detail.customizedReward" width="500" class="custom-prise-name" fontSize="22"></font-zoom> -->
  151. </div>
  152. </div>
  153. <div class="luck-list-title">
  154. <div>{{ state.detail.receiveCount || 0 }}/{{ state.detail.totalCount || 0 }} Winners</div>
  155. <div class="right">
  156. <span class="text" v-if="state.detail.rewardType === RewardType.money">
  157. <a-tooltip :title="state.detail.receiveAmountValue">
  158. {{ getBit(state.detail.receiveAmountValue) }}
  159. </a-tooltip>
  160. /
  161. <a-tooltip :title="state.detail.amountValue">
  162. {{ getBit(state.detail.amountValue) || '' }}
  163. </a-tooltip>
  164. </span>
  165. {{ state.detail.currencySymbol || '' }}
  166. </div>
  167. </div>
  168. <div class="luck-list max" @scroll="handleScroll($event)">
  169. <div class="luck-item" v-for="item, i in state.detail.allReceived" v-bind:key="i">
  170. <img v-if="item.simpleUserInfoVO.avatarUrl" :src="item.simpleUserInfoVO.avatarUrl"
  171. @click="openTwitterDetail(item)" alt />
  172. <img v-else :src="require('@/assets/svg/icon-twitter.svg')" alt />
  173. <img class="win" :src="require('@/assets/svg/icon-win-1.svg')" v-if="i == 0" alt />
  174. <img class="win" :src="require('@/assets/svg/icon-win-2.svg')" v-if="i == 1" alt />
  175. <img class="win" :src="require('@/assets/svg/icon-win-3.svg')" v-if="i == 2" alt />
  176. <div class="luck-content">
  177. <div class="luck-title" v-if="item.simpleUserInfoVO.nickName">{{ item.simpleUserInfoVO.nickName
  178. }}</div>
  179. <div class="luck-title" v-else>Twitter User</div>
  180. <div class="luck-time">{{ moment(item.receiveTimestamp).format('MM-DD HH:mm') }}</div>
  181. </div>
  182. <div class="luck-money" v-if="state.detail.rewardType === RewardType.money">
  183. <img :src="state.detail.currencyIconPath" alt />
  184. <div class="luck-money-txt">
  185. <a-tooltip :title="item.amountValue">
  186. {{ getBit(item.amountValue) }}
  187. </a-tooltip>
  188. </div>
  189. </div>
  190. <div class="luck-custom-prize" v-else>winner</div>
  191. <div class="luck-king" v-if="state.detail.rewardType === RewardType.money && item.maxAmount">
  192. <img :src="require('@/assets/svg/icon-king-hat.svg')" alt />
  193. <span>Luckiest Draw</span>
  194. </div>
  195. </div>
  196. </div>
  197. <get-more :reportData="{
  198. pageSource: Report.pageSource.received_success_page,
  199. postId: state.postId,
  200. redPacketType: Report.redPacketType.lottery
  201. }"></get-more>
  202. </div>
  203. <!-- no-open -->
  204. <div v-else-if="state.status == 'not-open'" class="not-open">
  205. <!-- <template v-if="state.detail.posterType === 2 && state.detail.customPosterInstalled">
  206. <img class="customImg" :src="state.detail.customPosterInstalled" />
  207. <div class="customBottom">
  208. <div class="theme">
  209. <img class="icon" :src="require('@/assets/svg/icon-last-time.svg')"/>
  210. <span class="time">{{ state.count_down_time }}</span>
  211. <span class="info">Left</span>
  212. </div>
  213. <div class="winner-info">
  214. <span class="count">{{state.detail.totalCount}} Winners</span>
  215. <span>to Share </span>
  216. <span class="prize-name">{{state.detail.rewardType === RewardType.money ? state.detail.amountValue + ' ' + state.detail.currencySymbol : state.detail.customizedReward}}</span>
  217. </div>
  218. <div class="open-red" @click="clickOpenRedPacket">
  219. Participate Now
  220. </div>
  221. </div>
  222. </template> -->
  223. <!-- <template v-else> -->
  224. <custom-card-cover :data="{
  225. totalCount: state.detail.totalCount,
  226. amountValue: state.detail.amountValue,
  227. tokenSymbol: state.detail.currencySymbol,
  228. currencyCode: state.detail.amountCurrencyCode,
  229. currencyIconUrl: state.detail.currencyIconPath,
  230. type: PlayType.lottery,
  231. validityDuration: state.count_down_time,
  232. countDown: state.count_down_time,
  233. userInfo: {
  234. nickName: state.detail.postUserInfo.nickName,
  235. avatarUrl: state.detail.postUserInfo.avatarUrl
  236. },
  237. rewardType: state.detail.rewardType,
  238. customizedReward: state.detail.customizedReward,
  239. customPosterUrl: state.detail.customPosterInstalled
  240. }" @clickOpenRedPacket="clickOpenRedPacket"></custom-card-cover>
  241. <!-- </template> -->
  242. </div>
  243. <!-- 领取列表 -->
  244. <div v-else-if="state.status == 'luck-peopel-list'" class="luck-peopel-list">
  245. <div class="head">
  246. <img :src="require('@/assets/svg/icon-back.svg')" alt />
  247. </div>
  248. <div class="luck-list-title">
  249. <div>{{ state.detail.receiveCount || 0 }}/{{ state.detail.totalCount || 0 }} Winners</div>
  250. <div class="right" v-if="state.detail.rewardType === RewardType.money">
  251. <span class="text">
  252. <a-tooltip :title="state.detail.receiveAmountValue">
  253. {{ getBit(state.detail.receiveAmountValue) }}
  254. </a-tooltip>
  255. /
  256. <a-tooltip :title="state.detail.amountValue">
  257. {{ getBit(state.detail.amountValue) || '' }}
  258. </a-tooltip>
  259. </span> {{ state.detail.currencySymbol || '' }}
  260. </div>
  261. </div>
  262. <div class="luck-list" @scroll="handleScroll">
  263. <div class="luck-item" v-for="item, i in state.detail.allReceived" v-bind:key="i">
  264. <img v-if="item.simpleUserInfoVO.avatarUrl" :src="item.simpleUserInfoVO.avatarUrl" alt
  265. @click="openTwitterDetail(item)" />
  266. <img v-else :src="require('@/assets/svg/icon-twitter.svg')" alt />
  267. <img class="win" :src="require('@/assets/svg/icon-win-1.svg')" v-if="i == 0" alt />
  268. <img class="win" :src="require('@/assets/svg/icon-win-2.svg')" v-if="i == 1" alt />
  269. <img class="win" :src="require('@/assets/svg/icon-win-3.svg')" v-if="i == 2" alt />
  270. <div class="luck-content">
  271. <div class="luck-title" v-if="item.simpleUserInfoVO.nickName">{{ item.simpleUserInfoVO.nickName
  272. }}</div>
  273. <div class="luck-title" v-else>Twitter User</div>
  274. <div class="luck-time">{{ moment(item.receiveTimestamp).format('MM-DD HH:mm:ss') }}</div>
  275. </div>
  276. <div class="luck-money" v-if="state.detail.rewardType === RewardType.money">
  277. <img :src="state.detail.currencyIconPath" alt />
  278. <div class="luck-money-txt">
  279. <a-tooltip :title="item.amountValue">
  280. {{ getBit(item.amountValue) }}
  281. </a-tooltip>
  282. </div>
  283. </div>
  284. <div class="luck-custom-prize" v-else>winner</div>
  285. <div class="luck-king" v-if="state.detail.rewardType === RewardType.money && item.maxAmount">
  286. <img :src="require('@/assets/svg/icon-king-hat.svg')" alt />
  287. <span>Luckiest Draw</span>
  288. </div>
  289. </div>
  290. </div>
  291. </div>
  292. <!-- 关闭状态 -->
  293. <div v-else-if="state.status == 'close'" class="close">
  294. <!-- 红包被领完了 -->
  295. <!-- <div class="header"
  296. :style="{ 'backgroundImage': `url(${require('@/assets/subject/002-back-head-top.svg')})` }"
  297. v-if="state.close_status == '已经过期了'">
  298. <div class="rabbit">
  299. <img class="flower" :src="require('@/assets/svg/icon-flower.svg')" alt />
  300. <p>This Draw is Complete</p>
  301. </div>
  302. </div> -->
  303. <div class="header"
  304. :style="{ 'backgroundImage': `url(${require('@/assets/subject/002-back-head-top.svg')})` }"
  305. v-show="state.close_status == '已经过期了'">
  306. <div class="close-title" v-for="item in state.close_text">{{ item }}</div>
  307. </div>
  308. <!-- 没有抽中 -->
  309. <div class="header"
  310. :style="{ 'backgroundImage': `url(${require('@/assets/subject/002-back-head-top.svg')})` }"
  311. v-if="state.close_status == '没有抽中'">
  312. <div class="rabbit">
  313. <img :src="require('@/assets/subject/001-icon-rabbit.svg')" alt />
  314. <p>Good Luck Next Time!</p>
  315. </div>
  316. </div>
  317. <!-- 等待结果 -->
  318. <div class="header"
  319. :style="{ 'backgroundImage': `url(${require('@/assets/subject/002-back-head-top.svg')})` }"
  320. v-if="state.close_status == '等待结果'">
  321. </div>
  322. <div class="load-result" v-if="state.close_status == '等待结果'">
  323. <div class="title">
  324. <img :src="require('@/assets/svg/icon-enter-ed.svg')" alt />
  325. <span>Participate Successful</span>
  326. </div>
  327. <!-- 票 -->
  328. <div class="ticket">
  329. <div class="div-ticket">
  330. <img :src="require('@/assets/svg/icon-ticket.svg')" alt />
  331. </div>
  332. </div>
  333. <p>Announcement Winner</p>
  334. <div class="time">
  335. <img :src="require('@/assets/svg/icon-win-time.svg')" alt />
  336. <span>{{ state.count_down_time || '' }}</span>
  337. </div>
  338. <get-more :style_type="2" :reportData="{
  339. pageSource: Report.pageSource.waitingLotteryPage,
  340. postId: state.postId,
  341. redPacketType: Report.redPacketType.lottery
  342. }"></get-more>
  343. <div class="notification_switch" v-if="state.notification_show">
  344. <span>Announcement Notification</span>
  345. <a-switch v-model:checked="state.notification_switch" @change="changeNotification" />
  346. </div>
  347. </div>
  348. <div class="luck-list-title" v-show="state.close_status != '等待结果'">
  349. <div>{{ state.detail.receiveCount || 0 }}/{{ state.detail.totalCount || 0 }} Winners</div>
  350. <div class="right" v-if="state.detail.rewardType === RewardType.money">
  351. <span class="text">
  352. <a-tooltip :title="state.detail.receiveAmountValue">
  353. {{ getBit(state.detail.receiveAmountValue) }}
  354. </a-tooltip>
  355. /
  356. <a-tooltip :title="state.detail.amountValue">
  357. {{ getBit(state.detail.amountValue || '') }}
  358. </a-tooltip>
  359. </span> {{
  360. state.detail.currencySymbol || ''
  361. }}
  362. </div>
  363. </div>
  364. <div class="luck-list max" @scroll="handleScroll" v-show="state.close_status != '等待结果'">
  365. <div class="luck-item" v-for="item, i in state.detail.allReceived" v-bind:key="i">
  366. <img v-if="item.simpleUserInfoVO.avatarUrl" :src="item.simpleUserInfoVO.avatarUrl" alt
  367. @click="openTwitterDetail(item)" />
  368. <img v-else :src="require('@/assets/svg/icon-twitter.svg')" alt />
  369. <img class="win" :src="require('@/assets/svg/icon-win-1.svg')" v-if="i == 0" alt />
  370. <img class="win" :src="require('@/assets/svg/icon-win-2.svg')" v-if="i == 1" alt />
  371. <img class="win" :src="require('@/assets/svg/icon-win-3.svg')" v-if="i == 2" alt />
  372. <div class="luck-content">
  373. <div class="luck-title" v-if="item.simpleUserInfoVO.nickName">{{ item.simpleUserInfoVO.nickName
  374. }}</div>
  375. <div class="luck-title" v-else>Twitter User</div>
  376. <div class="luck-time">{{ moment(item.receiveTimestamp).format('MM-DD HH:mm:ss') }}</div>
  377. </div>
  378. <div class="luck-money" v-if="state.detail.rewardType === RewardType.money">
  379. <img :src="state.detail.currencyIconPath" alt />
  380. <div class="luck-money-txt">
  381. <a-tooltip :title="item.amountValue">
  382. {{ getBit(item.amountValue) }}
  383. </a-tooltip>
  384. </div>
  385. </div>
  386. <div class="luck-custom-prize" v-else>winner</div>
  387. <div class="luck-king" v-if="state.detail.rewardType === RewardType.money && item.maxAmount">
  388. <img :src="require('@/assets/svg/icon-king-hat.svg')" alt />
  389. <span>Luckiest Draw</span>
  390. </div>
  391. </div>
  392. <div class="empty" v-show="state.detail.allReceived && state.detail.allReceived.length == 0">
  393. <img :src="require('@/assets/svg/icon-error.svg')" alt />
  394. </div>
  395. </div>
  396. <get-more :reportData="{
  397. pageSource: Report.pageSource.missingLotteryPage,
  398. postId: state.postId,
  399. redPacketType: Report.redPacketType.lottery
  400. }" v-if="state.close_status != '等待结果'"></get-more>
  401. </div>
  402. <!-- error -->
  403. <div v-else-if="state.status == 'error'" class="error">
  404. <img :src="require('@/assets/svg/icon-error.svg')" alt />
  405. <div class="txt">
  406. {{ state.error_txt }}
  407. </div>
  408. <div class="retry" v-show="state.retry" @click="clickRetry">
  409. Retry
  410. </div>
  411. </div>
  412. <!-- loading -->
  413. <div v-show="state.loading_show" class="loading">
  414. <img :src="require('@/assets/svg/icon-loading.svg')" alt />
  415. </div>
  416. <div v-show="state.loading_redbag" class="redbag">
  417. <img :src="require('@/assets/img/icon-loading-redbag.png')" alt />
  418. </div>
  419. </div>
  420. <div style="width: 100%; height: 30px; position: fixed; color: red; top:0;"
  421. v-if="state.process_mode != 'production'">
  422. {{ state.detail.validity }}</div>
  423. </template>
  424. <script>
  425. export default {
  426. name: 'redPacket',
  427. }
  428. </script>
  429. <script setup>
  430. import { onMounted, reactive, ref, computed } from "vue";
  431. import { getPostDetail, getRedPacket, finishRedPacket, oneKeyLike, oneKeyReTweet, oneKeyFollow, getTaskDetail, getReceivedList, addFinishEvent } from '@/http/redPacket.js'
  432. import { getQueryString, guid, getBit, formatSecondsAsDaysOrTime } from '@/uilts/help.js'
  433. import { message } from 'ant-design-vue';
  434. import FontAmount from '@/view/components/font-amount.vue'
  435. import FontZoom from '@/view/components/font-zoom.vue'
  436. import ComponentZoom from '@/view/components/component-zoom.vue'
  437. import GetMore from '@/view/iframe/publish/components/get-more.vue'
  438. import { setChromeStorage, getChromeStorage, sendCurrentTabMessage, chromeExtensionUrl } from '@/uilts/chromeExtension.js'
  439. import Report from "@/log-center/log"
  440. import { srcPublishSuccess } from '@/http/publishApi'
  441. import { discordAuthUrl, checkGuildJoined } from '@/http/discordApi'
  442. import { discordAuthRedirectUri, faceShareRedirectUrl } from '@/http/configAPI'
  443. import { getSetting, putSetting } from '@/http/user'
  444. import { getFrontConfig } from "@/http/account";
  445. import { getInviteGuildInfo } from "@/http/discordApi";
  446. import GlobalTip from '@/view/components/global-tip.vue';
  447. import customCardCover from '@/view/components/custom-card-cover.vue';
  448. import { RewardType, PlayType } from "@/types";
  449. var moment = require('moment');
  450. let discordAuthorizeRequired = false;
  451. let joinDiscordActionState = 'default'; //authAndJoinIng joinIng reAuth
  452. let joinDiscordIng = ref(false);
  453. let facebookAppConfig = {
  454. facebookAppId: "",
  455. faceShareRedirectUrl
  456. };
  457. let reportParams = {
  458. discordFans: '',
  459. twitterFans: '',
  460. done: {
  461. },
  462. hasReport: false,
  463. }
  464. let discordTaskDetail = null;
  465. let state = reactive({
  466. status: '',
  467. userId: '',
  468. loading_show: false,
  469. loading_redbag: true,
  470. detail: {},
  471. luck_list_end: false,
  472. page_index: 1,
  473. page_size: 20,
  474. srcContentId: '',
  475. customCover: '',
  476. customGiveaway: '',
  477. error_txt: `oops, new accounts cannot participate in this event,`,
  478. receiveAmount: 0,
  479. money: 0,
  480. // 状态
  481. done: {
  482. follow: false,
  483. like: false,
  484. retweet: false,
  485. join_discord: false,
  486. repost_facebook: false,
  487. reply: false
  488. },
  489. notification_show: false,
  490. notification_switch: false,
  491. open_timer_status: false,
  492. count_down_time: ''
  493. })
  494. let fullName = '';
  495. let successTopBgCpd = computed(() => {
  496. const { rewardType } = state.detail
  497. switch (rewardType) {
  498. case RewardType.custom:
  499. return require('@/assets/subject/success-top-bg-2.svg');
  500. default:
  501. return require('@/assets/subject/002-back-head-top-180.svg');
  502. break;
  503. }
  504. });
  505. function clickRetry() {
  506. init()
  507. }
  508. let follow_open_tabs = []
  509. async function clickLikeBtn() {
  510. let _userInfo = await checkIsLogin()
  511. if (!_userInfo) {
  512. return
  513. }
  514. state.detail.finishTaskTypeV2 = state.detail.finishTaskTypeV2.toString() || ''
  515. if (state.window_origin.indexOf('facebook.com') >= 0) {
  516. state.detail.finishTaskTypeV2 = '2'
  517. }
  518. switch (state.detail.finishTaskTypeV2) {
  519. case '1':
  520. state.loading_show = true
  521. oneKeyLike({
  522. params: {
  523. tweetId: state.srcContentId
  524. }
  525. }).then((res) => {
  526. state.loading_show = false
  527. if (res.code == 0) {
  528. if (res.data.result) {
  529. state.done.like = true
  530. } else {
  531. state.done.like = false
  532. window.open(`https://twitter.com/intent/like?tweet_id=${state.tweetId}`)
  533. }
  534. } else {
  535. window.open(`https://twitter.com/intent/like?tweet_id=${state.tweetId}`)
  536. state.done.like = false
  537. }
  538. }).catch(() => {
  539. state.loading_show = false
  540. })
  541. break
  542. case '2':
  543. window.open(`https://twitter.com/intent/like?tweet_id=${state.tweetId}`)
  544. break
  545. case '3':
  546. state.loading_show = true
  547. chrome.tabs.getCurrent((tab) => {
  548. chrome.tabs.sendMessage(tab.id, {
  549. actionType: "IFRAME_TWITTER_API_DO_TASK", task_data: {
  550. tweet_Id: state.tweetId
  551. }, task_type: 'like'
  552. }, (res) => { console.log(res) });
  553. })
  554. break
  555. default:
  556. window.open(`https://twitter.com/intent/like?tweet_id=${state.tweetId}`)
  557. break
  558. }
  559. // 埋点
  560. Report.reportLog({
  561. objectType: Report.objectType.like,
  562. pageSource: Report.pageSource.task_page,
  563. businessType: Report.businessType.buttonClick,
  564. postId: state.postId,
  565. srcContentId: state.tweetId,
  566. senderId: state.userId,
  567. customCover: state.customCover,
  568. customGiveaway: state.customGiveaway,
  569. });
  570. }
  571. function clickDone() {
  572. window.open(`${chromeExtensionUrl + ('iframe/home.html')}`)
  573. // 埋点
  574. Report.reportLog({
  575. objectType: Report.objectType.wallet_button,
  576. pageSource: Report.pageSource.received_success_page,
  577. businessType: Report.businessType.buttonClick,
  578. postId: state.postId,
  579. srcContentId: state.tweetId,
  580. senderId: state.userId,
  581. redPacketType: 1,
  582. customCover: state.customCover,
  583. customGiveaway: state.customGiveaway,
  584. });
  585. }
  586. function handleScroll(e) {
  587. if (state.luck_list_end) {
  588. return
  589. }
  590. e = e.target
  591. if ((e.clientHeight + e.scrollTop) / e.scrollHeight > .8) {
  592. state.luck_list_end = true
  593. state.page_index++
  594. handleReceivedList()
  595. }
  596. }
  597. function handleReceivedList() {
  598. getReceivedList({
  599. params: {
  600. pageNum: state.page_index,
  601. pageSize: state.page_size,
  602. postId: state.postId
  603. }
  604. }).then((res) => {
  605. if (res.code == 0) {
  606. if (res.data.length > 0) {
  607. state.detail.allReceived = state.detail.allReceived.concat(res.data)
  608. state.luck_list_end = false
  609. } else {
  610. state.luck_list_end = true
  611. }
  612. } else {
  613. console.log('getReceivedList', res)
  614. }
  615. })
  616. }
  617. const openTwitterDetail = (item) => {
  618. if (item.simpleUserInfoVO.nickName) {
  619. window.open(`https://twitter.com/${item.simpleUserInfoVO.nickName}`)
  620. }
  621. }
  622. async function clickRetweetBtn() {
  623. let _userInfo = await checkIsLogin()
  624. if (!_userInfo) {
  625. return
  626. }
  627. state.detail.finishTaskTypeV2 = state.detail.finishTaskTypeV2.toString() || ''
  628. if (state.window_origin.indexOf('facebook.com') >= 0) {
  629. state.detail.finishTaskTypeV2 = '2'
  630. }
  631. switch (state.detail.finishTaskTypeV2) {
  632. case '1':
  633. state.loading_show = true
  634. oneKeyReTweet({
  635. params: {
  636. tweetId: state.srcContentId
  637. }
  638. }).then((res) => {
  639. state.loading_show = false
  640. if (res.code == 0) {
  641. if (res.data.result) {
  642. state.done.retweet = true
  643. } else {
  644. window.open(`https://twitter.com/intent/retweet?tweet_id=${state.tweetId}`)
  645. state.done.retweet = false
  646. }
  647. } else {
  648. window.open(`https://twitter.com/retweet/like?tweet_id=${state.tweetId}`)
  649. state.done.retweet = false
  650. }
  651. }).catch(() => {
  652. state.loading_show = false
  653. })
  654. break;
  655. case '2':
  656. window.open(`https://twitter.com/intent/retweet?tweet_id=${state.tweetId}`)
  657. break
  658. case '3':
  659. state.loading_show = true
  660. chrome.tabs.getCurrent((tab) => {
  661. chrome.tabs.sendMessage(tab.id, {
  662. actionType: "IFRAME_TWITTER_API_DO_TASK", task_data: {
  663. tweet_Id: state.tweetId
  664. }, task_type: 'retweet'
  665. }, (res) => { console.log(res) });
  666. })
  667. break
  668. default:
  669. window.open(`https://twitter.com/intent/retweet?tweet_id=${state.tweetId}`)
  670. break;
  671. }
  672. // 埋点
  673. Report.reportLog({
  674. objectType: Report.objectType.retweet,
  675. pageSource: Report.pageSource.task_page,
  676. businessType: Report.businessType.buttonClick,
  677. postId: state.postId,
  678. srcContentId: state.tweetId,
  679. senderId: state.userId,
  680. customCover: state.customCover,
  681. customGiveaway: state.customGiveaway,
  682. });
  683. }
  684. function onTweetReplyClick(params) {
  685. let replyData = {
  686. postId: state.postId,
  687. type: params.type,
  688. taskLuckdropId: state.detail.taskLuckdropId
  689. }
  690. window.parent.postMessage({ actionType: "IFRAME_RED_PACKET_ON_TWEET_REPLY_CLICK", data: replyData }, "*");
  691. }
  692. function changeNotification(checked) {
  693. let noticeSwitch = checked ? 1 : 0;
  694. // set
  695. putSetting({
  696. params: { noticeSwitch }
  697. }).then(res => {
  698. let { code } = res;
  699. if (code === 0) {
  700. state.notification_switch = checked
  701. } else {
  702. state.notification_switch = !checked
  703. }
  704. }).catch(() => {
  705. state.notification_switch = !checked
  706. })
  707. }
  708. function setNotification(req) {
  709. state.notification_switch = req.status;
  710. }
  711. async function clickReply(params) {
  712. let _userInfo = await checkIsLogin()
  713. if (!_userInfo) {
  714. return
  715. }
  716. let replyData = {
  717. postId: state.postId,
  718. type: params.type,
  719. taskLuckdropId: state.detail.taskLuckdropId
  720. }
  721. if (state.window_origin.indexOf('facebook.com') > -1) {
  722. let url = `https://twitter.com/${state.tweet_author}/status/${state.tweetId}?actionType=denetFacebookToTwitterReply&deReplyParams=${JSON.stringify(replyData)}`
  723. window.open(url)
  724. } else {
  725. window.parent.postMessage({ actionType: "IFRAME_RED_PACKET_REPLY_CLICK", data: replyData }, "*");
  726. }
  727. // 埋点
  728. Report.reportLog({
  729. objectType: Report.objectType.comment_and_tag,
  730. pageSource: Report.pageSource.task_page,
  731. businessType: Report.businessType.buttonClick,
  732. postId: state.postId,
  733. srcContentId: state.tweetId,
  734. senderId: state.userId,
  735. redPacketType: 1,
  736. customCover: state.customCover,
  737. customGiveaway: state.customGiveaway,
  738. });
  739. }
  740. /**
  741. * 点击repost facebook
  742. */
  743. async function clickRepostFacebook(params) {
  744. let _userInfo = await checkIsLogin()
  745. if (!_userInfo) {
  746. return
  747. }
  748. let deUrlParams = {
  749. fullName,
  750. tweetId: state.tweetId
  751. }
  752. let href = `${state.postRedirectUrl}?deUrlParams=${JSON.stringify(deUrlParams)}`;
  753. console.log(href);
  754. let shareUrlparams = {
  755. href,
  756. type: params.type,
  757. taskLuckdropId: state.detail.taskLuckdropId
  758. }
  759. setChromeStorage({
  760. shareFacebookData: JSON.stringify({
  761. contentStr: state.srcContent
  762. })
  763. })
  764. let shareUrl = feacebookShareUrl(shareUrlparams);
  765. openShareFacebookWindow({ url: shareUrl });
  766. // 埋点
  767. Report.reportLog({
  768. objectType: Report.objectType.share_facebook,
  769. pageSource: Report.pageSource.task_page,
  770. businessType: Report.businessType.buttonClick,
  771. postId: state.postId,
  772. srcContentId: state.tweetId,
  773. senderId: state.userId,
  774. redPacketType: 1,
  775. customCover: state.customCover,
  776. customGiveaway: state.customGiveaway,
  777. });
  778. }
  779. /**
  780. * 分享到facebook
  781. */
  782. function openShareFacebookWindow({ url }) {
  783. const width = 800;
  784. chrome.windows.create({
  785. width,
  786. type: 'normal',
  787. url
  788. }, function (window) {
  789. })
  790. }
  791. /**
  792. * 分享fecebook 地址
  793. */
  794. function feacebookShareUrl(params = {}) {
  795. let { href = '', type = '', taskLuckdropId } = params;
  796. let cbParams = JSON.stringify({
  797. type,
  798. taskLuckdropId
  799. })
  800. let shareUrl = `https://www.facebook.com/dialog/share?app_id=${facebookAppConfig.facebookAppId}&display=popup&href=${href}&redirect_uri=${facebookAppConfig.faceShareRedirectUrl}?params=${cbParams}`;
  801. return shareUrl;
  802. }
  803. /**
  804. * 分享成功
  805. */
  806. function facebookShareSuccess(params) {
  807. let { taskLuckdropId } = params;
  808. if (taskLuckdropId == state.detail.taskLuckdropId) {
  809. state.done.repost_facebook = true;
  810. state.done.repost_facebook_red = false;
  811. }
  812. }
  813. function getValidity() {
  814. let _d1, _d2, _d3, _h, _m, _s
  815. if (!state.detail.myReceived.taskEndTimestamp) {
  816. return
  817. }
  818. let timer = setInterval(() => {
  819. let _time = new Date().getTime()
  820. _d3 = state.detail.myReceived.taskEndTimestamp - _time
  821. if (_d3 > 0) {
  822. _d1 = moment(state.detail.myReceived.taskEndTimestamp)
  823. _d2 = moment(_time)
  824. _h = moment.duration(_d1.diff(_d2)).hours()
  825. if (_h < 10) {
  826. _h = '0' + _h
  827. }
  828. _m = moment.duration(_d1.diff(_d2)).minutes()
  829. if (_m < 10) {
  830. _m = '0' + _m
  831. }
  832. _s = moment.duration(_d1.diff(_d2)).seconds()
  833. if (_s < 10) {
  834. _s = '0' + _s
  835. }
  836. state.detail.validity = `${_h}:${_m}:${_s}`
  837. } else {
  838. state.detail.validity = `00:00:00`
  839. clearInterval(timer)
  840. }
  841. }, 1000)
  842. }
  843. // 倒计时
  844. const getTimeStr = (end_time_ms) => {
  845. let now_time_ms, now_time, end_time
  846. let _time, _h, _m, _s, _time_str
  847. now_time_ms = new Date().getTime()
  848. _time = end_time_ms - now_time_ms
  849. if (_time > 0) {
  850. now_time = moment(now_time_ms)
  851. end_time = moment(end_time_ms)
  852. _h = moment.duration(end_time.diff(now_time)).hours()
  853. _m = moment.duration(end_time.diff(now_time)).minutes()
  854. _s = moment.duration(end_time.diff(now_time)).seconds()
  855. if (_h < 10) {
  856. _h = '0' + _h
  857. }
  858. if (_m < 10) {
  859. _m = '0' + _m
  860. }
  861. if (_s < 10) {
  862. _s = '0' + _s
  863. }
  864. _time_str = `${_h}:${_m}:${_s}`
  865. } else {
  866. _time_str = `00:00:00`
  867. }
  868. return _time_str
  869. }
  870. function openConutDownTime(end_time_ms, callback) {
  871. end_time_ms = Number(end_time_ms) + 5000
  872. let end_time_s = Number((end_time_ms - new Date().getTime()) / 1000)
  873. let timer = setInterval(() => {
  874. end_time_s = Number((end_time_ms - new Date().getTime()) / 1000)
  875. if (state.open_timer_status == true) {
  876. clearInterval(timer)
  877. }
  878. callback(formatSecondsAsDaysOrTime(end_time_s))
  879. }, 1000);
  880. callback(formatSecondsAsDaysOrTime(end_time_s))
  881. }
  882. const openFollowTabs = (arr_name) => {
  883. let array_finish = arr_name.filter((item) => { return !item.finished })
  884. // let array_finish = state.detail.taskCondition[0].relatedUsers.filter((item) => { return item.finished == false })
  885. let url
  886. if (array_finish.length > 0) {
  887. state.done.follow = false
  888. // 打开标签页的方法
  889. array_finish.forEach((item) => {
  890. url = `https://twitter.com/intent/follow?screen_name=${item.name}&tweet_id=${state.tweetId}`
  891. chrome.tabs.create({ url }, (tab) => {
  892. if (follow_open_tabs.filter((item) => { return item.url == tab.url }).length == 0) {
  893. follow_open_tabs.push(tab)
  894. }
  895. })
  896. })
  897. }
  898. }
  899. async function clickFollowAll(item, is_all) {
  900. let _userInfo = await checkIsLogin()
  901. if (!_userInfo) {
  902. return
  903. }
  904. let arr_name = []
  905. for (let i in item) {
  906. if (!item[i].finished) {
  907. arr_name.push(item[i])
  908. }
  909. }
  910. // ----
  911. state.detail.finishTaskTypeV2 = state.detail.finishTaskTypeV2.toString() || ''
  912. if (state.window_origin.indexOf('facebook.com') >= 0) {
  913. state.detail.finishTaskTypeV2 = '2'
  914. }
  915. switch (state.detail.finishTaskTypeV2) {
  916. case '1':
  917. // openapi
  918. state.loading_show = true
  919. oneKeyFollow({
  920. params: {
  921. names: arr_name
  922. }
  923. }).then((res) => {
  924. state.loading_show = false
  925. if (res.code == 0) {
  926. res.data.forEach((item1) => {
  927. state.detail.taskCondition[0].relatedUsers.forEach(item2 => {
  928. if (item1.name == item2.name && item1.finished) {
  929. item2.finished = true
  930. }
  931. });
  932. })
  933. openFollowTabs(arr_name)
  934. }
  935. }).catch(() => {
  936. state.loading_show = false
  937. })
  938. break
  939. case '2':
  940. openFollowTabs(arr_name)
  941. break
  942. case '3':
  943. if (arr_name.filter((item) => { return !item.twitterUserId }).length > 0) {
  944. openFollowTabs(arr_name)
  945. return
  946. }
  947. let follow_data = []
  948. arr_name.forEach((item) => {
  949. follow_data.push(item)
  950. })
  951. state.loading_show = true
  952. chrome.tabs.getCurrent((tab) => {
  953. chrome.tabs.sendMessage(tab.id, {
  954. actionType: "IFRAME_TWITTER_API_DO_TASK",
  955. task_data: {
  956. tweet_Id: state.tweetId,
  957. follow_data: follow_data,
  958. },
  959. task_type: 'follow'
  960. }, (res) => { console.log(res) });
  961. })
  962. break
  963. default:
  964. openFollowTabs(arr_name)
  965. break
  966. }
  967. // -------- 埋点 --------
  968. let _log_obj = {
  969. pageSource: Report.pageSource.task_page,
  970. businessType: Report.businessType.buttonClick,
  971. objectType: Report.objectType.follow,
  972. customCover: state.customCover,
  973. customGiveaway: state.customGiveaway,
  974. }
  975. if (is_all) {
  976. _log_obj.objectType = Report.objectType.follow_button
  977. }
  978. Report.reportLog(_log_obj, {
  979. postId: state.postId,
  980. srcContentId: state.tweetId,
  981. senderId: state.userId,
  982. });
  983. }
  984. // 重新绑定
  985. const reSetBindTwtterId = (_params) => {
  986. let postBizData = JSON.parse(_params.postBizData);
  987. let { taskCondition } = postBizData;
  988. let discordTask = JSON.parse(taskCondition).find(item => item.type == 7);
  989. getChromeStorage('userInfo', (_userInfo = {}) => {
  990. // if (_userInfo && _userInfo.uid == _params.uid) {
  991. if (_userInfo.uid) {
  992. srcPublishSuccess({
  993. params: {
  994. postId: state.postId,
  995. srcContentId: state.tweetId
  996. }
  997. }).then((res) => {
  998. if (res.code == 0 || res.code == 3003) {
  999. init({ from: 'reSetBindTwtterId' })
  1000. reportBindTweetSuccess({ discordTask, ..._params });
  1001. }
  1002. })
  1003. }
  1004. })
  1005. }
  1006. const reportBindTweetSuccess = (params) => {
  1007. let { discordTask, srcUserId } = params || {};
  1008. discordTaskDetail = discordTask;
  1009. sendCurrentTabMessage({
  1010. actionType: "IFRAME_API_GET_TWEET_USER_INFO_REQ",
  1011. data: {
  1012. screen_name: srcUserId,
  1013. tweetId: state.tweetId
  1014. }
  1015. })
  1016. if (discordTask) {
  1017. getDiscordInfo({ inviteUrl: JSON.parse(discordTask.bizData).inviteUrl }, (res) => {
  1018. if (res.inviteCode == res.code) {
  1019. reportParams.discordFans = res.approximate_member_count;
  1020. if (reportParams.twitterFans !== '' && !reportParams.hasReport) {
  1021. reportParams.hasReport = true;
  1022. Report.reportLog({
  1023. objectType: Report.objectType.tweetPostBinded,
  1024. twitterFans: reportParams.twitterFans,
  1025. discordFans: reportParams.discordFans,
  1026. redPacketType: 1,
  1027. postId: state.postId
  1028. });
  1029. }
  1030. }
  1031. })
  1032. }
  1033. }
  1034. const getDiscordInfo = (params, cb) => {
  1035. let { inviteUrl } = params;
  1036. if (!inviteUrl) return;
  1037. let inviteCode = '';
  1038. let arr = inviteUrl.split('/');
  1039. if (arr.length > 0) {
  1040. inviteCode = arr[arr.length - 1];
  1041. }
  1042. if (!inviteCode) {
  1043. return;
  1044. }
  1045. getInviteGuildInfo({
  1046. inviteCode
  1047. }).then(res => {
  1048. cb && cb({
  1049. ...res,
  1050. inviteCode
  1051. })
  1052. }).catch((err) => {
  1053. });
  1054. }
  1055. const showCloseEndTimePage = () => {
  1056. state.status = 'close'
  1057. state.open_timer_status = true
  1058. state.close_status = '已经过期了'
  1059. state.close_text = [`This Giveaways`, `expired on ${moment(state.detail.endTimestamp).format('MM-DD')}`]
  1060. }
  1061. const showCloseEndTimePageReport = () => {
  1062. // 埋点
  1063. Report.reportLog({
  1064. pageSource: Report.pageSource.expired_page,
  1065. businessType: Report.businessType.pageView,
  1066. postId: state.postId,
  1067. srcContentId: state.tweetId,
  1068. senderId: state.userId,
  1069. });
  1070. }
  1071. const showSuccessPage = () => {
  1072. state.status = 'success'
  1073. state.open_timer_status = true;
  1074. if (!reportParams.reportReceivedPageViewSuccess) {
  1075. reportParams.reportReceivedPageViewSuccess = true;
  1076. // 埋点
  1077. Report.reportLog({
  1078. pageSource: Report.pageSource.received_success_page,
  1079. businessType: Report.businessType.pageView,
  1080. postId: state.postId,
  1081. srcContentId: state.tweetId,
  1082. senderId: state.userId,
  1083. isOldTwitterFans: reportParams.done.follow,
  1084. isOldDiscordFans: reportParams.done.join_discord,
  1085. redPacketType: 1,
  1086. customCover: state.customCover,
  1087. customGiveaway: state.customGiveaway,
  1088. });
  1089. }
  1090. }
  1091. const showNotOpenPage = () => {
  1092. state.status = 'not-open'
  1093. openConutDownTime(state.detail.endTimestamp, (time_str) => {
  1094. state.count_down_time = time_str
  1095. if (time_str == '00:00:00') {
  1096. init()
  1097. }
  1098. })
  1099. Report.reportLog({
  1100. pageSource: Report.pageSource.pending_page,
  1101. businessType: Report.businessType.pageView,
  1102. postId: state.postId,
  1103. srcContentId: state.tweetId,
  1104. senderId: state.userId,
  1105. redPacketType: 1,
  1106. customCover: state.customCover,
  1107. customGiveaway: state.customGiveaway,
  1108. });
  1109. }
  1110. const showOpenedPage = () => {
  1111. state.status = 'opened'
  1112. state.open_timer_status == true
  1113. initTaskDetail(() => {
  1114. showOpenedPageReport()
  1115. })
  1116. }
  1117. const showOpenedPageReport = () => {
  1118. reportParams.done.follow = state.done.follow;
  1119. reportParams.done.join_discord = state.done.join_discord;
  1120. // 埋点
  1121. Report.reportLog({
  1122. pageSource: Report.pageSource.task_page,
  1123. businessType: Report.businessType.pageView,
  1124. postId: state.postId,
  1125. srcContentId: state.tweetId,
  1126. senderId: state.userId,
  1127. isOldTwitterFans: state.done.follow,
  1128. isOldDiscordFans: state.done.join_discord,
  1129. redPacketType: 1,
  1130. customCover: state.customCover,
  1131. customGiveaway: state.customGiveaway,
  1132. });
  1133. }
  1134. const showRabbitPage = () => {
  1135. state.status = 'close'
  1136. state.close_status = '没有抽中'
  1137. state.open_timer_status = true
  1138. }
  1139. const showRabbitPageReport = () => {
  1140. Report.reportLog({
  1141. pageSource: Report.pageSource.received_empty_rewards_page,
  1142. businessType: Report.businessType.pageView,
  1143. postId: state.postId,
  1144. srcContentId: state.tweetId,
  1145. senderId: state.userId,
  1146. });
  1147. }
  1148. const handleStatusPage = () => {
  1149. // status 红包状态(0:未开始,1:进行中,2:已结束,3:已终止,4:终止退款进行中)
  1150. // myReceived 我是否领取过
  1151. // taskFinishStatus 任务完成状态(0:未完成,1:已完成,2:已过期)
  1152. // receiveTimeExpired 是否已经过了红包的领取截止时间
  1153. // endTimestamp 开奖时间
  1154. // ---- 判断结构 ----
  1155. // 如果 红包状态 = 未开始
  1156. // 显示未打开页面 return
  1157. // 如果 红包状态 = 已终止 | 终止退款进行中
  1158. // 显示过期页面
  1159. // 如果 我领取过了
  1160. // 如果 任务完成状态 = 未完成 & 红包状态 = 进行中
  1161. // 显示任务未完成页面
  1162. // 如果 任务完成状态 = 未完成 & 红包状态 = 已结束
  1163. // 显示过期页面
  1164. // 如果 任务完成状态 = 已经完成
  1165. // 如果 (货币奖品类型 领取到红包金额 = 0 || 通用奖品类型 winner = 0) & 红包状态 = 已结束
  1166. // 显示兔子页面
  1167. // 否则如果 红包状态 = 已结束
  1168. // 显示成功页面
  1169. // 如果 红包状态 = 进行中
  1170. // 显示等待结果页面
  1171. // 如果 任务完成状态 = 已经过期
  1172. // 如果 红包状态 = 进行中
  1173. // 显示未打开页面
  1174. // 否则
  1175. // 显示已经过期页面
  1176. // 如果 我没有领取过 & 红包状态 = 进行中
  1177. // 如果 过了红包的领取截止时间 = true
  1178. // 显示已经过期页面
  1179. // 如果 过了红包的领取截止时间 = false
  1180. // 显示未打开页面
  1181. // 如果 我没有领取过 & 红包状态 = 已结束 | 已终止 | 终止退款进行中
  1182. // 显示过期页面
  1183. // -------- 华丽的分割线 --------
  1184. // 如果 红包状态 = 未开始
  1185. if (state.detail.status == 0) {
  1186. showNotOpenPage()
  1187. return
  1188. }
  1189. // 如果 红包状态 = 已终止 | 终止退款进行中
  1190. if (state.detail.status == 3 || state.detail.status == 4) {
  1191. // 显示过期页面
  1192. showCloseEndTimePage()
  1193. showCloseEndTimePageReport()
  1194. }
  1195. // 如果 我领取过了
  1196. else if (state.detail.myReceived) {
  1197. state.receiveAmount = state.detail.myReceived.amountValue || 0
  1198. state.detail.taskCondition = JSON.parse(state.detail.taskCondition)
  1199. // 如果 任务完成状态 = 未完成 & 红包状态 = 进行中
  1200. if (state.detail.myReceived.taskFinishStatus == 0 && state.detail.status == 1) {
  1201. // 显示任务未完成页面
  1202. showOpenedPage()
  1203. if (state.process_mode != 'production') {
  1204. getValidity()
  1205. }
  1206. // 如果 任务完成状态 = 未完成 & 红包状态 = 已结束
  1207. else if (state.detail.myReceived.taskFinishStatus == 0 && state.detail.status == 2) {
  1208. // 显示已经过期页面
  1209. showCloseEndTimePage()
  1210. showCloseEndTimePageReport()
  1211. }
  1212. //如果 任务完成状态 = 已经完成
  1213. } else if (state.detail.myReceived.taskFinishStatus == 1) {
  1214. // 领取到空红包 & 红包状态 = 已结束
  1215. if (((state.detail.rewardType === RewardType.money && state.receiveAmount == 0) || (state.detail.rewardType === RewardType.custom && state.detail.myReceived.winner === 0)) && state.detail.status == 2) {
  1216. showRabbitPage()
  1217. showRabbitPageReport()
  1218. } else if (state.detail.status == 2) {
  1219. // 显示成功页面
  1220. showSuccessPage()
  1221. }
  1222. // 如果 红包状态 = 进行中
  1223. else if (state.detail.status == 1) {
  1224. // 显示等待结果页面
  1225. showLoadResult()
  1226. openTimer()
  1227. }
  1228. // 如果 任务完成状态 = 已经过期
  1229. } else {
  1230. // 如果 红包状态 = 进行中
  1231. if (state.detail.status == 1) {
  1232. // 显示未打开页面
  1233. showNotOpenPage()
  1234. // 否则
  1235. } else {
  1236. // 显示已经过期页面
  1237. showCloseEndTimePage()
  1238. showCloseEndTimePageReport()
  1239. }
  1240. }
  1241. // 如果 我没有领取过
  1242. } else {
  1243. // 如果 红包状态 = 进行中
  1244. if (state.detail.status == 1) {
  1245. // 如果 过了红包的领取截止时间 = true
  1246. if (state.detail.receiveTimeExpired) {
  1247. // 显示过期页面
  1248. showCloseEndTimePage()
  1249. showCloseEndTimePageReport()
  1250. // 如果 过了红包的领取截止时间 = false
  1251. } else {
  1252. // 显示未打开页面
  1253. showNotOpenPage()
  1254. }
  1255. // 红包状态 = 已经结束了 | 已经终止 | 终止退款中
  1256. } else {
  1257. // 显示过期页面
  1258. showCloseEndTimePage()
  1259. showCloseEndTimePageReport()
  1260. }
  1261. }
  1262. }
  1263. function setFrontConfig() {
  1264. getFrontConfig({
  1265. params: {},
  1266. }).then((res) => {
  1267. if (res.code == 0) {
  1268. facebookAppConfig.facebookAppId = res.data.fbClientId;
  1269. }
  1270. });
  1271. };
  1272. function init(initParams) {
  1273. let { type } = initParams || {};
  1274. onPageVisbile();
  1275. onWindowMessage();
  1276. setFrontConfig();
  1277. getPostDetail({
  1278. params: {
  1279. postId: state.postId
  1280. }
  1281. }).then((res) => {
  1282. state.loading_show = false
  1283. // 领取0元为空红包继续流程
  1284. // ---- 完成任务接口 ----
  1285. // 如果金额是0
  1286. // 显示没有抽中
  1287. if (res.code == 0) {
  1288. state.srcContent = res.data.srcContent;
  1289. state.postRedirectUrl = res.data.postRedirectUrl;
  1290. // 判断推特id,绑定逻辑
  1291. state.srcContentId = res.data.srcContentId
  1292. if (!state.srcContentId) {
  1293. reSetBindTwtterId(res.data)
  1294. return
  1295. }
  1296. state.detail = JSON.parse(res.data.postBizData)
  1297. state.detail.taskCondition = state.detail.taskCondition || []
  1298. state.tweetId = state.srcContentId;
  1299. state.userId = res.data.srcUserId;
  1300. state.tweet_author = state.detail.postUserInfo && state.detail.postUserInfo.nickName || '';
  1301. state.customCover = state.detail.posterType == 2 ? 1 : 0;
  1302. state.customGiveaway = state.detail.rewardType == 2 ? 1 : 0;
  1303. // 不要删除这个console
  1304. console.log('postBizData', state.detail)
  1305. checkFacebookReply();
  1306. handleStatusPage()
  1307. } else {
  1308. handleErrorCode(res)
  1309. }
  1310. }).finally(() => {
  1311. state.loading_redbag = false
  1312. })
  1313. }
  1314. function initTaskDetail(cb) {
  1315. getChromeStorage('userInfo', (_userInfo) => {
  1316. if (_userInfo && _userInfo.uid) {
  1317. // 任务详情
  1318. getTaskDetail({
  1319. params: {
  1320. postId: state.postId
  1321. }
  1322. }).then((res) => {
  1323. if (res.code.toString()) {
  1324. for (let i in res.data) {
  1325. switch (res.data[i].type) {
  1326. case 1:
  1327. state.done.follow = res.data[i].finished
  1328. state.detail.taskCondition[0].relatedUsers = res.data[i].detail
  1329. break
  1330. case 2:
  1331. state.done.like = res.data[i].finished
  1332. break
  1333. case 3:
  1334. state.done.retweet = res.data[i].finished
  1335. break
  1336. case 7:
  1337. state.done.join_discord = res.data[i].finished
  1338. discordAuthorizeRequired = res.data[i].discordAuthorizeRequired
  1339. break
  1340. case 8:
  1341. state.done.repost_facebook = res.data[i].finished;
  1342. break;
  1343. case 9:
  1344. state.done.reply = res.data[i].finished;
  1345. if (!state.done.reply) {
  1346. onTweetReplyClick({ type: 9 });
  1347. }
  1348. break;
  1349. }
  1350. }
  1351. } else {
  1352. handleErrorCode(res)
  1353. }
  1354. cb && cb()
  1355. })
  1356. }
  1357. })
  1358. }
  1359. let tab_index = 0
  1360. const doTaskReport = (req, sender) => {
  1361. state.loading_show = false
  1362. let follow_name = req.task_data.follow_name || ''
  1363. // 1 Twitter follow Twitter ScreenName
  1364. // 2 Tweet like
  1365. // 3 Retweet
  1366. let event_type = 0
  1367. switch (req.task_type) {
  1368. case 'retweet':
  1369. event_type = 3
  1370. state.done.retweet = req.task_done
  1371. if (!req.task_done && req.do_type == 'api') {
  1372. window.open(`https://twitter.com/intent/retweet?tweet_id=${state.tweetId}`)
  1373. }
  1374. break;
  1375. case 'like':
  1376. event_type = 2
  1377. state.done.like = req.task_done
  1378. //
  1379. if (!req.task_done && req.do_type == 'api') {
  1380. window.open(`https://twitter.com/intent/like?tweet_id=${state.tweetId}`)
  1381. }
  1382. break
  1383. case 'follow':
  1384. event_type = 1
  1385. // for (let i = 0; i < follow_open_tabs.length; i++) {
  1386. // if (follow_open_tabs[i].id == sender.tab.id) {
  1387. // follow_open_tabs.splice(i, 1)
  1388. // break
  1389. // }
  1390. // }
  1391. // chrome.tabs.getCurrent((tab) => {
  1392. // if (follow_open_tabs.length > 0) {
  1393. // tab_index = follow_open_tabs[follow_open_tabs.length - 1].index
  1394. // } else {
  1395. // tab_index = tab.index
  1396. // }
  1397. // chrome.tabs.highlight({ windowId: tab.windowId, tabs: tab_index })
  1398. // })
  1399. let has_no_finished = false
  1400. state.detail.taskCondition[0].relatedUsers.forEach((item) => {
  1401. if (follow_name == item.name) {
  1402. item.finished = req.task_done
  1403. }
  1404. })
  1405. state.detail.taskCondition[0].relatedUsers.forEach((item) => {
  1406. if (!item.finished) {
  1407. has_no_finished = true
  1408. }
  1409. })
  1410. if (!has_no_finished) {
  1411. state.done.follow = true
  1412. state.done.follow_red = false
  1413. openFollowTabs(state.detail.taskCondition[0].relatedUsers)
  1414. }
  1415. break
  1416. }
  1417. if (req.do_type != 'api') {
  1418. chrome.tabs.remove(sender.tab.id)
  1419. }
  1420. if (req.task_done) {
  1421. addFinishEvent({
  1422. params: {
  1423. eventData: follow_name,
  1424. eventType: event_type,
  1425. luckdropId: state.detail.taskLuckdropId
  1426. }
  1427. })
  1428. }
  1429. }
  1430. let open_timer_flag = false
  1431. // 倒计时开奖
  1432. const openTimer = () => {
  1433. if (open_timer_flag) {
  1434. return
  1435. }
  1436. open_timer_flag = true
  1437. openConutDownTime(state.detail.endTimestamp, (time_str) => {
  1438. state.count_down_time = time_str
  1439. if (time_str == '00:00:00') {
  1440. init()
  1441. }
  1442. })
  1443. }
  1444. async function showLoadResult() {
  1445. state.status = 'close'
  1446. state.close_status = '等待结果'
  1447. getChromeStorage('userInfo', (_userInfo) => {
  1448. if (_userInfo) {
  1449. getUserSetting()
  1450. }
  1451. })
  1452. }
  1453. const getUserSetting = () => {
  1454. getSetting({}).then((res) => {
  1455. let { code, data } = res;
  1456. if (code === 0) {
  1457. state.notification_show = true
  1458. state.notification_switch = data.noticeSwitch === 1 ? true : false;
  1459. }
  1460. });
  1461. }
  1462. onMounted(() => {
  1463. state.process_mode = process.env.NODE_ENV
  1464. state.postId = getQueryString('postId')
  1465. state.window_origin = getQueryString('window_origin') || '';
  1466. if (state.window_origin.indexOf('twitter.com') > -1) {
  1467. state.tweetId = getQueryString('tweetId')
  1468. state.tweet_author = getQueryString('tweet_author');
  1469. }
  1470. getTweetAuthor()
  1471. init()
  1472. onRuntimeMsg();
  1473. // state.loading_show = true
  1474. // state.status = 'not-open'
  1475. // state.status = 'success'
  1476. // state.status = 'close'
  1477. // state.close_status = '已经过期了'
  1478. // state.close_text = [`This Giveaways`, `expired on ${moment(state.detail.endTimestamp).format('MM-DD')}`]
  1479. // state.close_status = '没有抽中'
  1480. // state.close_status = '已过期'
  1481. })
  1482. function getTweetAuthor() {
  1483. if (state.window_origin.indexOf('twitter.com') > -1) {
  1484. window.parent.postMessage({
  1485. actionType: "IFRAME_RED_PACKET_GET_TWEET_AUTHOR", data: {
  1486. postId: state.postId,
  1487. taskLuckdropId: state.detail.taskLuckdropId
  1488. }
  1489. }, "*");
  1490. }
  1491. }
  1492. function checkFacebookReply() {
  1493. console.log('checkFacebookReply')
  1494. if (state.window_origin.indexOf('twitter.com') > -1) {
  1495. window.parent.postMessage({
  1496. actionType: "IFRAME_RED_PACKET_CHECK_FACEBOOK_REPLY", data: {
  1497. postId: state.postId
  1498. }
  1499. }, "*");
  1500. }
  1501. }
  1502. // 点击领取
  1503. function clickOpenRedPacket() {
  1504. callEventPageMethod('CONTENT_GET_PINED', {})
  1505. handleRedPacket()
  1506. }
  1507. function handleRedPacket() {
  1508. state.loading_show = true
  1509. getRedPacket({
  1510. params: {
  1511. postId: state.postId
  1512. }
  1513. }).then((res) => {
  1514. if (res.code == 0) {
  1515. init()
  1516. } else {
  1517. state.loading_show = false
  1518. handleErrorCode(res)
  1519. }
  1520. }).catch(() => {
  1521. state.loading_show = false
  1522. })
  1523. // 埋点
  1524. Report.reportLog({
  1525. pageSource: Report.pageSource.pending_page,
  1526. businessType: Report.businessType.buttonClick,
  1527. objectType: Report.objectType.open_button,
  1528. postId: state.postId,
  1529. srcContentId: state.tweetId,
  1530. senderId: state.userId,
  1531. redPacketType: 1,
  1532. customCover: state.customCover,
  1533. customGiveaway: state.customGiveaway,
  1534. });
  1535. }
  1536. chrome.storage.onChanged.addListener(changes => {
  1537. if (changes.userInfo && changes.userInfo.newValue) {
  1538. // let item = JSON.parse(changes.userInfo.newValue)
  1539. state.loading_show = false
  1540. init()
  1541. }
  1542. })
  1543. // 校验是否封路
  1544. function checkIsLogin() {
  1545. return new Promise((resolve) => {
  1546. getChromeStorage('userInfo', (_userInfo) => {
  1547. if (!_userInfo) {
  1548. state.loading_show = true
  1549. setTimeout(() => {
  1550. state.loading_show = false
  1551. }, 3000)
  1552. chrome.runtime.sendMessage(
  1553. { actionType: "POPUP_LOGIN", data: "" },
  1554. (response) => {
  1555. console.log("res", response);
  1556. }
  1557. )
  1558. resolve(_userInfo)
  1559. } else {
  1560. resolve(_userInfo)
  1561. }
  1562. })
  1563. })
  1564. }
  1565. async function clickGetGiveaways() {
  1566. let _userInfo = await checkIsLogin()
  1567. if (_userInfo) {
  1568. handleFinishRedPacket()
  1569. }
  1570. }
  1571. function handleFinishRedPacket() {
  1572. state.loading_show = true
  1573. finishRedPacket({
  1574. params: {
  1575. postId: state.postId
  1576. }
  1577. }).then((res) => {
  1578. if (res.code == 0) {
  1579. if (res.data.finished) {
  1580. state.receiveAmount = res.data.receiveAmount
  1581. init()
  1582. // 埋点
  1583. Report.reportLog({
  1584. pageSource: Report.pageSource.task_page,
  1585. businessType: Report.businessType.buttonClick,
  1586. objectType: Report.objectType.get_giveaway,
  1587. postId: state.postId,
  1588. srcContentId: state.tweetId,
  1589. senderId: state.userId,
  1590. customCover: state.customCover,
  1591. customGiveaway: state.customGiveaway,
  1592. }, {
  1593. get_giveaway_result: Report.extParams.success
  1594. });
  1595. } else {
  1596. state.loading_show = false
  1597. let _data = res.data.conditionResult
  1598. for (let i in _data) {
  1599. switch (_data[i].type.toString()) {
  1600. case '1':
  1601. state.detail.taskCondition[0].relatedUsers = _data[i].detail
  1602. if (_data[i].finished) {
  1603. state.done.follow = true
  1604. state.done.follow_red = false
  1605. } else {
  1606. // alert('Please complete the task: follow')
  1607. state.done.follow = false
  1608. state.done.follow_red = true
  1609. }
  1610. break
  1611. case '2':
  1612. if (_data[i].finished) {
  1613. state.done.like = true
  1614. state.done.like_red = false
  1615. } else {
  1616. // alert('Please complete the task: like tweet')
  1617. state.done.like = false
  1618. state.done.like_red = true
  1619. }
  1620. break
  1621. case '3':
  1622. if (_data[i].finished) {
  1623. state.done.retweet = true
  1624. state.done.retweet_red = false
  1625. } else {
  1626. // alert('Please complete the task: Retweet')
  1627. state.done.retweet_red = true
  1628. state.done.retweet = false
  1629. }
  1630. break
  1631. case '7':
  1632. //join discord
  1633. discordAuthorizeRequired = _data[i].discordAuthorizeRequired;
  1634. if (_data[i].finished) {
  1635. state.done.join_discord = true
  1636. state.done.join_discord_red = false
  1637. } else {
  1638. state.done.join_discord = false;
  1639. state.done.join_discord_red = true
  1640. }
  1641. break
  1642. case '8':
  1643. //repost feacebook
  1644. if (_data[i].finished) {
  1645. state.done.repost_facebook = true
  1646. state.done.repost_facebook_red = false
  1647. } else {
  1648. state.done.repost_facebook = false;
  1649. state.done.repost_facebook_red = true
  1650. }
  1651. break
  1652. case '9':
  1653. //reply
  1654. if (_data[i].finished) {
  1655. state.done.reply = true
  1656. state.done.reply_red = false
  1657. } else {
  1658. state.done.reply = false;
  1659. state.done.reply_red = true
  1660. }
  1661. break
  1662. }
  1663. }
  1664. // 埋点
  1665. Report.reportLog({
  1666. pageSource: Report.pageSource.task_page,
  1667. businessType: Report.businessType.buttonClick,
  1668. objectType: Report.objectType.get_giveaway,
  1669. postId: state.postId,
  1670. srcContentId: state.tweetId,
  1671. senderId: state.userId,
  1672. customCover: state.customCover,
  1673. customGiveaway: state.customGiveaway,
  1674. }, {
  1675. get_giveaway_result: Report.extParams.failure,
  1676. });
  1677. if (discordAuthorizeRequired) {
  1678. discordAuth('reAuth');
  1679. }
  1680. }
  1681. } else {
  1682. state.loading_show = false
  1683. // 埋点
  1684. Report.reportLog({
  1685. pageSource: Report.pageSource.task_page,
  1686. businessType: Report.businessType.buttonClick,
  1687. objectType: Report.objectType.get_giveaway,
  1688. postId: state.postId,
  1689. srcContentId: state.tweetId,
  1690. senderId: state.userId,
  1691. customCover: state.customCover,
  1692. customGiveaway: state.customGiveaway,
  1693. }, {
  1694. get_giveaway_result: Report.extParams.failure,
  1695. });
  1696. handleErrorCode(res)
  1697. }
  1698. }).catch(() => {
  1699. state.loading_show = false
  1700. })
  1701. }
  1702. function handleErrorCode(res) {
  1703. switch (res.code.toString()) {
  1704. // 数据异常,请联系管理员
  1705. case '-102':
  1706. break
  1707. //系统错误
  1708. case '-101':
  1709. break
  1710. // 参数不对
  1711. case '-103':
  1712. break
  1713. // 接口被限流
  1714. case '-105':
  1715. break
  1716. // 访问凭证不存在
  1717. case '-107':
  1718. break
  1719. // 重复操作过于频繁
  1720. case '-106':
  1721. message.error('Clicking too often, wait a moment and click again')
  1722. state.loading_show = false
  1723. break
  1724. // 红包不存在
  1725. case '2001':
  1726. // message.error(res.msg)
  1727. break
  1728. // 还未到红包领取时间
  1729. case '2002':
  1730. // message.error(res.msg)
  1731. break
  1732. // 已超过红包领取时间
  1733. case '2003':
  1734. init()
  1735. break
  1736. // 红包支付状态异常 没有可提交的任务红包
  1737. case '2004':
  1738. init()
  1739. break
  1740. // 红包活动已结束
  1741. case '2006':
  1742. init()
  1743. break
  1744. // 红包金额已经被领取完了
  1745. case '2007':
  1746. state.status = 'close'
  1747. state.close_status = '已经过期了'
  1748. state.close_text = [`This Giveaways`, `expired on ${moment(state.detail.endTimestamp).format('MM-DD')}`]
  1749. init()
  1750. break
  1751. // 红包个数已经被领取完了
  1752. case '2008':
  1753. state.status = 'close'
  1754. state.close_status = '已经过期了'
  1755. state.close_text = [`This Giveaways`, `expired on ${moment(state.detail.endTimestamp).format('MM-DD')}`]
  1756. init()
  1757. break
  1758. // 该用户不满足领取条件
  1759. case '2009':
  1760. state.error_txt = [`oops, new accounts cannot participate in this event,`]
  1761. state.status = 'error'
  1762. state.retry = true
  1763. // 埋点
  1764. Report.reportLog({
  1765. pageSource: Report.pageSource.robot_detection_failed_page,
  1766. businessType: Report.businessType.pageView,
  1767. postId: state.postId,
  1768. srcContentId: state.tweetId,
  1769. senderId: state.userId,
  1770. });
  1771. break
  1772. // 无法校验用户Twitter信息
  1773. case '2010':
  1774. // message.error(res.msg)
  1775. break
  1776. // 用户已经领过该红包
  1777. case '2011':
  1778. // message.error(res.msg)
  1779. break
  1780. // 推文不存在
  1781. case '2022':
  1782. // message.error(res.msg)
  1783. break
  1784. // 推文未发布 and 不是红包任务的推文
  1785. case '2023':
  1786. // message.error(res.msg)
  1787. break
  1788. // 没有可提交的任务红包
  1789. case '2024':
  1790. state.status = 'not-open'
  1791. break
  1792. // 红包任务已完成
  1793. case '2025':
  1794. break
  1795. // 任务已经过期
  1796. case '2026':
  1797. break
  1798. // 任务未完成
  1799. case '2027':
  1800. break
  1801. // 红包金额每人不足1分钱
  1802. case '2028':
  1803. break
  1804. // 推文未发布
  1805. case '2029':
  1806. message.error('Tweet not posted')
  1807. break
  1808. // 不是红包任务的推文
  1809. case '2030':
  1810. break
  1811. case '2037':
  1812. showCloseEndTimePage()
  1813. init()
  1814. break
  1815. //用户没有领取过红包,无法重抽
  1816. case '2031':
  1817. break
  1818. // 需要重新授权 discord
  1819. case '1010':
  1820. discordAuth('reAuth');
  1821. break
  1822. }
  1823. }
  1824. // function clickBack() {
  1825. // state.status = 'opened'
  1826. // // 埋点
  1827. // Report.reportLog({
  1828. // pageSource: Report.pageSource.task_page,
  1829. // businessType: Report.businessType.pageView,
  1830. // });
  1831. // }
  1832. // function clickRoad() {
  1833. // state.status = 'luck-peopel-list'
  1834. // // 埋点
  1835. // Report.reportLog({
  1836. // pageSource: Report.pageSource.task_page,
  1837. // businessType: Report.businessType.buttonClick,
  1838. // objectType: Report.objectType.received_list
  1839. // });
  1840. // // 埋点
  1841. // Report.reportLog({
  1842. // pageSource: Report.pageSource.received_list_page,
  1843. // businessType: Report.businessType.pageView
  1844. // });
  1845. // }
  1846. function onWindowMessage() {
  1847. window.addEventListener("message", function (event) {
  1848. if (event.data) {
  1849. switch (event.data.actionType) {
  1850. case 'CONTENT_RED_PACKET_REPLY_RASK_FINSH':
  1851. state.done.reply = true;
  1852. state.done.reply_red = false;
  1853. break;
  1854. case 'CONTENT_RED_PACKET_GET_TWEET_AUTHOR':
  1855. fullName = event.data.data.fullName
  1856. break;
  1857. case 'CONTENT_RED_PACKET_FACEBOOK_REPLY':
  1858. clickReply(event.data.data)
  1859. break;
  1860. }
  1861. }
  1862. });
  1863. }
  1864. function onPageVisbile() {
  1865. document.addEventListener('visibilitychange', function () {
  1866. let isHidden = document.hidden;
  1867. if (!isHidden) {
  1868. checkJoinDiscord();
  1869. }
  1870. });
  1871. }
  1872. function onRuntimeMsg() {
  1873. chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
  1874. ;
  1875. switch (req.actionType) {
  1876. case 'BACK_DISCORD_LOGIN_SUCCESS':
  1877. discordLoginSuccess();
  1878. break;
  1879. case 'BG_FACEBOOK_SHARE_SUCCESS':
  1880. facebookShareSuccess(req.data);
  1881. break;
  1882. case 'DO_TASK':
  1883. if (!req.task_type || state.tweetId != req.tweet_Id) {
  1884. return
  1885. }
  1886. state.loading_show = false
  1887. doTaskReport(req, sender);
  1888. break;
  1889. case 'CONTENT_RED_PACKET_REPLY_RASK_FINSH':
  1890. if (req.data && req.data.postId == state.postId) {
  1891. state.done.reply = true;
  1892. state.done.reply_red = false;
  1893. }
  1894. break;
  1895. case 'CONTENT_API_GET_TWEET_USER_INFO_RES':
  1896. let { user } = req.data || {};
  1897. if (req.tweetId == state.tweetId && user && user.result && user.result.legacy) {
  1898. let legacy = user.result.legacy;
  1899. reportParams.twitterFans = legacy ? legacy.followers_count : 0;
  1900. if (!discordTaskDetail) {
  1901. if (reportParams.hasReport) return;
  1902. reportParams.hasReport = true;
  1903. Report.reportLog({
  1904. objectType: Report.objectType.tweetPostBinded,
  1905. twitterFans: reportParams.twitterFans,
  1906. redPacketType: 1,
  1907. postId: state.postId
  1908. });
  1909. } else {
  1910. if (reportParams.discordFans !== '') {
  1911. if (reportParams.hasReport) return;
  1912. reportParams.hasReport = true;
  1913. Report.reportLog({
  1914. objectType: Report.objectType.tweetPostBinded,
  1915. twitterFans: reportParams.twitterFans,
  1916. discordFans: reportParams.discordFans,
  1917. redPacketType: 1,
  1918. postId: state.postId
  1919. });
  1920. }
  1921. }
  1922. }
  1923. break;
  1924. case 'USER_SETTING':
  1925. setNotification(req.data)
  1926. break;
  1927. }
  1928. sendResponse && sendResponse();
  1929. })
  1930. }
  1931. /**
  1932. * 检查是否加入discord
  1933. */
  1934. function checkJoinDiscord() {
  1935. // 如果上次的状态是 joinIng 检查是否真正join
  1936. if (joinDiscordActionState == 'joinIng') {
  1937. joinDiscordActionState = 'default';
  1938. let url = getInviteUrl();
  1939. if (url) {
  1940. joinDiscordIng.value = true;
  1941. checkGuildJoinedStatus({ url }, (res = {}) => {
  1942. joinDiscordIng.value = false;
  1943. if (res.code == 0) {
  1944. let { joined } = res.data || {};
  1945. if (joined) {
  1946. state.done.join_discord = true;
  1947. } else {
  1948. state.done.join_discord = false;
  1949. }
  1950. } else if (res.code == 1010) {
  1951. discordAuth('reAuth');
  1952. }
  1953. })
  1954. }
  1955. }
  1956. }
  1957. const checkGuildJoinedStatus = ({ url }, cb) => {
  1958. checkGuildJoined({
  1959. params: {
  1960. inviteUrl: url
  1961. }
  1962. }).then(res => {
  1963. cb && cb(res);
  1964. }).catch(err => {
  1965. cb && cb({ catch: true })
  1966. })
  1967. }
  1968. /**
  1969. * 加入discord 事件
  1970. */
  1971. async function joinDiscord() {
  1972. let _userInfo = await checkIsLogin();
  1973. if (!_userInfo) {
  1974. return
  1975. }
  1976. if (joinDiscordIng.value) {
  1977. return;
  1978. }
  1979. // 埋点
  1980. Report.reportLog({
  1981. objectType: Report.objectType.join_discord,
  1982. pageSource: Report.pageSource.task_page,
  1983. businessType: Report.businessType.buttonClick,
  1984. postId: state.postId,
  1985. srcContentId: state.tweetId,
  1986. senderId: state.userId,
  1987. redPacketType: 1,
  1988. customCover: state.customCover,
  1989. customGiveaway: state.customGiveaway,
  1990. });
  1991. let url = getInviteUrl();
  1992. if (url) {
  1993. joinDiscordIng.value = true;
  1994. checkGuildJoinedStatus({ url }, (res) => {
  1995. setTimeout(() => {
  1996. joinDiscordIng.value = false;
  1997. }, 1500);
  1998. if (res.code == 0) {
  1999. let { joined } = res.data || {};
  2000. if (joined) {
  2001. state.done.join_discord = true;
  2002. } else {
  2003. state.done.join_discord = false;
  2004. if (discordAuthorizeRequired) {
  2005. discordAuth('authAndJoinIng');
  2006. } else {
  2007. openInviteUrl();
  2008. }
  2009. }
  2010. } else if (res.code == 1010) {
  2011. discordAuth('authAndJoinIng');
  2012. }
  2013. if (res.catch) {
  2014. //判断是否需要授权
  2015. if (discordAuthorizeRequired) {
  2016. discordAuth('authAndJoinIng');
  2017. } else {
  2018. openInviteUrl();
  2019. }
  2020. }
  2021. })
  2022. }
  2023. }
  2024. /**
  2025. * discord授权
  2026. */
  2027. function discordAuth(actionState = 'default') {
  2028. let state = guid();
  2029. discordAuthUrl({
  2030. params: {
  2031. redirectUrl: discordAuthRedirectUri,
  2032. state
  2033. }
  2034. }).then(res => {
  2035. if (res.code == 0) {
  2036. let { authorizeUrl = '' } = res.data || {};
  2037. if (authorizeUrl) {
  2038. joinDiscordActionState = actionState;
  2039. const width = 500;
  2040. chrome.windows.create({
  2041. width,
  2042. type: 'normal',
  2043. url: authorizeUrl
  2044. }, function (window) {
  2045. let windowId = window.id;
  2046. callEventPageMethod("RED_PACKET_SAVE_DISCORD_AUTH_WINDOW_ID", {
  2047. windowId: windowId
  2048. });
  2049. })
  2050. }
  2051. }
  2052. })
  2053. }
  2054. /**
  2055. * sendMessage
  2056. */
  2057. const callEventPageMethod = (actionType, data, callback) => {
  2058. chrome.runtime.sendMessage(
  2059. {
  2060. actionType: actionType,
  2061. data: data
  2062. },
  2063. function (response) {
  2064. if (typeof callback === "function") callback(response);
  2065. }
  2066. );
  2067. };
  2068. /**
  2069. * discord 授权成功
  2070. */
  2071. function discordLoginSuccess() {
  2072. console.log('discordloginSuccess');
  2073. // 如果是授权并join 默认打开 邀请链接
  2074. if (joinDiscordActionState == 'authAndJoinIng') {
  2075. openInviteUrl();
  2076. }
  2077. if (discordAuthorizeRequired) {
  2078. discordAuthorizeRequired = false;
  2079. }
  2080. }
  2081. /**
  2082. * 获取discord邀请链接
  2083. */
  2084. function getInviteUrl() {
  2085. let inviteData = state.detail.taskCondition.find(item => {
  2086. return item.type == 7;
  2087. });
  2088. let url;
  2089. if (inviteData && inviteData.bizData) {
  2090. url = JSON.parse(inviteData.bizData).inviteUrl;
  2091. }
  2092. return url;
  2093. }
  2094. /**
  2095. * 打开邀请discord链接
  2096. */
  2097. function openInviteUrl() {
  2098. joinDiscordActionState = 'joinIng';
  2099. let url = getInviteUrl();
  2100. if (url) {
  2101. if (!url.startsWith('http')) {
  2102. url = 'https://' + url;
  2103. }
  2104. window.open(url);
  2105. }
  2106. }
  2107. </script>
  2108. <style lang="scss" scoped>
  2109. html,
  2110. body {
  2111. margin: 0;
  2112. padding: 0;
  2113. width: 375px;
  2114. height: 500px;
  2115. background-color: unset !important;
  2116. }
  2117. :deep() .ant-switch {
  2118. background-color: #E9ECEE;
  2119. height: 14px;
  2120. line-height: 16px;
  2121. min-width: 36px;
  2122. }
  2123. :deep() .ant-switch-checked {
  2124. background-color: #AED8F5 !important;
  2125. }
  2126. :deep() .ant-switch::after {
  2127. width: 20px;
  2128. height: 20px;
  2129. top: -4px;
  2130. left: -1px;
  2131. }
  2132. :deep() .ant-switch-checked::after {
  2133. background-color: #1D9BF0 !important;
  2134. margin-left: 3px;
  2135. left: 100% !important;
  2136. }
  2137. .content {
  2138. position: relative;
  2139. width: 375px;
  2140. height: 500px;
  2141. background: #fafafa;
  2142. overflow: hidden;
  2143. box-sizing: border-box;
  2144. font-family: "SF Pro Display";
  2145. font-style: normal;
  2146. .loading {
  2147. background: #FFFFFF;
  2148. opacity: 0.8;
  2149. z-index: 222;
  2150. text-align: center;
  2151. width: 375px;
  2152. height: 500px;
  2153. position: fixed;
  2154. top: 0;
  2155. left: 0;
  2156. img {
  2157. margin-top: 216px;
  2158. width: 70px;
  2159. height: 70px;
  2160. }
  2161. }
  2162. .redbag {
  2163. z-index: 222;
  2164. text-align: center;
  2165. width: 375px;
  2166. height: 500px;
  2167. position: fixed;
  2168. top: 0;
  2169. left: 0;
  2170. img {
  2171. margin-top: 172px;
  2172. width: 130px;
  2173. height: 130px;
  2174. }
  2175. }
  2176. .error {
  2177. width: 100%;
  2178. height: 100%;
  2179. text-align: center;
  2180. position: relative;
  2181. img {
  2182. width: 100px;
  2183. height: 100px;
  2184. margin-top: 100px;
  2185. }
  2186. .txt {
  2187. font-weight: 500;
  2188. font-size: 22px;
  2189. line-height: 26px;
  2190. text-align: center;
  2191. letter-spacing: 0.3px;
  2192. color: #a8a8a8;
  2193. margin: 34px 44px 0 44px;
  2194. }
  2195. .retry {
  2196. position: absolute;
  2197. bottom: 30px;
  2198. left: 50%;
  2199. margin-left: -167.5px;
  2200. width: 335px;
  2201. height: 46px;
  2202. line-height: 46px;
  2203. text-align: center;
  2204. border-radius: 100px;
  2205. border: 1px solid #1D9BF0;
  2206. background: rgba(196, 196, 196, 0.01);
  2207. color: #1D9BF0;
  2208. font-size: 16px;
  2209. font-weight: 500;
  2210. cursor: pointer;
  2211. }
  2212. }
  2213. .success,
  2214. .close,
  2215. .luck-peopel-list {
  2216. filter: drop-shadow(0px 4px 94px rgba(0, 0, 0, 0.3));
  2217. width: 100%;
  2218. height: 100%;
  2219. border-radius: 11px;
  2220. background: #fff;
  2221. overflow: hidden;
  2222. display: flex;
  2223. flex-direction: column;
  2224. .close-title {
  2225. width: 100%;
  2226. font-weight: 600;
  2227. font-size: 27px;
  2228. line-height: 32px;
  2229. text-align: center;
  2230. letter-spacing: 0.3px;
  2231. font-weight: 800;
  2232. font-size: 22px;
  2233. color: #ffffff;
  2234. }
  2235. .head {
  2236. padding: 14px 16px;
  2237. img {
  2238. cursor: pointer;
  2239. width: 24px;
  2240. height: 24px;
  2241. }
  2242. }
  2243. .header {
  2244. text-align: center;
  2245. min-height: 160px;
  2246. width: 100%;
  2247. background: #fff;
  2248. // padding-top: 30px;
  2249. background-size: 100% 100%;
  2250. position: relative;
  2251. display: flex;
  2252. align-content: center;
  2253. flex-wrap: wrap;
  2254. .rabbit {
  2255. width: 100%;
  2256. height: 100%;
  2257. display: flex;
  2258. align-items: center;
  2259. align-content: center;
  2260. flex-wrap: wrap;
  2261. justify-content: center;
  2262. img {
  2263. width: 150px;
  2264. height: 80px;
  2265. margin-bottom: 6px;
  2266. }
  2267. .flower {
  2268. width: 62px;
  2269. height: 62px;
  2270. }
  2271. p {
  2272. width: 100%;
  2273. margin: 0;
  2274. padding: 0;
  2275. font-size: 22px;
  2276. font-weight: 800;
  2277. color: #fff;
  2278. text-align: center;
  2279. letter-spacing: 0.3px;
  2280. }
  2281. }
  2282. .done {
  2283. cursor: pointer;
  2284. position: absolute;
  2285. top: 107px;
  2286. left: 50%;
  2287. margin-left: -150px;
  2288. width: 300px;
  2289. height: 60px;
  2290. display: flex;
  2291. align-items: center;
  2292. border-radius: 100px;
  2293. background: #ffffff;
  2294. box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1);
  2295. justify-content: center;
  2296. span {
  2297. color: #000000;
  2298. font-size: 14px;
  2299. }
  2300. .icon-done {
  2301. width: 24px;
  2302. height: 24px;
  2303. margin-right: 10px;
  2304. }
  2305. .icon-right {
  2306. margin-left: 5px;
  2307. width: 7px;
  2308. height: 14px;
  2309. }
  2310. }
  2311. .title {
  2312. margin-top: 30px;
  2313. color: #fff7e4;
  2314. opacity: 0.6;
  2315. font-weight: 700;
  2316. font-size: 18px;
  2317. line-height: 21px;
  2318. letter-spacing: -0.3px;
  2319. }
  2320. .money {
  2321. margin-bottom: 30px;
  2322. width: 100%;
  2323. display: flex;
  2324. justify-content: center;
  2325. align-items: center;
  2326. img {
  2327. width: 40px;
  2328. height: 40px;
  2329. margin-right: 9px;
  2330. border-radius: 50%;
  2331. border: solid 2px #fff;
  2332. }
  2333. .big {
  2334. font-weight: 700;
  2335. font-size: 46px;
  2336. line-height: 55px;
  2337. /* identical to box height */
  2338. letter-spacing: 0.3px;
  2339. color: #fff;
  2340. }
  2341. .small {
  2342. margin-left: 4px;
  2343. font-weight: 700;
  2344. font-size: 13px;
  2345. line-height: 16px;
  2346. /* identical to box height */
  2347. letter-spacing: 0.5px;
  2348. color: #fff;
  2349. }
  2350. }
  2351. .custom-prize-show {
  2352. width: 100%;
  2353. display: flex;
  2354. justify-content: center;
  2355. align-items: center;
  2356. height: 44px;
  2357. margin-top: 20px;
  2358. img {
  2359. width: 24px;
  2360. height: 24px;
  2361. margin-right: 9px;
  2362. }
  2363. }
  2364. }
  2365. .luck-list-title {
  2366. /* margin-top: 47px;*/
  2367. margin: 0 16px;
  2368. padding: 14px 0 11px 0;
  2369. background: #fff;
  2370. display: flex;
  2371. justify-content: space-between;
  2372. color: #B0B0B0;
  2373. font-weight: 500;
  2374. border-bottom: 1px solid #F2F2F2;
  2375. div:last-child {
  2376. text-align: right;
  2377. }
  2378. .text {
  2379. cursor: pointer;
  2380. }
  2381. }
  2382. .luck-list {
  2383. background: #fff;
  2384. overflow: auto;
  2385. &.max {
  2386. height: 250px;
  2387. }
  2388. .empty {
  2389. width: 100%;
  2390. height: 100%;
  2391. text-align: center;
  2392. img {
  2393. margin-top: 70px;
  2394. width: 100px;
  2395. height: 100px;
  2396. }
  2397. }
  2398. .luck-item {
  2399. display: flex;
  2400. padding: 10px 0;
  2401. margin: 0 16px;
  2402. border-bottom: 1px solid #F2F2F2;
  2403. justify-content: space-between;
  2404. position: relative;
  2405. .win {
  2406. position: absolute;
  2407. left: 28px;
  2408. bottom: 7px;
  2409. width: 20px;
  2410. height: 20px;
  2411. }
  2412. img:first-child {
  2413. border-radius: 50%;
  2414. }
  2415. .luck-king {
  2416. position: absolute;
  2417. top: 36px;
  2418. right: 0px;
  2419. display: flex;
  2420. align-items: center;
  2421. img {
  2422. width: 22px;
  2423. height: 19px;
  2424. margin: 0;
  2425. }
  2426. span {
  2427. font-weight: 500;
  2428. font-size: 12px;
  2429. line-height: 14px;
  2430. letter-spacing: 0.3px;
  2431. color: #f5b945;
  2432. }
  2433. }
  2434. img {
  2435. cursor: pointer;
  2436. width: 42px;
  2437. height: 42px;
  2438. margin-right: 12px;
  2439. }
  2440. .luck-content {
  2441. flex: auto;
  2442. .luck-title {
  2443. color: #444444;
  2444. font-weight: 500;
  2445. font-size: 16px;
  2446. letter-spacing: 0.3px;
  2447. margin-bottom: 5px;
  2448. }
  2449. .luck-time {
  2450. font-weight: 400;
  2451. font-size: 12px;
  2452. line-height: 14px;
  2453. color: #B0B0B0;
  2454. }
  2455. }
  2456. .luck-money {
  2457. display: flex;
  2458. height: 17px;
  2459. align-items: center;
  2460. height: 100%;
  2461. img {
  2462. width: 14px;
  2463. height: 14px;
  2464. margin-right: 6px;
  2465. }
  2466. .luck-money-txt {
  2467. font-weight: 500;
  2468. font-size: 14px;
  2469. word-break: break-all;
  2470. /* identical to box height */
  2471. text-align: right;
  2472. letter-spacing: 0.3px;
  2473. color: #444444;
  2474. }
  2475. }
  2476. .luck-custom-prize {
  2477. font-weight: 500;
  2478. font-size: 14px;
  2479. letter-spacing: 0.3px;
  2480. color: #F5B945;
  2481. }
  2482. }
  2483. .luck-item:last-child {
  2484. border: 0;
  2485. }
  2486. }
  2487. }
  2488. .close {
  2489. position: relative;
  2490. .load-result {
  2491. position: absolute;
  2492. width: 100%;
  2493. height: 100%;
  2494. top: 0;
  2495. left: 0;
  2496. text-align: center;
  2497. display: flex;
  2498. flex-wrap: wrap;
  2499. justify-content: center;
  2500. align-content: flex-start;
  2501. .title {
  2502. width: 100%;
  2503. display: flex;
  2504. justify-content: center;
  2505. align-items: center;
  2506. margin-top: 36px;
  2507. img {
  2508. width: 26px;
  2509. height: 26px;
  2510. margin-right: 10px;
  2511. }
  2512. span {
  2513. color: #FFFFFF;
  2514. font-size: 18px;
  2515. font-weight: 800;
  2516. letter-spacing: 0.3px;
  2517. }
  2518. }
  2519. .ticket {
  2520. display: flex;
  2521. justify-content: center;
  2522. align-items: center;
  2523. width: 100%;
  2524. height: 163px;
  2525. img {
  2526. width: 250px;
  2527. height: 103px;
  2528. animation: myfirst 0.5s;
  2529. }
  2530. }
  2531. .div-ticket {
  2532. position: relative;
  2533. overflow: hidden;
  2534. transition-delay: 1s;
  2535. }
  2536. .div-ticket:after {
  2537. position: absolute;
  2538. right: -100%;
  2539. /*改变left的值,让其相对box影藏*/
  2540. top: 0;
  2541. width: 30%;
  2542. height: 100%;
  2543. content: "";
  2544. /* Safari 5.1 - 6.0 */
  2545. background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, .3) 50%, rgba(255, 255, 255, 0) 100%);
  2546. /* Opera 11.1 - 12.0 */
  2547. background: -o-linear-gradient(left, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, .3) 50%, rgba(255, 255, 255, 0) 100%);
  2548. /* Firefox 3.6 - 15 */
  2549. background: -moz-linear-gradient(left, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, .3) 50%, rgba(255, 255, 255, 0) 100%);
  2550. /* 标准的语法 */
  2551. background: linear-gradient(to right, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, .3) 50%, rgba(255, 255, 255, 0) 100%);
  2552. transform: skewX(45deg);
  2553. animation: div_light 1s;
  2554. animation-delay: 0.5s;
  2555. }
  2556. // .div-ticket:hover:after {
  2557. // right: 150%;
  2558. // transition: 1s ease;
  2559. // }
  2560. p {
  2561. width: 100%;
  2562. margin: 0;
  2563. padding: 0;
  2564. color: #FCAB40;
  2565. text-align: center;
  2566. letter-spacing: 0.3px;
  2567. font-size: 18px;
  2568. font-weight: 700;
  2569. }
  2570. .time {
  2571. width: 100%;
  2572. display: flex;
  2573. justify-content: center;
  2574. align-items: center;
  2575. margin-top: 16px;
  2576. img {
  2577. width: 22px;
  2578. height: 22px;
  2579. margin-right: 10px;
  2580. }
  2581. span {
  2582. font-weight: 800;
  2583. font-size: 28px;
  2584. color: #3F3F3F;
  2585. }
  2586. }
  2587. .notification_switch {
  2588. border-top: 1px solid #EFEFEF;
  2589. justify-content: space-between;
  2590. position: absolute;
  2591. height: 48px;
  2592. width: 100%;
  2593. display: flex;
  2594. align-items: center;
  2595. bottom: 0;
  2596. padding: 0 22px 0 16px;
  2597. }
  2598. }
  2599. }
  2600. .success {
  2601. .header {
  2602. min-height: 180px;
  2603. align-content: flex-start;
  2604. .success-title {
  2605. color: #FFFFFF;
  2606. font-weight: 800;
  2607. font-size: 21px;
  2608. line-height: 27px;
  2609. margin-top: 28px;
  2610. text-align: center;
  2611. width: 100%;
  2612. }
  2613. .done {
  2614. top: 130px;
  2615. }
  2616. }
  2617. .luck-list-title {
  2618. margin-top: 10px;
  2619. border-bottom: 1px solid #ECECEC;
  2620. }
  2621. .header-custom-prize {
  2622. align-items: flex-start;
  2623. .success-title {
  2624. line-height: 21px;
  2625. margin-top: 23px;
  2626. font-size: 18px;
  2627. }
  2628. }
  2629. }
  2630. .opened {
  2631. filter: drop-shadow(0px 4px 94px rgba(0, 0, 0, 0.3));
  2632. width: 100%;
  2633. height: 100%;
  2634. display: flex;
  2635. flex-direction: column;
  2636. justify-content: space-between;
  2637. border-radius: 11px;
  2638. overflow: hidden;
  2639. .header {
  2640. text-align: center;
  2641. min-height: 110px;
  2642. width: 100%;
  2643. background: #fff;
  2644. // padding-top: 30px;
  2645. background-size: 100% 100%;
  2646. display: flex;
  2647. flex-wrap: wrap;
  2648. align-content: center;
  2649. justify-content: center;
  2650. img {
  2651. width: 52px;
  2652. height: 52px;
  2653. margin-right: 14px;
  2654. }
  2655. .txt {
  2656. color: #FFFFFF;
  2657. font-weight: 700;
  2658. font-size: 18px;
  2659. letter-spacing: 0.3px;
  2660. p {
  2661. margin: 0;
  2662. padding: 0;
  2663. text-align: left;
  2664. }
  2665. }
  2666. }
  2667. .list {
  2668. overflow-y: auto;
  2669. padding: 0 16px 0 16px;
  2670. background: #ffffff;
  2671. flex: 1;
  2672. .item {
  2673. display: flex;
  2674. align-items: center;
  2675. // min-height: 50px;
  2676. border-bottom: 1px solid #f0f0f0;
  2677. padding: 12px 0;
  2678. box-sizing: border-box;
  2679. img {
  2680. width: 24px;
  2681. height: 24px;
  2682. }
  2683. .red-right {
  2684. width: 35px;
  2685. height: 24px;
  2686. }
  2687. .item-content {
  2688. width: 100%;
  2689. flex: 1;
  2690. .item-follow-title {
  2691. display: flex;
  2692. align-items: center;
  2693. margin-top: 20px;
  2694. margin-bottom: 11px;
  2695. position: relative;
  2696. .btn {
  2697. // position: absolute;
  2698. // right: 0;
  2699. }
  2700. }
  2701. .item-title {
  2702. flex: 1;
  2703. margin-left: 10px;
  2704. font-weight: 500;
  2705. font-size: 15px;
  2706. letter-spacing: 0.3px;
  2707. color: #000000;
  2708. }
  2709. .item-follow-area {
  2710. display: flex;
  2711. flex-wrap: wrap;
  2712. .item-follow {
  2713. cursor: pointer;
  2714. border: 1px solid #ebebeb;
  2715. border-radius: 1000px;
  2716. height: 26px;
  2717. margin-right: 5px;
  2718. margin-bottom: 5px;
  2719. display: flex;
  2720. align-items: center;
  2721. .finished {
  2722. text-decoration: line-through;
  2723. color: #949494;
  2724. }
  2725. span {
  2726. margin-left: 8px;
  2727. margin-right: 2px;
  2728. color: #1D9BF0;
  2729. opacity: 1;
  2730. }
  2731. img {
  2732. width: 16px;
  2733. height: 16px;
  2734. margin-right: 7px;
  2735. }
  2736. }
  2737. }
  2738. span {
  2739. font-weight: 400;
  2740. font-size: 11px;
  2741. line-height: 13px;
  2742. letter-spacing: 0.3px;
  2743. color: #000000;
  2744. opacity: 0.4;
  2745. }
  2746. }
  2747. .btn {
  2748. width: 90px;
  2749. height: 29px;
  2750. line-height: 29px;
  2751. background: rgba(56, 154, 255, 0.1);
  2752. border-radius: 500px;
  2753. text-align: center;
  2754. letter-spacing: 0.3px;
  2755. color: #1D9BF0;
  2756. cursor: pointer;
  2757. }
  2758. .loading-wrapper {
  2759. width: 90px;
  2760. text-align: center;
  2761. .icon-loading {
  2762. animation: loading 1s infinite linear;
  2763. }
  2764. }
  2765. }
  2766. }
  2767. .people {
  2768. cursor: pointer;
  2769. padding-left: 16px;
  2770. height: 38px;
  2771. line-height: 38px;
  2772. background: #fff;
  2773. box-shadow: 0px 1px 0px #f2f2f2;
  2774. display: flex;
  2775. align-items: center;
  2776. justify-content: space-between;
  2777. .txt {
  2778. width: 90%;
  2779. font-weight: 400;
  2780. font-size: 12px;
  2781. line-height: 14px;
  2782. letter-spacing: 0.3px;
  2783. color: #000000;
  2784. opacity: 0.4;
  2785. }
  2786. }
  2787. .footer {
  2788. background: #ffffff;
  2789. display: flex;
  2790. padding: 15px 22px 15px 17px;
  2791. .btn {
  2792. background: #1D9BF0;
  2793. border-radius: 100px;
  2794. color: #fff;
  2795. width: 100%;
  2796. height: 48px;
  2797. font-weight: 600;
  2798. font-size: 18px;
  2799. line-height: 48px;
  2800. text-align: center;
  2801. cursor: pointer;
  2802. }
  2803. .grey {
  2804. background: #DDDDDD;
  2805. cursor: auto;
  2806. }
  2807. }
  2808. }
  2809. .not-open {
  2810. width: 100%;
  2811. height: 100%;
  2812. filter: drop-shadow(0px 2px 20px rgba(0, 0, 0, 0.1));
  2813. position: relative;
  2814. overflow: hidden;
  2815. border-radius: 11px;
  2816. .customImg {
  2817. width: 100%;
  2818. min-height: 373px;
  2819. }
  2820. .customBottom {
  2821. width: 100%;
  2822. height: 125px;
  2823. background: #111214;
  2824. padding: 10px 16px;
  2825. font-weight: 500;
  2826. font-size: 12px;
  2827. line-height: 14px;
  2828. letter-spacing: 0.3px;
  2829. color: #838383;
  2830. line-height: 20px;
  2831. .theme {
  2832. display: flex;
  2833. height: 20px;
  2834. align-items: center;
  2835. justify-content: flex-start;
  2836. .icon {
  2837. width: 12px;
  2838. }
  2839. .time {
  2840. margin: 0 4px;
  2841. color: #1D9BF0;
  2842. }
  2843. }
  2844. .winner-info {
  2845. display: flex;
  2846. height: 20px;
  2847. align-items: center;
  2848. justify-content: flex-start;
  2849. margin-bottom: 13px;
  2850. .count {
  2851. color: #1D9BF0;
  2852. margin-right: 4px;
  2853. }
  2854. .prize-name {
  2855. color: #1D9BF0;
  2856. margin-left: 4px;
  2857. }
  2858. }
  2859. .open-red {
  2860. height: 45px;
  2861. background: linear-gradient(180deg, #4AB6FF 0%, #1D9BF0 100%, #1D9BF0 100%);
  2862. border: 1.5px solid rgba(255, 255, 255, 0.15);
  2863. border-radius: 52px;
  2864. line-height: 45px;
  2865. text-align: center;
  2866. cursor: pointer;
  2867. font-weight: 800;
  2868. font-size: 16px;
  2869. color: #FFFFFF;
  2870. }
  2871. }
  2872. .money-area {
  2873. width: 100%;
  2874. position: absolute;
  2875. top: 65px;
  2876. display: flex;
  2877. flex-wrap: wrap;
  2878. align-items: center;
  2879. justify-content: center;
  2880. .time-area {
  2881. display: flex;
  2882. justify-content: center;
  2883. align-items: center;
  2884. position: relative;
  2885. width: 100%;
  2886. height: 46px;
  2887. div {
  2888. width: 100%;
  2889. height: 100%;
  2890. position: absolute;
  2891. background: #000000;
  2892. z-index: 0;
  2893. opacity: 0.15;
  2894. }
  2895. img {
  2896. z-index: 1;
  2897. width: 26px;
  2898. height: 26px;
  2899. margin-right: 10px;
  2900. }
  2901. span {
  2902. z-index: 1;
  2903. color: #FFCC4D;
  2904. font-weight: 900;
  2905. font-size: 26px;
  2906. }
  2907. }
  2908. .mark-area {
  2909. width: 100%;
  2910. display: flex;
  2911. justify-content: center;
  2912. img {
  2913. width: 16px;
  2914. height: 16px;
  2915. margin-right: 4px;
  2916. }
  2917. .time {
  2918. display: flex;
  2919. align-items: center;
  2920. span {
  2921. color: #FFFFFF;
  2922. font-weight: 800;
  2923. font-size: 17px;
  2924. letter-spacing: 0.05em;
  2925. line-height: 22px;
  2926. }
  2927. }
  2928. .win {
  2929. display: flex;
  2930. align-items: center;
  2931. margin-left: 12px;
  2932. color: #FFCC4D;
  2933. letter-spacing: 0.05em;
  2934. line-height: 22px;
  2935. font-size: 17px;
  2936. font-weight: 800;
  2937. }
  2938. }
  2939. .txt {
  2940. font-weight: 800;
  2941. font-size: 16px;
  2942. text-align: center;
  2943. letter-spacing: 0.3px;
  2944. color: #FFFFFF;
  2945. }
  2946. .coin {
  2947. text-align: center;
  2948. margin-top: 6px;
  2949. /*margin-bottom: 7px;*/
  2950. display: flex;
  2951. justify-content: center;
  2952. align-items: center;
  2953. width: 90%;
  2954. img {
  2955. width: 46px;
  2956. height: 46px;
  2957. border-radius: 50%;
  2958. border: 3px solid #FFFFFF;
  2959. }
  2960. span {
  2961. margin-left: 12px;
  2962. font-weight: 800;
  2963. font-size: 60px;
  2964. line-height: 76px;
  2965. color: #FFFFFF;
  2966. }
  2967. }
  2968. .people {
  2969. font-weight: 800;
  2970. font-size: 13px;
  2971. line-height: 16px;
  2972. letter-spacing: 0.05em;
  2973. text-align: center;
  2974. color: #FFFFFF;
  2975. }
  2976. }
  2977. .title {
  2978. position: absolute;
  2979. top: 15px;
  2980. left: 15px;
  2981. z-index: 3;
  2982. display: flex;
  2983. align-items: center;
  2984. img {
  2985. width: 24px;
  2986. height: 24px;
  2987. border: 2px solid #FFF;
  2988. border-radius: 50%;
  2989. }
  2990. span {
  2991. margin-left: 10px;
  2992. font-weight: 600;
  2993. font-size: 16px;
  2994. letter-spacing: 0.3px;
  2995. color: #fff;
  2996. }
  2997. }
  2998. // .txt {
  2999. // width: 100%;
  3000. // position: absolute;
  3001. // font-style: normal;
  3002. // font-weight: 700;
  3003. // font-size: 42px;
  3004. // line-height: 50px;
  3005. // text-align: center;
  3006. // color: #FFF2D3;
  3007. // top: 90px;
  3008. // z-index: 3;
  3009. // }
  3010. img {
  3011. width: 100%;
  3012. }
  3013. .up {
  3014. position: absolute;
  3015. top: 0;
  3016. // box-shadow: 0px 4px 44px rgba(0, 0, 0, 0.1);
  3017. z-index: 1;
  3018. }
  3019. .down {
  3020. position: absolute;
  3021. top: 253px;
  3022. }
  3023. .open {
  3024. width: 335px;
  3025. height: 50px;
  3026. cursor: pointer;
  3027. position: absolute;
  3028. bottom: 28px;
  3029. left: 50%;
  3030. margin-left: -167.5px;
  3031. z-index: 4;
  3032. }
  3033. .open-gif {
  3034. width: 200px;
  3035. height: 200px;
  3036. text-align: center;
  3037. position: absolute;
  3038. bottom: 80px;
  3039. left: 50%;
  3040. margin-left: -100px;
  3041. z-index: 3;
  3042. }
  3043. }
  3044. @keyframes loading {
  3045. from {
  3046. transform: rotate(0deg);
  3047. }
  3048. to {
  3049. transform: rotate(360deg);
  3050. }
  3051. }
  3052. }
  3053. @keyframes div_light {
  3054. 0% {
  3055. right: -100%;
  3056. }
  3057. 100% {
  3058. right: 150%;
  3059. }
  3060. }
  3061. @keyframes myfirst {
  3062. 0% {
  3063. width: 250px;
  3064. height: 103px;
  3065. }
  3066. 50% {
  3067. width: 300px;
  3068. height: 153px;
  3069. }
  3070. 100% {
  3071. width: 250px;
  3072. height: 103px;
  3073. }
  3074. }
  3075. .none {
  3076. display: flex;
  3077. align-items: center;
  3078. justify-content: center;
  3079. width: 100%;
  3080. height: 100%;
  3081. }
  3082. </style>