red-packet.vue 57 KB

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