luck-draw.vue 109 KB

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