1
This commit is contained in:
parent
09d4906493
commit
f946789c8e
@ -108,11 +108,14 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
uploadUrl: config.baseUrl+'/common/upload',
|
||||
headers: {},
|
||||
//所有可选的平台
|
||||
range: [],
|
||||
sizeType: ['compressed'],
|
||||
//图片数组
|
||||
fileList: [],
|
||||
imageUrl:[],
|
||||
//地址集合
|
||||
addressList: [],
|
||||
//名片数据对象
|
||||
@ -141,12 +144,23 @@
|
||||
|
||||
/**初始化数据*/
|
||||
initData(id) {
|
||||
this.fileList = []
|
||||
this.imageUrl = []
|
||||
if (id) {
|
||||
getBusiCardById({
|
||||
id: id
|
||||
}).then(res => {
|
||||
console.log(res.data, 133)
|
||||
this.dataObj = res.data
|
||||
if (this.dataObj.image != null && this.dataObj.image != ''){
|
||||
console.log(this.dataObj.image,'this.dataObj.image')
|
||||
this.imageUrl = this.dataObj.image.split(',')
|
||||
this.imageUrl.map((item)=>{
|
||||
this.fileList.push({
|
||||
url:config.baseUrl + item
|
||||
})
|
||||
})
|
||||
}
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
@ -230,7 +244,11 @@
|
||||
toast("收货地址不能为空")
|
||||
return
|
||||
}
|
||||
// console.log(this.fileList,'fileList')
|
||||
if (this.fileList.length == 0) {
|
||||
toast("证明材料不能为空")
|
||||
return
|
||||
}
|
||||
this.dataObj.image = this.imageUrl.join(',');
|
||||
applyBusiCard(this.dataObj).then(res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
@ -250,24 +268,29 @@
|
||||
},
|
||||
|
||||
afterRead(file) {
|
||||
|
||||
for (let i = 0; i < file.tempFilePaths.length; i++) {
|
||||
upload({
|
||||
url: '',
|
||||
filePath: file.tempFilePaths[i]
|
||||
}).then((res) => {
|
||||
console.log(res, '215')
|
||||
this.fileList.push({
|
||||
url: config.baseUrl + res.data
|
||||
url: res.url
|
||||
})
|
||||
console.log(this.fileList, 'fileList')
|
||||
this.imageUrl.push(res.fileName)
|
||||
})
|
||||
}
|
||||
},
|
||||
deleteFile(file, index) {
|
||||
console.log('删除文件');
|
||||
this.fileList.splice(index, 1);
|
||||
this.imageUrl.splice(index, 1);
|
||||
},
|
||||
uploadSuccess(res, file) {
|
||||
console.log('上传成功', res);
|
||||
},
|
||||
uploadFail(error, file) {
|
||||
console.log('上传失败', error);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -23,7 +23,7 @@ const upload = config => {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
timeout: config.timeout || timeout,
|
||||
url: baseUrl + config.url,
|
||||
url: baseUrl + '/common/upload' + config.url,
|
||||
filePath: config.filePath,
|
||||
name: config.name || 'file',
|
||||
header: config.header,
|
||||
|
Loading…
Reference in New Issue
Block a user