luckdraw.vue 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227
  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. };
  485. Cookies.set('pickup_info', JSON.stringify(pickupInfo), { expires: 100 });
  486. },
  487. formatTime(time, _type = 'MM-DD HH:mm:ss') {
  488. return moment(time).format(_type)
  489. },
  490. getValidity(end_time) {
  491. let timer = setInterval(() => {
  492. let time = moment(new Date().getTime())
  493. let endTime = moment(end_time + 5000)
  494. let downTime = (endTime - time) || 0
  495. if (downTime > 0) {
  496. this.validity = formatSecondsAsDaysOrTime(downTime / 1000);
  497. } else {
  498. this.validity = `00:00:00`
  499. this.getDetail(() => {
  500. this.handleStatusPage()
  501. })
  502. clearInterval(timer)
  503. }
  504. }, 1000)
  505. },
  506. handleScroll(e) {
  507. e = e.target
  508. if (this.luck_list_end) {
  509. return
  510. }
  511. if ((e.clientHeight + e.scrollTop) / e.scrollHeight > .8) {
  512. this.luck_list_end = false
  513. this.page_index++
  514. this.getReceivedList()
  515. }
  516. },
  517. handleStatusPage() {
  518. // 如果 我领取过了
  519. // taskFinishStatus 任务完成状态(0:未完成,1:已完成,2:已过期)
  520. if (this.detail.postBizData.myReceived) {
  521. this.receiveAmount = this.detail.postBizData.myReceived.amountValue || 0
  522. // 如果 任务完成状态 = 未完成
  523. if (this.detail.postBizData.myReceived.taskFinishStatus == 0) {
  524. // 显示任务未完成页面
  525. this.status = `opened`
  526. } else if (this.detail.postBizData.myReceived.taskFinishStatus == 1) {
  527. //如果 任务完成状态 = 已经完成
  528. if (this.receiveAmount == 0) {
  529. // 领取到空红包
  530. this.status = `opened`
  531. } else {
  532. // 显示成功页面
  533. this.status = `success`
  534. }
  535. } else {
  536. // 如果 任务完成状态 = 已经过期
  537. if (this.detail.postBizData.status == 1) {
  538. // 显示未打开页面
  539. this.status = 'not-open'
  540. } else {
  541. // 显示已经过期页面
  542. this.status = 'expire'
  543. }
  544. }
  545. } else {
  546. // 如果 我没有领取过
  547. // 如果 红包状态 = 进行中
  548. if (this.detail.postBizData.status == 1) {
  549. // 如果 过了红包的领取截止时间 = true
  550. if (this.detail.postBizData.receiveTimeExpired) {
  551. // 显示过期页面
  552. this.status = 'expire'
  553. } else {
  554. // 如果 过了红包的领取截止时间 = false
  555. // 显示未打开页面
  556. this.status = 'not-open'
  557. }
  558. } else {
  559. // 红包状态 = 已经结束了 | 已经终止 | 终止退款中
  560. // 显示过期页面
  561. this.status = 'expire'
  562. }
  563. }
  564. // this.status = 'not-open'
  565. // getList
  566. if (this.status !== 'not-open') {
  567. this.getReceivedList()
  568. } else {
  569. this.getValidity(this.detail.postBizData.endTimestamp)
  570. }
  571. },
  572. async getDetail(fn) {
  573. let { data } = await axios.post(`${baseURL}/denet/post/getDetail`, {
  574. baseInfo: {
  575. appVersionCode: appVersionCode,
  576. mid: this.mid
  577. },
  578. params: {
  579. postId: this.detail.postId
  580. }
  581. })
  582. if (data.code == 0) {
  583. console.log(data.data)
  584. this.detail.postBizData = JSON.parse(data.data.postBizData)
  585. if (fn) fn();
  586. }
  587. },
  588. async getReceivedList() {
  589. let { data } = await axios.post(`${baseURL}/denet/post/luckdrop/getReceivedList`, {
  590. baseInfo: {
  591. appVersionCode: appVersionCode,
  592. mid: this.mid
  593. },
  594. params: {
  595. pageNum: this.page_index,
  596. pageSize: this.page_size,
  597. postId: this.detail.postId || ''
  598. }
  599. })
  600. if (data.code == 0) {
  601. if (data.data.length > 0) {
  602. this.luck_list = this.luck_list.concat(data.data)
  603. this.luck_list_end = false
  604. } else {
  605. this.luck_list_end = true
  606. }
  607. }
  608. },
  609. }
  610. }
  611. </script>
  612. <style lang="scss">
  613. html,
  614. body,
  615. #__nuxt,
  616. #__layout {
  617. width: 100%;
  618. height: 100%;
  619. padding: 0;
  620. margin: 0;
  621. }
  622. .content {
  623. overflow: hidden;
  624. width: 100%;
  625. height: 100%;
  626. background: #fff;
  627. .loading {
  628. position: absolute;
  629. transform: translate(-50%, -50%);
  630. top: 50%;
  631. left: 50%;
  632. margin: auto;
  633. width: 40px;
  634. border-radius: 50%;
  635. }
  636. .logo {
  637. display: flex;
  638. align-items: center;
  639. height: 70px;
  640. margin-left: 25px;
  641. img {
  642. width: 99px;
  643. height: 32px;
  644. }
  645. }
  646. .show {
  647. display: flex;
  648. align-items: center;
  649. height: calc(100% - 70px);
  650. .center {
  651. display: flex;
  652. margin: -50px auto 0;
  653. justify-content: space-between;
  654. width: 1000px;
  655. position: relative;
  656. .head-in-custom {
  657. position: absolute;
  658. bottom: 100%;
  659. left: 0;
  660. background: #fff;
  661. display: flex;
  662. align-items: center;
  663. font-weight: 500;
  664. font-size: 15px;
  665. color: #000;
  666. height: 54px;
  667. img {
  668. width: 30px;
  669. height: 30px;
  670. border-radius: 50%;
  671. margin-right: 10px;
  672. }
  673. }
  674. .giveaway {
  675. position: relative;
  676. overflow: hidden;
  677. width: 375px;
  678. height: 500px;
  679. border-radius: 20px;
  680. background-color: #fff;
  681. box-shadow: 0px 2px 20px rgba(0, 0, 0, 0.1);
  682. &.bg {
  683. background: linear-gradient(17.98deg, #3438FF 3.69%, #8B56FC 74.32%);
  684. }
  685. &.custom {
  686. background: unset;
  687. height: auto!important;
  688. }
  689. &.auto-height {
  690. height: auto;
  691. }
  692. .lottery {
  693. position: absolute;
  694. top: 0;
  695. right: 0;
  696. width: 110px;
  697. height: 94px;
  698. }
  699. .head {
  700. display: flex;
  701. height: 50px;
  702. align-items: center;
  703. img {
  704. width: 20px;
  705. height: 20px;
  706. border-radius: 50%;
  707. margin: 0 10px 0 15px;
  708. border: solid 2px #fff;
  709. }
  710. span {
  711. color: #fff;
  712. font-size: 13px;
  713. font-weight: 700;
  714. line-height: 16px;
  715. letter-spacing: 0.005em;
  716. }
  717. }
  718. .price {
  719. text-align: center;
  720. .usdt {
  721. margin: 10px 0;
  722. color: #FFFFFF;
  723. font-weight: bold;
  724. font-size: 16px;
  725. line-height: 20px;
  726. text-align: center;
  727. letter-spacing: 0.3px;
  728. }
  729. .money {
  730. display: flex;
  731. align-items: center;
  732. justify-content: center;
  733. img {
  734. width: 46px;
  735. height: 46px;
  736. margin-right: 15px;
  737. border-radius: 50%;
  738. border: solid 3px #fff;
  739. }
  740. span {
  741. color: #fff;
  742. font-size: 60px;
  743. font-weight: 800;
  744. line-height: 76px;
  745. }
  746. }
  747. }
  748. .time {
  749. display: flex;
  750. height: 46px;
  751. color: #FFCC4D;
  752. align-items: center;
  753. justify-content: center;
  754. font-weight: bold;
  755. font-size: 26px;
  756. line-height: 33px;
  757. text-align: center;
  758. background: rgba($color: #000000, $alpha: .15);
  759. .img {
  760. width: 26px;
  761. margin-right: 10px;
  762. }
  763. }
  764. .box {
  765. margin: auto;
  766. width: 200px;
  767. height: 200px;
  768. margin-top: 27px;
  769. img {
  770. width: 100%;
  771. height: 100%;
  772. }
  773. }
  774. }
  775. .desc {
  776. width: 520px;
  777. .title {
  778. color: #2C2C2C;
  779. font-size: 36px;
  780. line-height: 40px;
  781. font-weight: 900;
  782. margin-top: 90px;
  783. margin-bottom: 20px;
  784. }
  785. .issue {
  786. font-size: 15px;
  787. color: #A4A4A4;
  788. }
  789. .button {
  790. cursor: pointer;
  791. height: 64px;
  792. margin-top: 30px;
  793. }
  794. }
  795. }
  796. }
  797. }
  798. .small {
  799. width: 100%;
  800. height: 100%;
  801. position: relative;
  802. background-color: #fff;
  803. &.bg {
  804. background: linear-gradient(17.98deg, #3438FF 3.69%, #8B56FC 74.32%);
  805. }
  806. &.custom {
  807. background: #111214!important;
  808. }
  809. .lottery {
  810. position: absolute;
  811. top: 0;
  812. right: 0;
  813. width: 110px;
  814. height: 94px;
  815. }
  816. .luck-list {
  817. height: calc(100% - 430px);
  818. }
  819. .head {
  820. display: flex;
  821. height: 50px;
  822. align-items: center;
  823. img {
  824. width: 20px;
  825. height: 20px;
  826. border-radius: 50%;
  827. margin: 0 10px 0 15px;
  828. border: solid 2px #fff;
  829. }
  830. span {
  831. color: #fff;
  832. font-size: 13px;
  833. font-weight: 700;
  834. line-height: 16px;
  835. letter-spacing: 0.005em;
  836. }
  837. }
  838. .price {
  839. text-align: center;
  840. .usdt {
  841. margin: 10px 0;
  842. color: #FFFFFF;
  843. font-weight: bold;
  844. font-size: 16px;
  845. line-height: 20px;
  846. text-align: center;
  847. letter-spacing: 0.3px;
  848. }
  849. .money {
  850. display: flex;
  851. align-items: center;
  852. justify-content: center;
  853. img {
  854. width: 46px;
  855. height: 46px;
  856. margin-right: 15px;
  857. border-radius: 50%;
  858. border: solid 3px #fff;
  859. }
  860. span {
  861. color: #fff;
  862. font-size: 60px;
  863. font-weight: 800;
  864. line-height: 76px;
  865. }
  866. }
  867. }
  868. .time {
  869. display: flex;
  870. height: 46px;
  871. color: #FFCC4D;
  872. align-items: center;
  873. justify-content: center;
  874. font-weight: bold;
  875. font-size: 26px;
  876. line-height: 33px;
  877. text-align: center;
  878. background: rgba($color: #000000, $alpha: .15);
  879. .img {
  880. width: 26px;
  881. margin-right: 10px;
  882. }
  883. }
  884. .box {
  885. margin: auto;
  886. width: 200px;
  887. height: 200px;
  888. margin-top: 27px;
  889. img {
  890. width: 100%;
  891. height: 100%;
  892. }
  893. }
  894. .area-cp-link {
  895. position: absolute;
  896. bottom: 0;
  897. background: #fff;
  898. overflow: hidden;
  899. width: 100%;
  900. flex-wrap: wrap;
  901. height: 238px;
  902. box-shadow: 0px -4px 10px rgba(0, 0, 0, 0.1);
  903. border-top-left-radius: 10px;
  904. border-top-right-radius: 10px;
  905. .area-list {
  906. clear: both;
  907. margin: 15px;
  908. .item {
  909. clear: both;
  910. overflow: hidden;
  911. margin: 7px 0;
  912. font-size: 16px;
  913. font-weight: 500;
  914. .icon {
  915. float: left;
  916. margin-right: 8px;
  917. margin-top: -2px;
  918. }
  919. .font {
  920. float: left;
  921. margin-right: 8px;
  922. }
  923. .pc {
  924. float: left;
  925. margin-top: -2px;
  926. }
  927. }
  928. }
  929. .area-content {
  930. margin: 0 15px;
  931. color: #4B4B4B;
  932. padding: 7px 10px;
  933. font-size: 13px;
  934. border-radius: 5px;
  935. background: #F4F4F4;
  936. word-break: break-all;
  937. }
  938. .area-btn {
  939. flex: 1;
  940. display: flex;
  941. justify-content: center;
  942. .btn {
  943. margin: 15px 15px 0 15px;
  944. display: inline-block;
  945. width: 100%;
  946. height: 47px;
  947. font-size: 18px;
  948. line-height: 34px;
  949. color: #FFFFFF;
  950. border-radius: 100px;
  951. background: #389AFF;
  952. }
  953. }
  954. }
  955. }
  956. .layer {
  957. position: fixed;
  958. width: 100%;
  959. height: 100%;
  960. top: 0;
  961. left: 0;
  962. background: rgba(0, 0, 0, .5);
  963. .layer-box {
  964. width: 300px;
  965. height: 170px;
  966. background: #FFFFFF;
  967. border-radius: 11px;
  968. opacity: 1;
  969. position: absolute;
  970. top: 250px;
  971. left: 50%;
  972. margin-left: -150px;
  973. .layer-txt {
  974. margin: 30px 0;
  975. width: 100%;
  976. padding: 0 27px;
  977. font-weight: 600;
  978. font-size: 18px;
  979. text-align: center;
  980. }
  981. .layer-btn {
  982. width: 190px;
  983. height: 40px;
  984. background: #389AFF;
  985. border-radius: 100px;
  986. margin: 0 auto;
  987. text-align: center;
  988. line-height: 40px;
  989. color: #fff;
  990. font-weight: 600;
  991. font-size: 18px;
  992. }
  993. }
  994. }
  995. .luck-list {
  996. flex: 1;
  997. width: 100%;
  998. height: 310px;
  999. overflow-y: auto;
  1000. .luck-item {
  1001. display: flex;
  1002. padding: 12px 0;
  1003. margin: 0 16px;
  1004. border-bottom: 1px solid #F2F2F2;
  1005. justify-content: space-between;
  1006. position: relative;
  1007. .header {
  1008. border-radius: 50%;
  1009. }
  1010. .luck-king {
  1011. position: absolute;
  1012. top: 36px;
  1013. right: 0px;
  1014. display: flex;
  1015. align-items: center;
  1016. img {
  1017. width: 22px;
  1018. height: 19px;
  1019. margin: 0;
  1020. }
  1021. span {
  1022. font-weight: 500;
  1023. font-size: 12px;
  1024. line-height: 14px;
  1025. letter-spacing: 0.3px;
  1026. color: #f5b945;
  1027. }
  1028. }
  1029. .userLogo {
  1030. position: relative;
  1031. width: 42px;
  1032. height: 42px;
  1033. margin-right: 12px;
  1034. .medal {
  1035. position: absolute;
  1036. right: -5px;
  1037. bottom: -5px;
  1038. width: 18px;
  1039. height: 18px;
  1040. }
  1041. img {
  1042. width: 100%;
  1043. height: 100%;
  1044. }
  1045. }
  1046. .luck-content {
  1047. flex: auto;
  1048. .luck-title {
  1049. font-weight: 500;
  1050. font-size: 16px;
  1051. letter-spacing: 0.3px;
  1052. color: #444444;
  1053. }
  1054. .luck-time {
  1055. font-weight: 400;
  1056. font-size: 12px;
  1057. line-height: 14px;
  1058. color: #9b9b9b;
  1059. }
  1060. }
  1061. .luck-money {
  1062. display: flex;
  1063. height: 17px;
  1064. align-items: center;
  1065. img {
  1066. width: 14px;
  1067. height: 14px;
  1068. margin-right: 6px;
  1069. }
  1070. .luck-money-txt {
  1071. font-weight: 500;
  1072. font-size: 14px;
  1073. /* identical to box height */
  1074. text-align: right;
  1075. letter-spacing: 0.3px;
  1076. color: #444444;
  1077. }
  1078. }
  1079. .luck-custom-prize {
  1080. font-weight: 500;
  1081. font-size: 14px;
  1082. letter-spacing: 0.3px;
  1083. color: #F5B945;
  1084. }
  1085. }
  1086. .luck-item:last-child {
  1087. border: 0;
  1088. }
  1089. }
  1090. .succTop {
  1091. display: flex;
  1092. align-items: center;
  1093. flex-direction: column;
  1094. justify-content: center;
  1095. height: 150px;
  1096. margin-bottom: 13px;
  1097. background: #7D52FD;
  1098. border-radius: 0 586px 586px/0 0 104px 104px;
  1099. .img {
  1100. height: 62px;
  1101. }
  1102. .expire {
  1103. color: #FFFFFF;
  1104. font-size: 22px;
  1105. font-weight: 800;
  1106. line-height: 36px;
  1107. margin-top: 15px;
  1108. text-align: center;
  1109. }
  1110. .tips {
  1111. color: #FFFFFF;
  1112. font-size: 22px;
  1113. font-weight: 800;
  1114. line-height: 26px;
  1115. margin-top: 15px;
  1116. }
  1117. .win {
  1118. font-size: 21px;
  1119. font-weight: 800;
  1120. color: #fff;
  1121. }
  1122. .win-money {
  1123. display: flex;
  1124. margin-top: -10px;
  1125. align-items: center;
  1126. justify-content: center;
  1127. img {
  1128. width: 44px;
  1129. height: 44px;
  1130. margin-right: 15px;
  1131. border-radius: 50%;
  1132. border: solid 3px #fff;
  1133. }
  1134. span {
  1135. color: #fff;
  1136. font-size: 60px;
  1137. font-weight: 800;
  1138. line-height: 76px;
  1139. }
  1140. }
  1141. }
  1142. .succTitle {
  1143. display: flex;
  1144. padding: 5px 0;
  1145. justify-content: space-between;
  1146. box-shadow: inset 0px -1px 0px #F2F2F2;
  1147. span {
  1148. margin: 0 16px;
  1149. font-size: 12px;
  1150. color: #B0B0B0;
  1151. &:last-child {
  1152. text-align: right;
  1153. }
  1154. }
  1155. }
  1156. .customImg {
  1157. width: 100%;
  1158. min-height: 373px;
  1159. }
  1160. .customBottom {
  1161. width: 100%;
  1162. background:#111214;
  1163. padding: 10px 16px;
  1164. font-weight: 500;
  1165. font-size: 12px;
  1166. line-height: 14px;
  1167. letter-spacing: 0.3px;
  1168. color: #838383;
  1169. line-height: 20px;
  1170. .theme {
  1171. display: flex;
  1172. height: 20px;
  1173. align-items: center;
  1174. justify-content: flex-start;
  1175. .icon {
  1176. width: 12px;
  1177. }
  1178. .time2 {
  1179. margin: 0 4px;
  1180. color: #1D9BF0;
  1181. }
  1182. }
  1183. .winner-info {
  1184. display: flex;
  1185. height: 20px;
  1186. align-items: center;
  1187. justify-content: flex-start;
  1188. .count{
  1189. color: #1D9BF0;
  1190. margin-right: 4px;
  1191. }
  1192. .prize-name {
  1193. color: #1D9BF0;
  1194. margin-left: 4px;
  1195. }
  1196. }
  1197. }
  1198. </style>