feat: 新增需求
This commit is contained in:
@@ -149,7 +149,7 @@
|
||||
created() {
|
||||
const token = uni.getStorageSync('token')
|
||||
this.option = {
|
||||
url: this.baseURL + '/api/file/Uploader/annex',
|
||||
url: this.baseURL + '/admin-api/infra/file/jeelowcode/upload',
|
||||
name: 'file',
|
||||
header: {
|
||||
'Authorization': token,
|
||||
@@ -163,7 +163,18 @@
|
||||
watch: {
|
||||
modelValue: {
|
||||
handler(val) {
|
||||
this.fileList = JSON.parse(JSON.stringify(val));
|
||||
if (!val || typeof val !== 'string') {
|
||||
this.fileList = [];
|
||||
return;
|
||||
}
|
||||
const urlList = val.split(',').filter(item => item.trim());
|
||||
this.fileList = urlList.map(url => {
|
||||
const fileName = url.substring(url.lastIndexOf('/') + 1) || '未知文件';
|
||||
return {
|
||||
fileUrl: url,
|
||||
name: fileName
|
||||
};
|
||||
});
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
@@ -174,13 +185,17 @@
|
||||
if (item['responseText']) {
|
||||
let response = JSON.parse(item.responseText)
|
||||
if (this.fileList.length >= this.limit) return this.$u.toast('已达最大上传数量')
|
||||
if (response.code != 200) return this.$u.toast(response.msg)
|
||||
if (response.code != 0) return this.$u.toast(response.msg)
|
||||
console.log(this.fileList,'fileList---')
|
||||
this.fileList.push({
|
||||
fileName: item.name,
|
||||
name: item.name,
|
||||
fileId: response.data.name,
|
||||
url: response.data.url,
|
||||
fileUrl: response.data.url,
|
||||
fileExtension: response.data.fileExtension,
|
||||
fileSize: response.data.fileSize
|
||||
fileSize: response.data.size,
|
||||
fileType: response.data.type,
|
||||
filePath: response.data.path,
|
||||
})
|
||||
this.$emit('update:modelValue', this.fileList)
|
||||
this.$emit('change', this.fileList)
|
||||
|
||||
Reference in New Issue
Block a user