Commit c867ae69 authored by 和慭琛's avatar 和慭琛

小程序上传图片覆盖后台图片问题

parent 8ad2fcb0
...@@ -201,7 +201,9 @@ ...@@ -201,7 +201,9 @@
onShareAppMessage(res) { onShareAppMessage(res) {
let shareObj = { let shareObj = {
title: '', title: '',
path: '/pages/index/index', path: '/pages/index/index'
+ '?orderId=' + this.orderId
+ '&toWhere=detail',
imageUrl: '', imageUrl: '',
success(){}, success(){},
fail(){} fail(){}
......
...@@ -399,7 +399,25 @@ ...@@ -399,7 +399,25 @@
photoArray.forEach(item => { photoArray.forEach(item => {
var imageURL = getApp().globalData.domain_Name + '/wxh-sts-rest' + item var imageURL = getApp().globalData.domain_Name + '/wxh-sts-rest' + item
this.photoList.push(imageURL) console.log('原有的图片路径拼接:' + imageURL)
uni.getImageInfo({
src: imageURL, //服务器返回的图片地址
success: res => {
this.photoList.push(res.path)
this.photo_tempFilePaths.push(res.path)
console.log('原有图片:')
console.log('photoList数组个数:'+this.photoList.length)
console.log('photo_tempFilePaths数组个数:'+this.photo_tempFilePaths.length)
},
fail: function(res) {
uni.showToast({
icon:'none',
title:'URL图片格式不正确'
})
}
})
//this.photoList.push(imageURL)
}) })
// console.log('之前填写过的 照片数组:') // console.log('之前填写过的 照片数组:')
...@@ -870,8 +888,17 @@ ...@@ -870,8 +888,17 @@
//获取照片信息 //获取照片信息
getImageInfo: function(res) { getImageInfo: function(res) {
console.log('获取照片信息')
console.log('photo_tempFilePaths数组个数:'+this.photo_tempFilePaths.length)
if(this.photo_tempFilePaths && this.photo_tempFilePaths.length>0){
res.tempFilePaths.forEach(item => {
this.photo_tempFilePaths.push(item)
})
}else{
this.photo_tempFilePaths = res.tempFilePaths this.photo_tempFilePaths = res.tempFilePaths
}
//this.photo_tempFilePaths.push(res.tempFilePaths) //this.photo_tempFilePaths.push(res.tempFilePaths)
let that = this let that = this
...@@ -904,6 +931,20 @@ ...@@ -904,6 +931,20 @@
async photoUpload(){ async photoUpload(){
let that = this let that = this
console.log('照片上传')
console.log('photo_tempFilePaths数组个数:'+this.photo_tempFilePaths.length)
this.photo_tempFilePaths.forEach(item => {
console.log('每张照片的路径:')
console.log(item)
})
//return
// console.log('照片上传 数量 :') // console.log('照片上传 数量 :')
// console.log(this.photo_tempFilePaths.length) // console.log(this.photo_tempFilePaths.length)
// console.log(this.photo_tempFilePaths) // console.log(this.photo_tempFilePaths)
...@@ -923,7 +964,6 @@ ...@@ -923,7 +964,6 @@
//新增images参数 //新增images参数
for(let i = 0;i < this.photo_tempFilePaths.length; i++) { for(let i = 0;i < this.photo_tempFilePaths.length; i++) {
uni.uploadFile({ uni.uploadFile({
url: getApp().globalData.domain_Name url: getApp().globalData.domain_Name
...@@ -986,6 +1026,7 @@ ...@@ -986,6 +1026,7 @@
icon:'none', icon:'none',
title:'照片上传失败' title:'照片上传失败'
}) })
console.log(res)
} }
}); });
} }
......
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