<template>
	<view>
		<view class="w100 h-676 rows rowsc relative" style="background-image: linear-gradient(to bottom,#F3C0C3,#F7F6FA);">
			<view class="w100 rows rowsc absolute" style="top: 100rpx;">
				<view class="w-646 rows rowsm rowsc relative" style="height: 836rpx;">
					<image class="w100 h100" src="/static/images/evff.png" mode=""></image>
					<view class="rows rowsl rowsm absolute w100 h100 pt-80" style="top: 0;">
						<text class="fs-30 fw-b col333">邀请码</text>
						<image class="w-312 h-312 mt-100" :src="$tools.oss(infor.qrcode)" mode="aspectFill"></image>
					</view>
				</view>
			</view>
		</view>
		<view class="w100 rows rowsl rowsm fixed" style="bottom: 50rpx;">
			<view class="w-694 bg colfff br-100 h-90 rows rowsc rowsm fs-30"
			@click="shares">
				立即邀请
			</view>
			<view class="w-694 col br-100 h-90 rows rowsc rowsm fs-30 mt-30" style="border: 2rpx solid #E73232;"
			@click="saveImage">
				保存到相册
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				infor:{}
			}
		},
		onShow() {
			this.index()
		},
		methods: {
			index(){
				this.$tools.axiosFrom("POST","user/index").then(res => {
					this.infor = res.data
				})
			},
			saveImage(){
				uni.downloadFile({
					url: this.$tools.oss(this.infor.qrcode),
					success: (res) => {
						if (res.statusCode === 200) {
							uni.saveImageToPhotosAlbum({
								filePath:res.tempFilePath,
								success: () => {
									this.$tools.showtt("保存成功")
								},
								fail:(err) => {
									this.$tools.showtt("保存失败")
								}
							})
						}
					}
				})
			},
			shares(){
				// #ifdef MP-WEIXIN
				wx.downloadFile({
					url:this.$tools.oss(this.infor.qrcode),
					success:(res) => {
						wx.showShareImageMenu({
							path:res.tempFilePath
						})
					}
				})
				// #endif
			},
		}
	}
</script>

<style>
	page{
		background-color: #F7F6FA;
	}
</style>