index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. <template>
  2. <div class="content" :style="{ 'backgroundImage': `url(${this.back_img})` }">
  3. <div class="logo">
  4. <img src="/svg/icon-logo.svg" alt />
  5. </div>
  6. <!-- 红包 -->
  7. <div class="redPacket">
  8. <div class="area" v-show="area_show">
  9. <div class="title">
  10. <img :src="detail.postBizData.postUserInfo.avatarUrl" alt />
  11. <span>Giveaways from: {{ detail.postBizData.postUserInfo.nickName }}</span>
  12. </div>
  13. <div class="txt">Good Luck!</div>
  14. </div>
  15. <img src="/svg/back-top.svg" alt class="top" />
  16. <img src="/svg/back-down.svg" alt class="down" />
  17. <img src="/svg/icon-usd.svg" alt class="start" v-show="area_show" />
  18. <!-- 内容 -->
  19. <div class="head">
  20. <div class="head-title">
  21. <img :src="detail.postBizData.postUserInfo.avatarUrl" alt />
  22. <span>Giveaways from: {{ detail.postBizData.postUserInfo.nickName }}</span>
  23. </div>
  24. <div class="head-txt" v-if="status == 'open'">Awesome! You Will Get</div>
  25. <div class="head-txt" v-else-if="status == 'nothing'">Better luck next time!</div>
  26. <div class="head-txt" v-else-if="status == 'opened'">领取过了!</div>
  27. <div class="head-txt" v-else-if="status == 'expire'">This Giveways expired on 03-14</div>
  28. <div class="head-money" v-if="status == 'open'">
  29. <img src="/svg/icon-usd.svg" alt />
  30. <span class="money-txt">1.753</span>
  31. <div>
  32. <span>USD</span>
  33. </div>
  34. </div>
  35. </div>
  36. <div class="luck-list-title">
  37. <div>{{ detail.postBizData.receiveCount || 0 }}/{{ detail.postBizData.totalCount || 0 }} People Got</div>
  38. <div>Total ${{ detail.postBizData.amountValue / 100 || '' }} {{ detail.postBizData.amountCurrencyCode || '' }}</div>
  39. </div>
  40. <div class="luck-list" @scroll="handleScroll" ref="list">
  41. <div class="luck-item" v-for="item, i in luck_list" v-bind:key="i">
  42. <img v-if="item.simpleUserInfoVO.avatarUrl" :src="item.simpleUserInfoVO.avatarUrl" alt />
  43. <img v-else src="/svg/icon-twitter.svg" alt />
  44. <div class="luck-content">
  45. <div class="luck-title">{{ item.simpleUserInfoVO.nickName || 'Twitter User' }}</div>
  46. <div class="luck-time" v-if="item.finishTimestamp == -1">刚刚</div>
  47. <div class="luck-time" v-else>{{ item.finishTimestamp }}</div>
  48. </div>
  49. <div class="luck-money">
  50. <img src="/svg/icon-usd.svg" alt />
  51. <div class="luck-money-txt">{{ item.amountValue / 100 }}</div>
  52. </div>
  53. <div class="luck-king" v-if="item.maxAmount">
  54. <img src="/svg/icon-king-hat.svg" alt />
  55. <span>Luckiest Draw</span>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. <!-- 安装 -->
  61. <div class="install" v-show="status == 'open'">
  62. <div class="title">Withdraw to Wallet</div>
  63. <div class="validity">
  64. <span>Validity</span>
  65. <span style="color: red;">23:57:32</span>
  66. </div>
  67. <div class="flow">
  68. <div class="line"></div>
  69. <div class="area_num">
  70. <div class="num">1</div>
  71. <span>Install DeNet</span>
  72. </div>
  73. <div class="tip">Used for Task Verification and Giveaways Withdrawal</div>
  74. <div class="install_btn">Install</div>
  75. <div class="area_num">
  76. <div class="num">2</div>
  77. <span>Complete Tasks by {{ detail.postBizData.postUserInfo.nickName }}</span>
  78. </div>
  79. <div class="tip">Follow、Like tweet、Retweet (Just 1-3 minutes)</div>
  80. </div>
  81. </div>
  82. <div class="install no-chrome" v-show="status == 'opened'">
  83. <div>Install DeNet</div>
  84. <div>Don't miss the next Giveaway</div>
  85. <div class="tip">Used for Task Verification and Giveaways Withdrawal</div>
  86. <div class="install_btn">Install</div>
  87. <div class="install_chrome">
  88. <img src="/svg/icon-chrome.svg" alt />
  89. Install Chrome
  90. </div>
  91. </div>
  92. </div>
  93. </template>
  94. <script>
  95. import axios from 'axios';
  96. import Cookies from 'js-cookie'
  97. export default {
  98. name: "index",
  99. data() {
  100. return {
  101. back_img: '/svg/back-denet.svg',
  102. area_show: true,
  103. detail: {
  104. postId: '',
  105. postBizData: {
  106. imagePath: ''
  107. }
  108. },
  109. title: '',
  110. twitterTitle: 'deNet',
  111. jumpUrl: 'https://de-net-test.piaoquantv.com/',
  112. status: '',
  113. page_index: 1,
  114. page_size: 20,
  115. luck_list: [],
  116. luck_list_end: false,
  117. received_log: []
  118. }
  119. },
  120. head() {
  121. return {
  122. type: '',
  123. title: this.title,
  124. meta: [
  125. {
  126. name: 'twitter:card',
  127. content: 'summary_large_image'
  128. },
  129. {
  130. name: 'twitter:url',
  131. content: this.jumpUrl + this.detail.postId
  132. },
  133. {
  134. name: 'twitter:title',
  135. content: this.twitterTitle
  136. },
  137. {
  138. name: 'twitter:image',
  139. content: this.detail.postBizData.imagePath || ''
  140. },
  141. {
  142. name: 'twitter:image:width',
  143. content: '1280'
  144. },
  145. {
  146. name: 'twitter:image:height',
  147. content: '720'
  148. },
  149. ]
  150. }
  151. },
  152. methods: {
  153. handleScroll(e) {
  154. if (this.luck_list_end) {
  155. return
  156. }
  157. if ((this.$refs.list.clientHeight + this.$refs.list.scrollTop) / this.$refs.list.scrollHeight > .8) {
  158. this.luck_list_end = false
  159. this.page_index++
  160. this.getReceivedList()
  161. }
  162. },
  163. async getRedPacket() {
  164. this.received_log = Cookies.get('received_log') || []
  165. // 判断领取过
  166. if (this.received_log.length > 0) {
  167. this.received_log = JSON.parse(this.received_log)
  168. let _len = this.received_log.filter((item) => { return item.postId == this.detail.postId }).length
  169. if (_len) {
  170. // 领取过了
  171. this.status = 'opened'
  172. // 领取列表分页
  173. this.getReceivedList()
  174. return
  175. }
  176. }
  177. // return
  178. let { data } = await axios.post('https://denettestapi.piaoquantv.com/denet/post/luckdrop/receiveLuckdrop', {
  179. baseInfo: {
  180. },
  181. params: {
  182. postId: this.detail.postId || ''
  183. }
  184. })
  185. switch (data.code.toString()) {
  186. case '0':
  187. let _obj = {
  188. postId: this.detail.postId,
  189. receivedId: data.data.receivedId
  190. }
  191. this.received_log.push(_obj)
  192. Cookies.set('received_log', JSON.stringify(this.received_log), { expires: 100 });
  193. break;
  194. // 红包被领完了
  195. case '2008':
  196. this.status = 'nothing'
  197. break
  198. case '2029':
  199. // 推文未发布
  200. break
  201. default:
  202. console.log('getRedPacket', data)
  203. break;
  204. }
  205. // 领取列表分页
  206. this.getReceivedList()
  207. },
  208. async getReceivedList() {
  209. let { data } = await axios.post('https://denettestapi.piaoquantv.com/denet/post/luckdrop/getReceivedList', {
  210. params: {
  211. pageNum: this.page_index,
  212. pageSize: this.page_size,
  213. postId: this.detail.postId || ''
  214. }
  215. })
  216. if (data.code == 0) {
  217. if (data.data.length > 0) {
  218. this.luck_list = this.luck_list.concat(data.data)
  219. this.luck_list_end = false
  220. } else {
  221. this.luck_list_end = true
  222. }
  223. } else {
  224. console.log('getReceivedList', data)
  225. }
  226. },
  227. },
  228. async asyncData(params) {
  229. let { route } = params;
  230. let { data } = await axios.post('https://denettestapi.piaoquantv.com/denet/post/getDetail', {
  231. baseInfo: {
  232. token: ''
  233. },
  234. params: {
  235. postId: route.params.id || ''
  236. }
  237. })
  238. if (data.code == 0) {
  239. if (data.data && data.data.postBizData && typeof data.data.postBizData == 'string') {
  240. data.data.postBizData = JSON.parse(data.data.postBizData)
  241. }
  242. return {
  243. detail: data.data,
  244. }
  245. }
  246. },
  247. mounted() {
  248. //改变font-size
  249. (function (doc, win) {
  250. var docEI = doc.documentElement,
  251. resizeEvt = 'orientationchange' in window ? 'orientataionchange' : 'resize',
  252. recalc = function () {
  253. var clientWidth = docEI.clientWidth;
  254. if (!clientWidth) return;
  255. //100是字体大小,1510是开发时浏览器窗口的宽度,等比计算
  256. docEI.style.fontSize = 10 * (clientWidth / 1510) + 'px';
  257. }
  258. if (!doc.addEventListener) return;
  259. win.addEventListener(resizeEvt, recalc, false);
  260. doc.addEventListener('DOMContentLoaded', recalc, false);
  261. })(document, window);
  262. setTimeout(() => {
  263. this.area_show = false
  264. }, 1000)
  265. // 领取任务红包
  266. this.getRedPacket()
  267. }
  268. }
  269. </script>
  270. <style lang="scss" >
  271. html,
  272. body,
  273. #__nuxt,
  274. #__layout {
  275. width: 100%;
  276. height: 100%;
  277. padding: 0;
  278. margin: 0;
  279. }
  280. .content {
  281. width: 100%;
  282. height: 100%;
  283. background-size: 100%;
  284. background-repeat: no-repeat;
  285. position: relative;
  286. font-family: "SF Pro Display";
  287. font-style: normal;
  288. font-weight: 600;
  289. .logo {
  290. position: absolute;
  291. left: 4rem;
  292. top: 1.5rem;
  293. img {
  294. width: 107px;
  295. height: 40px;
  296. }
  297. }
  298. .redPacket {
  299. display: flex;
  300. justify-content: flex-start;
  301. flex-direction: column;
  302. position: absolute;
  303. top: 9rem;
  304. left: 50%;
  305. width: 37.5rem;
  306. margin-left: -18rem;
  307. height: 65rem;
  308. border-radius: 2rem;
  309. // background: red;
  310. overflow: hidden;
  311. animation: key_packet 3s;
  312. animation-delay: 6s;
  313. animation-fill-mode: forwards;
  314. box-shadow: 0 0 5px #888888;
  315. .start {
  316. position: absolute;
  317. width: 10rem;
  318. height: 10rem;
  319. bottom: 24rem;
  320. left: 50%;
  321. margin-left: -5rem;
  322. z-index: 3;
  323. }
  324. .top {
  325. top: 0;
  326. position: absolute;
  327. width: 100%;
  328. z-index: 1;
  329. animation: key_top 4s;
  330. animation-delay: 2s;
  331. animation-fill-mode: forwards;
  332. }
  333. .down {
  334. bottom: 0;
  335. position: absolute;
  336. height: 32.3rem;
  337. animation: key_down 4s;
  338. animation-delay: 2s;
  339. animation-fill-mode: forwards;
  340. }
  341. .head {
  342. .head-title {
  343. height: 9.7rem;
  344. line-height: 9.7rem;
  345. background: #ef4545;
  346. text-align: center;
  347. border-radius: 0 586px 586px/0 0 104px 104px;
  348. overflow: hidden;
  349. box-shadow: 0 0 5px #888888;
  350. img {
  351. width: 3rem;
  352. height: 3rem;
  353. border-radius: 50%;
  354. border: 2px solid #fff4db;
  355. }
  356. span {
  357. font-size: 1.4rem;
  358. color: #fff2d3;
  359. }
  360. }
  361. .head-txt {
  362. margin-top: 4.7rem;
  363. font-size: 2rem;
  364. text-align: center;
  365. color: #ef4545;
  366. }
  367. .head-money {
  368. display: flex;
  369. align-items: center;
  370. justify-content: center;
  371. img {
  372. width: 4rem;
  373. height: 4rem;
  374. }
  375. span {
  376. font-size: 1.3rem;
  377. }
  378. .money-txt {
  379. font-weight: 700;
  380. font-size: 4.8rem;
  381. color: #000000;
  382. letter-spacing: 0.3px;
  383. }
  384. }
  385. }
  386. .luck-list-title {
  387. padding: 0 16px;
  388. background: #fff;
  389. color: #9b9b9b;
  390. display: flex;
  391. justify-content: space-between;
  392. }
  393. .luck-list {
  394. background: #fff;
  395. flex: 1;
  396. overflow: scroll;
  397. .luck-item {
  398. display: flex;
  399. padding: 12px 16px;
  400. border-top: 1px solid #d1d1d1;
  401. justify-content: space-between;
  402. position: relative;
  403. img:first-child {
  404. border-radius: 50%;
  405. }
  406. .luck-king {
  407. position: absolute;
  408. top: 36px;
  409. right: 16px;
  410. display: flex;
  411. align-items: center;
  412. img {
  413. width: 22px;
  414. height: 19px;
  415. margin: 0;
  416. }
  417. span {
  418. font-weight: 500;
  419. font-size: 12px;
  420. line-height: 14px;
  421. letter-spacing: 0.3px;
  422. color: #f5b945;
  423. }
  424. }
  425. img {
  426. width: 42px;
  427. height: 42px;
  428. margin-right: 12px;
  429. }
  430. .luck-content {
  431. flex: auto;
  432. .luck-title {
  433. font-weight: 500;
  434. font-size: 16px;
  435. letter-spacing: 0.3px;
  436. color: #444444;
  437. }
  438. .luck-time {
  439. font-weight: 400;
  440. font-size: 12px;
  441. line-height: 14px;
  442. color: #9b9b9b;
  443. }
  444. }
  445. .luck-money {
  446. display: flex;
  447. height: 17px;
  448. align-items: center;
  449. img {
  450. width: 14px;
  451. height: 14px;
  452. margin-right: 6px;
  453. }
  454. .luck-money-txt {
  455. font-weight: 500;
  456. font-size: 14px;
  457. /* identical to box height */
  458. text-align: right;
  459. letter-spacing: 0.3px;
  460. color: #444444;
  461. }
  462. }
  463. }
  464. }
  465. .area {
  466. position: absolute;
  467. z-index: 2;
  468. width: 100%;
  469. .title {
  470. z-index: 11;
  471. margin-top: 8.5rem;
  472. text-align: center;
  473. img {
  474. width: 3rem;
  475. height: 3rem;
  476. border: 2px solid #fff4db;
  477. }
  478. span {
  479. letter-spacing: 0.3px;
  480. font-size: 1.6rem;
  481. color: #fff2d3;
  482. }
  483. }
  484. .txt {
  485. font-size: 4rem;
  486. text-align: center;
  487. letter-spacing: 0.03rem;
  488. color: #fff2d3;
  489. }
  490. }
  491. }
  492. .install {
  493. position: absolute;
  494. top: 20rem;
  495. right: 28.5rem;
  496. opacity: 0;
  497. animation: key_install 2s;
  498. animation-delay: 6s;
  499. animation-fill-mode: forwards;
  500. .title {
  501. font-size: 4.8rem;
  502. color: #000000;
  503. letter-spacing: 0.3px;
  504. }
  505. .validity {
  506. margin-top: 2rem;
  507. background: rgba(166, 166, 166, 0.1);
  508. width: 40rem;
  509. height: 3.3rem;
  510. line-height: 3.3rem;
  511. span {
  512. color: #000000;
  513. font-size: 1.4rem;
  514. }
  515. }
  516. .flow {
  517. position: absolute;
  518. margin-top: 4.6rem;
  519. .line {
  520. position: absolute;
  521. height: 16rem;
  522. border: 1px solid #e0e0e0;
  523. top: 3rem;
  524. left: 1.2rem;
  525. }
  526. .area_num {
  527. display: flex;
  528. align-items: center;
  529. .num {
  530. width: 2.4rem;
  531. height: 2.4rem;
  532. background-color: rgba(56, 154, 255, 1);
  533. border-radius: 50%;
  534. color: #fff;
  535. text-align: center;
  536. line-height: 2.4rem;
  537. font-size: 1.4rem;
  538. }
  539. span {
  540. margin-left: 1.5rem;
  541. color: #000000;
  542. font-size: 1.8rem;
  543. }
  544. }
  545. .tip {
  546. margin-left: 4rem;
  547. margin-top: 0.7rem;
  548. font-size: 1.4rem;
  549. color: #a4a4a4;
  550. }
  551. .install_btn {
  552. margin-left: 4rem;
  553. margin-top: 2rem;
  554. margin-bottom: 6.7rem;
  555. width: 23rem;
  556. height: 5.8rem;
  557. background: #389aff;
  558. border-radius: 10rem;
  559. color: #fff;
  560. line-height: 5.8rem;
  561. text-align: center;
  562. }
  563. }
  564. }
  565. }
  566. @keyframes key_install {
  567. 0% {
  568. opacity: 0.1;
  569. }
  570. 100% {
  571. opacity: 1;
  572. }
  573. }
  574. @keyframes key_packet {
  575. 0% {
  576. }
  577. 100% {
  578. left: 30.6rem;
  579. margin-left: -18rem;
  580. }
  581. }
  582. @keyframes key_top {
  583. 0% {
  584. top: 0;
  585. }
  586. 50% {
  587. top: -30rem;
  588. }
  589. 100% {
  590. top: -36rem;
  591. }
  592. }
  593. @keyframes key_down {
  594. 0% {
  595. bottom: 0;
  596. }
  597. 50% {
  598. bottom: -28.3rem;
  599. }
  600. 100% {
  601. bottom: -32.3rem;
  602. }
  603. }
  604. </style>