index.vue 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576
  1. <template>
  2. <div style="width: 100%; height: 100%;">
  3. <div class="content" :style="{ 'background': `#F5FAFF` }" v-show="show_home" v-if="detail">
  4. <div class="logo">
  5. <img src="/img/icon-logo.png" alt />
  6. </div>
  7. <!-- 未开始 -->
  8. <div class="not-open" v-show="status == 'not-open'">
  9. <img src="/subject/001.gif">
  10. </div>
  11. <!-- 红包打开 -->
  12. <div class="redPacket"
  13. :class="{ redPacket2: status != 'open', key_packet: status == 'open' }"
  14. v-if="status != 'nothing'"
  15. v-show="status != 'not-open'">
  16. <!-- 内容 -->
  17. <div class="head">
  18. <div class="head-title">
  19. <img :src="detail.postBizData.postUserInfo.avatarUrl" alt />
  20. <span>{{ detail.postBizData.postUserInfo.nickName }}</span>
  21. </div>
  22. <!-- <div class="head-txt" v-if="status == 'open' || status == 'opened'">Awesome! You Will Get</div> -->
  23. <!-- <div class="head-area" v-else-if="status == 'opened'">opened!</div> -->
  24. <!-- 红包被领完了 -->
  25. <div class="head-area" v-if="status == 'nothing'">
  26. <div class="txt">Better luck next time!</div>
  27. </div>
  28. <!-- 过期 -->
  29. <div class="head-area expire" v-if="status == 'expire'">
  30. <div class="txt">This Giveaways</div>
  31. <div class="titme">expired on {{ formatTime(detail.postBizData.endTimestamp, 'MM-DD') }}</div>
  32. </div>
  33. <!-- 非chrome浏览器 -->
  34. <div class="head-area expire" v-if="status == 'no-chrome'">
  35. <div class="txt">Get Giveaways</div>
  36. <div class="titme">with chrome</div>
  37. </div>
  38. <!-- 领取成功 -->
  39. <div class="head-area head-money" v-if="status == 'open' || status == 'opened'">
  40. <div class="txt">AWESOME! YOU Will GET</div>
  41. <div class="head-money-area">
  42. <img :src="currencyIconPath" alt />
  43. <span class="money-txt" :style="{ fontSize: amount_font_size + 'px' }">{{ receiveAmount }}</span>
  44. </div>
  45. </div>
  46. </div>
  47. <!-- 领取列表 -->
  48. <div class="luck-list-title">
  49. <div>{{ detail.postBizData.receiveCount || 0 }}/{{ detail.postBizData.totalCount || 0 }} Winners
  50. </div>
  51. <div> {{ detail.postBizData.receiveAmountValue }} / {{
  52. detail.postBizData.amountValue || ''
  53. }} {{ detail.postBizData.currencySymbol || '' }}</div>
  54. </div>
  55. <div class="luck-list" @scroll="handleScroll($event)">
  56. <div class="luck-item" v-for="item, i in luck_list" v-bind:key="i">
  57. <img v-if="item.simpleUserInfoVO.avatarUrl" :src="item.simpleUserInfoVO.avatarUrl" alt />
  58. <img v-else src="/svg/icon-twitter.svg" alt />
  59. <div class="luck-content">
  60. <div class="luck-title">{{ item.simpleUserInfoVO.nickName || 'Twitter User' }}</div>
  61. <div class="luck-time">{{ formatTime(item.receiveTimestamp, 'MM-DD HH:mm') }}</div>
  62. </div>
  63. <div class="luck-money">
  64. <img :src="item.currencyIconPath" alt />
  65. <div class="luck-money-txt">{{ item.amountValue || 0 }}</div>
  66. </div>
  67. <div class="luck-king" v-if="item.maxAmount">
  68. <img src="/svg/icon-king-hat.svg" alt />
  69. <span>Luckiest Draw</span>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. <div class="redBag" v-else>
  75. <img src="/subject/001-card.png" alt="">
  76. <img class="open-gif" src="/subject/001.gif" />
  77. <div class="title" v-if="detail.postBizData.postUserInfo">
  78. <img :src="detail.postBizData.postUserInfo.avatarUrl" alt />
  79. <span>{{ detail.postBizData.postUserInfo.nickName || 'FutureDoctor' }}</span>
  80. </div>
  81. <div class="money-area">
  82. <div class="txt">{{ detail.postBizData.currencySymbol }} GIVEAWAY</div>
  83. <div class="coin">
  84. <img :src="detail.postBizData.currencyIconPath" alt />
  85. <font-amount :amount="detail.postBizData.amountValue"></font-amount>
  86. </div>
  87. <div class="people">{{ detail.postBizData.totalCount }} WINNERS TO SHARE</div>
  88. </div>
  89. </div>
  90. <!-- 安装 -->
  91. <div class="install" v-if="status == 'nothing' || status == 'open' || status == 'opened'"
  92. :class="{ key_install: status == 'open' }">
  93. <div v-if="status == 'nothing'">
  94. <div class="title">Install Denet to Draw</div>
  95. </div>
  96. <div v-else>
  97. <div class="title">Withdraw to Wallet</div>
  98. <div class="validity">
  99. <template v-if="validity_state">
  100. <span style="color:#FFA620;">Remaining valid time </span>
  101. <span style="color: #FFA620;">{{ validity }}</span>
  102. </template>
  103. <template v-else>
  104. <span style="color: #FFA620;">Giveaways Validity</span>
  105. </template>
  106. </div>
  107. </div>
  108. <div class="flow">
  109. <div class="line"></div>
  110. <div class="area_num">
  111. <div class="num">1</div>
  112. <span>Install DeNet</span>
  113. </div>
  114. <div class="tip">Used to verify tasks and get rewards</div>
  115. <div class="install_btn" @click="installExtension">Install</div>
  116. <div class="area_num">
  117. <div class="num">2</div>
  118. <span v-if="status == 'nothing'">Complete Tasks</span>
  119. <span v-else>Complete Tasks by {{ detail.postBizData.postUserInfo.nickName }}</span>
  120. </div>
  121. <div class="tip">Complete like, retweet and follow in a simple way</div>
  122. </div>
  123. </div>
  124. <!-- 过期 -->
  125. <div class="install install-error" v-if="status == 'expire'">
  126. <div class="title">Install DeNet</div>
  127. <div class="title">Don't miss the next Giveaway</div>
  128. <div class="tip">Used to verify tasks and get rewards</div>
  129. <div class="install_btn" @click="installExtension">Install</div>
  130. </div>
  131. <!-- 非chrome 浏览器状态 -->
  132. <div class="install install-error" v-if="status == 'no-chrome'">
  133. <div class="title">Open Giveaways</div>
  134. <div class="title">with chrome</div>
  135. <div class="tip">Only supports getting Giveaways through chrome</div>
  136. <div class="install_chrome" @click="clickOpenChrome()">
  137. <img src="/svg/icon-chrome.svg" alt />
  138. Install Chrome
  139. </div>
  140. </div>
  141. <div v-if="status == 'error'"></div>
  142. </div>
  143. <div v-if="show_moblie" class="moblie">
  144. <div class="head-area">
  145. <div class="gift">
  146. <img :src=" require('../static/subject/gift.svg') " />
  147. </div>
  148. <div class="txt">
  149. <div>Complete tasks</div>
  150. <div>to Draw Prizes</div>
  151. </div>
  152. </div>
  153. <!-- 领取列表 -->
  154. <div class="luck-list" @scroll="handleScroll($event)">
  155. <div class="luck-item" v-for="item, i in luck_list" v-bind:key="i">
  156. <img v-if="item.simpleUserInfoVO.avatarUrl" :src="item.simpleUserInfoVO.avatarUrl" alt />
  157. <img v-else src="/svg/icon-twitter.svg" alt />
  158. <div class="luck-content">
  159. <div class="luck-title">{{ item.simpleUserInfoVO.nickName || 'Twitter User' }}</div>
  160. <div class="luck-time">{{ formatTime(item.receiveTimestamp) }}</div>
  161. </div>
  162. <div class="luck-money">
  163. <img :src="item.currencyIconPath" alt />
  164. <div class="luck-money-txt">{{ item.amountValue || 0 }}</div>
  165. </div>
  166. <div class="luck-king" v-if="item.maxAmount">
  167. <img src="/svg/icon-king-hat.svg" alt />
  168. <span>Luckiest Draw</span>
  169. </div>
  170. </div>
  171. </div>
  172. <div class="area-cp-link">
  173. <div class="area-list">
  174. <div class="item">
  175. <div class="icon"><img :src=" require('../static/subject/01.svg') " /></div>
  176. <div class="font">Complete the tasks on tweet</div>
  177. </div>
  178. <div class="item">
  179. <div class="icon"><img :src=" require('../static/subject/02.svg') " /></div>
  180. <div class="font">Open link on PC to draw</div>
  181. <div class="pc"><img :src=" require('../static/subject/pc.svg') " /></div>
  182. </div>
  183. </div>
  184. <div class="area-content">
  185. {{ cp_link }}
  186. </div>
  187. <div class="area-btn">
  188. <div class="btn" :data-clipboard-text="cp_link" @click="copyLinkHandle">Copy Link</div>
  189. </div>
  190. </div>
  191. <div class="layer" v-show="layer_show">
  192. <div class="layer-box">
  193. <div class="layer-txt">Unable to copy, please enter the link manually</div>
  194. <div class="layer-btn" @click="layer_show = false">Done</div>
  195. </div>
  196. </div>
  197. </div>
  198. </div>
  199. </template>
  200. <script>
  201. import axios from 'axios';
  202. import Cookies from 'js-cookie'
  203. import { isBrowser } from '../utils/help.js'
  204. import Report from "../log-center/log"
  205. import { Toast } from 'vant';
  206. import FontAmount from '../components/FontAmount.vue'
  207. var moment = require('moment');
  208. var ClipboardJS = require('clipboard')
  209. const api = {
  210. prod: 'https://api.denetme.net',
  211. pre: 'https://preapi.denetme.net',
  212. test: 'https://testapi.denetme.net'
  213. }
  214. const page = {
  215. prod: "https://h5.denetme.net",
  216. pre: "https://preh5.denetme.net",
  217. test: 'https://testh5.denetme.net'
  218. }
  219. const jumpUrl = page[process.env.NUXT_ENV.MODE] + '/'
  220. const baseURL = api[process.env.NUXT_ENV.MODE]
  221. const appType = 1;
  222. let appVersionCode = 6;
  223. export default {
  224. name: "index",
  225. data() {
  226. return {
  227. cp_link: '',
  228. appVersionCode: appVersionCode,
  229. mid: '',
  230. show_moblie: false,
  231. show_home: false,
  232. layer_show: false,
  233. amount_font_size:46,
  234. validity: '',
  235. receiveAmount: 0,
  236. validity_state: true,
  237. detail: {
  238. postId: '',
  239. postBizData: {
  240. imagePath: '',
  241. postUserInfo: {
  242. }
  243. }
  244. },
  245. currencyIconPath: '',
  246. title: 'DeNet Giveaway',
  247. metaTitle: 'DeNet: An Easy Web3 Tool For GIVEAWAY / AIRDROP',
  248. jumpUrl: jumpUrl,
  249. status: '',
  250. page_index: 1,
  251. page_size: 20,
  252. luck_list: [],
  253. luck_list_end: false,
  254. config: {
  255. extensionsInstallChannel: 'officeDownload', // chromeAppStore
  256. extensionsInstallUrl: ''
  257. }
  258. }
  259. },
  260. components: {
  261. FontAmount,
  262. },
  263. head() {
  264. return {
  265. type: '',
  266. title: this.title,
  267. appVersionCode: 3,
  268. meta: [
  269. // facebook
  270. {
  271. name: 'og:url',
  272. content: this.jumpUrl + this.detail.postId
  273. },
  274. {
  275. name: 'og:title',
  276. content: this.metaTitle
  277. },
  278. {
  279. name: 'og:image',
  280. content: this.detail.postBizData.imagePath || ''
  281. },
  282. // twitter
  283. {
  284. name: 'twitter:card',
  285. content: 'summary_large_image'
  286. },
  287. {
  288. name: 'twitter:url',
  289. content: this.jumpUrl + this.detail.postId
  290. },
  291. {
  292. name: 'twitter:title',
  293. content: this.metaTitle
  294. },
  295. {
  296. name: 'twitter:image',
  297. content: this.detail.postBizData.imagePath || ''
  298. }
  299. ]
  300. }
  301. },
  302. methods: {
  303. copyLinkHandle() {
  304. Report.reportLog({
  305. baseInfo: {
  306. appVersionCode: this.appVersionCode,
  307. mid: this.mid,
  308. pageSource: Report.pageSource.mobileLandingPage,
  309. appType,
  310. machineCode: this.mid
  311. },
  312. params: {
  313. eventData: {
  314. businessType: Report.businessType.buttonClick,
  315. objectType: Report.objectType.copyLinkButton
  316. },
  317. extParams: {
  318. postId: this.detail.postId,
  319. srcContentId: this.detail.srcContentId,
  320. senderId: this.detail.srcUserId,
  321. status: this.status,
  322. }
  323. }
  324. })
  325. },
  326. clickOpenChrome() {
  327. window.open('https://www.google.com/chrome')
  328. },
  329. isMobile() {
  330. let flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
  331. return flag;
  332. },
  333. installExtension() {
  334. let { extensionsInstallChannel, extensionsInstallUrl } = this.config;
  335. let url = extensionsInstallUrl;
  336. Report.reportLog({
  337. baseInfo: {
  338. appVersionCode: this.appVersionCode,
  339. mid: this.mid,
  340. pageSource: Report.pageSource.newUserLandingPage,
  341. appType,
  342. machineCode: this.mid
  343. },
  344. params: {
  345. eventData: {
  346. businessType: Report.businessType.buttonClick,
  347. objectType: Report.objectType.installButton
  348. },
  349. extParams: {
  350. postId: this.detail.postId,
  351. srcContentId: this.detail.srcContentId,
  352. senderId: this.detail.srcUserId,
  353. status: this.status,
  354. }
  355. }
  356. })
  357. switch (extensionsInstallChannel) {
  358. case "officeDownload":
  359. location.href = url;
  360. this.$router.push({
  361. path: '/install'
  362. })
  363. break;
  364. case "chromeAppStore":
  365. window.open(extensionsInstallUrl)
  366. break;
  367. }
  368. },
  369. formatTime(time, _type = 'MM-DD HH:mm:ss') {
  370. return moment(time).format(_type)
  371. },
  372. guid() {
  373. return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
  374. var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
  375. return v.toString(16);
  376. });
  377. },
  378. handleScroll(e) {
  379. e = e.target
  380. if (this.luck_list_end) {
  381. return
  382. }
  383. if ((e.clientHeight + e.scrollTop) / e.scrollHeight > .8) {
  384. this.luck_list_end = false
  385. this.page_index++
  386. this.getReceivedList()
  387. }
  388. },
  389. getFontSize(amount) {
  390. let _num = parseInt(360 / amount.length);
  391. this.amount_font_size = _num < 46 ? _num : 46;
  392. },
  393. setCookieMid() {
  394. let _cookie_mid_arr = Cookies.get('mid') || []
  395. if (_cookie_mid_arr.length > 0) {
  396. this.mid = JSON.parse(_cookie_mid_arr)[0].mid
  397. } else {
  398. this.mid = this.guid()
  399. Cookies.set('mid', JSON.stringify([{ mid: this.mid }]), { expires: 1000 })
  400. }
  401. },
  402. async getRedPacket() {
  403. this.currencyIconPath = this.detail.postBizData.currencyIconPath
  404. let { data } = await axios.post(`${baseURL}/denet/post/luckdrop/receiveLuckdrop`, {
  405. baseInfo: {
  406. appVersionCode: this.appVersionCode,
  407. mid: this.mid
  408. },
  409. params: {
  410. postId: this.detail.postId || ''
  411. }
  412. })
  413. this.show_home = true
  414. switch (data.code.toString()) {
  415. case '0':
  416. this.getDetail()
  417. if (data.data.receiveAmount == '0') {
  418. this.status = 'nothing'
  419. } else {
  420. if (data.data.newReceived) {
  421. this.status = 'not-open'
  422. setTimeout(() => {
  423. this.status = 'open'
  424. }, 3000)
  425. this.receiveAmount = data.data.receiveAmount
  426. } else {
  427. this.status = 'opened'
  428. }
  429. }
  430. this.getValidity(data.data.endTimestamp)
  431. this.receiveAmount = data.data.receiveAmount
  432. this.getFontSize(this.receiveAmount)
  433. break;
  434. case '2003':
  435. // this.status = 'expire'
  436. this.getDetail()
  437. this.status = 'nothing'
  438. break
  439. // 红包被领完了
  440. case '2008':
  441. this.getDetail()
  442. this.status = 'nothing'
  443. break
  444. case '2029':
  445. // 推文未发布
  446. this.status = 'error'
  447. break
  448. default:
  449. console.log('getRedPacket', data)
  450. // this.show_home = false
  451. this.getDetail()
  452. this.status = 'nothing'
  453. break;
  454. }
  455. // 领取列表分页
  456. this.getReceivedList()
  457. },
  458. async getReceivedList() {
  459. let { data } = await axios.post(`${baseURL}/denet/post/luckdrop/getReceivedList`, {
  460. baseInfo: {
  461. appVersionCode: this.appVersionCode,
  462. mid: this.mid
  463. },
  464. params: {
  465. pageNum: this.page_index,
  466. pageSize: this.page_size,
  467. postId: this.detail.postId || ''
  468. }
  469. })
  470. if (data.code == 0) {
  471. if (data.data.length > 0) {
  472. this.luck_list = this.luck_list.concat(data.data)
  473. this.luck_list_end = false
  474. } else {
  475. this.luck_list_end = true
  476. }
  477. } else {
  478. console.log('getReceivedList', data)
  479. }
  480. },
  481. getValidity(end_time) {
  482. let _d1, _d2, _d3, _h, _m, _s
  483. let timer = setInterval(() => {
  484. let _time = new Date().getTime()
  485. _d3 = end_time - _time
  486. if (_d3 > 0) {
  487. _d1 = moment(end_time)
  488. _d2 = moment(_time)
  489. _h = moment.duration(_d1.diff(_d2)).hours()
  490. _m = moment.duration(_d1.diff(_d2)).minutes()
  491. _s = moment.duration(_d1.diff(_d2)).seconds()
  492. if (_h < 10) {
  493. _h = '0' + _h
  494. }
  495. if (_m < 10) {
  496. _m = '0' + _m
  497. }
  498. if (_s < 10) {
  499. _s = '0' + _s
  500. }
  501. this.validity = `${_h}:${_m}:${_s}`
  502. } else {
  503. clearInterval(timer)
  504. }
  505. }, 1000)
  506. },
  507. setPickupInfo() {
  508. let pickupInfo = {
  509. srcContentId: this.detail.srcContentId,
  510. postNickName: this.detail.postBizData.postUserInfo.nickName,
  511. createTime: Date.now(),
  512. };
  513. Cookies.set('pickup_info', JSON.stringify(pickupInfo), { expires: 100 });
  514. },
  515. async getDetail() {
  516. let { data } = await axios.post(`${baseURL}/denet/post/getDetail`, {
  517. baseInfo: {
  518. appVersionCode: this.appVersionCode,
  519. mid: this.mid
  520. },
  521. params: {
  522. postId: this.detail.postId
  523. }
  524. })
  525. if (data.code == 0) {
  526. this.detail.postBizData = JSON.parse(data.data.postBizData)
  527. }
  528. },
  529. async getConfig() {
  530. let { data } = await axios.post(`${baseURL}/denet/base/config/getFrontConfig`, {
  531. baseInfo: {
  532. appVersionCode: this.appVersionCode,
  533. mid: this.mid
  534. },
  535. params: {
  536. }
  537. })
  538. if (data.code == 0) {
  539. this.config = data.data;
  540. }
  541. },
  542. },
  543. async asyncData(params) {
  544. let { route } = params;
  545. let { data } = await axios.post(`${baseURL}/denet/post/getDetail`, {
  546. baseInfo: {
  547. appVersionCode: appVersionCode,
  548. mid: function () {
  549. return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
  550. var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
  551. return v.toString(16);
  552. });
  553. }()
  554. },
  555. params: {
  556. postId: route.params.id || ''
  557. }
  558. })
  559. if (data.code == 0) {
  560. if (data.data && data.data.postBizData && typeof data.data.postBizData == 'string') {
  561. data.data.postBizData = JSON.parse(data.data.postBizData)
  562. }
  563. if(data.data.postBizData === null) {
  564. data.data.postBizData = {
  565. postUserInfo: {
  566. }
  567. }
  568. }
  569. return {
  570. detail: data.data,
  571. }
  572. }
  573. },
  574. mounted() {
  575. this.getConfig()
  576. if (!this.detail.postId) {
  577. return
  578. }
  579. console.log(this.detail)
  580. //改变font-size
  581. // (function (doc, win) {
  582. // var docEI = doc.documentElement,
  583. // resizeEvt = 'orientationchange' in window ? 'orientataionchange' : 'resize',
  584. // recalc = function () {
  585. // var clientWidth = docEI.clientWidth;
  586. // if (!clientWidth) return;
  587. // //100是字体大小,1510是开发时浏览器窗口的宽度,等比计算
  588. // docEI.style.fontSize = 10 * (clientWidth / 1510) + 'px';
  589. // }
  590. // if (!doc.addEventListener) return;
  591. // win.addEventListener(resizeEvt, recalc, false);
  592. // doc.addEventListener('DOMContentLoaded', recalc, false);
  593. // })(document, window);
  594. document.documentElement.style.fontSize = '62.5%'
  595. if (this.isMobile()) {
  596. this.setCookieMid();
  597. setTimeout(() => {
  598. Report.reportLog({
  599. baseInfo: {
  600. appVersionCode: this.appVersionCode,
  601. mid: this.mid,
  602. pageSource: Report.pageSource.mobileLandingPage,
  603. appType,
  604. machineCode: this.mid
  605. },
  606. params: {
  607. eventData: {
  608. businessType: Report.businessType.pageView
  609. },
  610. extParams: {
  611. postId: this.detail.postId,
  612. srcContentId: this.detail.srcContentId,
  613. senderId: this.detail.srcUserId,
  614. status: this.status,
  615. }
  616. }
  617. })
  618. }, 500)
  619. this.show_moblie = true
  620. this.cp_link = window.location.href
  621. // 复制链接
  622. var clipboard = new ClipboardJS('.btn');
  623. clipboard.on('success', function (e) {
  624. Toast('copy success');
  625. console.info('Action:', e.action);
  626. console.info('Text:', e.text);
  627. console.info('Trigger:', e.trigger);
  628. e.clearSelection();
  629. });
  630. clipboard.on('error', function (e) {
  631. this.layer_show = true
  632. console.error('Action:', e.action);
  633. console.error('Trigger:', e.trigger);
  634. });
  635. // 领取列表分页
  636. this.getReceivedList()
  637. } else if (isBrowser() == 'chrome') {
  638. // 领取任务红包
  639. this.setCookieMid()
  640. // 是否被领完
  641. if(this.detail.postBizData.receiveCount < this.detail.postBizData.totalCount){
  642. this.getRedPacket()
  643. }else{
  644. this.show_home = true
  645. this.status = 'nothing'
  646. }
  647. this.setPickupInfo()
  648. setTimeout(() => {
  649. Report.reportLog({
  650. baseInfo: {
  651. appVersionCode: this.appVersionCode,
  652. mid: this.mid,
  653. pageSource: Report.pageSource.newUserLandingPage,
  654. appType,
  655. machineCode: this.mid
  656. },
  657. params: {
  658. eventData: {
  659. businessType: Report.businessType.pageView,
  660. },
  661. extParams: {
  662. postId: this.detail.postId,
  663. srcContentId: this.detail.srcContentId,
  664. senderId: this.detail.srcUserId,
  665. status: this.status,
  666. }
  667. }
  668. });
  669. }, 500)
  670. } else {
  671. this.show_home = true
  672. this.status = 'no-chrome'
  673. Report.reportLog({
  674. baseInfo: {
  675. appVersionCode: this.appVersionCode,
  676. mid: this.mid,
  677. pageSource: Report.pageSource.newUserLandingPage,
  678. appType,
  679. machineCode: this.mid
  680. },
  681. params: {
  682. eventData: {
  683. businessType: Report.businessType.pageView,
  684. },
  685. extParams: {
  686. postId: this.detail.postId,
  687. srcContentId: this.detail.srcContentId,
  688. senderId: this.detail.srcUserId,
  689. status: this.status,
  690. }
  691. }
  692. })
  693. }
  694. }
  695. }
  696. </script>
  697. <style lang="scss" >
  698. html,
  699. body,
  700. #__nuxt,
  701. #__layout {
  702. width: 100%;
  703. height: 100%;
  704. padding: 0;
  705. margin: 0;
  706. }
  707. .moblie {
  708. display: flex;
  709. flex-wrap: wrap;
  710. height: 100%;
  711. align-content: flex-start;
  712. flex-direction: column;
  713. .layer {
  714. position: fixed;
  715. width: 100%;
  716. height: 100%;
  717. top: 0;
  718. left: 0;
  719. background: rgba(0, 0, 0, .5);
  720. .layer-box {
  721. width: 30rem;
  722. height: 17rem;
  723. background: #FFFFFF;
  724. border-radius: 11px;
  725. opacity: 1;
  726. position: absolute;
  727. top: 25rem;
  728. left: 50%;
  729. margin-left: -15rem;
  730. .layer-txt {
  731. margin: 3rem 0;
  732. width: 100%;
  733. padding: 0 2.7rem;
  734. font-weight: 600;
  735. font-size: 1.8rem;
  736. text-align: center;
  737. }
  738. .layer-btn {
  739. width: 19rem;
  740. height: 4rem;
  741. background: #389AFF;
  742. border-radius: 100px;
  743. margin: 0 auto;
  744. text-align: center;
  745. line-height: 4rem;
  746. color: #fff;
  747. font-weight: 600;
  748. font-size: 1.8rem;
  749. }
  750. }
  751. }
  752. .head-area {
  753. width: 100%;
  754. height: 11rem;
  755. text-align: center;
  756. letter-spacing: 0.3px;
  757. font-size: 2rem;
  758. text-align: center;
  759. color: #fff;
  760. background: #389AFF;
  761. border-radius: 0 586px 586px/0 0 104px 104px;
  762. display: flex;
  763. align-items: center;
  764. justify-content: center;
  765. .gift {
  766. margin-right: 1.4rem;
  767. img {
  768. width: 5.2rem;
  769. }
  770. }
  771. .txt {
  772. font-size: 1.8rem;
  773. text-align: left;
  774. }
  775. }
  776. .luck-list-title {
  777. /* margin-top: 47px;*/
  778. margin: 0 16px;
  779. padding: 14px 0 11px 0;
  780. background: #fff;
  781. display: flex;
  782. justify-content: space-between;
  783. color: #B0B0B0;
  784. border-bottom: 1px solid #D1D1D1;
  785. }
  786. .luck-list {
  787. flex: 1;
  788. width: 100%;
  789. overflow-y: auto;
  790. .luck-item {
  791. display: flex;
  792. padding: 12px 0;
  793. margin: 0 16px;
  794. border-bottom: 1px solid #F2F2F2;
  795. justify-content: space-between;
  796. position: relative;
  797. img:first-child {
  798. border-radius: 50%;
  799. }
  800. .luck-king {
  801. position: absolute;
  802. top: 36px;
  803. right: 0px;
  804. display: flex;
  805. align-items: center;
  806. img {
  807. width: 22px;
  808. height: 19px;
  809. margin: 0;
  810. }
  811. span {
  812. font-weight: 500;
  813. font-size: 12px;
  814. line-height: 14px;
  815. letter-spacing: 0.3px;
  816. color: #f5b945;
  817. }
  818. }
  819. img {
  820. width: 42px;
  821. height: 42px;
  822. margin-right: 12px;
  823. }
  824. .luck-content {
  825. flex: auto;
  826. .luck-title {
  827. font-weight: 500;
  828. font-size: 16px;
  829. letter-spacing: 0.3px;
  830. color: #444444;
  831. }
  832. .luck-time {
  833. font-weight: 400;
  834. font-size: 12px;
  835. line-height: 14px;
  836. color: #9b9b9b;
  837. }
  838. }
  839. .luck-money {
  840. display: flex;
  841. height: 17px;
  842. align-items: center;
  843. img {
  844. width: 14px;
  845. height: 14px;
  846. margin-right: 6px;
  847. }
  848. .luck-money-txt {
  849. font-weight: 500;
  850. font-size: 14px;
  851. /* identical to box height */
  852. text-align: right;
  853. letter-spacing: 0.3px;
  854. color: #444444;
  855. }
  856. }
  857. }
  858. .luck-item:last-child {
  859. border: 0;
  860. }
  861. }
  862. .area-cp-link {
  863. background: #fff;
  864. width: 100%;
  865. flex-wrap: wrap;
  866. height: 20rem;
  867. box-shadow: 0px -4px 10px rgba(0, 0, 0, 0.1);
  868. border-top-left-radius: 1rem;
  869. border-top-right-radius: 1rem;
  870. .area-list {
  871. width: 34.3rem;
  872. margin: 1.5rem auto;
  873. .item {
  874. clear: both;
  875. overflow: hidden;
  876. margin: 0.7rem 0;
  877. font-size: 1.6rem;
  878. font-weight: 500;
  879. .icon {
  880. float: left;
  881. margin-right: 0.8rem;
  882. }
  883. .font {
  884. float: left;
  885. margin-right: 0.8rem;
  886. }
  887. .pc {
  888. float: left;
  889. }
  890. }
  891. }
  892. .area-content {
  893. background: #F4F4F4;
  894. padding: 0.7rem 1rem;
  895. margin: 0 auto 1rem;
  896. width: 34.3rem;
  897. font-size: 1.3rem;
  898. border-radius: 0.5rem;
  899. word-break: break-all;
  900. }
  901. .area-btn {
  902. flex: 1;
  903. display: flex;
  904. justify-content: center;
  905. .btn {
  906. width: 34.3rem;
  907. height: 4rem;
  908. background: #389AFF;
  909. border-radius: 100px;
  910. font-size: 1.8rem;
  911. color: #FFFFFF;
  912. }
  913. }
  914. }
  915. }
  916. .content {
  917. width: 100%;
  918. height: 100%;
  919. background-size: 100%;
  920. background-repeat: no-repeat;
  921. position: relative;
  922. font-family: "SF Pro Display";
  923. font-style: normal;
  924. font-weight: 600;
  925. .not-open {
  926. display: flex;
  927. align-items: center;
  928. justify-content: center;
  929. width: 100%;
  930. height: 100%;
  931. img {
  932. width: 20rem;
  933. height: 20rem;
  934. }
  935. }
  936. .logo {
  937. position: absolute;
  938. left: 4rem;
  939. top: 1.5rem;
  940. img {
  941. width: 10.7rem;
  942. height: 3.4rem;
  943. }
  944. }
  945. .key_packet {
  946. animation: key_packet 3s;
  947. animation-delay: 0s;
  948. animation-fill-mode: forwards;
  949. }
  950. .redBag {
  951. display: flex;
  952. justify-content: flex-start;
  953. flex-direction: column;
  954. position: absolute;
  955. top: 14rem;
  956. left: 30.6rem;
  957. width: 37.5rem;
  958. height: 50rem;
  959. border-radius: 2rem;
  960. overflow-y: hidden;
  961. box-shadow: 0 0 5px #888888;
  962. background: #fff;
  963. .money-area {
  964. width: 100%;
  965. position: absolute;
  966. top: 65px;
  967. display: flex;
  968. flex-wrap: wrap;
  969. align-items: center;
  970. justify-content: center;
  971. .txt {
  972. font-weight: 800;
  973. font-size: 16px;
  974. text-align: center;
  975. letter-spacing: 0.3px;
  976. color: #FFFFFF;
  977. }
  978. .coin {
  979. text-align: center;
  980. margin-top: 6px;
  981. margin-bottom: 7px;
  982. display: flex;
  983. justify-content: center;
  984. align-items: center;
  985. width: 90%;
  986. img {
  987. width: 46px;
  988. height: 46px;
  989. border-radius: 50%;
  990. border: 3px solid #FFFFFF;
  991. }
  992. span {
  993. margin-left: 15px;
  994. font-weight: 800;
  995. font-size: 60px;
  996. line-height: 76px;
  997. color: #FFFFFF;
  998. }
  999. }
  1000. .people {
  1001. font-weight: 800;
  1002. font-size: 13px;
  1003. line-height: 16px;
  1004. letter-spacing: 0.05em;
  1005. text-align: center;
  1006. color: #FFFFFF;
  1007. }
  1008. }
  1009. .title {
  1010. position: absolute;
  1011. top: 15px;
  1012. left: 15px;
  1013. z-index: 3;
  1014. display: flex;
  1015. align-items: center;
  1016. img {
  1017. width: 24px;
  1018. height: 24px;
  1019. border: 2px solid #FFF;
  1020. border-radius: 50%;
  1021. }
  1022. span {
  1023. margin-left: 10px;
  1024. font-weight: 600;
  1025. font-size: 16px;
  1026. letter-spacing: 0.3px;
  1027. color: #fff;
  1028. }
  1029. }
  1030. img {
  1031. width: 100%;
  1032. }
  1033. .up {
  1034. position: absolute;
  1035. top: 0;
  1036. z-index: 1;
  1037. }
  1038. .down {
  1039. position: absolute;
  1040. top: 253px;
  1041. }
  1042. .open {
  1043. width: 335px;
  1044. height: 50px;
  1045. cursor: pointer;
  1046. position: absolute;
  1047. bottom: 28px;
  1048. left: 50%;
  1049. margin-left: -167.5px;
  1050. z-index: 4;
  1051. }
  1052. .open-gif {
  1053. width: 200px;
  1054. height: 200px;
  1055. text-align: center;
  1056. position: absolute;
  1057. bottom: 70px;
  1058. left: 50%;
  1059. margin-left: -100px;
  1060. z-index: 3;
  1061. }
  1062. }
  1063. .redPacket {
  1064. display: flex;
  1065. justify-content: flex-start;
  1066. flex-direction: column;
  1067. position: absolute;
  1068. top: 9rem;
  1069. left: 50%;
  1070. width: 37.5rem;
  1071. margin-left: -18rem;
  1072. height: 65rem;
  1073. border-radius: 2rem;
  1074. // background: red;
  1075. overflow-y: hidden;
  1076. box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.1);
  1077. background: #fff;
  1078. .top {
  1079. top: 0;
  1080. position: absolute;
  1081. width: 100%;
  1082. z-index: 12;
  1083. }
  1084. .down {
  1085. bottom: 0;
  1086. position: absolute;
  1087. height: 32.3rem;
  1088. z-index: 11;
  1089. }
  1090. .head {
  1091. position: relative;
  1092. .head-title {
  1093. position: absolute;
  1094. top: 0;
  1095. width: 100%;
  1096. display: flex;
  1097. align-items: center;
  1098. justify-content: center;
  1099. height: 3.6rem;
  1100. background: rgba(255, 255, 255, .1);
  1101. img {
  1102. width: 1.8rem;
  1103. height: 1.8rem;
  1104. border-radius: 50%;
  1105. border: 1px solid #fff;
  1106. }
  1107. span {
  1108. margin-left: .8rem;
  1109. font-size: 1.2rem;
  1110. color: #fff;
  1111. }
  1112. }
  1113. .head-txt {
  1114. margin-top: 4.7rem;
  1115. font-size: 2rem;
  1116. text-align: center;
  1117. color: #fff;
  1118. }
  1119. .head-area {
  1120. height: 19rem;
  1121. text-align: center;
  1122. letter-spacing: 0.3px;
  1123. font-size: 2rem;
  1124. text-align: center;
  1125. color: #fff;
  1126. background: #389AFF;
  1127. border-radius: 0 586px 586px/0 0 164px 164px;
  1128. .txt {
  1129. padding-top: 8.5rem;
  1130. }
  1131. }
  1132. .head-money {
  1133. .txt {
  1134. padding-top: 6.8rem;
  1135. font-weight: 800;
  1136. font-size: 1.5rem;
  1137. text-align: center;
  1138. letter-spacing: 0.3px;
  1139. }
  1140. .head-money-area {
  1141. display: flex;
  1142. width: 100%;
  1143. justify-content: center;
  1144. align-items: center;
  1145. img {
  1146. width: 4rem;
  1147. height: 4rem;
  1148. border: 2px solid #FFFFFF;
  1149. border-radius: 100px;
  1150. }
  1151. span {
  1152. margin-left: 1.3rem;
  1153. font-size: 4.6rem;
  1154. word-break: break-all;
  1155. }
  1156. }
  1157. }
  1158. }
  1159. .luck-list-title {
  1160. /* margin-top: 47px;*/
  1161. margin: 0 16px;
  1162. padding: 14px 0 11px 0;
  1163. background: #fff;
  1164. display: flex;
  1165. font-weight: 500;
  1166. justify-content: space-between;
  1167. color: #B0B0B0;
  1168. border-bottom: 1px solid #F2F2F2;
  1169. }
  1170. .luck-list {
  1171. background: #fff;
  1172. overflow-y: auto;
  1173. .luck-item {
  1174. display: flex;
  1175. padding: 12px 0;
  1176. margin: 0 16px;
  1177. border-bottom: 1px solid #F2F2F2;
  1178. justify-content: space-between;
  1179. position: relative;
  1180. img:first-child {
  1181. border-radius: 50%;
  1182. }
  1183. .luck-king {
  1184. position: absolute;
  1185. top: 36px;
  1186. right: 0px;
  1187. display: flex;
  1188. align-items: center;
  1189. img {
  1190. width: 22px;
  1191. height: 19px;
  1192. margin: 0;
  1193. }
  1194. span {
  1195. font-weight: 500;
  1196. font-size: 12px;
  1197. line-height: 14px;
  1198. letter-spacing: 0.3px;
  1199. color: #f5b945;
  1200. }
  1201. }
  1202. img {
  1203. width: 42px;
  1204. height: 42px;
  1205. margin-right: 12px;
  1206. }
  1207. .luck-content {
  1208. flex: auto;
  1209. .luck-title {
  1210. font-weight: 500;
  1211. font-size: 16px;
  1212. letter-spacing: 0.3px;
  1213. color: #444444;
  1214. margin-bottom: 5px;
  1215. }
  1216. .luck-time {
  1217. font-weight: 400;
  1218. font-size: 12px;
  1219. line-height: 14px;
  1220. color: #B0B0B0;
  1221. }
  1222. }
  1223. .luck-money {
  1224. display: flex;
  1225. height: 17px;
  1226. align-items: center;
  1227. img {
  1228. width: 14px;
  1229. height: 14px;
  1230. margin-right: 6px;
  1231. }
  1232. .luck-money-txt {
  1233. font-weight: 500;
  1234. font-size: 14px;
  1235. /* identical to box height */
  1236. text-align: right;
  1237. letter-spacing: 0.3px;
  1238. color: #444444;
  1239. }
  1240. }
  1241. }
  1242. .luck-item:last-child {
  1243. border: 0;
  1244. }
  1245. }
  1246. .area {
  1247. position: absolute;
  1248. z-index: 112;
  1249. width: 100%;
  1250. .title {
  1251. z-index: 11;
  1252. margin-top: 8.5rem;
  1253. text-align: center;
  1254. img {
  1255. width: 3.6rem;
  1256. height: 3.6rem;
  1257. border: 2px solid #fff4db;
  1258. border-radius: 50%;
  1259. }
  1260. span {
  1261. letter-spacing: 0.3px;
  1262. font-size: 1.6rem;
  1263. color: #fff2d3;
  1264. }
  1265. }
  1266. .txt {
  1267. font-size: 4rem;
  1268. text-align: center;
  1269. letter-spacing: 0.03rem;
  1270. color: #fff2d3;
  1271. }
  1272. }
  1273. .key_area {
  1274. animation: key_area 1s;
  1275. animation-delay: 1s;
  1276. animation-fill-mode: forwards;
  1277. }
  1278. }
  1279. .redPacket2 {
  1280. left: 43.6rem;
  1281. margin-left: -18rem;
  1282. }
  1283. .key_install {
  1284. opacity: 0;
  1285. animation: key_install 2s;
  1286. animation-delay: 0s;
  1287. animation-fill-mode: forwards;
  1288. }
  1289. .install {
  1290. position: absolute;
  1291. top: 20rem;
  1292. left: 73.5rem;
  1293. .title {
  1294. font-size: 4.8rem;
  1295. color: #000000;
  1296. letter-spacing: 0.3px;
  1297. }
  1298. .validity {
  1299. margin-top: 1rem;
  1300. color: #FF0000;
  1301. width: 40rem;
  1302. height: 3.3rem;
  1303. line-height: 3.3rem;
  1304. font-weight: normal;
  1305. span {
  1306. font-size: 1.4rem;
  1307. }
  1308. }
  1309. .flow {
  1310. position: absolute;
  1311. margin-top: 4rem;
  1312. .line {
  1313. position: absolute;
  1314. height: 16rem;
  1315. border: 1px solid #e0e0e0;
  1316. top: 3rem;
  1317. left: 1.2rem;
  1318. }
  1319. .area_num {
  1320. display: flex;
  1321. align-items: center;
  1322. .num {
  1323. width: 2.4rem;
  1324. height: 2.4rem;
  1325. background-color: rgba(56, 154, 255, 1);
  1326. border-radius: 50%;
  1327. color: #fff;
  1328. text-align: center;
  1329. line-height: 2.4rem;
  1330. font-size: 1.4rem;
  1331. }
  1332. span {
  1333. margin-left: 1.5rem;
  1334. color: #000000;
  1335. font-size: 1.8rem;
  1336. }
  1337. }
  1338. .tip {
  1339. margin-left: 4rem;
  1340. margin-top: 0.7rem;
  1341. font-size: 1.4rem;
  1342. color: #a4a4a4;
  1343. }
  1344. .install_btn {
  1345. cursor: pointer;
  1346. margin-left: 4rem;
  1347. margin-top: 2rem;
  1348. margin-bottom: 6.7rem;
  1349. width: 23rem;
  1350. height: 5.8rem;
  1351. background: #389aff;
  1352. border-radius: 10rem;
  1353. color: #fff;
  1354. line-height: 5.8rem;
  1355. text-align: center;
  1356. font-size: 2rem;
  1357. }
  1358. }
  1359. .tip {
  1360. margin-top: 0.7rem;
  1361. font-size: 1.4rem;
  1362. color: #a4a4a4;
  1363. }
  1364. .install_btn {
  1365. cursor: pointer;
  1366. margin-top: 2rem;
  1367. margin-bottom: 6.7rem;
  1368. width: 23rem;
  1369. height: 5.8rem;
  1370. background: #389aff;
  1371. border-radius: 10rem;
  1372. color: #fff;
  1373. line-height: 5.8rem;
  1374. text-align: center;
  1375. font-size: 2rem;
  1376. }
  1377. }
  1378. .install-error {
  1379. left: 78.5rem;
  1380. .install_chrome {
  1381. cursor: pointer;
  1382. width: 24.3rem;
  1383. height: 5.8rem;
  1384. font-size: 2rem;
  1385. font-weight: 500;
  1386. letter-spacing: 0.3px;
  1387. display: flex;
  1388. align-items: center;
  1389. background: #FFFFFF;
  1390. border: 1px solid #e8e8e8;
  1391. border-radius: 10rem;
  1392. margin-top: 3.3rem;
  1393. img {
  1394. width: 3.2rem;
  1395. height: 3.2rem;
  1396. margin-left: 3.3rem;
  1397. }
  1398. span {
  1399. margin-left: 1.2rem;
  1400. }
  1401. }
  1402. }
  1403. }
  1404. @keyframes key_area {
  1405. 0% {
  1406. opacity: 1;
  1407. }
  1408. 100% {
  1409. opacity: 0;
  1410. }
  1411. }
  1412. @keyframes key_install {
  1413. 0% {
  1414. opacity: 0;
  1415. }
  1416. 100% {
  1417. opacity: 1;
  1418. }
  1419. }
  1420. @keyframes key_packet {
  1421. 0% {}
  1422. 100% {
  1423. left: 30.6rem;
  1424. margin-left: -18rem;
  1425. }
  1426. }
  1427. </style>