Commit 54d3979d authored by Damon's avatar Damon

同步保存图片

parent bb5c7fc0
...@@ -64,36 +64,40 @@ ...@@ -64,36 +64,40 @@
methods: { methods: {
// 保存照片到本地 // 保存照片到本地
async saveTempToLocal(tempImagePath) { async saveTempToLocal(tempImagePath) {
//has_origin //是否保存原图 return new Promise(async (resolve, reject) => {
let that = this //has_origin //是否保存原图
const photo = getApp().globalData.photo let that = this
if(!photo.tempPath){ const photo = getApp().globalData.photo
return if(!photo.tempPath){
} return
let path = ''
if(photo.tempPath.origin && photo.waterSetting.hasOrigin){
// 保存原图到本地
path = photo.tempPath.origin
let result = await this.saveLocal(path)
if(result){
uni.showToast({
icon: 'none',
title: '已将照片原图保存到本地相册'
})
} }
} let path = ''
if(photo.tempPath.origin && photo.waterSetting.hasOrigin){
if(photo.tempPath.mixWater){ // 保存原图到本地
// 保存水印处理图片到本地 path = photo.tempPath.origin
path = photo.tempPath.mixWater let result = await this.saveLocal(path)
let result1 = await this.saveLocal(path) if(result){
if(result1){ uni.showToast({
uni.showToast({ icon: 'none',
icon: 'none', title: '已将照片原图保存到本地相册'
title: '已将水印图片保存到本地相册' })
}) }
} }
}
if(photo.tempPath.mixWater){
// 保存水印处理图片到本地
path = photo.tempPath.mixWater
console.log("path", path)
let result1 = await this.saveLocal(path)
if(result1){
uni.showToast({
icon: 'none',
title: '已将水印图片保存到本地相册'
})
resolve()
}
}
})
}, },
saveLocal(path){ saveLocal(path){
return new Promise((resolve,reject)=>{ return new Promise((resolve,reject)=>{
...@@ -128,13 +132,13 @@ ...@@ -128,13 +132,13 @@
//this.$emit('finish') //this.$emit('finish')
}, },
// 确认图片 // 确认图片
continuePhoto() { async continuePhoto() {
const photo = getApp().globalData.photo const photo = getApp().globalData.photo
let self = this let self = this
uni.showLoading({ uni.showLoading({
title:'图片保存中…' title:'图片保存中…'
}) })
self.saveTempToLocal() await self.saveTempToLocal()
if (this.upload) { if (this.upload) {
self.confirmUpload(true) self.confirmUpload(true)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment