codeyaoqing.vue 3.8 KB
<template>
	<view class='content'>
		<!-- 推广码弹层 -->
		
			<view class="yaocode">
				<view class="yaocodeimg">
					<image src="../../static/codeyaoqing.png" mode=""></image>
					<view class="codebox">
						<view class="codetext">您的专属邀请码</view>
						<view class='codenumber'>{{share_number}}</view>
						<view class="copybtn" @click="copy">点击复制</view>
						<view class='codezhuan'>“赶快发送邀请码给朋友们,一起赚钱吧”</view>
						<view class="codeimgk" @longtap="previewimg">
							<image :src="img" mode=""></image>
						</view>
					</view>
				</view>
			</view>
		
	</view>
</template>

<script>
	import app from "../../App.vue";
	    export default {
	        data() {
	            return {
	                showbanben: false,
					share_number:'',
					img:'../../static/codeimg.png',
					imgarr:["../../static/codeimg.png"],
					downloadarr:["下载App"]
	            }
	        },
	        onLoad() {
	
				this.getuserinfo()
	
	        },
	        methods: {
				// 预览二维码
				previewimg(){
					
					let that=this;
					 uni.previewImage({  
					            urls: that.imgarr,  
					            longPressActions: {  
					            itemList: that.downloadarr,  
					                success: function (res) {  
					                    console.log(res);  
										plus.runtime.openURL("http://zhongmian.w.brotop.cn/index/index/download")
					                },  
					                fail: function (res) {  
					                    console.log(res.errMsg);  
					                }      
					            }  
					        });
							
							
				},
	           // 获取用户信息
	           getuserinfo() {
	           	let that = this;
	           	var url = 'member/index';
	           	var params = {
	           
	           	}
	           	console.log('7766554', params)
	           	app.post(url, params).then((res) => {
	           		console.log(res);
					that.share_number=res.data.data.share_number
	           		
	           		
	           	}).catch((err) => {
	           		
	           		
	           		console.log(err)
	           		if(err.msg="用户未登录"){
	           			that.isuser=1
	           		}
	           		
	           		console.log('我是userusesue',that.isuser)
	           			
	           
	           	})
	           },
	           
			   // 复制粘贴功能
			   copy(){
				   let that=this;
				    uni.setClipboardData({
				           data:that.share_number,//要被复制的内容
				           success:()=>{//复制成功的回调函数
				             uni.showToast({//提示
				               title:'复制成功'
				             })
				           }
				         });
			   }
	      
	        }
	
	    }

</script>

<style>
	page{
		width:100%;
		height:100%;
	}
	.content{
		width:100%;
		height:100%;
	}
	.yaocode{
		width:100%;
		height:100%;
	}
	.yaocodeimg{
		width:100%;
		height:100%;
		font-size: 0;
		position: relative;
	}
	.codeimgk{
		width:230rpx;
		height:230rpx;
		font-size: 0;
		margin:25rpx auto 0;
	}
	.codeimgk image{
		width:100%;
		height:100%;
	}
	.yaocodeimg image{
		width:100%;
		height:100%
	}
	.codebox{
		width:500rpx;
		position: absolute;
		top:470rpx;
		left:50%;
		transform: translateX(-50%);
	}
	.codetext{
		color:#794B10;
		font-size: 28rpx;
		text-align: center;
	}
	.codenumber{
		color:#6F4105;
		font-size: 80rpx;
		font-weight: bold;
		text-align: center;
		margin-top:24rpx;
	}
	.copybtn{
		width:374rpx;
		height:80rpx;
		line-height: 80rpx;
		background:linear-gradient(123deg,rgba(255,136,0,1) 0%,rgba(255,84,0,1) 100%);
		box-shadow:0rpx 26rpx 42rpx 0rpx rgba(255,108,0,0.3);
		border-radius:40rpx;
		color:#fff;
		font-size:32rpx ;
		text-align: center;
		margin:90rpx auto 0;
	}
	.codezhuan{
		color:#6F4105;
		font-size: 28rpx;
		text-align: center;
		margin-top:72rpx
	}
		
</style>