index.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552
  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. Report.reportLog({
  598. baseInfo: {
  599. appVersionCode: this.appVersionCode,
  600. mid: this.mid,
  601. pageSource: Report.pageSource.mobileLandingPage,
  602. appType,
  603. machineCode: this.mid
  604. },
  605. params: {
  606. eventData: {
  607. businessType: Report.businessType.pageView
  608. },
  609. extParams: {
  610. postId: this.detail.postId,
  611. srcContentId: this.detail.srcContentId,
  612. senderId: this.detail.srcUserId,
  613. status: this.status,
  614. }
  615. }
  616. })
  617. this.show_moblie = true
  618. this.cp_link = window.location.href
  619. // 复制链接
  620. var clipboard = new ClipboardJS('.btn');
  621. clipboard.on('success', function (e) {
  622. Toast('copy success');
  623. console.info('Action:', e.action);
  624. console.info('Text:', e.text);
  625. console.info('Trigger:', e.trigger);
  626. e.clearSelection();
  627. });
  628. clipboard.on('error', function (e) {
  629. this.layer_show = true
  630. console.error('Action:', e.action);
  631. console.error('Trigger:', e.trigger);
  632. });
  633. // 领取列表分页
  634. this.getReceivedList()
  635. } else if (isBrowser() == 'chrome') {
  636. // 领取任务红包
  637. this.setCookieMid()
  638. // 是否被领完
  639. if(this.detail.postBizData.receiveCount < this.detail.postBizData.totalCount){
  640. this.getRedPacket()
  641. }else{
  642. this.show_home = true
  643. this.status = 'nothing'
  644. }
  645. this.setPickupInfo()
  646. Report.reportLog({
  647. baseInfo: {
  648. appVersionCode: this.appVersionCode,
  649. mid: this.mid,
  650. pageSource: Report.pageSource.newUserLandingPage,
  651. appType,
  652. machineCode: this.mid
  653. },
  654. params: {
  655. eventData: {
  656. businessType: Report.businessType.pageView,
  657. },
  658. extParams: {
  659. postId: this.detail.postId,
  660. srcContentId: this.detail.srcContentId,
  661. senderId: this.detail.srcUserId,
  662. status: this.status,
  663. }
  664. }
  665. });
  666. } else {
  667. this.show_home = true
  668. this.status = 'no-chrome'
  669. }
  670. }
  671. }
  672. </script>
  673. <style lang="scss" >
  674. html,
  675. body,
  676. #__nuxt,
  677. #__layout {
  678. width: 100%;
  679. height: 100%;
  680. padding: 0;
  681. margin: 0;
  682. }
  683. .moblie {
  684. display: flex;
  685. flex-wrap: wrap;
  686. height: 100%;
  687. align-content: flex-start;
  688. flex-direction: column;
  689. .layer {
  690. position: fixed;
  691. width: 100%;
  692. height: 100%;
  693. top: 0;
  694. left: 0;
  695. background: rgba(0, 0, 0, .5);
  696. .layer-box {
  697. width: 30rem;
  698. height: 17rem;
  699. background: #FFFFFF;
  700. border-radius: 11px;
  701. opacity: 1;
  702. position: absolute;
  703. top: 25rem;
  704. left: 50%;
  705. margin-left: -15rem;
  706. .layer-txt {
  707. margin: 3rem 0;
  708. width: 100%;
  709. padding: 0 2.7rem;
  710. font-weight: 600;
  711. font-size: 1.8rem;
  712. text-align: center;
  713. }
  714. .layer-btn {
  715. width: 19rem;
  716. height: 4rem;
  717. background: #389AFF;
  718. border-radius: 100px;
  719. margin: 0 auto;
  720. text-align: center;
  721. line-height: 4rem;
  722. color: #fff;
  723. font-weight: 600;
  724. font-size: 1.8rem;
  725. }
  726. }
  727. }
  728. .head-area {
  729. width: 100%;
  730. height: 11rem;
  731. text-align: center;
  732. letter-spacing: 0.3px;
  733. font-size: 2rem;
  734. text-align: center;
  735. color: #fff;
  736. background: #389AFF;
  737. border-radius: 0 586px 586px/0 0 104px 104px;
  738. display: flex;
  739. align-items: center;
  740. justify-content: center;
  741. .gift {
  742. margin-right: 1.4rem;
  743. img {
  744. width: 5.2rem;
  745. }
  746. }
  747. .txt {
  748. font-size: 1.8rem;
  749. text-align: left;
  750. }
  751. }
  752. .luck-list-title {
  753. /* margin-top: 47px;*/
  754. margin: 0 16px;
  755. padding: 14px 0 11px 0;
  756. background: #fff;
  757. display: flex;
  758. justify-content: space-between;
  759. color: #B0B0B0;
  760. border-bottom: 1px solid #D1D1D1;
  761. }
  762. .luck-list {
  763. flex: 1;
  764. width: 100%;
  765. overflow-y: auto;
  766. .luck-item {
  767. display: flex;
  768. padding: 12px 0;
  769. margin: 0 16px;
  770. border-bottom: 1px solid #F2F2F2;
  771. justify-content: space-between;
  772. position: relative;
  773. img:first-child {
  774. border-radius: 50%;
  775. }
  776. .luck-king {
  777. position: absolute;
  778. top: 36px;
  779. right: 0px;
  780. display: flex;
  781. align-items: center;
  782. img {
  783. width: 22px;
  784. height: 19px;
  785. margin: 0;
  786. }
  787. span {
  788. font-weight: 500;
  789. font-size: 12px;
  790. line-height: 14px;
  791. letter-spacing: 0.3px;
  792. color: #f5b945;
  793. }
  794. }
  795. img {
  796. width: 42px;
  797. height: 42px;
  798. margin-right: 12px;
  799. }
  800. .luck-content {
  801. flex: auto;
  802. .luck-title {
  803. font-weight: 500;
  804. font-size: 16px;
  805. letter-spacing: 0.3px;
  806. color: #444444;
  807. }
  808. .luck-time {
  809. font-weight: 400;
  810. font-size: 12px;
  811. line-height: 14px;
  812. color: #9b9b9b;
  813. }
  814. }
  815. .luck-money {
  816. display: flex;
  817. height: 17px;
  818. align-items: center;
  819. img {
  820. width: 14px;
  821. height: 14px;
  822. margin-right: 6px;
  823. }
  824. .luck-money-txt {
  825. font-weight: 500;
  826. font-size: 14px;
  827. /* identical to box height */
  828. text-align: right;
  829. letter-spacing: 0.3px;
  830. color: #444444;
  831. }
  832. }
  833. }
  834. .luck-item:last-child {
  835. border: 0;
  836. }
  837. }
  838. .area-cp-link {
  839. background: #fff;
  840. width: 100%;
  841. flex-wrap: wrap;
  842. height: 20rem;
  843. box-shadow: 0px -4px 10px rgba(0, 0, 0, 0.1);
  844. border-top-left-radius: 1rem;
  845. border-top-right-radius: 1rem;
  846. .area-list {
  847. width: 34.3rem;
  848. margin: 1.5rem auto;
  849. .item {
  850. clear: both;
  851. overflow: hidden;
  852. margin: 0.7rem 0;
  853. font-size: 1.6rem;
  854. font-weight: 500;
  855. .icon {
  856. float: left;
  857. margin-right: 0.8rem;
  858. }
  859. .font {
  860. float: left;
  861. margin-right: 0.8rem;
  862. }
  863. .pc {
  864. float: left;
  865. }
  866. }
  867. }
  868. .area-content {
  869. background: #F4F4F4;
  870. padding: 0.7rem 1rem;
  871. margin: 0 auto 1rem;
  872. width: 34.3rem;
  873. font-size: 1.3rem;
  874. border-radius: 0.5rem;
  875. word-break: break-all;
  876. }
  877. .area-btn {
  878. flex: 1;
  879. display: flex;
  880. justify-content: center;
  881. .btn {
  882. width: 34.3rem;
  883. height: 4rem;
  884. background: #389AFF;
  885. border-radius: 100px;
  886. font-size: 1.8rem;
  887. color: #FFFFFF;
  888. }
  889. }
  890. }
  891. }
  892. .content {
  893. width: 100%;
  894. height: 100%;
  895. background-size: 100%;
  896. background-repeat: no-repeat;
  897. position: relative;
  898. font-family: "SF Pro Display";
  899. font-style: normal;
  900. font-weight: 600;
  901. .not-open {
  902. display: flex;
  903. align-items: center;
  904. justify-content: center;
  905. width: 100%;
  906. height: 100%;
  907. img {
  908. width: 20rem;
  909. height: 20rem;
  910. }
  911. }
  912. .logo {
  913. position: absolute;
  914. left: 4rem;
  915. top: 1.5rem;
  916. img {
  917. width: 10.7rem;
  918. height: 3.4rem;
  919. }
  920. }
  921. .key_packet {
  922. animation: key_packet 3s;
  923. animation-delay: 0s;
  924. animation-fill-mode: forwards;
  925. }
  926. .redBag {
  927. display: flex;
  928. justify-content: flex-start;
  929. flex-direction: column;
  930. position: absolute;
  931. top: 14rem;
  932. left: 30.6rem;
  933. width: 37.5rem;
  934. height: 50rem;
  935. border-radius: 2rem;
  936. overflow-y: hidden;
  937. box-shadow: 0 0 5px #888888;
  938. background: #fff;
  939. .money-area {
  940. width: 100%;
  941. position: absolute;
  942. top: 65px;
  943. display: flex;
  944. flex-wrap: wrap;
  945. align-items: center;
  946. justify-content: center;
  947. .txt {
  948. font-weight: 800;
  949. font-size: 16px;
  950. text-align: center;
  951. letter-spacing: 0.3px;
  952. color: #FFFFFF;
  953. }
  954. .coin {
  955. text-align: center;
  956. margin-top: 6px;
  957. margin-bottom: 7px;
  958. display: flex;
  959. justify-content: center;
  960. align-items: center;
  961. width: 90%;
  962. img {
  963. width: 46px;
  964. height: 46px;
  965. border-radius: 50%;
  966. border: 3px solid #FFFFFF;
  967. }
  968. span {
  969. margin-left: 15px;
  970. font-weight: 800;
  971. font-size: 60px;
  972. line-height: 76px;
  973. color: #FFFFFF;
  974. }
  975. }
  976. .people {
  977. font-weight: 800;
  978. font-size: 13px;
  979. line-height: 16px;
  980. letter-spacing: 0.05em;
  981. text-align: center;
  982. color: #FFFFFF;
  983. }
  984. }
  985. .title {
  986. position: absolute;
  987. top: 15px;
  988. left: 15px;
  989. z-index: 3;
  990. display: flex;
  991. align-items: center;
  992. img {
  993. width: 24px;
  994. height: 24px;
  995. border: 2px solid #FFF;
  996. border-radius: 50%;
  997. }
  998. span {
  999. margin-left: 10px;
  1000. font-weight: 600;
  1001. font-size: 16px;
  1002. letter-spacing: 0.3px;
  1003. color: #fff;
  1004. }
  1005. }
  1006. img {
  1007. width: 100%;
  1008. }
  1009. .up {
  1010. position: absolute;
  1011. top: 0;
  1012. z-index: 1;
  1013. }
  1014. .down {
  1015. position: absolute;
  1016. top: 253px;
  1017. }
  1018. .open {
  1019. width: 335px;
  1020. height: 50px;
  1021. cursor: pointer;
  1022. position: absolute;
  1023. bottom: 28px;
  1024. left: 50%;
  1025. margin-left: -167.5px;
  1026. z-index: 4;
  1027. }
  1028. .open-gif {
  1029. width: 200px;
  1030. height: 200px;
  1031. text-align: center;
  1032. position: absolute;
  1033. bottom: 70px;
  1034. left: 50%;
  1035. margin-left: -100px;
  1036. z-index: 3;
  1037. }
  1038. }
  1039. .redPacket {
  1040. display: flex;
  1041. justify-content: flex-start;
  1042. flex-direction: column;
  1043. position: absolute;
  1044. top: 9rem;
  1045. left: 50%;
  1046. width: 37.5rem;
  1047. margin-left: -18rem;
  1048. height: 65rem;
  1049. border-radius: 2rem;
  1050. // background: red;
  1051. overflow-y: hidden;
  1052. box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.1);
  1053. background: #fff;
  1054. .top {
  1055. top: 0;
  1056. position: absolute;
  1057. width: 100%;
  1058. z-index: 12;
  1059. }
  1060. .down {
  1061. bottom: 0;
  1062. position: absolute;
  1063. height: 32.3rem;
  1064. z-index: 11;
  1065. }
  1066. .head {
  1067. position: relative;
  1068. .head-title {
  1069. position: absolute;
  1070. top: 0;
  1071. width: 100%;
  1072. display: flex;
  1073. align-items: center;
  1074. justify-content: center;
  1075. height: 3.6rem;
  1076. background: rgba(255, 255, 255, .1);
  1077. img {
  1078. width: 1.8rem;
  1079. height: 1.8rem;
  1080. border-radius: 50%;
  1081. border: 1px solid #fff;
  1082. }
  1083. span {
  1084. margin-left: .8rem;
  1085. font-size: 1.2rem;
  1086. color: #fff;
  1087. }
  1088. }
  1089. .head-txt {
  1090. margin-top: 4.7rem;
  1091. font-size: 2rem;
  1092. text-align: center;
  1093. color: #fff;
  1094. }
  1095. .head-area {
  1096. height: 19rem;
  1097. text-align: center;
  1098. letter-spacing: 0.3px;
  1099. font-size: 2rem;
  1100. text-align: center;
  1101. color: #fff;
  1102. background: #389AFF;
  1103. border-radius: 0 586px 586px/0 0 164px 164px;
  1104. .txt {
  1105. padding-top: 8.5rem;
  1106. }
  1107. }
  1108. .head-money {
  1109. .txt {
  1110. padding-top: 6.8rem;
  1111. font-weight: 800;
  1112. font-size: 1.5rem;
  1113. text-align: center;
  1114. letter-spacing: 0.3px;
  1115. }
  1116. .head-money-area {
  1117. display: flex;
  1118. width: 100%;
  1119. justify-content: center;
  1120. align-items: center;
  1121. img {
  1122. width: 4rem;
  1123. height: 4rem;
  1124. border: 2px solid #FFFFFF;
  1125. border-radius: 100px;
  1126. }
  1127. span {
  1128. margin-left: 1.3rem;
  1129. font-size: 4.6rem;
  1130. word-break: break-all;
  1131. }
  1132. }
  1133. }
  1134. }
  1135. .luck-list-title {
  1136. /* margin-top: 47px;*/
  1137. margin: 0 16px;
  1138. padding: 14px 0 11px 0;
  1139. background: #fff;
  1140. display: flex;
  1141. font-weight: 500;
  1142. justify-content: space-between;
  1143. color: #B0B0B0;
  1144. border-bottom: 1px solid #F2F2F2;
  1145. }
  1146. .luck-list {
  1147. background: #fff;
  1148. overflow-y: auto;
  1149. .luck-item {
  1150. display: flex;
  1151. padding: 12px 0;
  1152. margin: 0 16px;
  1153. border-bottom: 1px solid #F2F2F2;
  1154. justify-content: space-between;
  1155. position: relative;
  1156. img:first-child {
  1157. border-radius: 50%;
  1158. }
  1159. .luck-king {
  1160. position: absolute;
  1161. top: 36px;
  1162. right: 0px;
  1163. display: flex;
  1164. align-items: center;
  1165. img {
  1166. width: 22px;
  1167. height: 19px;
  1168. margin: 0;
  1169. }
  1170. span {
  1171. font-weight: 500;
  1172. font-size: 12px;
  1173. line-height: 14px;
  1174. letter-spacing: 0.3px;
  1175. color: #f5b945;
  1176. }
  1177. }
  1178. img {
  1179. width: 42px;
  1180. height: 42px;
  1181. margin-right: 12px;
  1182. }
  1183. .luck-content {
  1184. flex: auto;
  1185. .luck-title {
  1186. font-weight: 500;
  1187. font-size: 16px;
  1188. letter-spacing: 0.3px;
  1189. color: #444444;
  1190. margin-bottom: 5px;
  1191. }
  1192. .luck-time {
  1193. font-weight: 400;
  1194. font-size: 12px;
  1195. line-height: 14px;
  1196. color: #B0B0B0;
  1197. }
  1198. }
  1199. .luck-money {
  1200. display: flex;
  1201. height: 17px;
  1202. align-items: center;
  1203. img {
  1204. width: 14px;
  1205. height: 14px;
  1206. margin-right: 6px;
  1207. }
  1208. .luck-money-txt {
  1209. font-weight: 500;
  1210. font-size: 14px;
  1211. /* identical to box height */
  1212. text-align: right;
  1213. letter-spacing: 0.3px;
  1214. color: #444444;
  1215. }
  1216. }
  1217. }
  1218. .luck-item:last-child {
  1219. border: 0;
  1220. }
  1221. }
  1222. .area {
  1223. position: absolute;
  1224. z-index: 112;
  1225. width: 100%;
  1226. .title {
  1227. z-index: 11;
  1228. margin-top: 8.5rem;
  1229. text-align: center;
  1230. img {
  1231. width: 3.6rem;
  1232. height: 3.6rem;
  1233. border: 2px solid #fff4db;
  1234. border-radius: 50%;
  1235. }
  1236. span {
  1237. letter-spacing: 0.3px;
  1238. font-size: 1.6rem;
  1239. color: #fff2d3;
  1240. }
  1241. }
  1242. .txt {
  1243. font-size: 4rem;
  1244. text-align: center;
  1245. letter-spacing: 0.03rem;
  1246. color: #fff2d3;
  1247. }
  1248. }
  1249. .key_area {
  1250. animation: key_area 1s;
  1251. animation-delay: 1s;
  1252. animation-fill-mode: forwards;
  1253. }
  1254. }
  1255. .redPacket2 {
  1256. left: 43.6rem;
  1257. margin-left: -18rem;
  1258. }
  1259. .key_install {
  1260. opacity: 0;
  1261. animation: key_install 2s;
  1262. animation-delay: 0s;
  1263. animation-fill-mode: forwards;
  1264. }
  1265. .install {
  1266. position: absolute;
  1267. top: 20rem;
  1268. left: 73.5rem;
  1269. .title {
  1270. font-size: 4.8rem;
  1271. color: #000000;
  1272. letter-spacing: 0.3px;
  1273. }
  1274. .validity {
  1275. margin-top: 1rem;
  1276. color: #FF0000;
  1277. width: 40rem;
  1278. height: 3.3rem;
  1279. line-height: 3.3rem;
  1280. font-weight: normal;
  1281. span {
  1282. font-size: 1.4rem;
  1283. }
  1284. }
  1285. .flow {
  1286. position: absolute;
  1287. margin-top: 4rem;
  1288. .line {
  1289. position: absolute;
  1290. height: 16rem;
  1291. border: 1px solid #e0e0e0;
  1292. top: 3rem;
  1293. left: 1.2rem;
  1294. }
  1295. .area_num {
  1296. display: flex;
  1297. align-items: center;
  1298. .num {
  1299. width: 2.4rem;
  1300. height: 2.4rem;
  1301. background-color: rgba(56, 154, 255, 1);
  1302. border-radius: 50%;
  1303. color: #fff;
  1304. text-align: center;
  1305. line-height: 2.4rem;
  1306. font-size: 1.4rem;
  1307. }
  1308. span {
  1309. margin-left: 1.5rem;
  1310. color: #000000;
  1311. font-size: 1.8rem;
  1312. }
  1313. }
  1314. .tip {
  1315. margin-left: 4rem;
  1316. margin-top: 0.7rem;
  1317. font-size: 1.4rem;
  1318. color: #a4a4a4;
  1319. }
  1320. .install_btn {
  1321. cursor: pointer;
  1322. margin-left: 4rem;
  1323. margin-top: 2rem;
  1324. margin-bottom: 6.7rem;
  1325. width: 23rem;
  1326. height: 5.8rem;
  1327. background: #389aff;
  1328. border-radius: 10rem;
  1329. color: #fff;
  1330. line-height: 5.8rem;
  1331. text-align: center;
  1332. font-size: 2rem;
  1333. }
  1334. }
  1335. .tip {
  1336. margin-top: 0.7rem;
  1337. font-size: 1.4rem;
  1338. color: #a4a4a4;
  1339. }
  1340. .install_btn {
  1341. cursor: pointer;
  1342. margin-top: 2rem;
  1343. margin-bottom: 6.7rem;
  1344. width: 23rem;
  1345. height: 5.8rem;
  1346. background: #389aff;
  1347. border-radius: 10rem;
  1348. color: #fff;
  1349. line-height: 5.8rem;
  1350. text-align: center;
  1351. font-size: 2rem;
  1352. }
  1353. }
  1354. .install-error {
  1355. left: 78.5rem;
  1356. .install_chrome {
  1357. cursor: pointer;
  1358. width: 24.3rem;
  1359. height: 5.8rem;
  1360. font-size: 2rem;
  1361. font-weight: 500;
  1362. letter-spacing: 0.3px;
  1363. display: flex;
  1364. align-items: center;
  1365. background: #FFFFFF;
  1366. border: 1px solid #e8e8e8;
  1367. border-radius: 10rem;
  1368. margin-top: 3.3rem;
  1369. img {
  1370. width: 3.2rem;
  1371. height: 3.2rem;
  1372. margin-left: 3.3rem;
  1373. }
  1374. span {
  1375. margin-left: 1.2rem;
  1376. }
  1377. }
  1378. }
  1379. }
  1380. @keyframes key_area {
  1381. 0% {
  1382. opacity: 1;
  1383. }
  1384. 100% {
  1385. opacity: 0;
  1386. }
  1387. }
  1388. @keyframes key_install {
  1389. 0% {
  1390. opacity: 0;
  1391. }
  1392. 100% {
  1393. opacity: 1;
  1394. }
  1395. }
  1396. @keyframes key_packet {
  1397. 0% {}
  1398. 100% {
  1399. left: 30.6rem;
  1400. margin-left: -18rem;
  1401. }
  1402. }
  1403. </style>