luck-draw.vue 109 KB

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