luckdraw.vue 32 KB

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