luck-draw.vue 109 KB

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