red-packet.vue 69 KB

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