上传组件调整
This commit is contained in:
@@ -87,8 +87,8 @@ export default {
|
||||
this.$emit('list', this.fileList)
|
||||
},
|
||||
upload(wait) {
|
||||
let count = this.limit - (this.fileList?.length||0)
|
||||
if(count>0){
|
||||
let count = this.limit - (this.fileList?.length || 0)
|
||||
if (count > 0) {
|
||||
let params = {
|
||||
count,
|
||||
sizeType: ['compressed'],
|
||||
@@ -115,7 +115,7 @@ export default {
|
||||
} else {
|
||||
uni.chooseFile(params)
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
this.$u.toast(`不能超过${this.limit}个`)
|
||||
}
|
||||
},
|
||||
@@ -128,8 +128,9 @@ export default {
|
||||
this.$emit('manual', img)
|
||||
uni.hideLoading()
|
||||
} else {
|
||||
console.log(this.$instance.defaults)
|
||||
uni.uploadFile({
|
||||
url: this.$instance.config.baseURL + this.action,
|
||||
url: this.$instance.defaults.baseURL + this.action,
|
||||
filePath: img.path,
|
||||
name: 'file',
|
||||
header: {
|
||||
@@ -137,7 +138,6 @@ export default {
|
||||
Authorization: uni.getStorageSync('token'),
|
||||
},
|
||||
success: response => {
|
||||
uni.hideLoading()
|
||||
const res = JSON.parse(response.data)
|
||||
if (res?.data) {
|
||||
this.$emit('data', res.data)
|
||||
@@ -160,9 +160,9 @@ export default {
|
||||
}
|
||||
},
|
||||
fail: err => {
|
||||
console.log(err)
|
||||
uni.hideLoading()
|
||||
}
|
||||
console.error(err)
|
||||
},
|
||||
complete: () => uni.hideLoading()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,7 @@ import util from 'dvcp-wui/utils/util';
|
||||
import store from "../store"
|
||||
import instance from "dvcp-wui/utils/http";
|
||||
|
||||
instance.interceptors.request.use((config) => {
|
||||
config.baseURL = config.baseURL || setting.baseUrl
|
||||
return config;
|
||||
});
|
||||
instance.defaults.baseURL = setting.baseUrl
|
||||
|
||||
instance.interceptors.response.use(response => {
|
||||
util.$hideLoading();
|
||||
|
||||
Reference in New Issue
Block a user