luck-draw.vue 104 KB

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