Commit 410292e7 authored by 和慭琛's avatar 和慭琛

上传图片images赋值失败

parent 980d4b8d
......@@ -11,11 +11,11 @@
//https://system.dev.banshouhui.com
//测试环境
domain_Name: 'https://system.dev.banshouhui.com',
//domain_Name: 'https://system.dev.banshouhui.com',
//http://192.168.0.208:8192
//小青本地环境
//domain_Name: 'http://192.168.0.208:37080',
domain_Name: 'http://192.168.0.208:37080',
token:'',
//RTOKEN45f41a3053238cb72b3b72fe14df8d7040c9f502
......
......@@ -111,9 +111,9 @@
title:'加载中'
})
//getApp().globalData.domain_Name
// http://192.168.0.208:8192
// 'http://192.168.0.208:8192'
uni.request({
url: getApp().globalData.domain_Name
url: 'http://192.168.0.208:8192'
+getApp().globalData.getUsersByCode,
method: 'GET',
data: {
......
......@@ -213,7 +213,8 @@
photoList:[],
photo_fieldsValue:'',
photo_tempFilePaths:[],
photo_totalValue:''
photo_totalValue:'',
images_parameters:''
}
},
onLoad(e) {
......@@ -915,30 +916,55 @@
title: '上传中'
});
//新增images参数
for(let i = 0;i < this.photo_tempFilePaths.length; i++) {
uni.uploadFile({
url: getApp().globalData.domain_Name
+'/wxh-worker-rest/rest/'+getApp().globalData.token
+/order/+this.orderId
+'/guarantee/image', //仅为示例,非真实的接口地址
+'/guarantee/applet/image', // '/guarantee/applet/image' //'/guarantee/image'
filePath: this.photo_tempFilePaths[i],
name: 'image'+i,
formData: {
//'user': 'test'
'images': this.images_parameters
},
header:{
'Content-Type':'multipart/form-data'
},
success: (uploadFileRes) => {
uni.hideLoading();
console.log('第几次 i')
console.log(i)
console.log('filePath')
console.log(this.photo_tempFilePaths[i])
console.log('images 参数')
console.log(this.images_parameters)
successCount = successCount + 1
console.log('totalCount:'+totalCount)
console.log('successCount:'+successCount)
that.photo_totalValue = that.photo_totalValue + uploadFileRes.data + ','
//小青 最后一次上传时将之前的拼接数据传入images参数中
if(successCount == totalCount-1 && uploadFileRes.statusCode == 200){
that.images_parameters = that.photo_totalValue
console.log('最后一次上传时将之前的拼接数据传入images参数中 images_parameters:')
console.log(that.images_parameters)
}
//if(i == (that.photo_tempFilePaths.length-1)){
if (successCount == totalCount){
if (successCount == totalCount && uploadFileRes.statusCode == 200){
//改为先上传照片
//that.finishConfirm()
that.savePhotoValues(that.photo_totalValue)
//that.savePhotoValues(that.photo_totalValue)
//小青方案
that.uploadImagesOneMoreTime()
}
console.log( '第' + i + '张 照片单张上传 成功');
......@@ -960,6 +986,45 @@
},
//再单独传一次images
uploadImagesOneMoreTime: function(){
console.log('再单独传一次images')
uni.uploadFile({
url: getApp().globalData.domain_Name
+'/wxh-worker-rest/rest/'+getApp().globalData.token
+/order/+this.orderId
+'/guarantee/applet/image', // '/guarantee/applet/image' //'/guarantee/image'
filePath: '',
name: '',
formData: {
'images': this.images_parameters
},
header:{
'Content-Type':'multipart/form-data'
},
success: (uploadFileRes) => {
uni.hideLoading();
//if(i == (that.photo_tempFilePaths.length-1)){
if (uploadFileRes.statusCode == 200){
//改为先上传照片
//that.finishConfirm()
//that.savePhotoValues(that.photo_totalValue)
}
},fail(res) {
uni.hideLoading();
console.log('照片单张上传 失败');
console.log(res);
uni.showToast({
icon:'none',
title:'照片上传失败'
})
}
});
},
//保存照片value到配置项里
savePhotoValues: function(photoValue){
console.log('保存照片value到配置项里')
......@@ -1096,6 +1161,10 @@
confirmClick: function () {
this.photoUpload()
return
uni.pageScrollTo({scrollTop: 99999, duration: 0});
clearTimeout(this.TimeID);
this.TimeID = setTimeout(() => {
......
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