123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- <template>
- <div class="nft-content">
- <div class="logo">
- <img src="/img/icon-logo.png" alt />
- </div>
- <div class="show">
- <img
- v-if="isLoading"
- class="loading"
- src="../static/svg/icon-loading.svg" />
- <div class="center" v-else>
- <div class="img">
- <img :src="detail.pageImagePath" />
- </div>
- <div class="info">
- <img class="tag" src="../static/svg/icon-nft.svg" />
- <div class="title">{{detail.nftProjectName}}</div>
- <button class="buy" @click="installExtension">Install Denet to Buy</button>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import axios from 'axios'
- import Cookies from 'js-cookie'
- const api = {
- prod: 'https://api.denetme.net',
- pre: 'https://preapi.denetme.net',
- test: 'https://testapi.denetme.net'
- }
- const page = {
- prod: "https://h5.denetme.net",
- pre: "https://preh5.denetme.net",
- test: 'https://testh5.denetme.net'
- }
- const jumpUrl = page[process.env.NUXT_ENV.MODE] + '/'
- const baseURL = api[process.env.NUXT_ENV.MODE]
- export default {
- name: 'ntf',
- data() {
- return {
- isLoading: true,
- appVersionCode: 3,
- jumpUrl: jumpUrl,
- detail: {},
- config: {},
- title: 'DeNet Giveaway',
- metaTitle: 'DeNet: An Easy Web3 Tool For GIVEAWAY / AIRDROP',
- }
- },
- head() {
- return {
- type: '',
- title: this.title,
- appVersionCode: 3,
- meta: [
- // facebook
- {
- name: 'og:url',
- content: this.jumpUrl + 'nft/' + this.$route.params.id
- },
- {
- name: 'og:title',
- content: this.metaTitle
- },
- {
- name: 'og:image',
- content: this.detail.linkImagePath || ''
- },
- // twitter
- {
- name: 'twitter:card',
- content: 'summary_large_image'
- },
- {
- name: 'twitter:url',
- content: this.jumpUrl + 'nft/' + this.$route.params.id
- },
- {
- name: 'twitter:title',
- content: this.metaTitle
- },
- {
- name: 'twitter:image',
- content: this.detail.linkImagePath || ''
- }
- ]
- }
- },
- mounted() {
- this.setCookieMid();
- this.getConfig();
- this.getData();
- },
- methods: {
- getData() {
- if (this.$route.params && this.$route.params.id) {
- axios.post(`${baseURL}/denet/nft/project/getNftProjectInfo`, {
- baseInfo: {
- appVersionCode: this.appVersionCode,
- mid: this.mid
- },
- params: {
- nftProjectId: this.$route.params.id || ''
- }
- }).then(res => {
- let { code, data } = res.data;
- if (code === 0) {
- this.detail = data;
- this.isLoading = false;
- }
- })
- }
- },
- guid() {
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
- var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
- return v.toString(16);
- });
- },
- setCookieMid() {
- let _cookie_mid_arr = Cookies.get('mid') || []
- if (_cookie_mid_arr.length > 0) {
- this.mid = JSON.parse(_cookie_mid_arr)[0].mid
- } else {
- this.mid = this.guid()
- Cookies.set('mid', JSON.stringify([{ mid: this.mid }]), { expires: 1000 })
- }
- },
- installExtension() {
- let { extensionsInstallUrl } = this.config;
- window.open(extensionsInstallUrl)
- },
- async getConfig() {
- let { data } = await axios.post(`${baseURL}/denet/base/config/getFrontConfig`, {
- baseInfo: {
- appVersionCode: this.appVersionCode,
- mid: this.mid
- },
- params: {}
- })
- if (data.code == 0) {
- this.config = data.data;
- }
- },
- }
- }
- </script>
- <style lang="scss">
- html,
- body,
- #__nuxt,
- #__layout {
- width: 100%;
- height: 100%;
- padding: 0;
- margin: 0;
- }
- .nft-content {
- overflow: hidden;
- width: 100%;
- height: 100%;
- background: linear-gradient(180deg, #FFFFFF 0%, #F0F7FE 94.31%);
- .logo {
- display: flex;
- align-items: center;
- height: 70px;
- margin-left: 25px;
- img {
- width: 99px;
- height: 32px;
- }
- }
- .show {
- display: flex;
- align-items: center;
- height: calc(100% - 70px);
- .loading {
- margin: auto;
- width: 40px;
- border-radius: 50%;
- }
- .center {
- display: flex;
- margin: -50px auto 0;
- max-width: 1000px;
- .img {
- width: 50%;
- margin-right: 6%;
- img {
- width: 100%;
- }
- }
- .info {
- display: flex;
- flex-direction: column;
- justify-content: center;
- width: 44%;
- .tag {
- width: 25%;
- margin-bottom: 6px;
- }
- .title {
- font-size: 3.6vw;
- font-family: 'SF Pro Display';
- font-weight: bold;
- word-break: break-word;
- }
- .buy {
- overflow: hidden;
- width: 55%;
- height: 3.5vw;
- border: 0;
- margin-top: .6vw;
- color: #FFFFFF;
- font-size: 1vw;
- font-weight: 700;
- background: #1D9BF0;
- border-radius: 1000px;
- }
- }
- }
- }
- }
- </style>
|