uniapp如何图片放大或保存并且上传图片

308 阅读1分钟
page{ background-color: rgb(248, 248, 248); } .contents{ background-color: rgb(248, 248, 248); // height: 1174px; } i{ color: red; font-style: initial; position: relative; top: 2px; left: 2px; } .image { position: absolute; width: 100%; height: 340rpx; } .storeForm{ // margin-top: -260rpx; position: relative; top: 100rpx; padding: 0 8rpx; } ::v-deep .step .uni-steps__row-title{ margin-bottom: 30rpx; } ::v-deep .step .uni-icons>span{ font-size: 50rpx } ::v-deep .step .uni-steps__row-title>span{ color: rgb(255, 254, 255) } // ::v-deep .strp .uni-steps__row-line-item>.uni-steps__row-line{ // background-color: rgb(255,255,255)!important // } // 公共样式 .common{ margin-top: 10rpx; padding: 30rpx 20rpx 0rpx 20rpx; background: #FFFFFF; border-top-left-radius: 20rpx; border-top-right-radius: 20rpx; border-bottom-left-radius: 16rpx; border-bottom-right-radius: 16rpx; } .flexs{ display: flex; justify-content: space-between; } .StoreInfo{ // padding-top: 20rpx; // height: 100rpx; border-bottom: 2rpx solid rgb(248, 248, 250); } ::v-deep .StoreInfo .uni-forms-item__content{ display: flex; justify-content: flex-start; } // ::v-deep .StoreInfo .uni-forms-item__content:last-child{ // display: block; // } .Storetitle{ font-size: 30rpx; color: rgb(117, 115, 118); } .uploads{ // padding-top: 20rpx; } .upload{ margin-top: 16rpx; } ::v-deep .upload uni-image{ width: 100rpx; height: 100rpx; } ::v-deep .uploadLogo uni-image{ width: 100rpx; height: 100rpx; } ::v-deep .upload .imageItem{ width: 118rpx; height: 118rpx; margin: 10rpx 2rpx; } .ups{ // background: url(../../../static/person/merchantJoin/img_bg_logo.png) -2rpx; // background-size: 106%; width: 120rpx; height: 120rpx; position: relative;left: 50%; transform: translateX(-50%); } ::v-deep .uploadLogo .imageItem{ position: relative; left: 50%; transform: translateX(-50%); width: 118rpx; height: 118rpx; margin: 10rpx 2rpx; } ::v-deep .upload .imageDel{ position: relative; width: 32rpx; height: 34rpx; left: 80rpx; bottom:112rpx; background-color: rgba(0,0,0,0.6); text-align: center; line-height: 30rpx; border-radius: 50%; color: white; font-size: 24rpx; } ::v-deep .uploadLogo .imageDel{ position: relative; width: 32rpx; height: 34rpx; left: 80rpx; bottom:112rpx; background-color: rgba(0,0,0,0.6); text-align: center; line-height: 30rpx; border-radius: 50%; color: white; font-size: 24rpx; } ::v-deep .uploadLogo .imageUpload{ position: relative; left: 50%; transform: translateX(-50%); text-align: center; font-size: 50rpx; line-height: 112rpx; color: #7ce0be; background-size: 106%!important; border: 2rpx dashed #bcfce6; background: url(../../../static/person/merchantJoin/img_bg_logo.png) -2rpx; border-radius: 8rpx; width: 114rpx; height: 118rpx; } ::v-deep .upload .imageUpload{ text-align: center; font-size: 50rpx; line-height: 112rpx; color: #7ce0be;; border:2rpx dashed #bcfce6; background-color: rgb(243, 252, 249); border-radius: 8rpx; width: 115rpx; height: 118rpx; } ::v-deep .uploadMerchants .imageUpload{ text-align: center; font-size: 50rpx; line-height: 112rpx; color: #7ce0be;; border:2rpx dashed #bcfce6; background-color: rgb(243, 252, 249); border-radius: 8rpx; width: 200rpx; height: 118rpx; } .uploadMerchantss{ width: 310rpx; height: 194rpx; } // ::v-deep .uploadMerchantss .imageUpload{ // text-align: center; // font-size: 50rpx; // line-height: 112rpx; // color: #7ce0be;; // border:2rpx dashed #bcfce6; // // background-color: rgb(243, 252, 249); // border-radius: 8rpx; // width: 200rpx; // height: 118rpx; // } // ::v-deep .s1 .imageUpload{ // background-size: 106%!important; // border: 2rpx dashed #bcfce6; // background: url(../../../static/person/merchantJoin/img_1.png) -2rpx; // } // ::v-deep .s2 .imageUpload{ // background-size: 106%!important; // border: 2rpx dashed #bcfce6; // background: url(../../../static/person/merchantJoin/img_2.png) -2rpx; // } ::v-deep .citySelect .uni-forms-item__content{ display: flex; justify-content: flex-start; } ::v-deep .citySelect .input-value-border{ margin-top: -20rpx; border: none; } ::v-deep .citySelect .arrow-area{ position: absolute; margin-left: auto; width: 56px; left: 162%; display: flex; justify-content: center; -webkit-transform: rotate(-45deg); transform: rotate(-138deg); -webkit-transform-origin: center; transform-origin: center; } ::v-deep .citySelect .arrow-area .input-arrow{ width: 5px; height: 5px; border-left: 1px solid #999; border-bottom: 1px solid #999; } ::v-deep .storeTextarea .uni-textarea-textarea{ background-color: rgb(252, 251, 254); border-radius: 20rpx; padding: 16rpx; height: 240rpx; } .next1{ position: absolute; left: -16rpx; bottom: -40rpx; width: 106%; height: 92rpx; background-color: white; } .next1 button{ position: relative; top: 18%; line-height:60rpx; width: 86%; background-color: #9bedd2; border-radius: 40rpx; } ::v-deep .StoreInfo .uni-list-cell{ display: flex; } ::v-deep .StoreInfo uni-radio-group{ display: flex; } .dataSubmitted{ position: absolute; left: 50%; transform: translateX(-50%); color: #333333; font-size: 36rpx; top: 58%; } .waitAudit{ position: absolute; left: 50%; transform: translateX(-50%); top: 64%; color:#666666; font-size: 28rpx; } .waitImage{ width: 50%; height: 320rpx; position: relative; left: 50%; transform: translateX(-50%); top:80rpx; } ::v-deep .fonts .uni-input-input{ font-size: 28rpx; } ::v-deep .fonts .uni-input-placeholder{ font-size: 28rpx; } .uni-list-cell{ margin-right: 28rpx; } ::v-deep .operatorLabel .uni-radio-input{ width: 28rpx; height: 28rpx; background-color: rgb(3, 210, 139) !important; border-color: rgb(3, 210, 139) !important; } ::v-deep .superiorChannel .uni-radio-input{ border-radius: 50%; border-color: rgb(222, 222, 222) !important; } ::v-deep .superiorChannel .uni-radio-input-checked{ color: #fff !important; border-color: rgb(3, 210, 139) !important; background-color: rgb(3, 210, 139) !important; } .determine{ position: relative; left: -16rpx; bottom: -16rpx; width: 106%; height: 88rpx; background-color: white; } .determine button{ position: relative; top: 18%; line-height: 56rpx; width: 86%; background-color: rgb(3, 210, 139); border-radius: 40rpx; } .classification{ position: relative; background-color: #fff; padding: 15px; border-top-left-radius: 30rpx; border-top-right-radius: 30rpx; } .classificationTitle{ color: #333333; font-size: 30rpx; text-align: center; border-bottom: 1px solid rgb(249, 249, 249); padding-bottom: 30rpx; } ::v-deep .uni-list-cell .uni-checkbox-input{ border-radius: 50%; border-color: rgb(222, 222, 222) !important; } ::v-deep .uni-list-cell .uni-checkbox-input-checked{ border-radius: 50%; color: #fff !important; border-color: rgb(3, 210, 139) !important; background-color: rgb(3, 210, 139); } .addImg{ display: flex; margin: 24rpx 12rpx; } .addImg2{ width: 114rpx;height: 114rpx;border: 2rpx dashed #bcfce6;background-color: rgb(243, 252, 249);position: relative; } .addImg2>view{ color: rgb(124, 225, 201);font-size: 48rpx;position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%); } .deleteStoreImg{ position: absolute; width: 16px;height: 16px;background-color: rgba(0, 0, 0, 0.5);top: -12%;left: 82%;border-radius: 50%;color: #fff;text-align: center;line-height: 16px; } .deleteMerchantImg{ position: absolute; width: 16px;height: 16px;background-color: rgba(0, 0, 0, 0.5);top: -12%;left: 90%;border-radius: 50%;color: #fff;text-align: center;line-height: 16px; } .forImg{ width: 114rpx; height: 114rpx; margin-right: 16rpx; position: relative; } .forImg2{ width: 310rpx; height: 194rpx; margin-right: 16rpx; position: relative; } .deleteLogo{ position: absolute; width: 16px;height: 16px;background-color: rgba(0, 0, 0, 0.5);top: -6px;left: 56%;border-radius: 50%;color: #fff;text-align: center;line-height: 16px; } .formInfoUpload{ width: 51rpx;height: 51rpx;position: absolute;left: 50%;transform: translateX(-44%);top: 34%; } .formInfoStoreLogo{ width: 122rpx;height: 122rpx;margin-left: -2rpx;margin-top: -3rpx; border: 2rpx dashed #bcfce6; } .editInfo{ position: relative; left: 50%; transform: translateX(-50%); top:264rpx; width: 480rpx; height: 72rpx; // background-color: #03D28B; text-align: center; line-height: 72rpx; } .editInfo button{ color: white; width: 100%; background-color: rgb(3, 210, 139); border-radius: 60rpx; height: 100%; line-height: 72rpx; }
	// 查看图片预览放大(单张)
	showUploadProgressSingle(imageUrl){
		  var images = [];
		  	images.push(imageUrl);
		  	uni.previewImage({ 
		  	current:0,
		  	urls:images,
		  	longPressActions: {  //长按保存图片到相册
		  		itemList: ['保存图片'],
		  		success: (data)=> {
		  		uni.saveImageToPhotosAlbum({ //保存图片到相册
		  		filePath: payUrl,
		  		success: function () {
		  		uni.showToast({icon:'success',title:'保存成功'})
		  	},
		  		fail: (err) => {
		  		uni.showToast({icon:'none',title:'保存失败,请重新尝试'})
		  		}
		  	});
		  },
		  	fail: (err)=> {
		  	console.log(err.errMsg);
		}
			}
		});	
		},
	// 查看图片预览放大(多张)
	showUploadProgress(imageUrl,index){
	  var images = [];
	  	images.push(imageUrl.fileUrl);
	  	uni.previewImage({ 
	  	current:index,
	  	urls:images,
	  	longPressActions: {  //长按保存图片到相册
	  		itemList: ['保存图片'],
	  		success: (data)=> {
	  		uni.saveImageToPhotosAlbum({ //保存图片到相册
	  		filePath: payUrl,
	  		success: function () {
	  		uni.showToast({icon:'success',title:'保存成功'})
	  	},
	  		fail: (err) => {
	  		uni.showToast({icon:'none',title:'保存失败,请重新尝试'})
	  		}
	  	});
	  },
	  	fail: (err)=> {
	  	console.log(err.errMsg);
	}
}
	});	
	}