luck-draw.vue 109 KB

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