red-packet.vue 51 KB

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