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