You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

196 lines
3.8 KiB

<template>
<view class="main">
<!-- nav -->
<navigation>{{ i18n.InviteFriends }}</navigation>
<view class="body">
<view class="shareText">{{ i18n.ShareWithFriends }}</view>
<!-- <view class="scanText">{{ i18n.ScanTheCode }}</view> -->
<!-- 二维码 -->
<view class="QRCode">
<u-image class="QRCodeImg" :src="qr" width="400rpx" height="400rpx">
</u-image>
</view>
<!-- <view class="myIdText">{{ i18n.MyReferralID }}{{inviteRules.invitationCode}}</view> -->
<!-- 按钮 -->
<!-- <u-button class="button" color="#00E8A2" throttleTime="500" @click="copyId(referralID)">{{
i18n.CopyID
}}
</u-button> -->
<view class="copy">
<view class="item">
{{link}}
</view>
<view class="btn" @click="copyId(link)">
{{ i18n.CopyLink}}
</view>
</view>
<view class="copy">
<view class="item2">
{{ i18n.MyReferralID }}{{this.inviteRules.invitationCode}}
</view>
<view class="btn" @click="copyId(inviteRules.invitationCode)">
{{ i18n.CopyID}}
</view>
</view>
<view class="title" style="color: #94939B;">
{{ i18n.TIPS}}
</view>
<view class="scanText" v-html="inviteRules.invitationRules"></view>
</view>
</view>
</template>
<script>
import uniCopy from '@/utils/uni-copy'
import api from '@/utils/api'
import constant from '@/utils/constant.js';
import QR from '@/utils/qrCode/wxqrcode.js'
export default {
name: "inviteFriends",
data() {
return {
// 邀请链接
link:'',
qr: null,
referralID: 857222,
inviteRules: {},
};
},
computed: {
i18n() {
return this.$t("me");
},
},
onLoad() {
this.invitation()
},
onShow() {},
methods: {
//获取邀请规则文案
invitation() {
api.invitation().then(res => {
this.inviteRules = res
this.link = this.inviteRules.generateQRCodeUrl + this.inviteRules.invitLink
// let baseURL = constant.BASE_URL
// e=e.replace('h5Path',baseURL)
this.qr = QR.createQrCodeImg(this.link)
})
},
copyId(e) {
// console.log(value)
uniCopy({
content: e,
success: (res) => {
uni.showToast({
title: this.$t("login").copySuccess,
duration: 3000,
})
},
error: (e) => {
uni.showToast({
title: e,
icon: 'none',
duration: 2000,
})
}
})
},
},
}
</script>
<style lang="scss" scoped>
.copy {
margin-bottom: 60rpx;
background: #323045;
border-radius: 32rpx;
line-height: 60rpx;
padding: 32rpx;
position: relative;
.item {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
width: 450rpx;
}
.btn {
position: absolute;
right: 0;
top: 0;
line-height: 60rpx;
height: 100%;
background: #00E8A2;
border-radius: 0px 32rpx 32rpx 0px;
width: 162rpx;
font-weight: 600;
font-size: 28rpx;
display: flex;
align-items: center;
color: #15141F;
justify-content: center;
}
}
.main {
.body {
overflow: hidden;
margin-top: 200rpx;
padding: 0 48rpx;
padding-bottom: 45rpx;
.shareText {
margin-top: 104rpx;
font-size: 60rpx;
font-weight: 800;
text-align: center;
}
.scanText {
font-size: 32rpx;
text-align: center;
color: #A2A0A8;
word-break: break-all;
}
.QRCode {
box-sizing: border-box;
margin: 66rpx auto;
width: 520rpx;
height: 520rpx;
background-image: url(../../static/me/bg_QR_code.png);
background-repeat: no-repeat;
background-size: 520rpx;
padding: 52rpx;
.QRCodeImg {
margin-left: 8rpx;
}
}
.myIdText {
font-size: 48rpx;
font-weight: 800;
text-align: center;
}
.button {
height: 112rpx;
margin: 72rpx 0;
border-radius: 32rpx;
color: #15141F !important;
font-weight: 700;
font-size: 32rpx;
}
}
}
</style>