Browse Source

补充上传视频

wyx
fp 1 month ago
parent
commit
f4c4735dcc
  1. 42
      pages/tabBar/xjPage/xj.vue

42
pages/tabBar/xjPage/xj.vue

@ -35,7 +35,7 @@
:deletable="true" :deletable="true"
:show-upload-list="true" :show-upload-list="true"
:file-list="fileList" :file-list="fileList"
accept="image" accept="image,video"
@after-read="afterRead" @after-read="afterRead"
@delete="onDelete" @delete="onDelete"
> >
@ -144,7 +144,7 @@ export default {
var arry = []; var arry = [];
this.fileList.filter((v, i) => { this.fileList.filter((v, i) => {
arry.push({ arry.push({
name: '', name: v.name || '',
format: v.type, format: v.type,
url:v.url url:v.url
}); });
@ -156,7 +156,7 @@ export default {
var arry = []; var arry = [];
this.fileList.filter((v, i) => { this.fileList.filter((v, i) => {
arry.push({ arry.push({
name: '', name: v.name || '',
format: v.type, format: v.type,
url:v.url url:v.url
}); });
@ -193,42 +193,8 @@ export default {
}); });
}); });
}, },
uploadFile(file){
let that = this
console.log('uploadFile',file);
uni.uploadFile({
url: this.uploadUlr,
filePath: file.url,
name: 'file', //
method: 'post',
header: {
"Authorization": uni.getStorageSync('token')
},
formData: {
//
file: file
},
success(res) {
let data = JSON.parse(res.data)
// console.log(data);
if (data.url) {
that.form.imageList.push({
url: data.url,
name: '',
format: file.type
})
}
},
fail(res) {
uni.showToast({
icon: 'error',
title: '图片上传失败!'
})
}
})
},
handleBtn () { handleBtn () {
console.log(this.form);
if(!this.form.apartmentId){ if(!this.form.apartmentId){
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',

Loading…
Cancel
Save