luck-draw.vue 109 KB

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