luck-draw.vue 109 KB

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