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