<template>
	<view>
		<!-- 状态栏 -->
		<status-nav :titleVal="'我的二维码'" :statusTitle="true"></status-nav>
		<view :style="{paddingTop: statusHNH+'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>
	</view>
</template>

<script>
	import {base64ToPath} from '@/jsFile/base64-src.js';
	export default {
		data() {
			return {
				statusHNH:uni.getStorageSync('statusHNH'),
				publicColor:uni.getStorageSync('publicColor'),//主题颜色
				imgSrc:'',
				isBtn:false
			}
		},
		onShow() {
			this.$toolAll.tools.isLogin()
		},
		onLoad() {
			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>