red-packet.vue 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220
  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 = (arr_name) => {
  510. let array_finish = arr_name.filter((item) => { return !item.finished })
  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}&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(arr_name)
  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(arr_name)
  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. getChromeStorage('userInfo', (_userInfo) => {
  767. if (_userInfo.uid) {
  768. // 任务详情
  769. getTaskDetail({
  770. params: {
  771. postId: state.postId
  772. }
  773. }).then((res) => {
  774. if (res.code.toString()) {
  775. for (let i in res.data) {
  776. switch (res.data[i].type) {
  777. case 1:
  778. state.done.follow = res.data[i].finished
  779. state.detail.taskCondition[0].relatedUsers = res.data[i].detail
  780. break
  781. case 2:
  782. state.done.like = res.data[i].finished
  783. break
  784. case 3:
  785. state.done.retweet = res.data[i].finished
  786. break
  787. case 7:
  788. state.done.join_discord = res.data[i].finished
  789. discordAuthorizeRequired = res.data[i].discordAuthorizeRequired
  790. break
  791. }
  792. }
  793. } else {
  794. handleErrorCode(res)
  795. }
  796. })
  797. }
  798. })
  799. }
  800. let tab_index = 0
  801. const doTaskReport = (req, sender) => {
  802. let follow_name = req.task_data.follow_name || ''
  803. // 1 Twitter follow Twitter ScreenName
  804. // 2 Tweet like
  805. // 3 Retweet
  806. let event_type = 0
  807. switch (req.task_type) {
  808. case 'retweet':
  809. event_type = 3
  810. state.done.retweet = req.task_done
  811. chrome.tabs.remove(sender.tab.id)
  812. break;
  813. case 'like':
  814. event_type = 2
  815. state.done.like = req.task_done
  816. chrome.tabs.remove(sender.tab.id)
  817. break
  818. case 'follow':
  819. event_type = 1
  820. chrome.tabs.remove(sender.tab.id)
  821. for (let i = 0; i < follow_open_tabs.length; i++) {
  822. if (follow_open_tabs[i].id == sender.tab.id) {
  823. follow_open_tabs.splice(i, 1)
  824. break
  825. }
  826. }
  827. chrome.tabs.getCurrent((tab) => {
  828. if (follow_open_tabs.length > 0) {
  829. tab_index = follow_open_tabs[follow_open_tabs.length - 1].index
  830. } else {
  831. tab_index = tab.index
  832. }
  833. chrome.tabs.highlight({ windowId: tab.windowId, tabs: tab_index })
  834. })
  835. let has_no_finished = false
  836. state.detail.taskCondition[0].relatedUsers.forEach((item) => {
  837. if (follow_name == item.name) {
  838. item.finished = req.task_done
  839. }
  840. })
  841. state.detail.taskCondition[0].relatedUsers.forEach((item) => {
  842. if (!item.finished) {
  843. has_no_finished = true
  844. }
  845. })
  846. if (!has_no_finished) {
  847. state.done.follow = true
  848. state.done.follow_red = false
  849. }
  850. break
  851. }
  852. if (req.task_done) {
  853. addFinishEvent({
  854. params: {
  855. eventData: follow_name,
  856. eventType: event_type,
  857. luckdropId: state.detail.taskLuckdropId
  858. }
  859. })
  860. }
  861. }
  862. onMounted(() => {
  863. state.process_mode = process.env.NODE_ENV
  864. state.postId = getQueryString('postId')
  865. state.tweetId = getQueryString('tweetId')
  866. init()
  867. // state.loading_show = true
  868. // state.status = 'opened'
  869. // state.close_status = '没有领到钱'
  870. })
  871. // 点击领取
  872. function clickOpenRedPacket() {
  873. chrome.runtime.sendMessage({
  874. actionType: 'CONTENT_GET_PINED'
  875. }, res => {
  876. console.log(res);
  877. })
  878. handleRedPacket()
  879. }
  880. function handleRedPacket() {
  881. getRedPacket({
  882. params: {
  883. postId: state.postId
  884. }
  885. }).then((res) => {
  886. if (res.code == 0) {
  887. showOpenedPage()
  888. init()
  889. } else {
  890. handleErrorCode(res)
  891. }
  892. })
  893. // 埋点
  894. Report.reportLog({
  895. pageSource: Report.pageSource.pending_page,
  896. businessType: Report.businessType.buttonClick,
  897. objectType: Report.objectType.open_button
  898. });
  899. }
  900. chrome.storage.onChanged.addListener(changes => {
  901. if (changes.userInfo) {
  902. // let item = JSON.parse(changes.userInfo.newValue)
  903. state.loading_show = false
  904. init()
  905. }
  906. })
  907. // 校验是否封路
  908. function checkIsLogin() {
  909. return new Promise((resolve) => {
  910. getChromeStorage('userInfo', (_userInfo) => {
  911. if (!_userInfo) {
  912. state.loading_show = true
  913. setTimeout(() => {
  914. state.loading_show = false
  915. }, 3000)
  916. chrome.runtime.sendMessage(
  917. { actionType: "POPUP_LOGIN", data: "" },
  918. (response) => {
  919. console.log("res", response);
  920. }
  921. )
  922. resolve(_userInfo)
  923. } else {
  924. resolve(_userInfo)
  925. }
  926. })
  927. })
  928. }
  929. async function clickGetGiveaways() {
  930. let _userInfo = await checkIsLogin()
  931. if (_userInfo) {
  932. handleFinishRedPacket()
  933. }
  934. }
  935. function handleFinishRedPacket() {
  936. state.loading_show = true
  937. finishRedPacket({
  938. params: {
  939. postId: state.postId
  940. }
  941. }).then((res) => {
  942. state.loading_show = false
  943. if (res.code == 0) {
  944. if (res.data.finished) {
  945. state.receiveAmount = res.data.receiveAmount
  946. if (state.receiveAmount == 0) {
  947. showRabbitPage()
  948. } else {
  949. state.status = 'success'
  950. }
  951. init()
  952. // 埋点
  953. Report.reportLog({
  954. pageSource: Report.pageSource.task_page,
  955. businessType: Report.businessType.buttonClick,
  956. objectType: Report.objectType.get_giveaway
  957. }, {
  958. get_giveaway_result: Report.extParams.success
  959. });
  960. } else {
  961. let _data = res.data.conditionResult
  962. for (let i in _data) {
  963. switch (_data[i].type.toString()) {
  964. case '1':
  965. state.detail.taskCondition[0].relatedUsers = _data[i].detail
  966. if (_data[i].finished) {
  967. state.done.follow = true
  968. state.done.follow_red = false
  969. } else {
  970. // alert('Please complete the task: follow')
  971. state.done.follow = false
  972. state.done.follow_red = true
  973. }
  974. break
  975. case '2':
  976. if (_data[i].finished) {
  977. state.done.like = true
  978. state.done.like_red = false
  979. } else {
  980. // alert('Please complete the task: like tweet')
  981. state.done.like = false
  982. state.done.like_red = true
  983. }
  984. break
  985. case '3':
  986. if (_data[i].finished) {
  987. state.done.retweet = true
  988. state.done.retweet_red = false
  989. } else {
  990. // alert('Please complete the task: Retweet')
  991. state.done.retweet_red = true
  992. state.done.retweet = false
  993. }
  994. break
  995. case '7':
  996. discordAuthorizeRequired = _data[i].discordAuthorizeRequired;
  997. if (_data[i].finished) {
  998. state.done.join_discord = true
  999. state.done.join_discord_red = false
  1000. } else {
  1001. state.done.join_discord = false;
  1002. state.done.join_discord_red = true
  1003. }
  1004. break
  1005. }
  1006. }
  1007. // 埋点
  1008. Report.reportLog({
  1009. pageSource: Report.pageSource.task_page,
  1010. businessType: Report.businessType.buttonClick,
  1011. objectType: Report.objectType.get_giveaway
  1012. }, {
  1013. get_giveaway_result: Report.extParams.failure
  1014. });
  1015. if (discordAuthorizeRequired) {
  1016. discordAuth('reAuth');
  1017. }
  1018. }
  1019. } else {
  1020. // 埋点
  1021. Report.reportLog({
  1022. pageSource: Report.pageSource.task_page,
  1023. businessType: Report.businessType.buttonClick,
  1024. objectType: Report.objectType.get_giveaway
  1025. }, {
  1026. get_giveaway_result: Report.extParams.failure
  1027. });
  1028. handleErrorCode(res)
  1029. }
  1030. })
  1031. }
  1032. function handleErrorCode(res) {
  1033. switch (res.code.toString()) {
  1034. // 数据异常,请联系管理员
  1035. case '-102':
  1036. break
  1037. //系统错误
  1038. case '-101':
  1039. break
  1040. // 参数不对
  1041. case '-103':
  1042. break
  1043. // 接口被限流
  1044. case '-105':
  1045. break
  1046. // 访问凭证不存在
  1047. case '-107':
  1048. break
  1049. // 重复操作过于频繁
  1050. case '-106':
  1051. message.error('Clicking too often, wait a moment and click again')
  1052. state.loading_show = false
  1053. break
  1054. // 红包不存在
  1055. case '2001':
  1056. // message.error(res.msg)
  1057. break
  1058. // 还未到红包领取时间
  1059. case '2002':
  1060. // message.error(res.msg)
  1061. break
  1062. // 已超过红包领取时间
  1063. case '2003':
  1064. init()
  1065. break
  1066. // 红包支付状态异常 没有可提交的任务红包
  1067. case '2004':
  1068. init()
  1069. break
  1070. // 红包活动已结束
  1071. case '2006':
  1072. init()
  1073. break
  1074. // 红包金额已经被领取完了
  1075. case '2007':
  1076. state.status = 'close'
  1077. state.close_status = '红包过期了'
  1078. state.close_text = [`This Giveaways`, `expired on ${moment(state.detail.endTimestamp).format('MM-DD')}`]
  1079. init()
  1080. break
  1081. // 红包个数已经被领取完了
  1082. case '2008':
  1083. state.status = 'close'
  1084. state.close_status = '红包过期了'
  1085. state.close_text = [`This Giveaways`, `expired on ${moment(state.detail.endTimestamp).format('MM-DD')}`]
  1086. init()
  1087. break
  1088. // 该用户不满足领取条件
  1089. case '2009':
  1090. state.error_txt = [`oops, new accounts cannot participate in this event,`]
  1091. state.status = 'error'
  1092. state.retry = true
  1093. // 埋点
  1094. Report.reportLog({
  1095. pageSource: Report.pageSource.robot_detection_failed_page,
  1096. businessType: Report.businessType.pageView,
  1097. });
  1098. break
  1099. // 无法校验用户Twitter信息
  1100. case '2010':
  1101. // message.error(res.msg)
  1102. break
  1103. // 用户已经领过该红包
  1104. case '2011':
  1105. // message.error(res.msg)
  1106. break
  1107. // 推文不存在
  1108. case '2022':
  1109. // message.error(res.msg)
  1110. break
  1111. // 推文未发布 and 不是红包任务的推文
  1112. case '2023':
  1113. // message.error(res.msg)
  1114. break
  1115. // 没有可提交的任务红包
  1116. case '2024':
  1117. state.status = 'not-open'
  1118. break
  1119. // 红包任务已完成
  1120. case '2025':
  1121. break
  1122. // 任务已经过期
  1123. case '2026':
  1124. break
  1125. // 任务未完成
  1126. case '2027':
  1127. break
  1128. // 红包金额每人不足1分钱
  1129. case '2028':
  1130. break
  1131. // 推文未发布
  1132. case '2029':
  1133. message.error('Tweet not posted')
  1134. break
  1135. // 不是红包任务的推文
  1136. case '2030':
  1137. break
  1138. case '2037':
  1139. showCloseEndTimePage()
  1140. init()
  1141. break
  1142. //用户没有领取过红包,无法重抽
  1143. case '2031':
  1144. break
  1145. // 需要重新授权 discord
  1146. case '1010':
  1147. discordAuth('reAuth');
  1148. break
  1149. }
  1150. }
  1151. // function clickBack() {
  1152. // state.status = 'opened'
  1153. // // 埋点
  1154. // Report.reportLog({
  1155. // pageSource: Report.pageSource.task_page,
  1156. // businessType: Report.businessType.pageView,
  1157. // });
  1158. // }
  1159. // function clickRoad() {
  1160. // state.status = 'luck-peopel-list'
  1161. // // 埋点
  1162. // Report.reportLog({
  1163. // pageSource: Report.pageSource.task_page,
  1164. // businessType: Report.businessType.buttonClick,
  1165. // objectType: Report.objectType.received_list
  1166. // });
  1167. // // 埋点
  1168. // Report.reportLog({
  1169. // pageSource: Report.pageSource.received_list_page,
  1170. // businessType: Report.businessType.pageView
  1171. // });
  1172. // }
  1173. function onPageVisbile() {
  1174. document.addEventListener('visibilitychange', function () {
  1175. let isHidden = document.hidden;
  1176. console.log('joinDiscordActionState', joinDiscordActionState);
  1177. if (!isHidden) {
  1178. checkJoinDiscord();
  1179. }
  1180. });
  1181. }
  1182. function onRuntimeMsg() {
  1183. chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
  1184. sendResponse('');
  1185. switch (req.actionType) {
  1186. case 'BACK_DISCORD_LOGIN_SUCCESS':
  1187. discordLoginSuccess();
  1188. break;
  1189. case 'DO_TASK':
  1190. if (!req.task_type || state.tweetId != req.tweet_Id) {
  1191. return
  1192. }
  1193. state.loading_show = false
  1194. doTaskReport(req, sender)
  1195. }
  1196. })
  1197. }
  1198. /**
  1199. * 检查是否加入discord
  1200. */
  1201. function checkJoinDiscord() {
  1202. // 如果上次的状态是 joinIng 检查是否真正join
  1203. if (joinDiscordActionState == 'joinIng') {
  1204. joinDiscordActionState = 'default';
  1205. let url = getInviteUrl();
  1206. if (url) {
  1207. joinDiscordIng.value = true;
  1208. checkGuildJoinedStatus({ url }, (res = {}) => {
  1209. joinDiscordIng.value = false;
  1210. if (res.code == 0) {
  1211. let { joined } = res.data || {};
  1212. if (joined) {
  1213. state.done.join_discord = true;
  1214. } else {
  1215. state.done.join_discord = false;
  1216. }
  1217. } else if (res.code == 1010) {
  1218. discordAuth('reAuth');
  1219. }
  1220. })
  1221. }
  1222. }
  1223. }
  1224. const checkGuildJoinedStatus = ({ url }, cb) => {
  1225. checkGuildJoined({
  1226. params: {
  1227. inviteUrl: url
  1228. }
  1229. }).then(res => {
  1230. cb && cb(res);
  1231. }).catch(err => {
  1232. cb && cb({ catch: true })
  1233. })
  1234. }
  1235. /**
  1236. * 加入discord 事件
  1237. */
  1238. async function joinDiscord() {
  1239. let _userInfo = await checkIsLogin();
  1240. if (!_userInfo) {
  1241. return
  1242. }
  1243. if (joinDiscordIng.value) {
  1244. return;
  1245. }
  1246. let url = getInviteUrl();
  1247. if (url) {
  1248. joinDiscordIng.value = true;
  1249. checkGuildJoinedStatus({ url }, (res) => {
  1250. setTimeout(() => {
  1251. joinDiscordIng.value = false;
  1252. }, 1500);
  1253. if (res.code == 0) {
  1254. let { joined } = res.data || {};
  1255. if (joined) {
  1256. state.done.join_discord = true;
  1257. } else {
  1258. state.done.join_discord = false;
  1259. if (discordAuthorizeRequired) {
  1260. discordAuth('authAndJoinIng');
  1261. } else {
  1262. openInviteUrl();
  1263. }
  1264. }
  1265. } else if (res.code == 1010) {
  1266. discordAuth('authAndJoinIng');
  1267. }
  1268. if (res.catch) {
  1269. //判断是否需要授权
  1270. if (discordAuthorizeRequired) {
  1271. discordAuth('authAndJoinIng');
  1272. } else {
  1273. openInviteUrl();
  1274. }
  1275. }
  1276. })
  1277. }
  1278. }
  1279. /**
  1280. * discord授权
  1281. */
  1282. function discordAuth(actionState = 'default') {
  1283. let state = guid();
  1284. discordAuthUrl({
  1285. params: {
  1286. redirectUrl: discordAuthRedirectUri,
  1287. state
  1288. }
  1289. }).then(res => {
  1290. if (res.code == 0) {
  1291. let { authorizeUrl = '' } = res.data || {};
  1292. if (authorizeUrl) {
  1293. joinDiscordActionState = actionState;
  1294. const width = 500;
  1295. chrome.windows.create({
  1296. width,
  1297. type: 'normal',
  1298. url: authorizeUrl
  1299. }, function (window) {
  1300. let windowId = window.id;
  1301. callEventPageMethod("RED_PACKET_SAVE_DISCORD_AUTH_WINDOW_ID", {
  1302. windowId: windowId
  1303. }, function (response) {
  1304. });
  1305. })
  1306. }
  1307. }
  1308. })
  1309. }
  1310. /**
  1311. * sendMessage
  1312. */
  1313. const callEventPageMethod = (actionType, data, callback) => {
  1314. chrome.runtime.sendMessage(
  1315. {
  1316. actionType: actionType,
  1317. data: data
  1318. },
  1319. function (response) {
  1320. if (typeof callback === "function") callback(response);
  1321. }
  1322. );
  1323. };
  1324. /**
  1325. * discord 授权成功
  1326. */
  1327. function discordLoginSuccess() {
  1328. console.log('discordloginSuccess');
  1329. // 如果是授权并join 默认打开 邀请链接
  1330. if (joinDiscordActionState == 'authAndJoinIng') {
  1331. openInviteUrl();
  1332. }
  1333. if (discordAuthorizeRequired) {
  1334. discordAuthorizeRequired = false;
  1335. }
  1336. }
  1337. /**
  1338. * 获取discord邀请链接
  1339. */
  1340. function getInviteUrl() {
  1341. let inviteData = state.detail.taskCondition.find(item => {
  1342. return item.type == 7;
  1343. });
  1344. let url;
  1345. if (inviteData && inviteData.bizData) {
  1346. url = JSON.parse(inviteData.bizData).inviteUrl;
  1347. }
  1348. return url;
  1349. }
  1350. /**
  1351. * 打开邀请discord链接
  1352. */
  1353. function openInviteUrl() {
  1354. joinDiscordActionState = 'joinIng';
  1355. let url = getInviteUrl();
  1356. if (url) {
  1357. if (!url.startsWith('http')) {
  1358. url = 'https://' + url;
  1359. }
  1360. window.open(url);
  1361. }
  1362. }
  1363. </script>
  1364. <style lang="scss" scoped>
  1365. html,
  1366. body {
  1367. margin: 0;
  1368. padding: 0;
  1369. width: 375px;
  1370. height: 500px;
  1371. background-color: unset !important;
  1372. }
  1373. .content {
  1374. position: relative;
  1375. width: 375px;
  1376. height: 500px;
  1377. background: #fafafa;
  1378. border-radius: 11px;
  1379. overflow: hidden;
  1380. box-sizing: border-box;
  1381. border: 1px solid #DCDCDC;
  1382. font-family: "SF Pro Display";
  1383. font-style: normal;
  1384. .loading {
  1385. background: #FFFFFF;
  1386. opacity: 0.8;
  1387. z-index: 222;
  1388. text-align: center;
  1389. width: 375px;
  1390. height: 500px;
  1391. position: fixed;
  1392. top: 0;
  1393. left: 0;
  1394. img {
  1395. margin-top: 216px;
  1396. width: 70px;
  1397. height: 70px;
  1398. }
  1399. }
  1400. .error {
  1401. width: 100%;
  1402. height: 100%;
  1403. text-align: center;
  1404. position: relative;
  1405. img {
  1406. width: 100px;
  1407. height: 100px;
  1408. margin-top: 100px;
  1409. }
  1410. .txt {
  1411. font-weight: 500;
  1412. font-size: 22px;
  1413. line-height: 26px;
  1414. text-align: center;
  1415. letter-spacing: 0.3px;
  1416. color: #a8a8a8;
  1417. margin: 34px 44px 0 44px;
  1418. }
  1419. .retry {
  1420. position: absolute;
  1421. bottom: 30px;
  1422. left: 50%;
  1423. margin-left: -167.5px;
  1424. width: 335px;
  1425. height: 46px;
  1426. line-height: 46px;
  1427. text-align: center;
  1428. border-radius: 100px;
  1429. border: 1px solid #1D9BF0;
  1430. background: rgba(196, 196, 196, 0.01);
  1431. color: #1D9BF0;
  1432. font-size: 16px;
  1433. font-weight: 500;
  1434. cursor: pointer;
  1435. }
  1436. }
  1437. .success,
  1438. .close,
  1439. .luck-peopel-list {
  1440. filter: drop-shadow(0px 4px 94px rgba(0, 0, 0, 0.3));
  1441. width: 100%;
  1442. height: 100%;
  1443. border-radius: 11px;
  1444. background: #fff;
  1445. overflow: hidden;
  1446. display: flex;
  1447. flex-direction: column;
  1448. .close-title {
  1449. width: 100%;
  1450. font-weight: 600;
  1451. font-size: 27px;
  1452. line-height: 32px;
  1453. text-align: center;
  1454. letter-spacing: 0.3px;
  1455. color: #ffffff;
  1456. }
  1457. .head {
  1458. padding: 14px 16px;
  1459. img {
  1460. cursor: pointer;
  1461. width: 24px;
  1462. height: 24px;
  1463. }
  1464. }
  1465. .header {
  1466. text-align: center;
  1467. min-height: 150px;
  1468. width: 100%;
  1469. background: #fff;
  1470. // padding-top: 30px;
  1471. background-size: 100% 100%;
  1472. position: relative;
  1473. display: flex;
  1474. align-content: center;
  1475. flex-wrap: wrap;
  1476. .rabbit {
  1477. width: 100%;
  1478. height: 100%;
  1479. display: flex;
  1480. align-items: center;
  1481. align-content: center;
  1482. flex-wrap: wrap;
  1483. justify-content: center;
  1484. img {
  1485. width: 150px;
  1486. height: 80px;
  1487. margin-bottom: 6px;
  1488. }
  1489. p {
  1490. width: 100%;
  1491. margin: 0;
  1492. padding: 0;
  1493. color: #fff;
  1494. text-align: center;
  1495. font-weight: 600;
  1496. font-size: 15px;
  1497. letter-spacing: 0.3px;
  1498. }
  1499. }
  1500. .done {
  1501. cursor: pointer;
  1502. position: absolute;
  1503. top: 107px;
  1504. left: 50%;
  1505. margin-left: -150px;
  1506. width: 300px;
  1507. height: 60px;
  1508. display: flex;
  1509. align-items: center;
  1510. border-radius: 100px;
  1511. background: #ffffff;
  1512. box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1);
  1513. justify-content: center;
  1514. span {
  1515. color: #000000;
  1516. font-size: 14px;
  1517. }
  1518. .icon-done {
  1519. width: 24px;
  1520. height: 24px;
  1521. margin-right: 10px;
  1522. }
  1523. .icon-right {
  1524. margin-left: 5px;
  1525. width: 7px;
  1526. height: 14px;
  1527. }
  1528. }
  1529. .title {
  1530. margin-top: 30px;
  1531. color: #fff7e4;
  1532. opacity: 0.6;
  1533. font-weight: 700;
  1534. font-size: 18px;
  1535. line-height: 21px;
  1536. letter-spacing: -0.3px;
  1537. }
  1538. .money {
  1539. margin-bottom: 30px;
  1540. width: 100%;
  1541. display: flex;
  1542. justify-content: center;
  1543. align-items: center;
  1544. img {
  1545. width: 40px;
  1546. height: 40px;
  1547. margin-right: 9px;
  1548. }
  1549. .big {
  1550. font-weight: 700;
  1551. font-size: 46px;
  1552. line-height: 55px;
  1553. /* identical to box height */
  1554. letter-spacing: 0.3px;
  1555. color: #fff;
  1556. }
  1557. .small {
  1558. margin-left: 4px;
  1559. font-weight: 700;
  1560. font-size: 13px;
  1561. line-height: 16px;
  1562. /* identical to box height */
  1563. letter-spacing: 0.5px;
  1564. color: #fff;
  1565. }
  1566. }
  1567. }
  1568. .luck-list-title {
  1569. /* margin-top: 47px;*/
  1570. margin: 0 16px;
  1571. padding: 14px 0 11px 0;
  1572. background: #fff;
  1573. display: flex;
  1574. justify-content: space-between;
  1575. color: #B0B0B0;
  1576. border-bottom: 1px solid #F2F2F2;
  1577. div:last-child {
  1578. text-align: right;
  1579. }
  1580. .text {
  1581. cursor: pointer;
  1582. }
  1583. }
  1584. .luck-list {
  1585. background: #fff;
  1586. overflow: auto;
  1587. &.max {
  1588. height: 250px;
  1589. }
  1590. .empty {
  1591. width: 100%;
  1592. height: 100%;
  1593. text-align: center;
  1594. img {
  1595. margin-top: 90px;
  1596. width: 100px;
  1597. height: 100px;
  1598. }
  1599. }
  1600. .luck-item {
  1601. display: flex;
  1602. padding: 10px 0;
  1603. margin: 0 16px;
  1604. border-bottom: 1px solid #F2F2F2;
  1605. justify-content: space-between;
  1606. position: relative;
  1607. img:first-child {
  1608. border-radius: 50%;
  1609. }
  1610. .luck-king {
  1611. position: absolute;
  1612. top: 36px;
  1613. right: 0px;
  1614. display: flex;
  1615. align-items: center;
  1616. img {
  1617. width: 22px;
  1618. height: 19px;
  1619. margin: 0;
  1620. }
  1621. span {
  1622. font-weight: 500;
  1623. font-size: 12px;
  1624. line-height: 14px;
  1625. letter-spacing: 0.3px;
  1626. color: #f5b945;
  1627. }
  1628. }
  1629. img {
  1630. cursor: pointer;
  1631. width: 42px;
  1632. height: 42px;
  1633. margin-right: 12px;
  1634. }
  1635. .luck-content {
  1636. flex: auto;
  1637. .luck-title {
  1638. font-weight: 500;
  1639. font-size: 16px;
  1640. letter-spacing: 0.3px;
  1641. color: #444444;
  1642. }
  1643. .luck-time {
  1644. font-weight: 400;
  1645. font-size: 12px;
  1646. line-height: 14px;
  1647. color: #9b9b9b;
  1648. }
  1649. }
  1650. .luck-money {
  1651. display: flex;
  1652. height: 17px;
  1653. align-items: center;
  1654. height: 100%;
  1655. img {
  1656. width: 14px;
  1657. height: 14px;
  1658. margin-right: 6px;
  1659. }
  1660. .luck-money-txt {
  1661. font-weight: 500;
  1662. font-size: 14px;
  1663. word-break: break-all;
  1664. /* identical to box height */
  1665. text-align: right;
  1666. letter-spacing: 0.3px;
  1667. color: #444444;
  1668. }
  1669. }
  1670. }
  1671. .luck-item:last-child {
  1672. border: 0;
  1673. }
  1674. }
  1675. }
  1676. .success {
  1677. .luck-list-title {
  1678. margin-top: 17px;
  1679. margin-bottom: 11px;
  1680. border-bottom: 1px solid #D1D1D1;
  1681. }
  1682. }
  1683. .opened {
  1684. filter: drop-shadow(0px 4px 94px rgba(0, 0, 0, 0.3));
  1685. width: 100%;
  1686. height: 100%;
  1687. display: flex;
  1688. flex-direction: column;
  1689. justify-content: space-between;
  1690. border-radius: 11px;
  1691. overflow: hidden;
  1692. .header {
  1693. text-align: center;
  1694. min-height: 110px;
  1695. width: 100%;
  1696. background: #fff;
  1697. // padding-top: 30px;
  1698. background-size: 100% 100%;
  1699. display: flex;
  1700. flex-wrap: wrap;
  1701. align-content: center;
  1702. justify-content: center;
  1703. img {
  1704. width: 52px;
  1705. height: 52px;
  1706. margin-right: 14px;
  1707. }
  1708. .txt {
  1709. color: #FFFFFF;
  1710. font-weight: 700;
  1711. font-size: 18px;
  1712. letter-spacing: 0.3px;
  1713. p {
  1714. margin: 0;
  1715. padding: 0;
  1716. text-align: left;
  1717. }
  1718. }
  1719. }
  1720. .list {
  1721. padding: 0 16px 0 16px;
  1722. background: #ffffff;
  1723. flex: 1;
  1724. .item {
  1725. display: flex;
  1726. align-items: center;
  1727. min-height: 50px;
  1728. border-bottom: 1px solid #f0f0f0;
  1729. img {
  1730. width: 24px;
  1731. height: 24px;
  1732. }
  1733. .red-right {
  1734. width: 35px;
  1735. height: 24px;
  1736. }
  1737. .item-content {
  1738. width: 100%;
  1739. flex: 1;
  1740. .item-follow-title {
  1741. display: flex;
  1742. align-items: center;
  1743. margin-top: 20px;
  1744. margin-bottom: 11px;
  1745. position: relative;
  1746. .btn {
  1747. // position: absolute;
  1748. // right: 0;
  1749. }
  1750. }
  1751. .item-title {
  1752. flex: 1;
  1753. margin-left: 10px;
  1754. font-weight: 500;
  1755. font-size: 16px;
  1756. letter-spacing: 0.3px;
  1757. color: #000000;
  1758. }
  1759. .item-follow-area {
  1760. display: flex;
  1761. flex-wrap: wrap;
  1762. .item-follow {
  1763. cursor: pointer;
  1764. border: 1px solid #ebebeb;
  1765. border-radius: 1000px;
  1766. height: 26px;
  1767. margin-right: 5px;
  1768. margin-bottom: 5px;
  1769. display: flex;
  1770. align-items: center;
  1771. .finished {
  1772. text-decoration: line-through;
  1773. color: #949494;
  1774. }
  1775. span {
  1776. margin-left: 8px;
  1777. margin-right: 2px;
  1778. color: #1D9BF0;
  1779. opacity: 1;
  1780. }
  1781. img {
  1782. width: 16px;
  1783. height: 16px;
  1784. margin-right: 7px;
  1785. }
  1786. }
  1787. }
  1788. span {
  1789. font-weight: 400;
  1790. font-size: 11px;
  1791. line-height: 13px;
  1792. letter-spacing: 0.3px;
  1793. color: #000000;
  1794. opacity: 0.4;
  1795. }
  1796. }
  1797. .btn {
  1798. width: 90px;
  1799. height: 29px;
  1800. line-height: 29px;
  1801. background: rgba(56, 154, 255, 0.1);
  1802. border-radius: 500px;
  1803. text-align: center;
  1804. letter-spacing: 0.3px;
  1805. color: #1D9BF0;
  1806. cursor: pointer;
  1807. }
  1808. .loading-wrapper {
  1809. width: 90px;
  1810. text-align: center;
  1811. .icon-loading {
  1812. animation: loading 1s infinite linear;
  1813. }
  1814. }
  1815. }
  1816. }
  1817. .people {
  1818. cursor: pointer;
  1819. padding-left: 16px;
  1820. height: 38px;
  1821. line-height: 38px;
  1822. background: #fff;
  1823. box-shadow: 0px 1px 0px #f2f2f2;
  1824. display: flex;
  1825. align-items: center;
  1826. justify-content: space-between;
  1827. .txt {
  1828. width: 90%;
  1829. font-weight: 400;
  1830. font-size: 12px;
  1831. line-height: 14px;
  1832. letter-spacing: 0.3px;
  1833. color: #000000;
  1834. opacity: 0.4;
  1835. }
  1836. }
  1837. .footer {
  1838. background: #ffffff;
  1839. display: flex;
  1840. padding: 15px 22px 15px 17px;
  1841. .winner {
  1842. flex: 1;
  1843. height: 100%;
  1844. background: #fff;
  1845. align-items: center;
  1846. display: flex;
  1847. align-content: center;
  1848. flex-wrap: wrap;
  1849. p {
  1850. color: #959595;
  1851. font-size: 12px;
  1852. margin: 0;
  1853. padding: 0;
  1854. }
  1855. .right {
  1856. width: 100%;
  1857. height: 22px;
  1858. position: relative;
  1859. img {
  1860. position: absolute;
  1861. width: 22px;
  1862. height: 22px;
  1863. border: 2px solid #fff;
  1864. border-radius: 50%;
  1865. }
  1866. .more {
  1867. border: 0;
  1868. }
  1869. }
  1870. }
  1871. .btn {
  1872. background: #1D9BF0;
  1873. border-radius: 100px;
  1874. color: #fff;
  1875. width: 258px;
  1876. height: 52px;
  1877. font-weight: 600;
  1878. font-size: 18px;
  1879. line-height: 52px;
  1880. text-align: center;
  1881. cursor: pointer;
  1882. }
  1883. }
  1884. }
  1885. .not-open {
  1886. width: 100%;
  1887. height: 100%;
  1888. filter: drop-shadow(0px 2px 20px rgba(0, 0, 0, 0.1));
  1889. position: relative;
  1890. overflow: hidden;
  1891. border-radius: 11px;
  1892. .money-area {
  1893. width: 100%;
  1894. position: absolute;
  1895. top: 65px;
  1896. display: flex;
  1897. flex-wrap: wrap;
  1898. align-items: center;
  1899. justify-content: center;
  1900. .txt {
  1901. font-weight: 800;
  1902. font-size: 16px;
  1903. text-align: center;
  1904. letter-spacing: 0.3px;
  1905. color: #FFFFFF;
  1906. }
  1907. .coin {
  1908. text-align: center;
  1909. margin-top: 6px;
  1910. margin-bottom: 7px;
  1911. display: flex;
  1912. justify-content: center;
  1913. align-items: center;
  1914. width: 90%;
  1915. img {
  1916. width: 46px;
  1917. height: 46px;
  1918. border-radius: 50%;
  1919. border: 3px solid #FFFFFF;
  1920. }
  1921. span {
  1922. margin-left: 12px;
  1923. font-weight: 800;
  1924. font-size: 60px;
  1925. line-height: 76px;
  1926. color: #FFFFFF;
  1927. }
  1928. }
  1929. .people {
  1930. font-weight: 800;
  1931. font-size: 13px;
  1932. line-height: 16px;
  1933. letter-spacing: 0.05em;
  1934. text-align: center;
  1935. color: #FFFFFF;
  1936. }
  1937. }
  1938. .title {
  1939. position: absolute;
  1940. top: 15px;
  1941. left: 15px;
  1942. z-index: 3;
  1943. display: flex;
  1944. align-items: center;
  1945. img {
  1946. width: 24px;
  1947. height: 24px;
  1948. border: 2px solid #FFF;
  1949. border-radius: 50%;
  1950. }
  1951. span {
  1952. margin-left: 10px;
  1953. font-weight: 600;
  1954. font-size: 16px;
  1955. letter-spacing: 0.3px;
  1956. color: #fff;
  1957. }
  1958. }
  1959. // .txt {
  1960. // width: 100%;
  1961. // position: absolute;
  1962. // font-style: normal;
  1963. // font-weight: 700;
  1964. // font-size: 42px;
  1965. // line-height: 50px;
  1966. // text-align: center;
  1967. // color: #FFF2D3;
  1968. // top: 90px;
  1969. // z-index: 3;
  1970. // }
  1971. img {
  1972. width: 100%;
  1973. }
  1974. .up {
  1975. position: absolute;
  1976. top: 0;
  1977. // box-shadow: 0px 4px 44px rgba(0, 0, 0, 0.1);
  1978. z-index: 1;
  1979. }
  1980. .down {
  1981. position: absolute;
  1982. top: 253px;
  1983. }
  1984. .open {
  1985. width: 335px;
  1986. height: 50px;
  1987. cursor: pointer;
  1988. position: absolute;
  1989. bottom: 28px;
  1990. left: 50%;
  1991. margin-left: -167.5px;
  1992. z-index: 4;
  1993. }
  1994. .open-gif {
  1995. width: 200px;
  1996. height: 200px;
  1997. text-align: center;
  1998. position: absolute;
  1999. bottom: 70px;
  2000. left: 50%;
  2001. margin-left: -100px;
  2002. z-index: 3;
  2003. }
  2004. }
  2005. @keyframes loading {
  2006. from {
  2007. transform: rotate(0deg);
  2008. }
  2009. to {
  2010. transform: rotate(360deg);
  2011. }
  2012. }
  2013. }
  2014. .none {
  2015. display: flex;
  2016. align-item: center;
  2017. justify-content: center;
  2018. width: 100%;
  2019. height: 100%;
  2020. }
  2021. </style>