red-packet.vue 57 KB

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