red-packet.vue 79 KB

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