<template>
	<view style="width:100%;background-color:#F7F7F7;min-height:100vh;background-size:100% 100%;padding-top:30%;">
		<view
			style="height:500rpx;width:500rpx;display:flex;align-items:center;justify-content:center;text-align:center;border:1px solid gray;background-color:white;border-radius:20rpx;margin:0 auto;">
			<view style="margin-top:20rpx;">
				<view>
					<image :src="BASE_URL+'/api/File/Image/annexpic/'+imgsrc" style="width:300rpx;height:300rpx;"
						show-menu-by-longpress="true">
					</image>
				</view>
				<view style="margin-top:50rpx;">
					<text>{{'分享人:'+user.realName}}</text>
				</view>
			</view>
		</view>
		<view class="centerview" style="margin-top:20rpx;">
			<button  openType="share" type="primary" class="">分享小程序</button>
		</view>
	</view>

</template>

<script>
	import BASE_URL from '../../common/config.js'
	import service from '../../service/service.js'
	export default {
		onShareAppMessage(res) {
			if (res.from === 'button') { // 来自页面内分享按钮
				console.log(res.target)
			}
			return {
				title: '朗思测评官方报名小程序',
				path: '/pages/login/index?scene=' + service.getUser().id,
				imageUrl: this.BASE_URL + '/api/File/Image/annexpic/20221222_375601989435786501.png'
			}
		},
		data() {
			return {
				BASE_URL,
				imgsrc: '',
				user: null,
				model: {
					page: 'pages/login/index',
					scene: '',
				}
			}
		},
		onLoad() {
			this.ShowInfo()
			this.ShowQRcode()
		},
		methods: {
			ShowInfo() {
				this.API.GetCustomUserInfo(service.getUser().id).then(res => {
					if (res.code == 200) {
						this.user = res.data
					} else {
						uni.showToast({
							title: '获取用户信息失败',
							icon: 'none'
						})
					}
				})
			},
			ShowQRcode() {
				this.model.scene = service.getUser().id
				this.API.GetQRCode(this.model).then(res => {
					console.log('这是获取信息', res)
					this.imgsrc = res.data
				})
			}
		}
	}
</script>

<style>
	
</style>
