<template>
	<view >
		<view style="margin-top: 50rpx;" class="center flex-direction">
			<image
				@error="error"
				style="width: 600rpx;height: 600rpx;"
				:src="src"
				mode="widthFix"></image>
				<view class="center margin-top-50">
					<text class="text-base">*请保存二维码，然后到微信中扫码关注该公众号</text>
				</view>
		</view>

		<view class="" style="position: fixed;bottom: 150rpx;width: 100%;">
			<view class="center">
				<view @click="saveImg" class="cu-btn  flex radius text-lg"
					style="padding: 46rpx 0;background-color: #EF9944;color: #FFFFFF;width: 90%;">
					<u-icon name="download"></u-icon>
					<text class="margin-left-20">保存到相册</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: '',
		data() {
			return {
				src:''
			};
		},
		onLoad(options) {
			this.src=options.src
			if (this.$isEmpty(this.src)) {
				this.$dialog.showModalAndBack('二维码获取失败')
				return
			}
			if (this.$isNotEmpty(this.src) && this.src.indexOf('https')<0) {
				this.src=this.src.replace('http','https')
			}
		},
		methods:{
			error(){
				this.$dialog.showModalAndBack('二维码加载失败')
			},
			async saveImg(){
				let res=await this.$mpi.downloadFile(this.src)
				this.$mpi.saveImg(res)
			}
		}
	};
</script>

<style lang="scss" scoped>

</style>
