<template>
	<view>
		<!-- 状态栏 -->
		<status-nav :titleVal="'我的二维码'" :statusTitle="true"></status-nav>
		<view :style="{paddingTop: statusHeight+'px'}" class="pad-zy32">
			<image :src="imgSrc" class="mar-s32" style="width: 100%;" mode="widthFix"></image>
			<view v-if="isBtn" @tap="sendImg" class="fon40 bold colf mar-z10 radius20 tc" style="height: 90rpx;margin: 80rpx;background-color: #38CE51;line-height: 90rpx;">发送二维码</view>
		</view>
		<!-- 底部客服 -->
		<public-customer :nbottom="100"></public-customer>
		<!-- 用户信息授权，手机号授权 -->
		<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
	</view>
</template>

<script>
	import {base64ToPath} from '@/jsFile/base64-src.js';
	export default {
		data() {
			return {
				imgSrc:'',
				isBtn:false
			}
		},
		computed:{
			statusHeight() {
				return this.$store.state.statusHeight
			}
		},
		onLoad() {
			if(uni.getStorageSync('phone_active')!=0 && uni.getStorageSync('is_active')!=0){
				this.checkImg()
			}
		},
		methods: {
			checkImg(){
				this.$requst.post('user/service-qr').then(res=>{
					// console.log('二维码：',res);
					if(res.code==0){
						base64ToPath(res.data.qr).then(path => {
							this.imgSrc = path
							this.isBtn = true
						}).catch(error => {})
					}
				},error=>{})
			},
			sendImg(){
				wx.showShareImageMenu({
				    path: this.imgSrc
				})
			}
		}
	}
</script>

<style>
</style>
