red-packet.vue 79 KB

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