| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 | 
							- <template>
 
- 	<view class="container">
 
- 		<view class="img-box">
 
- 			<view class="img">
 
- 				<image class="qrcode" :src="imgurl" mode="widthFix"  lazy-load :show-menu-by-longpress="true"></image>
 
- 			</view>
 
- 			
 
- 		</view>
 
- 	</view>
 
- </template>
 
- <script>
 
- 	import { getAppContactWay } from "@/api/user.js"
 
- 	export default {
 
- 		data() {
 
- 			return {
 
- 				baseUrl:uni.getStorageSync('requestPath'),
 
- 				userId:null,
 
- 				imgurl: ''
 
- 			}
 
- 		},
 
- 		onLoad(options) {
 
- 			this.userId=options.userId || uni.getStorageSync('userId');
 
- 			console.log(options.userId)
 
- 			this.getQRCode()
 
- 		},
 
- 		methods: {
 
- 			getQRCode() {
 
- 				getAppContactWay(this.userId).then(res=>{
 
- 					if(res.code==200){
 
- 						this.imgurl = res.data || ''
 
- 					} else {
 
- 						uni.showToast({
 
- 							title: res.msg,
 
- 							icon: ''
 
- 						})
 
- 					}
 
- 				})
 
- 			},
 
- 			downImg() {
 
- 				uni.showLoading({
 
- 					title: "图片保存中..."
 
- 				})
 
- 				uni.downloadFile({
 
- 					url: this.imgurl,
 
- 					fail: function(res) {
 
- 					  uni.showModal({
 
- 						title: '提示',
 
- 						content: '保存失败',
 
- 					  })
 
- 					  uni.hideLoading();
 
- 					},
 
- 					success: function(res) {
 
- 						var tempFilePath = res.tempFilePath;
 
- 						uni.saveImageToPhotosAlbum({
 
- 							filePath: tempFilePath,
 
- 							success:()=> {
 
- 							  uni.showToast({
 
- 								title: "保存成功",
 
- 								duration: 2000
 
- 							  })
 
- 							},
 
- 							fail:()=>{
 
- 							  console.log("图片失败");
 
- 							  uni.showToast({
 
- 									title: "图片失败",
 
- 									duration: 2000,
 
- 									icon: "error"
 
- 							  })
 
- 							  uni.hideLoading();
 
- 							},
 
- 							complete: function() {
 
- 							  uni.hideLoading();
 
- 							}
 
- 						})
 
- 					},
 
- 				})
 
- 			}
 
- 		}
 
- 	}
 
- </script>
 
- <style lang="scss">
 
- 	.container {
 
- 		padding: 15rpx;
 
- 		.img-box{
 
- 			display: flex;
 
- 			align-items: center;
 
- 			justify-content: center;
 
- 			width: 100%;
 
- 			height:100%;
 
- 			.img{
 
- 				width: 100%;
 
- 				height:100%;
 
- 				position: relative;
 
- 				.qrcode{
 
- 					width: 100%;
 
- 					height:100%;
 
- 					image{
 
- 						width: 100%;
 
- 						height:100%;
 
- 					}
 
- 				}
 
- 				
 
- 			}
 
- 			
 
- 			
 
- 		}
 
- 	}
 
- 	 
 
- </style>
 
 
  |