red-packet.vue 57 KB

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