red-packet.vue 68 KB

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