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