|
@@ -0,0 +1,285 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div class="page">
|
|
|
|
|
+ <div class="share-img">
|
|
|
|
|
+ <img src="../../assets/share1.png" alt="" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="share-btn">
|
|
|
|
|
+ <van-button type="primary" @click="share" round block>立即邀请</van-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <!-- <div class="code">
|
|
|
|
|
+ <div class="code-top">
|
|
|
|
|
+ <div class="text1">我的邀请码</div>
|
|
|
|
|
+ <div class="text2">7474448585955505057578578</div>
|
|
|
|
|
+ <van-button round plain> 复制</van-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="code-btn">
|
|
|
|
|
+ <van-button type="primary" round block>领取奖励</van-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div> -->
|
|
|
|
|
+
|
|
|
|
|
+ <div class="panel">
|
|
|
|
|
+ <div class="panel-title">我的邀请</div>
|
|
|
|
|
+ <div class="panel-box">
|
|
|
|
|
+ <div class="panel-item">
|
|
|
|
|
+ <div class="text1">
|
|
|
|
|
+ <span>{{ userInfo.inviteAirDrop || 0 }}</span>
|
|
|
|
|
+ <small>个</small>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="text2">已获得藏品</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="panel-item">
|
|
|
|
|
+ <div class="text1">
|
|
|
|
|
+ <span>{{ userInfo.inviteNum || 0 }}</span>
|
|
|
|
|
+ <small>人</small>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="text2">邀请好友</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="tips">
|
|
|
|
|
+ 活动规则:<br />
|
|
|
|
|
+ 1、活动期间内,成功邀请10名注册Cosmos
|
|
|
|
|
+ Art平台并且完成实名认证即有机会获得《30w就这?纪念徽章-铜卡》数字藏品卡1张,限量1921份,送完即止;<br />
|
|
|
|
|
+ 2、活动期间内,累计邀请20名新用户注册并且完成实名认证将有机会获得“莫斯马克米奇”数字藏品空投一张(奖励于“莫斯马克米奇”首次发售后5个小时内空投至用户藏品室),限量500份,送完即止;<br />
|
|
|
|
|
+ 3、活动期间累计邀请注册且完成实名认证的用户数量排名前十的收藏师将额外获得惊喜奖励。<br />
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <van-overlay :show="show" @click="show = false">
|
|
|
|
|
+ <div class="wrapper">
|
|
|
|
|
+ <img :src="img" class="wrapper-img" v-if="img" alt="" />
|
|
|
|
|
+ <div class="wrapper-box" v-else ref="post" @click.stop>
|
|
|
|
|
+ <img class="share2" :src="shareBg" alt="" />
|
|
|
|
|
+ <vue-qrcode :value="url" :options="{ width: 70, margin: 3 }" class="share-code"></vue-qrcode>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <img src="../../assets/close.png" alt="" class="close" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </van-overlay>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script>
|
|
|
|
|
+import { mapState } from 'vuex';
|
|
|
|
|
+import resolveUrl from 'resolve-url';
|
|
|
|
|
+import vueQrcode from '@chenfengyuan/vue-qrcode';
|
|
|
|
|
+import html2canvas from 'html2canvas';
|
|
|
|
|
+export default {
|
|
|
|
|
+ computed: {
|
|
|
|
|
+ ...mapState(['userInfo']),
|
|
|
|
|
+ url() {
|
|
|
|
|
+ return resolveUrl(this.$baseUrl, 'cosmos/register?invitor=' + this.userInfo.id);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ components: {
|
|
|
|
|
+ vueQrcode
|
|
|
|
|
+ },
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ show: false,
|
|
|
|
|
+ img: '',
|
|
|
|
|
+ shareBg: ''
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+ mounted() {
|
|
|
|
|
+ this.getImgBase64(require('../../assets/share2.png'), 'shareBg');
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ share() {
|
|
|
|
|
+ this.show = true;
|
|
|
|
|
+ if (!this.img) {
|
|
|
|
|
+ this.$toast.loading({
|
|
|
|
|
+ message: '加载中...',
|
|
|
|
|
+ forbidClick: true
|
|
|
|
|
+ });
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ this.loadImg();
|
|
|
|
|
+ }, 500);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ loadImg() {
|
|
|
|
|
+ html2canvas(this.$refs.post, {
|
|
|
|
|
+ useCORS: true,
|
|
|
|
|
+ allowTaint: true,
|
|
|
|
|
+ backgroundColor: null,
|
|
|
|
|
+ scale: 3
|
|
|
|
|
+ }).then(canvas => {
|
|
|
|
|
+ this.$toast.clear();
|
|
|
|
|
+ this.img = canvas.toDataURL('image/png');
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ getImgBase64(img2, key) {
|
|
|
|
|
+ let img = new Image();
|
|
|
|
|
+ img.crossOrigin = 'anonymous';
|
|
|
|
|
+ let _this = this;
|
|
|
|
|
+ img.onload = function () {
|
|
|
|
|
+ let src = _this.image2Base64(img);
|
|
|
|
|
+ _this[key] = src;
|
|
|
|
|
+ };
|
|
|
|
|
+ img.src = img2;
|
|
|
|
|
+ },
|
|
|
|
|
+ image2Base64(img) {
|
|
|
|
|
+ let canvas = document.createElement('canvas');
|
|
|
|
|
+ canvas.width = img.width;
|
|
|
|
|
+ canvas.height = img.height;
|
|
|
|
|
+ let ctx = canvas.getContext('2d');
|
|
|
|
|
+ ctx.drawImage(img, 0, 0, img.width, img.height);
|
|
|
|
|
+ let dataURL = canvas.toDataURL('image/png');
|
|
|
|
|
+ return dataURL;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style lang="less" scoped>
|
|
|
|
|
+.page {
|
|
|
|
|
+ background-color: #f3f4f5;
|
|
|
|
|
+}
|
|
|
|
|
+.share-btn {
|
|
|
|
|
+ padding: 16px 70px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.code {
|
|
|
|
|
+ padding: 0 7px;
|
|
|
|
|
+ .code-top {
|
|
|
|
|
+ .flex();
|
|
|
|
|
+ height: 56px;
|
|
|
|
|
+ border-bottom: 1px dotted #ebeff1;
|
|
|
|
|
+
|
|
|
|
|
+ .text1 {
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ color: #939599;
|
|
|
|
|
+ }
|
|
|
|
|
+ .text2 {
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ color: #26273c;
|
|
|
|
|
+ margin-left: 4px;
|
|
|
|
|
+ flex-grow: 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ .van-button {
|
|
|
|
|
+ border: 1px solid #ebeff1;
|
|
|
|
|
+ min-width: 70px;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ background-color: #fff;
|
|
|
|
|
+ margin: 0 16px;
|
|
|
|
|
+ border-radius: 12px;
|
|
|
|
|
+
|
|
|
|
|
+ .code-btn {
|
|
|
|
|
+ padding: 12px 80px 16px;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.panel {
|
|
|
|
|
+ margin: 20px 16px 0;
|
|
|
|
|
+ background: #ffffff;
|
|
|
|
|
+ border-radius: 12px;
|
|
|
|
|
+
|
|
|
|
|
+ .panel-title {
|
|
|
|
|
+ font-size: 18px;
|
|
|
|
|
+ font-weight: bold;
|
|
|
|
|
+ line-height: 24px;
|
|
|
|
|
+ color: #26273c;
|
|
|
|
|
+ padding-top: 22px;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .panel-box {
|
|
|
|
|
+ .flex();
|
|
|
|
|
+ .panel-item {
|
|
|
|
|
+ width: 50%;
|
|
|
|
|
+ .flex-col();
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ padding: 28px 0;
|
|
|
|
|
+
|
|
|
|
|
+ .text1 {
|
|
|
|
|
+ font-size: 26px;
|
|
|
|
|
+ font-weight: bold;
|
|
|
|
|
+ line-height: 35px;
|
|
|
|
|
+ color: #ff6464;
|
|
|
|
|
+ .flex();
|
|
|
|
|
+ span {
|
|
|
|
|
+ display: inline-block;
|
|
|
|
|
+ }
|
|
|
|
|
+ small {
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ font-weight: normal;
|
|
|
|
|
+ line-height: 17px;
|
|
|
|
|
+ color: #939599;
|
|
|
|
|
+ margin-top: 6px;
|
|
|
|
|
+ display: inline-block;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .text2 {
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ line-height: 17px;
|
|
|
|
|
+ color: #939599;
|
|
|
|
|
+ margin-top: 2px;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.tips {
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ line-height: 24px;
|
|
|
|
|
+ color: #939599;
|
|
|
|
|
+ margin: 25px 16px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.share-img {
|
|
|
|
|
+ padding: 19px 16px 0;
|
|
|
|
|
+ img {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+.wrapper {
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ left: 50%;
|
|
|
|
|
+ top: 50%;
|
|
|
|
|
+ transform: translate(-50%, -50%);
|
|
|
|
|
+ .flex-col();
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+}
|
|
|
|
|
+.share2 {
|
|
|
|
|
+ width: 300px;
|
|
|
|
|
+ height: auto;
|
|
|
|
|
+ display: block;
|
|
|
|
|
+}
|
|
|
|
|
+.share-code {
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ bottom: 8px;
|
|
|
|
|
+ right: 7px;
|
|
|
|
|
+ border-radius: 6px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.wrapper-box {
|
|
|
|
|
+ border-radius: 10px;
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ .title {
|
|
|
|
|
+ font-size: 16px;
|
|
|
|
|
+ line-height: 24px;
|
|
|
|
|
+ color: #26273c;
|
|
|
|
|
+ opacity: 1;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ padding: 9px;
|
|
|
|
|
+ background-color: #fff;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.wrapper-img {
|
|
|
|
|
+ width: 300px;
|
|
|
|
|
+ display: block;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.close {
|
|
|
|
|
+ width: 40px;
|
|
|
|
|
+ height: 40px;
|
|
|
|
|
+ display: block;
|
|
|
|
|
+ margin-top: 12px;
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|