Feat:管家入驻(小程序)
This commit is contained in:
@@ -1199,3 +1199,33 @@ export function uploadImage(imgPath, callback) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function uploadVideo(videoPath, callback) {
|
||||
uni.showLoading({
|
||||
title: "视频上传中",
|
||||
mask: true
|
||||
});
|
||||
uni.uploadFile({
|
||||
url: `${VUE_APP_API_URL}/api/upload`,
|
||||
filePath: videoPath,
|
||||
header: {
|
||||
Authorization: "Bearer " + store.getters.token
|
||||
},
|
||||
name: "file",
|
||||
success: res => {
|
||||
if (callback) {
|
||||
callback(JSON.parse(res.data).link)
|
||||
}
|
||||
},
|
||||
fail: err => {
|
||||
uni.showToast({
|
||||
title: "上传视频失败" + err,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
},
|
||||
complete: res => {
|
||||
uni.hideLoading()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user