luckdraw.vue 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228
  1. <!-- 红包玩法落地页 -->
  2. <template>
  3. <div class="content">
  4. <template v-if="isLoading">
  5. <img
  6. class="loading"
  7. src="../static/svg/icon-loading.svg" />
  8. </template>
  9. <template v-else>
  10. <template v-if="isMobile">
  11. <!-- 手机端 -->
  12. <div class="small" :class="{
  13. bg: status === 'not-open',
  14. custom: detail.postBizData.posterType === 2 && detail.postBizData.customPosterInstalled,
  15. }">
  16. <template v-if="status === 'not-open'">
  17. <template v-if="detail.postBizData.posterType === 2 && detail.postBizData.customPosterInstalled">
  18. <img class="customImg" :src="detail.postBizData.customPosterInstalled" />
  19. </template>
  20. <template v-else>
  21. <template v-if="isMoneyPrize">
  22. <img class="lottery" :src=" require('../static/svg/icon-luck-mark.svg') " />
  23. <div class="head">
  24. <img :src="detail.postBizData.postUserInfo.avatarUrl" />
  25. <span>{{ detail.postBizData.postUserInfo.nickName }}</span>
  26. </div>
  27. <div class="price">
  28. <div class="usdt">{{ detail.postBizData.currencySymbol }} GIVEAWAY</div>
  29. <div class="money">
  30. <img :src="detail.postBizData.currencyIconPath" />
  31. <font-amount :fontSize="60" :amount="detail.postBizData.amountValue"></font-amount>
  32. </div>
  33. </div>
  34. <div class="time">
  35. <img class="img" :src=" require('../static/svg/icon-time.svg') " />
  36. {{ validity || '00:00:00' }}
  37. </div>
  38. <div class="box">
  39. <img src="../static/subject/icon-box.png" />
  40. </div>
  41. </template>
  42. <template v-else>
  43. <custom-card-cover
  44. :totalCount="detail.postBizData.totalCount"
  45. :amountValue="detail.postBizData.amountValue"
  46. :tokenSymbol="detail.postBizData.tokenSymbol"
  47. :currencyIconUrl="detail.postBizData.iconPath"
  48. :playType="2"
  49. :validity="validity"
  50. :userInfo="{
  51. nickName: detail.postBizData.postUserInfo.nickName,
  52. avatarUrl: detail.postBizData.postUserInfo.avatarUrl
  53. }"
  54. :rewardType="detail.postBizData.rewardType"
  55. :customizedReward="detail.postBizData.customizedReward"
  56. :showBottomInfo="false"
  57. ></custom-card-cover>
  58. </template>
  59. </template>
  60. </template>
  61. <template v-else>
  62. <div class="succTop">
  63. <template v-if="status === 'opened'">
  64. <img class="img" :src=" require('../static/svg/icon-luck-rabbit.svg') " />
  65. <p class="tips">Good Luck Next Time!</p>
  66. </template>
  67. <template v-else-if="status === 'expire'">
  68. <!-- <img class="img" :src=" require('../static/svg/icon-luck-complete.svg') " />
  69. <p class="tips">This Draw is Complete</p> -->
  70. <p class="expire">This Giveaways<br/>expired on {{ formatTime(detail.postBizData.endTimestamp, 'MM-DD') }}</p>
  71. </template>
  72. <template v-else>
  73. <p class="win">🎉 Awesome! You Will Get</p>
  74. <div class="win-money">
  75. <img :src="detail.postBizData.currencyIconPath" />
  76. <font-amount :fontSize="46" :amount="receiveAmount"></font-amount>
  77. </div>
  78. </template>
  79. </div>
  80. <div class="succTitle">
  81. <span>{{ detail.postBizData.receiveCount || 0 }}/{{ detail.postBizData.totalCount || 0 }} Winners</span>
  82. <span v-if="isMoneyPrize">{{ detail.postBizData.receiveAmountValue }} / {{ detail.postBizData.amountValue || '' }} {{ detail.postBizData.currencySymbol || '' }}</span>
  83. </div>
  84. <div class="luck-list" @scroll="handleScroll($event)">
  85. <div class="luck-item" v-for="item, i in luck_list" v-bind:key="i">
  86. <div class="userLogo">
  87. <img class="medal" v-if="i < 2" :src=" require('../static/svg/icon-medal-' + i + '.svg') " />
  88. <img class="header" v-if="item.simpleUserInfoVO.avatarUrl" :src="item.simpleUserInfoVO.avatarUrl" alt />
  89. <img class="header" v-else src="/svg/icon-twitter.svg" alt />
  90. </div>
  91. <div class="luck-content">
  92. <div class="luck-title">{{ item.simpleUserInfoVO.nickName || 'Twitter User' }}</div>
  93. <div class="luck-time">{{ formatTime(item.receiveTimestamp, 'MM-DD HH:mm') }}</div>
  94. </div>
  95. <div class="luck-money" v-if="isMoneyPrize">
  96. <img :src="item.currencyIconPath" alt />
  97. <div class="luck-money-txt">{{ item.amountValue || 0 }}</div>
  98. </div>
  99. <div class="luck-custom-prize" v-else>winner</div>
  100. <div class="luck-king" v-if="isMoneyPrize && item.maxAmount">
  101. <img src="/svg/icon-king-hat.svg" alt />
  102. <span>Luckiest Draw</span>
  103. </div>
  104. </div>
  105. </div>
  106. </template>
  107. <div class="area-cp-link">
  108. <div class="area-list">
  109. <div class="item">
  110. <div class="icon"><img :src=" require('../static/subject/01.svg') " /></div>
  111. <div class="font">Complete the tasks on tweet</div>
  112. </div>
  113. <div class="item">
  114. <div class="icon"><img :src=" require('../static/subject/02.svg') " /></div>
  115. <div class="font">Open link on PC to draw</div>
  116. <div class="pc"><img :src=" require('../static/subject/pc.svg') " /></div>
  117. </div>
  118. </div>
  119. <div class="area-content">
  120. {{ linkHref }}
  121. </div>
  122. <div class="area-btn">
  123. <div class="btn" :data-clipboard-text="linkHref">Copy Link</div>
  124. </div>
  125. </div>
  126. <div class="layer" v-show="layer_show">
  127. <div class="layer-box">
  128. <div class="layer-txt">Unable to copy, please enter the link manually</div>
  129. <div class="layer-btn" @click="layer_show = false">Done</div>
  130. </div>
  131. </div>
  132. </div>
  133. </template>
  134. <!-- PC端 -->
  135. <template v-else>
  136. <div class="logo">
  137. <img src="/img/icon-logo.png" />
  138. </div>
  139. <div class="show">
  140. <div class="center">
  141. <div class="head-in-custom" v-if="!isMoneyPrize">
  142. <img :src="detail.postBizData.postUserInfo.avatarUrl" />
  143. <span>{{ detail.postBizData.postUserInfo.nickName }}</span>
  144. </div>
  145. <div class="giveaway" :class="{
  146. bg: status === 'not-open',
  147. custom: detail.postBizData.posterType === 2 && detail.postBizData.customPosterInstalled,
  148. 'auto-height': !isMoneyPrize
  149. }">
  150. <div v-if="status === 'not-open'">
  151. <template v-if="detail.postBizData.posterType === 2 && detail.postBizData.customPosterInstalled">
  152. <img class="customImg" :src="detail.postBizData.customPosterInstalled" />
  153. <div class="customBottom">
  154. <div class="theme">
  155. <img class="icon" :src="require('../static/svg/icon-last-time.svg')"/>
  156. <span class="time2">{{ validity || '00:00:00' }}</span>
  157. <span class="info">Left</span>
  158. </div>
  159. <div class="winner-info">
  160. <span class="count">{{detail.postBizData.totalCount}} Winners</span>
  161. <span>to Share </span>
  162. <span class="prize-name">{{detail.postBizData.amountValue + ' ' + detail.postBizData.currencySymbol}}</span>
  163. </div>
  164. </div>
  165. </template>
  166. <template v-else>
  167. <!-- 旧版 样式,后续更新时在 custom-card-cover 公共组件内维护-->
  168. <template v-if="isMoneyPrize">
  169. <img class="lottery" :src=" require('../static/svg/icon-luck-mark.svg') " />
  170. <div class="head">
  171. <img :src="detail.postBizData.postUserInfo.avatarUrl" />
  172. <span>{{ detail.postBizData.postUserInfo.nickName }}</span>
  173. </div>
  174. <div class="price">
  175. <div class="usdt">{{ detail.postBizData.currencySymbol }} GIVEAWAY</div>
  176. <div class="money">
  177. <img :src="detail.postBizData.currencyIconPath" />
  178. <font-amount :fontSize="60" :amount="detail.postBizData.amountValue"></font-amount>
  179. </div>
  180. </div>
  181. <div class="time">
  182. <img class="img" :src=" require('../static/svg/icon-time.svg') " />
  183. {{ validity || '00:00:00' }}
  184. </div>
  185. <div class="box">
  186. <img src="../static/subject/icon-box.png" />
  187. </div>
  188. </template>
  189. <template v-else>
  190. <custom-card-cover
  191. :totalCount="detail.postBizData.totalCount"
  192. :amountValue="detail.postBizData.amountValue"
  193. :tokenSymbol="detail.postBizData.tokenSymbol"
  194. :currencyIconUrl="detail.postBizData.iconPath"
  195. :playType="2"
  196. :validity="validity"
  197. :userInfo="{
  198. nickName: detail.postBizData.postUserInfo.nickName,
  199. avatarUrl: detail.postBizData.postUserInfo.avatarUrl
  200. }"
  201. :rewardType="detail.postBizData.rewardType"
  202. :customizedReward="detail.postBizData.customizedReward"
  203. :showBottomInfo="true"
  204. ></custom-card-cover>
  205. </template>
  206. </template>
  207. </div>
  208. <template v-else>
  209. <div class="succTop">
  210. <template v-if="status === 'opened'">
  211. <img class="img" :src=" require('../static/svg/icon-luck-rabbit.svg') " />
  212. <p class="tips">Good Luck Next Time!</p>
  213. </template>
  214. <template v-else-if="status === 'expire'">
  215. <!-- <img class="img" :src=" require('../static/svg/icon-luck-complete.svg') " />
  216. <p class="tips">This Draw is Complete</p> -->
  217. <p class="expire">This Giveaways<br/>expired on {{ formatTime(detail.postBizData.endTimestamp, 'MM-DD') }}</p>
  218. </template>
  219. <template v-else>
  220. <p class="win">🎉 Awesome! You are Winner!</p>
  221. <div class="win-money">
  222. <img :src="detail.postBizData.currencyIconPath" />
  223. <font-amount :fontSize="46" :amount="receiveAmount"></font-amount>
  224. </div>
  225. </template>
  226. </div>
  227. <div class="succTitle">
  228. <span>{{ detail.postBizData.receiveCount || 0 }}/{{ detail.postBizData.totalCount || 0 }} Winners</span>
  229. <span v-if="isMoneyPrize">{{ detail.postBizData.receiveAmountValue }} / {{ detail.postBizData.amountValue || '' }} {{ detail.postBizData.currencySymbol || '' }}</span>
  230. </div>
  231. <div class="luck-list" @scroll="handleScroll($event)">
  232. <div class="luck-item" v-for="item, i in luck_list" v-bind:key="i">
  233. <div class="userLogo">
  234. <img class="medal" v-if="i < 2" :src=" require('../static/svg/icon-medal-' + i + '.svg') " />
  235. <img class="header" v-if="item.simpleUserInfoVO.avatarUrl" :src="item.simpleUserInfoVO.avatarUrl" alt />
  236. <img class="header" v-else src="/svg/icon-twitter.svg" alt />
  237. </div>
  238. <div class="luck-content">
  239. <div class="luck-title">{{ item.simpleUserInfoVO.nickName || 'Twitter User' }}</div>
  240. <div class="luck-time">{{ formatTime(item.receiveTimestamp, 'MM-DD HH:mm') }}</div>
  241. </div>
  242. <div class="luck-money" v-if="isMoneyPrize">
  243. <img :src="item.currencyIconPath" alt />
  244. <div class="luck-money-txt">{{ item.amountValue || 0 }}</div>
  245. </div>
  246. <div class="luck-custom-prize" v-else>winner</div>
  247. <div class="luck-king" v-if="isMoneyPrize && item.maxAmount">
  248. <img src="/svg/icon-king-hat.svg" alt />
  249. <span>Luckiest Draw</span>
  250. </div>
  251. </div>
  252. </div>
  253. </template>
  254. </div>
  255. <div class="desc">
  256. <template v-if="isChrome">
  257. <template v-if="status === 'not-open'">
  258. <div class="title">Install DeNet Plugin<br/>to Draw Prizes</div>
  259. <div class="issue">DeNet will detect task situation to issue Giveaway</div>
  260. </template>
  261. <template v-else>
  262. <div class="title">Install the Denet plugin<br/>to not miss the next draw</div>
  263. </template>
  264. <img class="button" @click="installExtension" src="../static/svg/icon-install-nft-plugin.svg" />
  265. </template>
  266. <template v-else>
  267. <div class="title">Get Giveaway<br />with chrome</div>
  268. <div class="issue">Only supports getting Giveaways through chrome</div>
  269. <img class="button" @click="clickOpenChrome" src="../static/svg/icon-install-nft-chrome.svg" />
  270. </template>
  271. </div>
  272. </div>
  273. </div>
  274. </template>
  275. </template>
  276. </div>
  277. </template>
  278. <script>
  279. import axios from 'axios'
  280. import Cookies from 'js-cookie'
  281. import { Toast } from 'vant';
  282. import { isBrowser, appType, appVersionCode, formatSecondsAsDaysOrTime } from '../utils/help.js'
  283. import FontAmount from '../components/FontAmount.vue'
  284. import CustomCardCover from '../components/CustomCardCover.vue'
  285. import { RewardType } from '../types';
  286. var moment = require('moment');
  287. var ClipboardJS = require('clipboard')
  288. const api = {
  289. prod: 'https://api.denetme.net',
  290. pre: 'https://preapi.denetme.net',
  291. test: 'https://testapi.denetme.net'
  292. }
  293. const page = {
  294. prod: "https://h5.denetme.net",
  295. pre: "https://preh5.denetme.net",
  296. test: 'https://testh5.denetme.net'
  297. }
  298. const jumpUrl = page[process.env.NUXT_ENV.MODE] + '/'
  299. const baseURL = api[process.env.NUXT_ENV.MODE]
  300. export default {
  301. name: 'luckdraw',
  302. components: {
  303. FontAmount,CustomCardCover
  304. },
  305. head() {
  306. return {
  307. type: '',
  308. title: this.title,
  309. appVersionCode: 3,
  310. meta: [
  311. // facebook
  312. {
  313. name: 'og:url',
  314. content: this.jumpUrl + 'luckdraw/' + this.detail.postId
  315. },
  316. {
  317. name: 'og:title',
  318. content: this.metaTitle
  319. },
  320. {
  321. name: 'og:image',
  322. content: this.detail.postBizData.imagePath || this.detail.postBizData.customPosterUninstalled || ''
  323. },
  324. // twitter
  325. {
  326. name: 'twitter:card',
  327. content: 'summary_large_image'
  328. },
  329. {
  330. name: 'twitter:url',
  331. content: this.jumpUrl + 'luckdraw/' + this.detail.postId
  332. },
  333. {
  334. name: 'twitter:title',
  335. content: this.metaTitle
  336. },
  337. {
  338. name: 'twitter:image',
  339. content: this.detail.postBizData.imagePath || this.detail.postBizData.customPosterUninstalled || ''
  340. }
  341. ]
  342. }
  343. },
  344. data() {
  345. return {
  346. detail: {
  347. postId: '',
  348. postBizData: {
  349. imagePath: '',
  350. postUserInfo: {},
  351. amountValue: '0',
  352. }
  353. },
  354. luck_list: [],
  355. luck_list_end: false,
  356. layer_show: false,
  357. isLoading: true,
  358. isMobile: false,
  359. isChrome: false,
  360. config: {},
  361. mid: '',
  362. status: '', // not-open->未打开 opened->没有抽中 success->抽中了 expire->过期
  363. page_index: 1,
  364. page_size: 20,
  365. validity: '',
  366. receiveAmount: '0',
  367. title: 'DeNet Giveaway',
  368. jumpUrl: jumpUrl,
  369. metaTitle: 'DeNet: An Easy Web3 Tool For GIVEAWAY / AIRDROP',
  370. }
  371. },
  372. computed: {
  373. // 货币类型的奖品
  374. isMoneyPrize() {
  375. return this.detail.postBizData.rewardType === RewardType.money;
  376. }
  377. },
  378. mounted() {
  379. this.getConfig()
  380. this.setCookieMid()
  381. this.checkBrowser()
  382. this.handleStatusPage()
  383. this.isLoading = false;
  384. // 复制链接
  385. var clipboard = new ClipboardJS('.btn');
  386. clipboard.on('success', function (e) {
  387. Toast('copy success');
  388. e.clearSelection();
  389. });
  390. clipboard.on('error', function (e) {
  391. this.layer_show = true
  392. });
  393. },
  394. async asyncData(params) {
  395. let { route } = params;
  396. let { data } = await axios.post(`${baseURL}/denet/post/getDetail`, {
  397. baseInfo: {
  398. appVersionCode: appVersionCode,
  399. mid: function () {
  400. return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
  401. var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
  402. return v.toString(16);
  403. });
  404. }()
  405. },
  406. params: {
  407. postId: route.params.id || ''
  408. }
  409. })
  410. if (data.code == 0) {
  411. if (data.data && data.data.postBizData && typeof data.data.postBizData == 'string') {
  412. data.data.postBizData = JSON.parse(data.data.postBizData)
  413. }
  414. if(data.data.postBizData === null) {
  415. data.data.postBizData = {
  416. postUserInfo: {}
  417. }
  418. }
  419. return {
  420. detail: data.data,
  421. }
  422. }
  423. },
  424. methods: {
  425. checkBrowser() {
  426. this.linkHref = window.location.href;
  427. this.isChrome = isBrowser() == 'chrome';
  428. this.isMobile = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
  429. if (!this.isChrome) {
  430. this.status = 'no-chrome'
  431. } else {
  432. this.setPickupInfo()
  433. }
  434. },
  435. async getConfig() {
  436. let { data } = await axios.post(`${baseURL}/denet/base/config/getFrontConfig`, {
  437. baseInfo: {
  438. appVersionCode: appVersionCode,
  439. mid: this.mid
  440. },
  441. params: {}
  442. })
  443. if (data.code == 0) {
  444. this.config = data.data;
  445. }
  446. },
  447. setCookieMid() {
  448. let _cookie_mid_arr = Cookies.get('mid') || []
  449. if (_cookie_mid_arr.length > 0) {
  450. this.mid = JSON.parse(_cookie_mid_arr)[0].mid
  451. } else {
  452. this.mid = this.guid()
  453. Cookies.set('mid', JSON.stringify([{ mid: this.mid }]), { expires: 1000 })
  454. }
  455. },
  456. guid() {
  457. return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
  458. var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
  459. return v.toString(16);
  460. });
  461. },
  462. clickOpenChrome() {
  463. window.open('https://www.google.com/chrome')
  464. },
  465. installExtension() {
  466. let { extensionsInstallChannel, extensionsInstallUrl } = this.config;
  467. switch (extensionsInstallChannel) {
  468. case "officeDownload":
  469. location.href = url;
  470. this.$router.push({
  471. path: '/install'
  472. })
  473. break;
  474. case "chromeAppStore":
  475. window.open(extensionsInstallUrl)
  476. break;
  477. }
  478. },
  479. setPickupInfo() {
  480. let pickupInfo = {
  481. srcContentId: this.detail.srcContentId || '',
  482. postNickName: this.detail.postBizData.postUserInfo.nickName || '',
  483. createTime: Date.now(),
  484. jump_type: 'luck_draw',
  485. };
  486. Cookies.set('jump_info', JSON.stringify(pickupInfo), { expires: 100 });
  487. },
  488. formatTime(time, _type = 'MM-DD HH:mm:ss') {
  489. return moment(time).format(_type)
  490. },
  491. getValidity(end_time) {
  492. let timer = setInterval(() => {
  493. let time = moment(new Date().getTime())
  494. let endTime = moment(end_time + 5000)
  495. let downTime = (endTime - time) || 0
  496. if (downTime > 0) {
  497. this.validity = formatSecondsAsDaysOrTime(downTime / 1000);
  498. } else {
  499. this.validity = `00:00:00`
  500. this.getDetail(() => {
  501. this.handleStatusPage()
  502. })
  503. clearInterval(timer)
  504. }
  505. }, 1000)
  506. },
  507. handleScroll(e) {
  508. e = e.target
  509. if (this.luck_list_end) {
  510. return
  511. }
  512. if ((e.clientHeight + e.scrollTop) / e.scrollHeight > .8) {
  513. this.luck_list_end = false
  514. this.page_index++
  515. this.getReceivedList()
  516. }
  517. },
  518. handleStatusPage() {
  519. // 如果 我领取过了
  520. // taskFinishStatus 任务完成状态(0:未完成,1:已完成,2:已过期)
  521. if (this.detail.postBizData.myReceived) {
  522. this.receiveAmount = this.detail.postBizData.myReceived.amountValue || 0
  523. // 如果 任务完成状态 = 未完成
  524. if (this.detail.postBizData.myReceived.taskFinishStatus == 0) {
  525. // 显示任务未完成页面
  526. this.status = `opened`
  527. } else if (this.detail.postBizData.myReceived.taskFinishStatus == 1) {
  528. //如果 任务完成状态 = 已经完成
  529. if (this.receiveAmount == 0) {
  530. // 领取到空红包
  531. this.status = `opened`
  532. } else {
  533. // 显示成功页面
  534. this.status = `success`
  535. }
  536. } else {
  537. // 如果 任务完成状态 = 已经过期
  538. if (this.detail.postBizData.status == 1) {
  539. // 显示未打开页面
  540. this.status = 'not-open'
  541. } else {
  542. // 显示已经过期页面
  543. this.status = 'expire'
  544. }
  545. }
  546. } else {
  547. // 如果 我没有领取过
  548. // 如果 红包状态 = 进行中
  549. if (this.detail.postBizData.status == 1) {
  550. // 如果 过了红包的领取截止时间 = true
  551. if (this.detail.postBizData.receiveTimeExpired) {
  552. // 显示过期页面
  553. this.status = 'expire'
  554. } else {
  555. // 如果 过了红包的领取截止时间 = false
  556. // 显示未打开页面
  557. this.status = 'not-open'
  558. }
  559. } else {
  560. // 红包状态 = 已经结束了 | 已经终止 | 终止退款中
  561. // 显示过期页面
  562. this.status = 'expire'
  563. }
  564. }
  565. // this.status = 'not-open'
  566. // getList
  567. if (this.status !== 'not-open') {
  568. this.getReceivedList()
  569. } else {
  570. this.getValidity(this.detail.postBizData.endTimestamp)
  571. }
  572. },
  573. async getDetail(fn) {
  574. let { data } = await axios.post(`${baseURL}/denet/post/getDetail`, {
  575. baseInfo: {
  576. appVersionCode: appVersionCode,
  577. mid: this.mid
  578. },
  579. params: {
  580. postId: this.detail.postId
  581. }
  582. })
  583. if (data.code == 0) {
  584. console.log(data.data)
  585. this.detail.postBizData = JSON.parse(data.data.postBizData)
  586. if (fn) fn();
  587. }
  588. },
  589. async getReceivedList() {
  590. let { data } = await axios.post(`${baseURL}/denet/post/luckdrop/getReceivedList`, {
  591. baseInfo: {
  592. appVersionCode: appVersionCode,
  593. mid: this.mid
  594. },
  595. params: {
  596. pageNum: this.page_index,
  597. pageSize: this.page_size,
  598. postId: this.detail.postId || ''
  599. }
  600. })
  601. if (data.code == 0) {
  602. if (data.data.length > 0) {
  603. this.luck_list = this.luck_list.concat(data.data)
  604. this.luck_list_end = false
  605. } else {
  606. this.luck_list_end = true
  607. }
  608. }
  609. },
  610. }
  611. }
  612. </script>
  613. <style lang="scss">
  614. html,
  615. body,
  616. #__nuxt,
  617. #__layout {
  618. width: 100%;
  619. height: 100%;
  620. padding: 0;
  621. margin: 0;
  622. }
  623. .content {
  624. overflow: hidden;
  625. width: 100%;
  626. height: 100%;
  627. background: #fff;
  628. .loading {
  629. position: absolute;
  630. transform: translate(-50%, -50%);
  631. top: 50%;
  632. left: 50%;
  633. margin: auto;
  634. width: 40px;
  635. border-radius: 50%;
  636. }
  637. .logo {
  638. display: flex;
  639. align-items: center;
  640. height: 70px;
  641. margin-left: 25px;
  642. img {
  643. width: 99px;
  644. height: 32px;
  645. }
  646. }
  647. .show {
  648. display: flex;
  649. align-items: center;
  650. height: calc(100% - 70px);
  651. .center {
  652. display: flex;
  653. margin: -50px auto 0;
  654. justify-content: space-between;
  655. width: 1000px;
  656. position: relative;
  657. .head-in-custom {
  658. position: absolute;
  659. bottom: 100%;
  660. left: 0;
  661. background: #fff;
  662. display: flex;
  663. align-items: center;
  664. font-weight: 500;
  665. font-size: 15px;
  666. color: #000;
  667. height: 54px;
  668. img {
  669. width: 30px;
  670. height: 30px;
  671. border-radius: 50%;
  672. margin-right: 10px;
  673. }
  674. }
  675. .giveaway {
  676. position: relative;
  677. overflow: hidden;
  678. width: 375px;
  679. height: 500px;
  680. border-radius: 20px;
  681. background-color: #fff;
  682. box-shadow: 0px 2px 20px rgba(0, 0, 0, 0.1);
  683. &.bg {
  684. background: linear-gradient(17.98deg, #3438FF 3.69%, #8B56FC 74.32%);
  685. }
  686. &.custom {
  687. background: unset;
  688. height: auto!important;
  689. }
  690. &.auto-height {
  691. height: auto;
  692. }
  693. .lottery {
  694. position: absolute;
  695. top: 0;
  696. right: 0;
  697. width: 110px;
  698. height: 94px;
  699. }
  700. .head {
  701. display: flex;
  702. height: 50px;
  703. align-items: center;
  704. img {
  705. width: 20px;
  706. height: 20px;
  707. border-radius: 50%;
  708. margin: 0 10px 0 15px;
  709. border: solid 2px #fff;
  710. }
  711. span {
  712. color: #fff;
  713. font-size: 13px;
  714. font-weight: 700;
  715. line-height: 16px;
  716. letter-spacing: 0.005em;
  717. }
  718. }
  719. .price {
  720. text-align: center;
  721. .usdt {
  722. margin: 10px 0;
  723. color: #FFFFFF;
  724. font-weight: bold;
  725. font-size: 16px;
  726. line-height: 20px;
  727. text-align: center;
  728. letter-spacing: 0.3px;
  729. }
  730. .money {
  731. display: flex;
  732. align-items: center;
  733. justify-content: center;
  734. img {
  735. width: 46px;
  736. height: 46px;
  737. margin-right: 15px;
  738. border-radius: 50%;
  739. border: solid 3px #fff;
  740. }
  741. span {
  742. color: #fff;
  743. font-size: 60px;
  744. font-weight: 800;
  745. line-height: 76px;
  746. }
  747. }
  748. }
  749. .time {
  750. display: flex;
  751. height: 46px;
  752. color: #FFCC4D;
  753. align-items: center;
  754. justify-content: center;
  755. font-weight: bold;
  756. font-size: 26px;
  757. line-height: 33px;
  758. text-align: center;
  759. background: rgba($color: #000000, $alpha: .15);
  760. .img {
  761. width: 26px;
  762. margin-right: 10px;
  763. }
  764. }
  765. .box {
  766. margin: auto;
  767. width: 200px;
  768. height: 200px;
  769. margin-top: 27px;
  770. img {
  771. width: 100%;
  772. height: 100%;
  773. }
  774. }
  775. }
  776. .desc {
  777. width: 520px;
  778. .title {
  779. color: #2C2C2C;
  780. font-size: 36px;
  781. line-height: 40px;
  782. font-weight: 900;
  783. margin-top: 90px;
  784. margin-bottom: 20px;
  785. }
  786. .issue {
  787. font-size: 15px;
  788. color: #A4A4A4;
  789. }
  790. .button {
  791. cursor: pointer;
  792. height: 64px;
  793. margin-top: 30px;
  794. }
  795. }
  796. }
  797. }
  798. }
  799. .small {
  800. width: 100%;
  801. height: 100%;
  802. position: relative;
  803. background-color: #fff;
  804. &.bg {
  805. background: linear-gradient(17.98deg, #3438FF 3.69%, #8B56FC 74.32%);
  806. }
  807. &.custom {
  808. background: #111214!important;
  809. }
  810. .lottery {
  811. position: absolute;
  812. top: 0;
  813. right: 0;
  814. width: 110px;
  815. height: 94px;
  816. }
  817. .luck-list {
  818. height: calc(100% - 430px);
  819. }
  820. .head {
  821. display: flex;
  822. height: 50px;
  823. align-items: center;
  824. img {
  825. width: 20px;
  826. height: 20px;
  827. border-radius: 50%;
  828. margin: 0 10px 0 15px;
  829. border: solid 2px #fff;
  830. }
  831. span {
  832. color: #fff;
  833. font-size: 13px;
  834. font-weight: 700;
  835. line-height: 16px;
  836. letter-spacing: 0.005em;
  837. }
  838. }
  839. .price {
  840. text-align: center;
  841. .usdt {
  842. margin: 10px 0;
  843. color: #FFFFFF;
  844. font-weight: bold;
  845. font-size: 16px;
  846. line-height: 20px;
  847. text-align: center;
  848. letter-spacing: 0.3px;
  849. }
  850. .money {
  851. display: flex;
  852. align-items: center;
  853. justify-content: center;
  854. img {
  855. width: 46px;
  856. height: 46px;
  857. margin-right: 15px;
  858. border-radius: 50%;
  859. border: solid 3px #fff;
  860. }
  861. span {
  862. color: #fff;
  863. font-size: 60px;
  864. font-weight: 800;
  865. line-height: 76px;
  866. }
  867. }
  868. }
  869. .time {
  870. display: flex;
  871. height: 46px;
  872. color: #FFCC4D;
  873. align-items: center;
  874. justify-content: center;
  875. font-weight: bold;
  876. font-size: 26px;
  877. line-height: 33px;
  878. text-align: center;
  879. background: rgba($color: #000000, $alpha: .15);
  880. .img {
  881. width: 26px;
  882. margin-right: 10px;
  883. }
  884. }
  885. .box {
  886. margin: auto;
  887. width: 200px;
  888. height: 200px;
  889. margin-top: 27px;
  890. img {
  891. width: 100%;
  892. height: 100%;
  893. }
  894. }
  895. .area-cp-link {
  896. position: absolute;
  897. bottom: 0;
  898. background: #fff;
  899. overflow: hidden;
  900. width: 100%;
  901. flex-wrap: wrap;
  902. height: 238px;
  903. box-shadow: 0px -4px 10px rgba(0, 0, 0, 0.1);
  904. border-top-left-radius: 10px;
  905. border-top-right-radius: 10px;
  906. .area-list {
  907. clear: both;
  908. margin: 15px;
  909. .item {
  910. clear: both;
  911. overflow: hidden;
  912. margin: 7px 0;
  913. font-size: 16px;
  914. font-weight: 500;
  915. .icon {
  916. float: left;
  917. margin-right: 8px;
  918. margin-top: -2px;
  919. }
  920. .font {
  921. float: left;
  922. margin-right: 8px;
  923. }
  924. .pc {
  925. float: left;
  926. margin-top: -2px;
  927. }
  928. }
  929. }
  930. .area-content {
  931. margin: 0 15px;
  932. color: #4B4B4B;
  933. padding: 7px 10px;
  934. font-size: 13px;
  935. border-radius: 5px;
  936. background: #F4F4F4;
  937. word-break: break-all;
  938. }
  939. .area-btn {
  940. flex: 1;
  941. display: flex;
  942. justify-content: center;
  943. .btn {
  944. margin: 15px 15px 0 15px;
  945. display: inline-block;
  946. width: 100%;
  947. height: 47px;
  948. font-size: 18px;
  949. line-height: 34px;
  950. color: #FFFFFF;
  951. border-radius: 100px;
  952. background: #389AFF;
  953. }
  954. }
  955. }
  956. }
  957. .layer {
  958. position: fixed;
  959. width: 100%;
  960. height: 100%;
  961. top: 0;
  962. left: 0;
  963. background: rgba(0, 0, 0, .5);
  964. .layer-box {
  965. width: 300px;
  966. height: 170px;
  967. background: #FFFFFF;
  968. border-radius: 11px;
  969. opacity: 1;
  970. position: absolute;
  971. top: 250px;
  972. left: 50%;
  973. margin-left: -150px;
  974. .layer-txt {
  975. margin: 30px 0;
  976. width: 100%;
  977. padding: 0 27px;
  978. font-weight: 600;
  979. font-size: 18px;
  980. text-align: center;
  981. }
  982. .layer-btn {
  983. width: 190px;
  984. height: 40px;
  985. background: #389AFF;
  986. border-radius: 100px;
  987. margin: 0 auto;
  988. text-align: center;
  989. line-height: 40px;
  990. color: #fff;
  991. font-weight: 600;
  992. font-size: 18px;
  993. }
  994. }
  995. }
  996. .luck-list {
  997. flex: 1;
  998. width: 100%;
  999. height: 310px;
  1000. overflow-y: auto;
  1001. .luck-item {
  1002. display: flex;
  1003. padding: 12px 0;
  1004. margin: 0 16px;
  1005. border-bottom: 1px solid #F2F2F2;
  1006. justify-content: space-between;
  1007. position: relative;
  1008. .header {
  1009. border-radius: 50%;
  1010. }
  1011. .luck-king {
  1012. position: absolute;
  1013. top: 36px;
  1014. right: 0px;
  1015. display: flex;
  1016. align-items: center;
  1017. img {
  1018. width: 22px;
  1019. height: 19px;
  1020. margin: 0;
  1021. }
  1022. span {
  1023. font-weight: 500;
  1024. font-size: 12px;
  1025. line-height: 14px;
  1026. letter-spacing: 0.3px;
  1027. color: #f5b945;
  1028. }
  1029. }
  1030. .userLogo {
  1031. position: relative;
  1032. width: 42px;
  1033. height: 42px;
  1034. margin-right: 12px;
  1035. .medal {
  1036. position: absolute;
  1037. right: -5px;
  1038. bottom: -5px;
  1039. width: 18px;
  1040. height: 18px;
  1041. }
  1042. img {
  1043. width: 100%;
  1044. height: 100%;
  1045. }
  1046. }
  1047. .luck-content {
  1048. flex: auto;
  1049. .luck-title {
  1050. font-weight: 500;
  1051. font-size: 16px;
  1052. letter-spacing: 0.3px;
  1053. color: #444444;
  1054. }
  1055. .luck-time {
  1056. font-weight: 400;
  1057. font-size: 12px;
  1058. line-height: 14px;
  1059. color: #9b9b9b;
  1060. }
  1061. }
  1062. .luck-money {
  1063. display: flex;
  1064. height: 17px;
  1065. align-items: center;
  1066. img {
  1067. width: 14px;
  1068. height: 14px;
  1069. margin-right: 6px;
  1070. }
  1071. .luck-money-txt {
  1072. font-weight: 500;
  1073. font-size: 14px;
  1074. /* identical to box height */
  1075. text-align: right;
  1076. letter-spacing: 0.3px;
  1077. color: #444444;
  1078. }
  1079. }
  1080. .luck-custom-prize {
  1081. font-weight: 500;
  1082. font-size: 14px;
  1083. letter-spacing: 0.3px;
  1084. color: #F5B945;
  1085. }
  1086. }
  1087. .luck-item:last-child {
  1088. border: 0;
  1089. }
  1090. }
  1091. .succTop {
  1092. display: flex;
  1093. align-items: center;
  1094. flex-direction: column;
  1095. justify-content: center;
  1096. height: 150px;
  1097. margin-bottom: 13px;
  1098. background: #7D52FD;
  1099. border-radius: 0 586px 586px/0 0 104px 104px;
  1100. .img {
  1101. height: 62px;
  1102. }
  1103. .expire {
  1104. color: #FFFFFF;
  1105. font-size: 22px;
  1106. font-weight: 800;
  1107. line-height: 36px;
  1108. margin-top: 15px;
  1109. text-align: center;
  1110. }
  1111. .tips {
  1112. color: #FFFFFF;
  1113. font-size: 22px;
  1114. font-weight: 800;
  1115. line-height: 26px;
  1116. margin-top: 15px;
  1117. }
  1118. .win {
  1119. font-size: 21px;
  1120. font-weight: 800;
  1121. color: #fff;
  1122. }
  1123. .win-money {
  1124. display: flex;
  1125. margin-top: -10px;
  1126. align-items: center;
  1127. justify-content: center;
  1128. img {
  1129. width: 44px;
  1130. height: 44px;
  1131. margin-right: 15px;
  1132. border-radius: 50%;
  1133. border: solid 3px #fff;
  1134. }
  1135. span {
  1136. color: #fff;
  1137. font-size: 60px;
  1138. font-weight: 800;
  1139. line-height: 76px;
  1140. }
  1141. }
  1142. }
  1143. .succTitle {
  1144. display: flex;
  1145. padding: 5px 0;
  1146. justify-content: space-between;
  1147. box-shadow: inset 0px -1px 0px #F2F2F2;
  1148. span {
  1149. margin: 0 16px;
  1150. font-size: 12px;
  1151. color: #B0B0B0;
  1152. &:last-child {
  1153. text-align: right;
  1154. }
  1155. }
  1156. }
  1157. .customImg {
  1158. width: 100%;
  1159. min-height: 373px;
  1160. }
  1161. .customBottom {
  1162. width: 100%;
  1163. background:#111214;
  1164. padding: 10px 16px;
  1165. font-weight: 500;
  1166. font-size: 12px;
  1167. line-height: 14px;
  1168. letter-spacing: 0.3px;
  1169. color: #838383;
  1170. line-height: 20px;
  1171. .theme {
  1172. display: flex;
  1173. height: 20px;
  1174. align-items: center;
  1175. justify-content: flex-start;
  1176. .icon {
  1177. width: 12px;
  1178. }
  1179. .time2 {
  1180. margin: 0 4px;
  1181. color: #1D9BF0;
  1182. }
  1183. }
  1184. .winner-info {
  1185. display: flex;
  1186. height: 20px;
  1187. align-items: center;
  1188. justify-content: flex-start;
  1189. .count{
  1190. color: #1D9BF0;
  1191. margin-right: 4px;
  1192. }
  1193. .prize-name {
  1194. color: #1D9BF0;
  1195. margin-left: 4px;
  1196. }
  1197. }
  1198. }
  1199. </style>