<template>
	<view class="box" style="">
		<!-- 邀请展示图 -->
		<image :src="hbimg" mode="" style="width: 100vw;" :style="{'height':(height * 1.3)+'rpx'}">
		</image>
		<!-- 二维码及邀请码 -->
		<view class="panel" style="position: absolute;bottom: 520rpx;left: 100rpx;">
			<view class="panel-qr">
				<w-qrcode @presWs="longtap" style="margin-right: 10px; margin-top: 12px;" :options="arrList"
					ref="qrcode">
				</w-qrcode>
				<text style="margin-right: 10px;color: #fff;">邀请码{{invitnum}}</text>
			</view>
		</view>
		<!-- 底部分享 -->
		<u-overlay :show="show" @click="show = false">
			<view class="sitting">
				<view class="link">
					<view class="link-item" @click="paste(linkstr)">
						<image src="@/static/invite/lj.png" mode=""></image>
						<text class="item-btn">复制链接</text>
					</view>
					<view class="link-item" @click="qrshare">
						<image src="@/static/invite/ewm.png" mode=""></image>
						<text>保存海报图片</text>
					</view>
					<view class="link-item" @click="paste(invitnum)">
						<image src="@/static/invite/yqm.svg" mode=""></image>
						<text>复制邀请码</text>
					</view>
				</view>
			</view>
		</u-overlay>
		<view class="btn">
			<button @click="show=true" style="">邀请好友</button>
		</view>
	</view>

</template>

<script>
	import {
		onLoad
	} from '@/uni_modules/uview-ui/libs/mixin/mixin';

	export default {
		data() {
			return {
				height: 1280,
				hbimg: "",
				invitnum: '',
				linkstr: '',
				qr: false,
				link: false,
				invit: false,
				show: false,
				arrList: {
					code: 'https://qm.qq.com/cgi-bin/qm/qr?k=LKqML292dD2WvwQfAJXBUmvgbiB_TZWF&noverify=0',
					size: 200, // 二维码大小
					type: 'none',
					padding: 1,
				}
			};
		},
		onLoad() {
			this.height = (uni.getSystemInfoSync().screenHeight * 1.8);
			// console.log(this.height, 1);
			this.action = getApp().globalData.base
			this.$request("/ops/homesub/list", {
				amenuId: 24,
			}, 'get').then(res => {
				this.hbimg = res.data.rows.filter(item => item.subId == 13)[0].subImg
				this.hbimg = this.action + this.hbimg
			})
			this.$request("/system/user/qRCode", {}, "get").then((res) => {
				let str = res.data.data
				this.linkstr = res.data.data
				this.invitnum = str.slice(-7)
			})

		},
		methods: {
			paste(value) {
				uni.setClipboardData({
					data: value
				});
			},
			qrshare() {
				uni.navigateTo({
					url: '/components/invite/haibao'
				})

			},
		},
		components: {

		}
	}
</script>

<style lang="scss" scoped>
	.box {
		display: flex;
		flex-direction: column;
		align-items: center;
		position: relative;
	}

	.sitting {
		position: fixed;
		left: 0;
		bottom: -1px;
		background-color: #fff;
	}

	.link {
		width: 750rpx;
		height: 180rpx;
		display: flex;
		justify-content: space-around;
		border-radius: 12px 12px 0 0;
		align-items: center;

		.link-item {
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
		}

		image {
			width: 48px;
			height: 48px;
		}

		text {
			font-size: 12px;
			font-weight: 500;
			margin-top: 5px;
			line-height: 17.38px;
			color: rgba(119, 119, 119, 1)
		}
	}

	.panel-qr {
		display: flex;
		justify-content: center;
		flex-direction: column;
		align-items: center;
	}

	.btn {
		position: absolute;
		bottom: 50rpx;
		width: 500rpx;

		button {
			background: linear-gradient(180deg, rgba(255, 120, 14, 1) 0%, rgba(254, 225, 94, 1) 100%);
			box-shadow: -0.42px 3.98px 14px rgba(190, 0, 14, 0.82);
			border-radius: 22px;
		}

	}
</style>