Browse Source

修改图片上传

master
邓宏 2 years ago
parent
commit
29ef4d4ada
  1. 5
      common/request.js
  2. 6
      components/form.vue
  3. 1
      pages/massif/index.vue

5
common/request.js

@ -3,7 +3,7 @@ import store from "@/store"
function host(host='default'){
return(
process.env.NODE_ENV === 'development'?{
default:"http://vpep38.natappfree.cc/plant_manage"
default:"http://tishia.natappfree.cc/plant_manage"
}:{
default:"http://vtm3hk.natappfree.cc/plant_manage"
}
@ -33,7 +33,8 @@ const request=async function(url,param={}){
var res=await uni.uploadFile({
url:`${param.host||host()}${('/'+url).replace(/\/{2}/,'/').replace(/\?.+/,"")}?${pathData}`,
files:param.file,
name:"file",
// name:"file",
formData:param.body||{},
timeout:param.timeout||60*1000,
header,
}).then(data=>({...data[1],data:JSON.parse(data[1].data)}))

6
components/form.vue

@ -265,8 +265,12 @@ import request from '@/common/request'
sizeType:['compressed'],
})
if(/ok/.test(res[1].errMsg)){
console.log(res[1].tempFiles.map(v=>v.name),'---asfd-----')
var upImg=await request("/sys/common/uploadBatch",{
file:res[1].tempFiles//.map(v=>({...v,name:'file'})),
file:res[1].tempFiles,
body:{
name:res[1].tempFiles.map(v=>v.name)
}
})
console.log(upImg,"-----333333------------")
}else{

1
pages/massif/index.vue

@ -120,6 +120,7 @@ import request from '@/common/request'
},
onLoad(){
this.search()
console.log(new FormData())
},
methods:{
clean(){

Loading…
Cancel
Save