luck-draw.vue 99 KB

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