red-packet.vue 79 KB

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