red-packet.vue 79 KB

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