luckdraw.vue 44 KB

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