luck-draw.vue 109 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378
  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"
  125. v-if="state.detail.rewardType === RewardType.money"
  126. :style="{ 'backgroundImage': `url(${require('@/assets/subject/002-back-head-top-180.svg')})` }">
  127. <div class="success-title">
  128. 🎉 Awesome! You are Winner!
  129. </div>
  130. <div class="money">
  131. <img :src="state.detail.currencyIconPath" alt />
  132. <font-amount :amount="state.receiveAmount" class="big" :fontSize="46"></font-amount>
  133. <!-- <span class="small">{{ state.detail.currencySymbol }}</span> -->
  134. </div>
  135. <div class="done" @click="clickDone">
  136. <img :src="require('@/assets/subject/001-icon-done.svg')" alt class="icon-done" />
  137. <span>View Rewards In Wallet</span>
  138. <img :src="require('@/assets/svg/icon-right.svg')" alt class="icon-right" />
  139. </div>
  140. </div>
  141. <div class="header header-custom-prize"
  142. v-else
  143. :style="{ 'backgroundImage': `url(${successTopBgCpd})`, 'minHeight': '150px'}">
  144. <div class="success-title">
  145. 🎉 Awesome! You are the Winner!
  146. </div>
  147. <div class="custom-prize-show">
  148. <component-zoom width="340" fontSize="22" class="custom-prise-name">
  149. <img :src="require('@/assets/subject/icon-gift-inline.svg')" alt />
  150. <span>{{state.detail.customizedReward}}</span>
  151. </component-zoom>
  152. <!-- <font-zoom :amount="state.detail.customizedReward" width="500" class="custom-prise-name" fontSize="22"></font-zoom> -->
  153. </div>
  154. </div>
  155. <div class="luck-list-title">
  156. <div>{{ state.detail.receiveCount || 0 }}/{{ state.detail.totalCount || 0 }} Winners</div>
  157. <div class="right">
  158. <span class="text" v-if="state.detail.rewardType === RewardType.money">
  159. <a-tooltip :title="state.detail.receiveAmountValue">
  160. {{ getBit(state.detail.receiveAmountValue) }}
  161. </a-tooltip>
  162. /
  163. <a-tooltip :title="state.detail.amountValue">
  164. {{ getBit(state.detail.amountValue) || '' }}
  165. </a-tooltip>
  166. </span>
  167. {{ state.detail.currencySymbol || '' }}
  168. </div>
  169. </div>
  170. <div class="luck-list max" @scroll="handleScroll($event)">
  171. <div class="luck-item" v-for="item, i in state.detail.allReceived" v-bind:key="i">
  172. <img v-if="item.simpleUserInfoVO.avatarUrl" :src="item.simpleUserInfoVO.avatarUrl"
  173. @click="openTwitterDetail(item)" alt />
  174. <img v-else :src="require('@/assets/svg/icon-twitter.svg')" alt />
  175. <img class="win" :src="require('@/assets/svg/icon-win-1.svg')" v-if="i == 0" alt />
  176. <img class="win" :src="require('@/assets/svg/icon-win-2.svg')" v-if="i == 1" alt />
  177. <img class="win" :src="require('@/assets/svg/icon-win-3.svg')" v-if="i == 2" alt />
  178. <div class="luck-content">
  179. <div class="luck-title" v-if="item.simpleUserInfoVO.nickName">{{ item.simpleUserInfoVO.nickName
  180. }}</div>
  181. <div class="luck-title" v-else>Twitter User</div>
  182. <div class="luck-time">{{ moment(item.receiveTimestamp).format('MM-DD HH:mm') }}</div>
  183. </div>
  184. <div class="luck-money" v-if="state.detail.rewardType === RewardType.money">
  185. <img :src="state.detail.currencyIconPath" alt />
  186. <div class="luck-money-txt">
  187. <a-tooltip :title="item.amountValue">
  188. {{ getBit(item.amountValue) }}
  189. </a-tooltip>
  190. </div>
  191. </div>
  192. <div class="luck-custom-prize" v-else>winner</div>
  193. <div class="luck-king" v-if="state.detail.rewardType === RewardType.money && item.maxAmount">
  194. <img :src="require('@/assets/svg/icon-king-hat.svg')" alt />
  195. <span>Luckiest Draw</span>
  196. </div>
  197. </div>
  198. </div>
  199. <get-more></get-more>
  200. </div>
  201. <!-- no-open -->
  202. <div v-else-if="state.status == 'not-open'" class="not-open">
  203. <!-- <template v-if="state.detail.posterType === 2 && state.detail.customPosterInstalled">
  204. <img class="customImg" :src="state.detail.customPosterInstalled" />
  205. <div class="customBottom">
  206. <div class="theme">
  207. <img class="icon" :src="require('@/assets/svg/icon-last-time.svg')"/>
  208. <span class="time">{{ state.count_down_time }}</span>
  209. <span class="info">Left</span>
  210. </div>
  211. <div class="winner-info">
  212. <span class="count">{{state.detail.totalCount}} Winners</span>
  213. <span>to Share </span>
  214. <span class="prize-name">{{state.detail.rewardType === RewardType.money ? state.detail.amountValue + ' ' + state.detail.currencySymbol : state.detail.customizedReward}}</span>
  215. </div>
  216. <div class="open-red" @click="clickOpenRedPacket">
  217. Participate Now
  218. </div>
  219. </div>
  220. </template> -->
  221. <!-- <template v-else> -->
  222. <custom-card-cover
  223. :data="{
  224. totalCount: state.detail.totalCount,
  225. amountValue: state.detail.amountValue,
  226. tokenSymbol: state.detail.currencySymbol,
  227. currencyIconUrl: state.detail.currencyIconPath,
  228. type: PlayType.lottery,
  229. validityDuration: state.count_down_time,
  230. countDown: state.count_down_time,
  231. userInfo: {
  232. nickName: state.detail.postUserInfo.name,
  233. avatarUrl: state.detail.postUserInfo.avatarUrl
  234. },
  235. rewardType: state.detail.rewardType,
  236. customizedReward: state.detail.customizedReward,
  237. customPosterUrl: state.detail.customPosterInstalled
  238. }"
  239. @clickOpenRedPacket = "clickOpenRedPacket"
  240. ></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> {{
  260. state.detail.currencySymbol || ''
  261. }}
  262. </div>
  263. </div>
  264. <div class="luck-list" @scroll="handleScroll">
  265. <div class="luck-item" v-for="item, i in state.detail.allReceived" v-bind:key="i">
  266. <img v-if="item.simpleUserInfoVO.avatarUrl" :src="item.simpleUserInfoVO.avatarUrl" alt
  267. @click="openTwitterDetail(item)" />
  268. <img v-else :src="require('@/assets/svg/icon-twitter.svg')" alt />
  269. <img class="win" :src="require('@/assets/svg/icon-win-1.svg')" v-if="i == 0" alt />
  270. <img class="win" :src="require('@/assets/svg/icon-win-2.svg')" v-if="i == 1" alt />
  271. <img class="win" :src="require('@/assets/svg/icon-win-3.svg')" v-if="i == 2" alt />
  272. <div class="luck-content">
  273. <div class="luck-title" v-if="item.simpleUserInfoVO.nickName">{{ item.simpleUserInfoVO.nickName
  274. }}</div>
  275. <div class="luck-title" v-else>Twitter User</div>
  276. <div class="luck-time">{{ moment(item.receiveTimestamp).format('MM-DD HH:mm:ss') }}</div>
  277. </div>
  278. <div class="luck-money" v-if="state.detail.rewardType === RewardType.money">
  279. <img :src="state.detail.currencyIconPath" alt />
  280. <div class="luck-money-txt">
  281. <a-tooltip :title="item.amountValue">
  282. {{ getBit(item.amountValue) }}
  283. </a-tooltip>
  284. </div>
  285. </div>
  286. <div class="luck-custom-prize" v-else>winner</div>
  287. <div class="luck-king" v-if="state.detail.rewardType === RewardType.money && item.maxAmount">
  288. <img :src="require('@/assets/svg/icon-king-hat.svg')" alt />
  289. <span>Luckiest Draw</span>
  290. </div>
  291. </div>
  292. </div>
  293. </div>
  294. <!-- 关闭状态 -->
  295. <div v-else-if="state.status == 'close'" class="close">
  296. <!-- 红包被领完了 -->
  297. <!-- <div class="header"
  298. :style="{ 'backgroundImage': `url(${require('@/assets/subject/002-back-head-top.svg')})` }"
  299. v-if="state.close_status == '已经过期了'">
  300. <div class="rabbit">
  301. <img class="flower" :src="require('@/assets/svg/icon-flower.svg')" alt />
  302. <p>This Draw is Complete</p>
  303. </div>
  304. </div> -->
  305. <div class="header"
  306. :style="{ 'backgroundImage': `url(${require('@/assets/subject/002-back-head-top.svg')})` }"
  307. v-show="state.close_status == '已经过期了'">
  308. <div class="close-title" v-for="item in state.close_text">{{ item }}</div>
  309. </div>
  310. <!-- 没有抽中 -->
  311. <div class="header"
  312. :style="{ 'backgroundImage': `url(${require('@/assets/subject/002-back-head-top.svg')})` }"
  313. v-if="state.close_status == '没有抽中'">
  314. <div class="rabbit">
  315. <img :src="require('@/assets/subject/001-icon-rabbit.svg')" alt />
  316. <p>Good Luck Next Time!</p>
  317. </div>
  318. </div>
  319. <!-- 等待结果 -->
  320. <div class="header"
  321. :style="{ 'backgroundImage': `url(${require('@/assets/subject/002-back-head-top.svg')})` }"
  322. v-if="state.close_status == '等待结果'">
  323. </div>
  324. <div class="load-result" v-if="state.close_status == '等待结果'">
  325. <div class="title">
  326. <img :src="require('@/assets/svg/icon-enter-ed.svg')" alt />
  327. <span>Participate Successful</span>
  328. </div>
  329. <!-- 票 -->
  330. <div class="ticket">
  331. <div class="div-ticket">
  332. <img :src="require('@/assets/svg/icon-ticket.svg')" alt />
  333. </div>
  334. </div>
  335. <p>Announcement Winner</p>
  336. <div class="time">
  337. <img :src="require('@/assets/svg/icon-win-time.svg')" alt />
  338. <span>{{ state.count_down_time || '' }}</span>
  339. </div>
  340. <get-more :style_type="2"></get-more>
  341. <div class="notification_switch" v-if="state.notification_show">
  342. <span>Announcement Notification</span>
  343. <a-switch v-model:checked="state.notification_switch" @change="changeNotification" />
  344. </div>
  345. </div>
  346. <div class="luck-list-title" v-show="state.close_status != '等待结果'">
  347. <div>{{ state.detail.receiveCount || 0 }}/{{ state.detail.totalCount || 0 }} Winners</div>
  348. <div class="right" v-if="state.detail.rewardType === RewardType.money">
  349. <span class="text">
  350. <a-tooltip :title="state.detail.receiveAmountValue">
  351. {{ getBit(state.detail.receiveAmountValue) }}
  352. </a-tooltip>
  353. /
  354. <a-tooltip :title="state.detail.amountValue">
  355. {{ getBit(state.detail.amountValue || '') }}
  356. </a-tooltip>
  357. </span> {{
  358. state.detail.currencySymbol || ''
  359. }}
  360. </div>
  361. </div>
  362. <div class="luck-list max" @scroll="handleScroll" v-show="state.close_status != '等待结果'">
  363. <div class="luck-item" v-for="item, i in state.detail.allReceived" v-bind:key="i">
  364. <img v-if="item.simpleUserInfoVO.avatarUrl" :src="item.simpleUserInfoVO.avatarUrl" alt
  365. @click="openTwitterDetail(item)" />
  366. <img v-else :src="require('@/assets/svg/icon-twitter.svg')" alt />
  367. <img class="win" :src="require('@/assets/svg/icon-win-1.svg')" v-if="i == 0" alt />
  368. <img class="win" :src="require('@/assets/svg/icon-win-2.svg')" v-if="i == 1" alt />
  369. <img class="win" :src="require('@/assets/svg/icon-win-3.svg')" v-if="i == 2" alt />
  370. <div class="luck-content">
  371. <div class="luck-title" v-if="item.simpleUserInfoVO.nickName">{{ item.simpleUserInfoVO.nickName
  372. }}</div>
  373. <div class="luck-title" v-else>Twitter User</div>
  374. <div class="luck-time">{{ moment(item.receiveTimestamp).format('MM-DD HH:mm:ss') }}</div>
  375. </div>
  376. <div class="luck-money" v-if="state.detail.rewardType === RewardType.money">
  377. <img :src="state.detail.currencyIconPath" alt />
  378. <div class="luck-money-txt">
  379. <a-tooltip :title="item.amountValue">
  380. {{ getBit(item.amountValue) }}
  381. </a-tooltip>
  382. </div>
  383. </div>
  384. <div class="luck-custom-prize" v-else>winner</div>
  385. <div class="luck-king" v-if="state.detail.rewardType === RewardType.money && item.maxAmount">
  386. <img :src="require('@/assets/svg/icon-king-hat.svg')" alt />
  387. <span>Luckiest Draw</span>
  388. </div>
  389. </div>
  390. <div class="empty" v-show="state.detail.allReceived && state.detail.allReceived.length == 0">
  391. <img :src="require('@/assets/svg/icon-error.svg')" alt />
  392. </div>
  393. </div>
  394. <get-more v-if="state.close_status != '等待结果'"></get-more>
  395. </div>
  396. <!-- error -->
  397. <div v-else-if="state.status == 'error'" class="error">
  398. <img :src="require('@/assets/svg/icon-error.svg')" alt />
  399. <div class="txt">
  400. {{ state.error_txt }}
  401. </div>
  402. <div class="retry" v-show="state.retry" @click="clickRetry">
  403. Retry
  404. </div>
  405. </div>
  406. <!-- loading -->
  407. <div v-show="state.loading_show" class="loading">
  408. <img :src="require('@/assets/svg/icon-loading.svg')" alt />
  409. </div>
  410. <div v-show="state.loading_redbag" class="redbag">
  411. <img :src="require('@/assets/img/icon-loading-redbag.gif')" alt />
  412. </div>
  413. </div>
  414. <div style="width: 100%; height: 30px; position: fixed; color: red; top:0;"
  415. v-if="state.process_mode != 'production'">
  416. {{ state.detail.validity }}</div>
  417. </template>
  418. <script>
  419. export default {
  420. name: 'redPacket',
  421. }
  422. </script>
  423. <script setup>
  424. import { onMounted, reactive, ref, computed } from "vue";
  425. import { getPostDetail, getRedPacket, finishRedPacket, oneKeyLike, oneKeyReTweet, oneKeyFollow, getTaskDetail, getReceivedList, addFinishEvent } from '@/http/redPacket.js'
  426. import { getQueryString, guid, getBit, formatSecondsAsDaysOrTime } from '@/uilts/help.js'
  427. import { message } from 'ant-design-vue';
  428. import FontAmount from '@/view/components/font-amount.vue'
  429. import FontZoom from '@/view/components/font-zoom.vue'
  430. import ComponentZoom from '@/view/components/component-zoom.vue'
  431. import GetMore from '@/view/iframe/publish/components/get-more.vue'
  432. import { setChromeStorage, getChromeStorage, sendChromeTabMessage } from '@/uilts/chromeExtension.js'
  433. import Report from "@/log-center/log"
  434. import { srcPublishSuccess } from '@/http/publishApi'
  435. import { discordAuthUrl, checkGuildJoined } from '@/http/discordApi'
  436. import { discordAuthRedirectUri, faceShareRedirectUrl } from '@/http/configAPI'
  437. import { getSetting, putSetting } from '@/http/user'
  438. import { getFrontConfig } from "@/http/account";
  439. import { getInviteGuildInfo } from "@/http/discordApi";
  440. import GlobalTip from '@/view/components/global-tip.vue';
  441. import customCardCover from '@/view/components/custom-card-cover.vue';
  442. import { RewardType, PlayType } from "@/types";
  443. var moment = require('moment');
  444. let discordAuthorizeRequired = false;
  445. let joinDiscordActionState = 'default'; //authAndJoinIng joinIng reAuth
  446. let joinDiscordIng = ref(false);
  447. let facebookAppConfig = {
  448. facebookAppId: "",
  449. faceShareRedirectUrl
  450. };
  451. let reportParams = {
  452. discordFans: '',
  453. twitterFans: '',
  454. done: {
  455. },
  456. hasReport: false,
  457. }
  458. let discordTaskDetail = null;
  459. let state = reactive({
  460. status: '',
  461. userId: '',
  462. loading_show: false,
  463. loading_redbag: true,
  464. detail: {},
  465. luck_list_end: false,
  466. page_index: 1,
  467. page_size: 20,
  468. srcContentId: '',
  469. customCover: '',
  470. customGiveaway: '',
  471. error_txt: `oops, new accounts cannot participate in this event,`,
  472. receiveAmount: 0,
  473. money: 0,
  474. // 状态
  475. done: {
  476. follow: false,
  477. like: false,
  478. retweet: false,
  479. join_discord: false,
  480. repost_facebook: false,
  481. reply: false
  482. },
  483. notification_show: false,
  484. notification_switch: false,
  485. open_timer_status: false,
  486. count_down_time: ''
  487. })
  488. let fullName = '';
  489. let successTopBgCpd = computed(() => {
  490. const { rewardType } = state.detail
  491. switch (rewardType) {
  492. case RewardType.custom:
  493. return require('@/assets/subject/success-top-bg-2.svg');
  494. default:
  495. return require('@/assets/subject/002-back-head-top-180.svg');
  496. break;
  497. }
  498. });
  499. function clickRetry() {
  500. init()
  501. }
  502. let follow_open_tabs = []
  503. async function clickLikeBtn() {
  504. let _userInfo = await checkIsLogin()
  505. if (!_userInfo) {
  506. return
  507. }
  508. state.detail.finishTaskTypeV2 = state.detail.finishTaskTypeV2.toString() || ''
  509. if (state.window_origin.indexOf('facebook.com') >= 0) {
  510. state.detail.finishTaskTypeV2 = '2'
  511. }
  512. switch (state.detail.finishTaskTypeV2) {
  513. case '1':
  514. state.loading_show = true
  515. oneKeyLike({
  516. params: {
  517. tweetId: state.srcContentId
  518. }
  519. }).then((res) => {
  520. state.loading_show = false
  521. if (res.code == 0) {
  522. if (res.data.result) {
  523. state.done.like = true
  524. } else {
  525. state.done.like = false
  526. window.open(`https://twitter.com/intent/like?tweet_id=${state.tweetId}`)
  527. }
  528. } else {
  529. window.open(`https://twitter.com/intent/like?tweet_id=${state.tweetId}`)
  530. state.done.like = false
  531. }
  532. }).catch(() => {
  533. state.loading_show = false
  534. })
  535. break
  536. case '2':
  537. window.open(`https://twitter.com/intent/like?tweet_id=${state.tweetId}`)
  538. break
  539. case '3':
  540. state.loading_show = true
  541. chrome.tabs.getCurrent((tab) => {
  542. chrome.tabs.sendMessage(tab.id, {
  543. actionType: "IFRAME_TWITTER_API_DO_TASK", task_data: {
  544. tweet_Id: state.tweetId
  545. }, task_type: 'like'
  546. }, (res) => { console.log(res) });
  547. })
  548. break
  549. default:
  550. window.open(`https://twitter.com/intent/like?tweet_id=${state.tweetId}`)
  551. break
  552. }
  553. // 埋点
  554. Report.reportLog({
  555. objectType: Report.objectType.like,
  556. pageSource: Report.pageSource.task_page,
  557. businessType: Report.businessType.buttonClick,
  558. postId: state.postId,
  559. srcContentId: state.tweetId,
  560. senderId: state.userId,
  561. customCover: state.customCover,
  562. customGiveaway: state.customGiveaway,
  563. });
  564. }
  565. function clickDone() {
  566. window.open(`${chrome.runtime.getURL('/iframe/home.html')}`)
  567. // 埋点
  568. Report.reportLog({
  569. objectType: Report.objectType.wallet_button,
  570. pageSource: Report.pageSource.received_success_page,
  571. businessType: Report.businessType.buttonClick,
  572. postId: state.postId,
  573. srcContentId: state.tweetId,
  574. senderId: state.userId,
  575. redPacketType: 1,
  576. customCover: state.customCover,
  577. customGiveaway: state.customGiveaway,
  578. });
  579. }
  580. function handleScroll(e) {
  581. if (state.luck_list_end) {
  582. return
  583. }
  584. e = e.target
  585. if ((e.clientHeight + e.scrollTop) / e.scrollHeight > .8) {
  586. state.luck_list_end = true
  587. state.page_index++
  588. handleReceivedList()
  589. }
  590. }
  591. function handleReceivedList() {
  592. getReceivedList({
  593. params: {
  594. pageNum: state.page_index,
  595. pageSize: state.page_size,
  596. postId: state.postId
  597. }
  598. }).then((res) => {
  599. if (res.code == 0) {
  600. if (res.data.length > 0) {
  601. state.detail.allReceived = state.detail.allReceived.concat(res.data)
  602. state.luck_list_end = false
  603. } else {
  604. state.luck_list_end = true
  605. }
  606. } else {
  607. console.log('getReceivedList', res)
  608. }
  609. })
  610. }
  611. const openTwitterDetail = (item) => {
  612. if (item.simpleUserInfoVO.nickName) {
  613. window.open(`https://twitter.com/${item.simpleUserInfoVO.nickName}`)
  614. }
  615. }
  616. async function clickRetweetBtn() {
  617. let _userInfo = await checkIsLogin()
  618. if (!_userInfo) {
  619. return
  620. }
  621. state.detail.finishTaskTypeV2 = state.detail.finishTaskTypeV2.toString() || ''
  622. if (state.window_origin.indexOf('facebook.com') >= 0) {
  623. state.detail.finishTaskTypeV2 = '2'
  624. }
  625. switch (state.detail.finishTaskTypeV2) {
  626. case '1':
  627. state.loading_show = true
  628. oneKeyReTweet({
  629. params: {
  630. tweetId: state.srcContentId
  631. }
  632. }).then((res) => {
  633. state.loading_show = false
  634. if (res.code == 0) {
  635. if (res.data.result) {
  636. state.done.retweet = true
  637. } else {
  638. window.open(`https://twitter.com/intent/retweet?tweet_id=${state.tweetId}`)
  639. state.done.retweet = false
  640. }
  641. } else {
  642. window.open(`https://twitter.com/retweet/like?tweet_id=${state.tweetId}`)
  643. state.done.retweet = false
  644. }
  645. }).catch(() => {
  646. state.loading_show = false
  647. })
  648. break;
  649. case '2':
  650. window.open(`https://twitter.com/intent/retweet?tweet_id=${state.tweetId}`)
  651. break
  652. case '3':
  653. state.loading_show = true
  654. chrome.tabs.getCurrent((tab) => {
  655. chrome.tabs.sendMessage(tab.id, {
  656. actionType: "IFRAME_TWITTER_API_DO_TASK", task_data: {
  657. tweet_Id: state.tweetId
  658. }, task_type: 'retweet'
  659. }, (res) => { console.log(res) });
  660. })
  661. break
  662. default:
  663. window.open(`https://twitter.com/intent/retweet?tweet_id=${state.tweetId}`)
  664. break;
  665. }
  666. // 埋点
  667. Report.reportLog({
  668. objectType: Report.objectType.retweet,
  669. pageSource: Report.pageSource.task_page,
  670. businessType: Report.businessType.buttonClick,
  671. postId: state.postId,
  672. srcContentId: state.tweetId,
  673. senderId: state.userId,
  674. customCover: state.customCover,
  675. customGiveaway: state.customGiveaway,
  676. });
  677. }
  678. function onTweetReplyClick(params) {
  679. let replyData = {
  680. postId: state.postId,
  681. type: params.type,
  682. taskLuckdropId: state.detail.taskLuckdropId
  683. }
  684. window.parent.postMessage({ actionType: "IFRAME_RED_PACKET_ON_TWEET_REPLY_CLICK", data: replyData }, "*");
  685. }
  686. function changeNotification(checked) {
  687. let noticeSwitch = checked ? 1 : 0;
  688. // set
  689. putSetting({
  690. params: { noticeSwitch }
  691. }).then(res => {
  692. let { code } = res;
  693. if (code === 0) {
  694. state.notification_switch = checked
  695. } else {
  696. state.notification_switch = !checked
  697. }
  698. }).catch(() => {
  699. state.notification_switch = !checked
  700. })
  701. }
  702. function setNotification(req) {
  703. state.notification_switch = req.status;
  704. }
  705. async function clickReply(params) {
  706. let _userInfo = await checkIsLogin()
  707. if (!_userInfo) {
  708. return
  709. }
  710. let replyData = {
  711. postId: state.postId,
  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. window.parent.postMessage({ actionType: "IFRAME_RED_PACKET_REPLY_CLICK", data: replyData }, "*");
  720. }
  721. // 埋点
  722. Report.reportLog({
  723. objectType: Report.objectType.comment_and_tag,
  724. pageSource: Report.pageSource.task_page,
  725. businessType: Report.businessType.buttonClick,
  726. postId: state.postId,
  727. srcContentId: state.tweetId,
  728. senderId: state.userId,
  729. redPacketType: 1,
  730. customCover: state.customCover,
  731. customGiveaway: state.customGiveaway,
  732. });
  733. }
  734. /**
  735. * 点击repost facebook
  736. */
  737. async function clickRepostFacebook(params) {
  738. let _userInfo = await checkIsLogin()
  739. if (!_userInfo) {
  740. return
  741. }
  742. let deUrlParams = {
  743. fullName,
  744. tweetId: state.tweetId
  745. }
  746. let href = `${state.postRedirectUrl}?deUrlParams=${JSON.stringify(deUrlParams)}`;
  747. console.log(href);
  748. let shareUrlparams = {
  749. href,
  750. type: params.type,
  751. taskLuckdropId: state.detail.taskLuckdropId
  752. }
  753. setChromeStorage({
  754. shareFacebookData: JSON.stringify({
  755. contentStr: state.srcContent
  756. })
  757. })
  758. let shareUrl = feacebookShareUrl(shareUrlparams);
  759. openShareFacebookWindow({ url: shareUrl });
  760. // 埋点
  761. Report.reportLog({
  762. objectType: Report.objectType.share_facebook,
  763. pageSource: Report.pageSource.task_page,
  764. businessType: Report.businessType.buttonClick,
  765. postId: state.postId,
  766. srcContentId: state.tweetId,
  767. senderId: state.userId,
  768. redPacketType: 1,
  769. customCover: state.customCover,
  770. customGiveaway: state.customGiveaway,
  771. });
  772. }
  773. /**
  774. * 分享到facebook
  775. */
  776. function openShareFacebookWindow({ url }) {
  777. const width = 800;
  778. chrome.windows.create({
  779. width,
  780. type: 'normal',
  781. url
  782. }, function (window) {
  783. })
  784. }
  785. /**
  786. * 分享fecebook 地址
  787. */
  788. function feacebookShareUrl(params = {}) {
  789. let { href = '', type = '', taskLuckdropId } = params;
  790. let cbParams = JSON.stringify({
  791. type,
  792. taskLuckdropId
  793. })
  794. let shareUrl = `https://www.facebook.com/dialog/share?app_id=${facebookAppConfig.facebookAppId}&display=popup&href=${href}&redirect_uri=${facebookAppConfig.faceShareRedirectUrl}?params=${cbParams}`;
  795. return shareUrl;
  796. }
  797. /**
  798. * 分享成功
  799. */
  800. function facebookShareSuccess(params) {
  801. let { taskLuckdropId } = params;
  802. if (taskLuckdropId == state.detail.taskLuckdropId) {
  803. state.done.repost_facebook = true;
  804. state.done.repost_facebook_red = false;
  805. }
  806. }
  807. function getValidity() {
  808. let _d1, _d2, _d3, _h, _m, _s
  809. if (!state.detail.myReceived.taskEndTimestamp) {
  810. return
  811. }
  812. let timer = setInterval(() => {
  813. let _time = new Date().getTime()
  814. _d3 = state.detail.myReceived.taskEndTimestamp - _time
  815. if (_d3 > 0) {
  816. _d1 = moment(state.detail.myReceived.taskEndTimestamp)
  817. _d2 = moment(_time)
  818. _h = moment.duration(_d1.diff(_d2)).hours()
  819. if (_h < 10) {
  820. _h = '0' + _h
  821. }
  822. _m = moment.duration(_d1.diff(_d2)).minutes()
  823. if (_m < 10) {
  824. _m = '0' + _m
  825. }
  826. _s = moment.duration(_d1.diff(_d2)).seconds()
  827. if (_s < 10) {
  828. _s = '0' + _s
  829. }
  830. state.detail.validity = `${_h}:${_m}:${_s}`
  831. } else {
  832. state.detail.validity = `00:00:00`
  833. clearInterval(timer)
  834. }
  835. }, 1000)
  836. }
  837. // 倒计时
  838. const getTimeStr = (end_time_ms) => {
  839. let now_time_ms, now_time, end_time
  840. let _time, _h, _m, _s, _time_str
  841. now_time_ms = new Date().getTime()
  842. _time = end_time_ms - now_time_ms
  843. if (_time > 0) {
  844. now_time = moment(now_time_ms)
  845. end_time = moment(end_time_ms)
  846. _h = moment.duration(end_time.diff(now_time)).hours()
  847. _m = moment.duration(end_time.diff(now_time)).minutes()
  848. _s = moment.duration(end_time.diff(now_time)).seconds()
  849. if (_h < 10) {
  850. _h = '0' + _h
  851. }
  852. if (_m < 10) {
  853. _m = '0' + _m
  854. }
  855. if (_s < 10) {
  856. _s = '0' + _s
  857. }
  858. _time_str = `${_h}:${_m}:${_s}`
  859. } else {
  860. _time_str = `00:00:00`
  861. }
  862. return _time_str
  863. }
  864. function openConutDownTime(end_time_ms, callback) {
  865. end_time_ms = Number(end_time_ms) + 5000
  866. let end_time_s = Number((end_time_ms - new Date().getTime()) / 1000)
  867. let timer = setInterval(() => {
  868. end_time_s = Number((end_time_ms - new Date().getTime()) / 1000)
  869. if (state.open_timer_status == true) {
  870. clearInterval(timer)
  871. }
  872. callback(formatSecondsAsDaysOrTime(end_time_s))
  873. }, 1000);
  874. callback(formatSecondsAsDaysOrTime(end_time_s))
  875. }
  876. const openFollowTabs = (arr_name) => {
  877. let array_finish = arr_name.filter((item) => { return !item.finished })
  878. // let array_finish = state.detail.taskCondition[0].relatedUsers.filter((item) => { return item.finished == false })
  879. let url
  880. if (array_finish.length > 0) {
  881. state.done.follow = false
  882. // 打开标签页的方法
  883. array_finish.forEach((item) => {
  884. url = `https://twitter.com/intent/follow?screen_name=${item.name}&tweet_id=${state.tweetId}`
  885. chrome.tabs.create({ url }, (tab) => {
  886. if (follow_open_tabs.filter((item) => { return item.url == tab.url }).length == 0) {
  887. follow_open_tabs.push(tab)
  888. }
  889. })
  890. })
  891. }
  892. }
  893. async function clickFollowAll(item, is_all) {
  894. let _userInfo = await checkIsLogin()
  895. if (!_userInfo) {
  896. return
  897. }
  898. let arr_name = []
  899. for (let i in item) {
  900. if (!item[i].finished) {
  901. arr_name.push(item[i])
  902. }
  903. }
  904. // ----
  905. state.detail.finishTaskTypeV2 = state.detail.finishTaskTypeV2.toString() || ''
  906. if (state.window_origin.indexOf('facebook.com') >= 0) {
  907. state.detail.finishTaskTypeV2 = '2'
  908. }
  909. switch (state.detail.finishTaskTypeV2) {
  910. case '1':
  911. // openapi
  912. state.loading_show = true
  913. oneKeyFollow({
  914. params: {
  915. names: arr_name
  916. }
  917. }).then((res) => {
  918. state.loading_show = false
  919. if (res.code == 0) {
  920. res.data.forEach((item1) => {
  921. state.detail.taskCondition[0].relatedUsers.forEach(item2 => {
  922. if (item1.name == item2.name && item1.finished) {
  923. item2.finished = true
  924. }
  925. });
  926. })
  927. openFollowTabs(arr_name)
  928. }
  929. }).catch(() => {
  930. state.loading_show = false
  931. })
  932. break
  933. case '2':
  934. openFollowTabs(arr_name)
  935. break
  936. case '3':
  937. if (arr_name.filter((item) => { return !item.twitterUserId }).length > 0) {
  938. openFollowTabs(arr_name)
  939. return
  940. }
  941. let follow_data = []
  942. arr_name.forEach((item) => {
  943. follow_data.push(item)
  944. })
  945. state.loading_show = true
  946. chrome.tabs.getCurrent((tab) => {
  947. chrome.tabs.sendMessage(tab.id, {
  948. actionType: "IFRAME_TWITTER_API_DO_TASK",
  949. task_data: {
  950. tweet_Id: state.tweetId,
  951. follow_data: follow_data,
  952. },
  953. task_type: 'follow'
  954. }, (res) => { console.log(res) });
  955. })
  956. break
  957. default:
  958. openFollowTabs(arr_name)
  959. break
  960. }
  961. // -------- 埋点 --------
  962. let _log_obj = {
  963. pageSource: Report.pageSource.task_page,
  964. businessType: Report.businessType.buttonClick,
  965. objectType: Report.objectType.follow,
  966. customCover: state.customCover,
  967. customGiveaway: state.customGiveaway,
  968. }
  969. if (is_all) {
  970. _log_obj.objectType = Report.objectType.follow_button
  971. }
  972. Report.reportLog(_log_obj, {
  973. postId: state.postId,
  974. srcContentId: state.tweetId,
  975. senderId: state.userId,
  976. });
  977. }
  978. // 重新绑定
  979. const reSetBindTwtterId = (_params) => {
  980. let postBizData = JSON.parse(_params.postBizData);
  981. let { taskCondition } = postBizData;
  982. let discordTask = JSON.parse(taskCondition).find(item => item.type == 7);
  983. getChromeStorage('userInfo', (_userInfo = {}) => {
  984. // if (_userInfo && _userInfo.uid == _params.uid) {
  985. if (_userInfo.uid) {
  986. srcPublishSuccess({
  987. params: {
  988. postId: state.postId,
  989. srcContentId: state.tweetId
  990. }
  991. }).then((res) => {
  992. if (res.code == 0 || res.code == 3003) {
  993. init({ from: 'reSetBindTwtterId' })
  994. reportBindTweetSuccess({ discordTask, ..._params });
  995. }
  996. })
  997. }
  998. })
  999. }
  1000. const reportBindTweetSuccess = (params) => {
  1001. let { discordTask, srcUserId } = params || {};
  1002. discordTaskDetail = discordTask;
  1003. sendChromeTabMessage({
  1004. actionType: "IFRAME_API_GET_TWEET_USER_INFO_REQ",
  1005. data: {
  1006. screen_name: srcUserId
  1007. }
  1008. })
  1009. if (discordTask) {
  1010. getDiscordInfo({ inviteUrl: JSON.parse(discordTask.bizData).inviteUrl }, (res) => {
  1011. if (res.inviteCode == res.code) {
  1012. reportParams.discordFans = res.approximate_member_count;
  1013. if (reportParams.twitterFans !== '' && !reportParams.hasReport) {
  1014. reportParams.hasReport = true;
  1015. Report.reportLog({
  1016. objectType: Report.objectType.tweetPostBinded,
  1017. twitterFans: reportParams.twitterFans,
  1018. discordFans: reportParams.discordFans,
  1019. redPacketType: 1
  1020. });
  1021. }
  1022. }
  1023. })
  1024. }
  1025. }
  1026. const getDiscordInfo = (params, cb) => {
  1027. let { inviteUrl } = params;
  1028. if (!inviteUrl) return;
  1029. let inviteCode = '';
  1030. let arr = inviteUrl.split('/');
  1031. if (arr.length > 0) {
  1032. inviteCode = arr[arr.length - 1];
  1033. }
  1034. if (!inviteCode) {
  1035. return;
  1036. }
  1037. getInviteGuildInfo({
  1038. inviteCode
  1039. }).then(res => {
  1040. cb && cb({
  1041. ...res,
  1042. inviteCode
  1043. })
  1044. }).catch((err) => {
  1045. });
  1046. }
  1047. const showCloseEndTimePage = () => {
  1048. state.status = 'close'
  1049. state.open_timer_status = true
  1050. state.close_status = '已经过期了'
  1051. state.close_text = [`This Giveaways`, `expired on ${moment(state.detail.endTimestamp).format('MM-DD')}`]
  1052. }
  1053. const showCloseEndTimePageReport = () => {
  1054. // 埋点
  1055. Report.reportLog({
  1056. pageSource: Report.pageSource.expired_page,
  1057. businessType: Report.businessType.pageView,
  1058. postId: state.postId,
  1059. srcContentId: state.tweetId,
  1060. senderId: state.userId,
  1061. });
  1062. }
  1063. const showSuccessPage = () => {
  1064. state.status = 'success'
  1065. state.open_timer_status = true;
  1066. if (!reportParams.reportReceivedPageViewSuccess) {
  1067. reportParams.reportReceivedPageViewSuccess = true;
  1068. // 埋点
  1069. Report.reportLog({
  1070. pageSource: Report.pageSource.received_success_page,
  1071. businessType: Report.businessType.pageView,
  1072. postId: state.postId,
  1073. srcContentId: state.tweetId,
  1074. senderId: state.userId,
  1075. isOldTwitterFans: reportParams.done.follow,
  1076. isOldDiscordFans: reportParams.done.join_discord,
  1077. redPacketType: 1,
  1078. customCover: state.customCover,
  1079. customGiveaway: state.customGiveaway,
  1080. });
  1081. }
  1082. }
  1083. const showNotOpenPage = () => {
  1084. state.status = 'not-open'
  1085. openConutDownTime(state.detail.endTimestamp, (time_str) => {
  1086. state.count_down_time = time_str
  1087. if (time_str == '00:00:00') {
  1088. init()
  1089. }
  1090. })
  1091. Report.reportLog({
  1092. pageSource: Report.pageSource.pending_page,
  1093. businessType: Report.businessType.pageView,
  1094. postId: state.postId,
  1095. srcContentId: state.tweetId,
  1096. senderId: state.userId,
  1097. redPacketType: 1,
  1098. customCover: state.customCover,
  1099. customGiveaway: state.customGiveaway,
  1100. });
  1101. }
  1102. const showOpenedPage = () => {
  1103. state.status = 'opened'
  1104. state.open_timer_status == true
  1105. initTaskDetail(() => {
  1106. showOpenedPageReport()
  1107. })
  1108. }
  1109. const showOpenedPageReport = () => {
  1110. reportParams.done.follow = state.done.follow;
  1111. reportParams.done.join_discord = state.done.join_discord;
  1112. // 埋点
  1113. Report.reportLog({
  1114. pageSource: Report.pageSource.task_page,
  1115. businessType: Report.businessType.pageView,
  1116. postId: state.postId,
  1117. srcContentId: state.tweetId,
  1118. senderId: state.userId,
  1119. isOldTwitterFans: state.done.follow,
  1120. isOldDiscordFans: state.done.join_discord,
  1121. redPacketType: 1,
  1122. customCover: state.customCover,
  1123. customGiveaway: state.customGiveaway,
  1124. });
  1125. }
  1126. const showRabbitPage = () => {
  1127. state.status = 'close'
  1128. state.close_status = '没有抽中'
  1129. state.open_timer_status = true
  1130. }
  1131. const showRabbitPageReport = () => {
  1132. Report.reportLog({
  1133. pageSource: Report.pageSource.received_empty_rewards_page,
  1134. businessType: Report.businessType.pageView,
  1135. postId: state.postId,
  1136. srcContentId: state.tweetId,
  1137. senderId: state.userId,
  1138. });
  1139. }
  1140. const handleStatusPage = () => {
  1141. // status 红包状态(0:未开始,1:进行中,2:已结束,3:已终止,4:终止退款进行中)
  1142. // myReceived 我是否领取过
  1143. // taskFinishStatus 任务完成状态(0:未完成,1:已完成,2:已过期)
  1144. // receiveTimeExpired 是否已经过了红包的领取截止时间
  1145. // endTimestamp 开奖时间
  1146. // ---- 判断结构 ----
  1147. // 如果 红包状态 = 未开始
  1148. // 显示未打开页面 return
  1149. // 如果 红包状态 = 已终止 | 终止退款进行中
  1150. // 显示过期页面
  1151. // 如果 我领取过了
  1152. // 如果 任务完成状态 = 未完成 & 红包状态 = 进行中
  1153. // 显示任务未完成页面
  1154. // 如果 任务完成状态 = 未完成 & 红包状态 = 已结束
  1155. // 显示过期页面
  1156. // 如果 任务完成状态 = 已经完成
  1157. // 如果 (货币奖品类型 领取到红包金额 = 0 || 通用奖品类型 winner = 0) & 红包状态 = 已结束
  1158. // 显示兔子页面
  1159. // 否则如果 红包状态 = 已结束
  1160. // 显示成功页面
  1161. // 如果 红包状态 = 进行中
  1162. // 显示等待结果页面
  1163. // 如果 任务完成状态 = 已经过期
  1164. // 如果 红包状态 = 进行中
  1165. // 显示未打开页面
  1166. // 否则
  1167. // 显示已经过期页面
  1168. // 如果 我没有领取过 & 红包状态 = 进行中
  1169. // 如果 过了红包的领取截止时间 = true
  1170. // 显示已经过期页面
  1171. // 如果 过了红包的领取截止时间 = false
  1172. // 显示未打开页面
  1173. // 如果 我没有领取过 & 红包状态 = 已结束 | 已终止 | 终止退款进行中
  1174. // 显示过期页面
  1175. // -------- 华丽的分割线 --------
  1176. // 如果 红包状态 = 未开始
  1177. if (state.detail.status == 0) {
  1178. showNotOpenPage()
  1179. return
  1180. }
  1181. // 如果 红包状态 = 已终止 | 终止退款进行中
  1182. if (state.detail.status == 3 || state.detail.status == 4) {
  1183. // 显示过期页面
  1184. showCloseEndTimePage()
  1185. showCloseEndTimePageReport()
  1186. }
  1187. // 如果 我领取过了
  1188. else if (state.detail.myReceived) {
  1189. state.receiveAmount = state.detail.myReceived.amountValue || 0
  1190. state.detail.taskCondition = JSON.parse(state.detail.taskCondition)
  1191. // 如果 任务完成状态 = 未完成 & 红包状态 = 进行中
  1192. if (state.detail.myReceived.taskFinishStatus == 0 && state.detail.status == 1) {
  1193. // 显示任务未完成页面
  1194. showOpenedPage()
  1195. if (state.process_mode != 'production') {
  1196. getValidity()
  1197. }
  1198. // 如果 任务完成状态 = 未完成 & 红包状态 = 已结束
  1199. else if (state.detail.myReceived.taskFinishStatus == 0 && state.detail.status == 2) {
  1200. // 显示已经过期页面
  1201. showCloseEndTimePage()
  1202. showCloseEndTimePageReport()
  1203. }
  1204. //如果 任务完成状态 = 已经完成
  1205. } else if (state.detail.myReceived.taskFinishStatus == 1) {
  1206. // 领取到空红包 & 红包状态 = 已结束
  1207. if (((state.detail.rewardType === RewardType.money && state.receiveAmount == 0) || (state.detail.rewardType === RewardType.custom && state.detail.myReceived.winner === 0)) && state.detail.status == 2) {
  1208. showRabbitPage()
  1209. showRabbitPageReport()
  1210. } else if (state.detail.status == 2) {
  1211. // 显示成功页面
  1212. showSuccessPage()
  1213. }
  1214. // 如果 红包状态 = 进行中
  1215. else if (state.detail.status == 1) {
  1216. // 显示等待结果页面
  1217. showLoadResult()
  1218. openTimer()
  1219. }
  1220. // 如果 任务完成状态 = 已经过期
  1221. } else {
  1222. // 如果 红包状态 = 进行中
  1223. if (state.detail.status == 1) {
  1224. // 显示未打开页面
  1225. showNotOpenPage()
  1226. // 否则
  1227. } else {
  1228. // 显示已经过期页面
  1229. showCloseEndTimePage()
  1230. showCloseEndTimePageReport()
  1231. }
  1232. }
  1233. // 如果 我没有领取过
  1234. } else {
  1235. // 如果 红包状态 = 进行中
  1236. if (state.detail.status == 1) {
  1237. // 如果 过了红包的领取截止时间 = true
  1238. if (state.detail.receiveTimeExpired) {
  1239. // 显示过期页面
  1240. showCloseEndTimePage()
  1241. showCloseEndTimePageReport()
  1242. // 如果 过了红包的领取截止时间 = false
  1243. } else {
  1244. // 显示未打开页面
  1245. showNotOpenPage()
  1246. }
  1247. // 红包状态 = 已经结束了 | 已经终止 | 终止退款中
  1248. } else {
  1249. // 显示过期页面
  1250. showCloseEndTimePage()
  1251. showCloseEndTimePageReport()
  1252. }
  1253. }
  1254. }
  1255. function setFrontConfig() {
  1256. getFrontConfig({
  1257. params: {},
  1258. }).then((res) => {
  1259. if (res.code == 0) {
  1260. facebookAppConfig.facebookAppId = res.data.fbClientId;
  1261. }
  1262. });
  1263. };
  1264. function init(initParams) {
  1265. let { type } = initParams || {};
  1266. onPageVisbile();
  1267. onWindowMessage();
  1268. setFrontConfig();
  1269. getPostDetail({
  1270. params: {
  1271. postId: state.postId
  1272. }
  1273. }).then((res) => {
  1274. state.loading_show = false
  1275. // 领取0元为空红包继续流程
  1276. // ---- 完成任务接口 ----
  1277. // 如果金额是0
  1278. // 显示没有抽中
  1279. if (res.code == 0) {
  1280. state.srcContent = res.data.srcContent;
  1281. state.postRedirectUrl = res.data.postRedirectUrl;
  1282. // 判断推特id,绑定逻辑
  1283. state.srcContentId = res.data.srcContentId
  1284. if (!state.srcContentId) {
  1285. reSetBindTwtterId(res.data)
  1286. return
  1287. }
  1288. state.detail = JSON.parse(res.data.postBizData)
  1289. state.detail.taskCondition = state.detail.taskCondition || []
  1290. state.tweetId = state.srcContentId;
  1291. state.userId = res.data.srcUserId;
  1292. state.tweet_author = state.detail.postUserInfo && state.detail.postUserInfo.nickName || '';
  1293. state.customCover = state.detail.posterType == 2 ? 1 : 0;
  1294. state.customGiveaway = state.detail.rewardType == 2 ? 1 : 0;
  1295. // 不要删除这个console
  1296. console.log('postBizData', state.detail)
  1297. checkFacebookReply();
  1298. handleStatusPage()
  1299. } else {
  1300. handleErrorCode(res)
  1301. }
  1302. }).finally(() => {
  1303. state.loading_redbag = false
  1304. })
  1305. }
  1306. function initTaskDetail(cb) {
  1307. getChromeStorage('userInfo', (_userInfo) => {
  1308. if (_userInfo && _userInfo.uid) {
  1309. // 任务详情
  1310. getTaskDetail({
  1311. params: {
  1312. postId: state.postId
  1313. }
  1314. }).then((res) => {
  1315. if (res.code.toString()) {
  1316. for (let i in res.data) {
  1317. switch (res.data[i].type) {
  1318. case 1:
  1319. state.done.follow = res.data[i].finished
  1320. state.detail.taskCondition[0].relatedUsers = res.data[i].detail
  1321. break
  1322. case 2:
  1323. state.done.like = res.data[i].finished
  1324. break
  1325. case 3:
  1326. state.done.retweet = res.data[i].finished
  1327. break
  1328. case 7:
  1329. state.done.join_discord = res.data[i].finished
  1330. discordAuthorizeRequired = res.data[i].discordAuthorizeRequired
  1331. break
  1332. case 8:
  1333. state.done.repost_facebook = res.data[i].finished;
  1334. break;
  1335. case 9:
  1336. state.done.reply = res.data[i].finished;
  1337. if (!state.done.reply) {
  1338. onTweetReplyClick({ type: 9 });
  1339. }
  1340. break;
  1341. }
  1342. }
  1343. } else {
  1344. handleErrorCode(res)
  1345. }
  1346. cb && cb()
  1347. })
  1348. }
  1349. })
  1350. }
  1351. let tab_index = 0
  1352. const doTaskReport = (req, sender) => {
  1353. state.loading_show = false
  1354. let follow_name = req.task_data.follow_name || ''
  1355. // 1 Twitter follow Twitter ScreenName
  1356. // 2 Tweet like
  1357. // 3 Retweet
  1358. let event_type = 0
  1359. switch (req.task_type) {
  1360. case 'retweet':
  1361. event_type = 3
  1362. state.done.retweet = req.task_done
  1363. if (!req.task_done && req.do_type == 'api') {
  1364. window.open(`https://twitter.com/intent/retweet?tweet_id=${state.tweetId}`)
  1365. }
  1366. break;
  1367. case 'like':
  1368. event_type = 2
  1369. state.done.like = req.task_done
  1370. //
  1371. if (!req.task_done && req.do_type == 'api') {
  1372. window.open(`https://twitter.com/intent/like?tweet_id=${state.tweetId}`)
  1373. }
  1374. break
  1375. case 'follow':
  1376. event_type = 1
  1377. // for (let i = 0; i < follow_open_tabs.length; i++) {
  1378. // if (follow_open_tabs[i].id == sender.tab.id) {
  1379. // follow_open_tabs.splice(i, 1)
  1380. // break
  1381. // }
  1382. // }
  1383. // chrome.tabs.getCurrent((tab) => {
  1384. // if (follow_open_tabs.length > 0) {
  1385. // tab_index = follow_open_tabs[follow_open_tabs.length - 1].index
  1386. // } else {
  1387. // tab_index = tab.index
  1388. // }
  1389. // chrome.tabs.highlight({ windowId: tab.windowId, tabs: tab_index })
  1390. // })
  1391. let has_no_finished = false
  1392. state.detail.taskCondition[0].relatedUsers.forEach((item) => {
  1393. if (follow_name == item.name) {
  1394. item.finished = req.task_done
  1395. }
  1396. })
  1397. state.detail.taskCondition[0].relatedUsers.forEach((item) => {
  1398. if (!item.finished) {
  1399. has_no_finished = true
  1400. }
  1401. })
  1402. if (!has_no_finished) {
  1403. state.done.follow = true
  1404. state.done.follow_red = false
  1405. openFollowTabs(state.detail.taskCondition[0].relatedUsers)
  1406. }
  1407. break
  1408. }
  1409. if (req.do_type != 'api') {
  1410. chrome.tabs.remove(sender.tab.id)
  1411. }
  1412. if (req.task_done) {
  1413. addFinishEvent({
  1414. params: {
  1415. eventData: follow_name,
  1416. eventType: event_type,
  1417. luckdropId: state.detail.taskLuckdropId
  1418. }
  1419. })
  1420. }
  1421. }
  1422. let open_timer_flag = false
  1423. // 倒计时开奖
  1424. const openTimer = () => {
  1425. if (open_timer_flag) {
  1426. return
  1427. }
  1428. open_timer_flag = true
  1429. openConutDownTime(state.detail.endTimestamp, (time_str) => {
  1430. state.count_down_time = time_str
  1431. if (time_str == '00:00:00') {
  1432. init()
  1433. }
  1434. })
  1435. }
  1436. async function showLoadResult() {
  1437. state.status = 'close'
  1438. state.close_status = '等待结果'
  1439. getChromeStorage('userInfo', (_userInfo) => {
  1440. if (_userInfo) {
  1441. getUserSetting()
  1442. }
  1443. })
  1444. }
  1445. const getUserSetting = () => {
  1446. getSetting({}).then((res) => {
  1447. let { code, data } = res;
  1448. if (code === 0) {
  1449. state.notification_show = true
  1450. state.notification_switch = data.noticeSwitch === 1 ? true : false;
  1451. }
  1452. });
  1453. }
  1454. onMounted(() => {
  1455. state.process_mode = process.env.NODE_ENV
  1456. state.postId = getQueryString('postId')
  1457. state.window_origin = getQueryString('window_origin') || '';
  1458. if (state.window_origin.indexOf('twitter.com') > -1) {
  1459. state.tweetId = getQueryString('tweetId')
  1460. state.tweet_author = getQueryString('tweet_author');
  1461. }
  1462. getTweetAuthor()
  1463. init()
  1464. onRuntimeMsg();
  1465. // state.loading_show = true
  1466. // state.status = 'not-open'
  1467. // state.status = 'success'
  1468. // state.status = 'close'
  1469. // state.close_status = '已经过期了'
  1470. // state.close_text = [`This Giveaways`, `expired on ${moment(state.detail.endTimestamp).format('MM-DD')}`]
  1471. // state.close_status = '没有抽中'
  1472. // state.close_status = '已过期'
  1473. })
  1474. function getTweetAuthor() {
  1475. if (state.window_origin.indexOf('twitter.com') > -1) {
  1476. window.parent.postMessage({
  1477. actionType: "IFRAME_RED_PACKET_GET_TWEET_AUTHOR", data: {
  1478. postId: state.postId,
  1479. taskLuckdropId: state.detail.taskLuckdropId
  1480. }
  1481. }, "*");
  1482. }
  1483. }
  1484. function checkFacebookReply() {
  1485. console.log('checkFacebookReply')
  1486. if (state.window_origin.indexOf('twitter.com') > -1) {
  1487. window.parent.postMessage({
  1488. actionType: "IFRAME_RED_PACKET_CHECK_FACEBOOK_REPLY", data: {
  1489. postId: state.postId
  1490. }
  1491. }, "*");
  1492. }
  1493. }
  1494. // 点击领取
  1495. function clickOpenRedPacket() {
  1496. callEventPageMethod('CONTENT_GET_PINED', {})
  1497. handleRedPacket()
  1498. }
  1499. function handleRedPacket() {
  1500. state.loading_show = true
  1501. getRedPacket({
  1502. params: {
  1503. postId: state.postId
  1504. }
  1505. }).then((res) => {
  1506. if (res.code == 0) {
  1507. init()
  1508. } else {
  1509. state.loading_show = false
  1510. handleErrorCode(res)
  1511. }
  1512. }).catch(() => {
  1513. state.loading_show = false
  1514. })
  1515. // 埋点
  1516. Report.reportLog({
  1517. pageSource: Report.pageSource.pending_page,
  1518. businessType: Report.businessType.buttonClick,
  1519. objectType: Report.objectType.open_button,
  1520. postId: state.postId,
  1521. srcContentId: state.tweetId,
  1522. senderId: state.userId,
  1523. redPacketType: 1,
  1524. customCover: state.customCover,
  1525. customGiveaway: state.customGiveaway,
  1526. });
  1527. }
  1528. chrome.storage.onChanged.addListener(changes => {
  1529. if (changes.userInfo) {
  1530. // let item = JSON.parse(changes.userInfo.newValue)
  1531. state.loading_show = false
  1532. init()
  1533. }
  1534. })
  1535. // 校验是否封路
  1536. function checkIsLogin() {
  1537. return new Promise((resolve) => {
  1538. getChromeStorage('userInfo', (_userInfo) => {
  1539. if (!_userInfo) {
  1540. state.loading_show = true
  1541. setTimeout(() => {
  1542. state.loading_show = false
  1543. }, 3000)
  1544. chrome.runtime.sendMessage(
  1545. { actionType: "POPUP_LOGIN", data: "" },
  1546. (response) => {
  1547. console.log("res", response);
  1548. }
  1549. )
  1550. resolve(_userInfo)
  1551. } else {
  1552. resolve(_userInfo)
  1553. }
  1554. })
  1555. })
  1556. }
  1557. async function clickGetGiveaways() {
  1558. let _userInfo = await checkIsLogin()
  1559. if (_userInfo) {
  1560. handleFinishRedPacket()
  1561. }
  1562. }
  1563. function handleFinishRedPacket() {
  1564. state.loading_show = true
  1565. finishRedPacket({
  1566. params: {
  1567. postId: state.postId
  1568. }
  1569. }).then((res) => {
  1570. if (res.code == 0) {
  1571. if (res.data.finished) {
  1572. state.receiveAmount = res.data.receiveAmount
  1573. init()
  1574. // 埋点
  1575. Report.reportLog({
  1576. pageSource: Report.pageSource.task_page,
  1577. businessType: Report.businessType.buttonClick,
  1578. objectType: Report.objectType.get_giveaway,
  1579. postId: state.postId,
  1580. srcContentId: state.tweetId,
  1581. senderId: state.userId,
  1582. customCover: state.customCover,
  1583. customGiveaway: state.customGiveaway,
  1584. }, {
  1585. get_giveaway_result: Report.extParams.success
  1586. });
  1587. } else {
  1588. state.loading_show = false
  1589. let _data = res.data.conditionResult
  1590. for (let i in _data) {
  1591. switch (_data[i].type.toString()) {
  1592. case '1':
  1593. state.detail.taskCondition[0].relatedUsers = _data[i].detail
  1594. if (_data[i].finished) {
  1595. state.done.follow = true
  1596. state.done.follow_red = false
  1597. } else {
  1598. // alert('Please complete the task: follow')
  1599. state.done.follow = false
  1600. state.done.follow_red = true
  1601. }
  1602. break
  1603. case '2':
  1604. if (_data[i].finished) {
  1605. state.done.like = true
  1606. state.done.like_red = false
  1607. } else {
  1608. // alert('Please complete the task: like tweet')
  1609. state.done.like = false
  1610. state.done.like_red = true
  1611. }
  1612. break
  1613. case '3':
  1614. if (_data[i].finished) {
  1615. state.done.retweet = true
  1616. state.done.retweet_red = false
  1617. } else {
  1618. // alert('Please complete the task: Retweet')
  1619. state.done.retweet_red = true
  1620. state.done.retweet = false
  1621. }
  1622. break
  1623. case '7':
  1624. //join discord
  1625. discordAuthorizeRequired = _data[i].discordAuthorizeRequired;
  1626. if (_data[i].finished) {
  1627. state.done.join_discord = true
  1628. state.done.join_discord_red = false
  1629. } else {
  1630. state.done.join_discord = false;
  1631. state.done.join_discord_red = true
  1632. }
  1633. break
  1634. case '8':
  1635. //repost feacebook
  1636. if (_data[i].finished) {
  1637. state.done.repost_facebook = true
  1638. state.done.repost_facebook_red = false
  1639. } else {
  1640. state.done.repost_facebook = false;
  1641. state.done.repost_facebook_red = true
  1642. }
  1643. break
  1644. case '9':
  1645. //reply
  1646. if (_data[i].finished) {
  1647. state.done.reply = true
  1648. state.done.reply_red = false
  1649. } else {
  1650. state.done.reply = false;
  1651. state.done.reply_red = true
  1652. }
  1653. break
  1654. }
  1655. }
  1656. // 埋点
  1657. Report.reportLog({
  1658. pageSource: Report.pageSource.task_page,
  1659. businessType: Report.businessType.buttonClick,
  1660. objectType: Report.objectType.get_giveaway,
  1661. postId: state.postId,
  1662. srcContentId: state.tweetId,
  1663. senderId: state.userId,
  1664. customCover: state.customCover,
  1665. customGiveaway: state.customGiveaway,
  1666. }, {
  1667. get_giveaway_result: Report.extParams.failure,
  1668. });
  1669. if (discordAuthorizeRequired) {
  1670. discordAuth('reAuth');
  1671. }
  1672. }
  1673. } else {
  1674. state.loading_show = false
  1675. // 埋点
  1676. Report.reportLog({
  1677. pageSource: Report.pageSource.task_page,
  1678. businessType: Report.businessType.buttonClick,
  1679. objectType: Report.objectType.get_giveaway,
  1680. postId: state.postId,
  1681. srcContentId: state.tweetId,
  1682. senderId: state.userId,
  1683. customCover: state.customCover,
  1684. customGiveaway: state.customGiveaway,
  1685. }, {
  1686. get_giveaway_result: Report.extParams.failure,
  1687. });
  1688. handleErrorCode(res)
  1689. }
  1690. }).catch(() => {
  1691. state.loading_show = false
  1692. })
  1693. }
  1694. function handleErrorCode(res) {
  1695. switch (res.code.toString()) {
  1696. // 数据异常,请联系管理员
  1697. case '-102':
  1698. break
  1699. //系统错误
  1700. case '-101':
  1701. break
  1702. // 参数不对
  1703. case '-103':
  1704. break
  1705. // 接口被限流
  1706. case '-105':
  1707. break
  1708. // 访问凭证不存在
  1709. case '-107':
  1710. break
  1711. // 重复操作过于频繁
  1712. case '-106':
  1713. message.error('Clicking too often, wait a moment and click again')
  1714. state.loading_show = false
  1715. break
  1716. // 红包不存在
  1717. case '2001':
  1718. // message.error(res.msg)
  1719. break
  1720. // 还未到红包领取时间
  1721. case '2002':
  1722. // message.error(res.msg)
  1723. break
  1724. // 已超过红包领取时间
  1725. case '2003':
  1726. init()
  1727. break
  1728. // 红包支付状态异常 没有可提交的任务红包
  1729. case '2004':
  1730. init()
  1731. break
  1732. // 红包活动已结束
  1733. case '2006':
  1734. init()
  1735. break
  1736. // 红包金额已经被领取完了
  1737. case '2007':
  1738. state.status = 'close'
  1739. state.close_status = '已经过期了'
  1740. state.close_text = [`This Giveaways`, `expired on ${moment(state.detail.endTimestamp).format('MM-DD')}`]
  1741. init()
  1742. break
  1743. // 红包个数已经被领取完了
  1744. case '2008':
  1745. state.status = 'close'
  1746. state.close_status = '已经过期了'
  1747. state.close_text = [`This Giveaways`, `expired on ${moment(state.detail.endTimestamp).format('MM-DD')}`]
  1748. init()
  1749. break
  1750. // 该用户不满足领取条件
  1751. case '2009':
  1752. state.error_txt = [`oops, new accounts cannot participate in this event,`]
  1753. state.status = 'error'
  1754. state.retry = true
  1755. // 埋点
  1756. Report.reportLog({
  1757. pageSource: Report.pageSource.robot_detection_failed_page,
  1758. businessType: Report.businessType.pageView,
  1759. postId: state.postId,
  1760. srcContentId: state.tweetId,
  1761. senderId: state.userId,
  1762. });
  1763. break
  1764. // 无法校验用户Twitter信息
  1765. case '2010':
  1766. // message.error(res.msg)
  1767. break
  1768. // 用户已经领过该红包
  1769. case '2011':
  1770. // message.error(res.msg)
  1771. break
  1772. // 推文不存在
  1773. case '2022':
  1774. // message.error(res.msg)
  1775. break
  1776. // 推文未发布 and 不是红包任务的推文
  1777. case '2023':
  1778. // message.error(res.msg)
  1779. break
  1780. // 没有可提交的任务红包
  1781. case '2024':
  1782. state.status = 'not-open'
  1783. break
  1784. // 红包任务已完成
  1785. case '2025':
  1786. break
  1787. // 任务已经过期
  1788. case '2026':
  1789. break
  1790. // 任务未完成
  1791. case '2027':
  1792. break
  1793. // 红包金额每人不足1分钱
  1794. case '2028':
  1795. break
  1796. // 推文未发布
  1797. case '2029':
  1798. message.error('Tweet not posted')
  1799. break
  1800. // 不是红包任务的推文
  1801. case '2030':
  1802. break
  1803. case '2037':
  1804. showCloseEndTimePage()
  1805. init()
  1806. break
  1807. //用户没有领取过红包,无法重抽
  1808. case '2031':
  1809. break
  1810. // 需要重新授权 discord
  1811. case '1010':
  1812. discordAuth('reAuth');
  1813. break
  1814. }
  1815. }
  1816. // function clickBack() {
  1817. // state.status = 'opened'
  1818. // // 埋点
  1819. // Report.reportLog({
  1820. // pageSource: Report.pageSource.task_page,
  1821. // businessType: Report.businessType.pageView,
  1822. // });
  1823. // }
  1824. // function clickRoad() {
  1825. // state.status = 'luck-peopel-list'
  1826. // // 埋点
  1827. // Report.reportLog({
  1828. // pageSource: Report.pageSource.task_page,
  1829. // businessType: Report.businessType.buttonClick,
  1830. // objectType: Report.objectType.received_list
  1831. // });
  1832. // // 埋点
  1833. // Report.reportLog({
  1834. // pageSource: Report.pageSource.received_list_page,
  1835. // businessType: Report.businessType.pageView
  1836. // });
  1837. // }
  1838. function onWindowMessage() {
  1839. window.addEventListener("message", function (event) {
  1840. if (event.data) {
  1841. switch (event.data.actionType) {
  1842. case 'CONTENT_RED_PACKET_REPLY_RASK_FINSH':
  1843. state.done.reply = true;
  1844. state.done.reply_red = false;
  1845. break;
  1846. case 'CONTENT_RED_PACKET_GET_TWEET_AUTHOR':
  1847. fullName = event.data.data.fullName
  1848. break;
  1849. case 'CONTENT_RED_PACKET_FACEBOOK_REPLY':
  1850. clickReply(event.data.data)
  1851. break;
  1852. }
  1853. }
  1854. });
  1855. }
  1856. function onPageVisbile() {
  1857. document.addEventListener('visibilitychange', function () {
  1858. let isHidden = document.hidden;
  1859. if (!isHidden) {
  1860. checkJoinDiscord();
  1861. }
  1862. });
  1863. }
  1864. function onRuntimeMsg() {
  1865. chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
  1866. sendResponse('ok');
  1867. switch (req.actionType) {
  1868. case 'BACK_DISCORD_LOGIN_SUCCESS':
  1869. discordLoginSuccess();
  1870. break;
  1871. case 'BG_FACEBOOK_SHARE_SUCCESS':
  1872. facebookShareSuccess(req.data);
  1873. break;
  1874. case 'DO_TASK':
  1875. if (!req.task_type || state.tweetId != req.tweet_Id) {
  1876. return
  1877. }
  1878. state.loading_show = false
  1879. doTaskReport(req, sender);
  1880. break;
  1881. case 'CONTENT_RED_PACKET_REPLY_RASK_FINSH':
  1882. if (req.data && req.data.postId == state.postId) {
  1883. state.done.reply = true;
  1884. state.done.reply_red = false;
  1885. }
  1886. break;
  1887. case 'CONTENT_API_GET_TWEET_USER_INFO_RES':
  1888. let { user } = req.data || {};
  1889. if (user && user.result && user.result.legacy) {
  1890. let legacy = user.result.legacy;
  1891. reportParams.twitterFans = legacy.followers_count;
  1892. if (!discordTaskDetail) {
  1893. if (reportParams.hasReport) return;
  1894. reportParams.hasReport = true;
  1895. Report.reportLog({
  1896. objectType: Report.objectType.tweetPostBinded,
  1897. twitterFans: reportParams.twitterFans,
  1898. redPacketType: 1
  1899. });
  1900. } else {
  1901. if (reportParams.discordFans !== '') {
  1902. if (reportParams.hasReport) return;
  1903. reportParams.hasReport = true;
  1904. Report.reportLog({
  1905. objectType: Report.objectType.tweetPostBinded,
  1906. twitterFans: reportParams.twitterFans,
  1907. discordFans: reportParams.discordFans,
  1908. redPacketType: 1
  1909. });
  1910. }
  1911. }
  1912. }
  1913. break;
  1914. case 'USER_SETTING':
  1915. setNotification(req.data)
  1916. break;
  1917. }
  1918. })
  1919. }
  1920. /**
  1921. * 检查是否加入discord
  1922. */
  1923. function checkJoinDiscord() {
  1924. // 如果上次的状态是 joinIng 检查是否真正join
  1925. if (joinDiscordActionState == 'joinIng') {
  1926. joinDiscordActionState = 'default';
  1927. let url = getInviteUrl();
  1928. if (url) {
  1929. joinDiscordIng.value = true;
  1930. checkGuildJoinedStatus({ url }, (res = {}) => {
  1931. joinDiscordIng.value = false;
  1932. if (res.code == 0) {
  1933. let { joined } = res.data || {};
  1934. if (joined) {
  1935. state.done.join_discord = true;
  1936. } else {
  1937. state.done.join_discord = false;
  1938. }
  1939. } else if (res.code == 1010) {
  1940. discordAuth('reAuth');
  1941. }
  1942. })
  1943. }
  1944. }
  1945. }
  1946. const checkGuildJoinedStatus = ({ url }, cb) => {
  1947. checkGuildJoined({
  1948. params: {
  1949. inviteUrl: url
  1950. }
  1951. }).then(res => {
  1952. cb && cb(res);
  1953. }).catch(err => {
  1954. cb && cb({ catch: true })
  1955. })
  1956. }
  1957. /**
  1958. * 加入discord 事件
  1959. */
  1960. async function joinDiscord() {
  1961. let _userInfo = await checkIsLogin();
  1962. if (!_userInfo) {
  1963. return
  1964. }
  1965. if (joinDiscordIng.value) {
  1966. return;
  1967. }
  1968. // 埋点
  1969. Report.reportLog({
  1970. objectType: Report.objectType.join_discord,
  1971. pageSource: Report.pageSource.task_page,
  1972. businessType: Report.businessType.buttonClick,
  1973. postId: state.postId,
  1974. srcContentId: state.tweetId,
  1975. senderId: state.userId,
  1976. redPacketType: 1,
  1977. customCover: state.customCover,
  1978. customGiveaway: state.customGiveaway,
  1979. });
  1980. let url = getInviteUrl();
  1981. if (url) {
  1982. joinDiscordIng.value = true;
  1983. checkGuildJoinedStatus({ url }, (res) => {
  1984. setTimeout(() => {
  1985. joinDiscordIng.value = false;
  1986. }, 1500);
  1987. if (res.code == 0) {
  1988. let { joined } = res.data || {};
  1989. if (joined) {
  1990. state.done.join_discord = true;
  1991. } else {
  1992. state.done.join_discord = false;
  1993. if (discordAuthorizeRequired) {
  1994. discordAuth('authAndJoinIng');
  1995. } else {
  1996. openInviteUrl();
  1997. }
  1998. }
  1999. } else if (res.code == 1010) {
  2000. discordAuth('authAndJoinIng');
  2001. }
  2002. if (res.catch) {
  2003. //判断是否需要授权
  2004. if (discordAuthorizeRequired) {
  2005. discordAuth('authAndJoinIng');
  2006. } else {
  2007. openInviteUrl();
  2008. }
  2009. }
  2010. })
  2011. }
  2012. }
  2013. /**
  2014. * discord授权
  2015. */
  2016. function discordAuth(actionState = 'default') {
  2017. let state = guid();
  2018. discordAuthUrl({
  2019. params: {
  2020. redirectUrl: discordAuthRedirectUri,
  2021. state
  2022. }
  2023. }).then(res => {
  2024. if (res.code == 0) {
  2025. let { authorizeUrl = '' } = res.data || {};
  2026. if (authorizeUrl) {
  2027. joinDiscordActionState = actionState;
  2028. const width = 500;
  2029. chrome.windows.create({
  2030. width,
  2031. type: 'normal',
  2032. url: authorizeUrl
  2033. }, function (window) {
  2034. let windowId = window.id;
  2035. callEventPageMethod("RED_PACKET_SAVE_DISCORD_AUTH_WINDOW_ID", {
  2036. windowId: windowId
  2037. }, function (response) {
  2038. });
  2039. })
  2040. }
  2041. }
  2042. })
  2043. }
  2044. /**
  2045. * sendMessage
  2046. */
  2047. const callEventPageMethod = (actionType, data, callback) => {
  2048. chrome.runtime.sendMessage(
  2049. {
  2050. actionType: actionType,
  2051. data: data
  2052. },
  2053. function (response) {
  2054. if (typeof callback === "function") callback(response);
  2055. }
  2056. );
  2057. };
  2058. /**
  2059. * discord 授权成功
  2060. */
  2061. function discordLoginSuccess() {
  2062. console.log('discordloginSuccess');
  2063. // 如果是授权并join 默认打开 邀请链接
  2064. if (joinDiscordActionState == 'authAndJoinIng') {
  2065. openInviteUrl();
  2066. }
  2067. if (discordAuthorizeRequired) {
  2068. discordAuthorizeRequired = false;
  2069. }
  2070. }
  2071. /**
  2072. * 获取discord邀请链接
  2073. */
  2074. function getInviteUrl() {
  2075. let inviteData = state.detail.taskCondition.find(item => {
  2076. return item.type == 7;
  2077. });
  2078. let url;
  2079. if (inviteData && inviteData.bizData) {
  2080. url = JSON.parse(inviteData.bizData).inviteUrl;
  2081. }
  2082. return url;
  2083. }
  2084. /**
  2085. * 打开邀请discord链接
  2086. */
  2087. function openInviteUrl() {
  2088. joinDiscordActionState = 'joinIng';
  2089. let url = getInviteUrl();
  2090. if (url) {
  2091. if (!url.startsWith('http')) {
  2092. url = 'https://' + url;
  2093. }
  2094. window.open(url);
  2095. }
  2096. }
  2097. </script>
  2098. <style lang="scss" scoped>
  2099. html,
  2100. body {
  2101. margin: 0;
  2102. padding: 0;
  2103. width: 375px;
  2104. height: 500px;
  2105. background-color: unset !important;
  2106. }
  2107. :deep() .ant-switch {
  2108. background-color: #E9ECEE;
  2109. height: 14px;
  2110. line-height: 16px;
  2111. min-width: 36px;
  2112. }
  2113. :deep() .ant-switch-checked {
  2114. background-color: #AED8F5 !important;
  2115. }
  2116. :deep() .ant-switch::after {
  2117. width: 20px;
  2118. height: 20px;
  2119. top: -4px;
  2120. left: -1px;
  2121. }
  2122. :deep() .ant-switch-checked::after {
  2123. background-color: #1D9BF0 !important;
  2124. margin-left: 3px;
  2125. left: 100% !important;
  2126. }
  2127. .content {
  2128. position: relative;
  2129. width: 375px;
  2130. height: 500px;
  2131. background: #fafafa;
  2132. border-radius: 11px;
  2133. overflow: hidden;
  2134. box-sizing: border-box;
  2135. border: 1px solid #DCDCDC;
  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-item: center;
  3070. justify-content: center;
  3071. width: 100%;
  3072. height: 100%;
  3073. }
  3074. </style>