| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 | 
							- <template>
 
- 	<view class="content">
 
- 		<view class="item">
 
- 			<image mode="aspectFit" :show-menu-by-longpress="true" :src="urls[0]"  ></image>
 
- 			<!-- <view class="btn" @click="savePhoto()">
 
- 				保存本地
 
- 			</view> -->
 
- 		</view>
 
- 		 
 
- 	</view>
 
- </template>
 
- <script>
 
- 	
 
- 	export default {
 
- 		data() {
 
- 			return {
 
- 				urls:['https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20221119/61b277f036444bdebf6be3e9626b272c.jpg']
 
- 			};
 
- 		},
 
- 		onLoad(option) {
 
- 			 
 
- 			
 
- 		},
 
- 		onShow() {
 
- 		},
 
- 		methods: {
 
- 			savePhoto(){
 
- 				var that=this;
 
- 				uni.downloadFile({ //下载文件资源到本地,返回文件的本地临时路径
 
- 						url: that.urls[0], //网络图片路径
 
- 						success:(res)=>{
 
- 								  var imageUrl=res.tempFilePath;//临时文件路径
 
- 								  uni.saveImageToPhotosAlbum({ //保存图片到系统相册
 
- 									   filePath: imageUrl,
 
- 									   success: (res) => {
 
- 										  console.log('图片保存成功');
 
- 									   },
 
- 									   fail: (err) => {
 
- 										   console.log('图片保存失败');
 
- 									   }
 
- 								  })
 
- 						}
 
- 				}) 
 
- 			},
 
- 			showImg() {
 
- 			 	//预览图片
 
- 			 	uni.previewImage({
 
- 					urls: this.urls,
 
- 			 	 	current: this.urls[0],
 
- 					// 长按图片显示操作菜单,如不填默认为保存相册
 
- 					longPressActions:{
 
- 						itemList:[]
 
- 					}
 
- 			 	});
 
- 			},
 
- 		}
 
- 	}
 
- </script>
 
- <style lang="scss">
 
- 	.content{
 
- 		height: 100%;
 
- 		width: 100%;
 
- 		display: flex;
 
- 		align-items: center;
 
- 		justify-content: center;
 
- 		.item{
 
- 			display: flex;
 
- 			flex-direction: column;
 
- 			align-items: center;
 
- 			justify-content: center;
 
- 			width: 100vw;
 
- 			height: 100vh;
 
- 			image{
 
- 				width: 100%;
 
- 				height:100%;
 
- 			}
 
- 			.btn{
 
- 				margin-top: 30rpx;
 
- 				background-image: linear-gradient(#ff4545,red);
 
- 				padding: 30rpx 60rpx;
 
- 				border-radius: 60rpx;
 
- 				background-color: red;
 
- 				color: #fff;
 
- 				font-size: 30rpx;
 
- 				font-family: 'PingFangTC-Regular';
 
- 				font-weight: 600;
 
- 			}
 
- 		}
 
- 		
 
- 	}
 
- </style>
 
 
  |