Feat(店铺入驻):增加视频封面配置
This commit is contained in:
@@ -1059,6 +1059,51 @@ export function chooseImage(callback) {
|
||||
});
|
||||
}
|
||||
|
||||
export function chooseVideoToUpload(callback) {
|
||||
uni.chooseVideo({
|
||||
count: 1,
|
||||
sourceType: ['album', 'camera'],
|
||||
success: res => {
|
||||
const { tempFilePath, size } = res
|
||||
if (size / 1024 / 1024 > 30) {
|
||||
uni.showToast({
|
||||
title: '视频文件超过30MB',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '视频上传中',
|
||||
mask: true
|
||||
})
|
||||
uni.uploadFile({
|
||||
url: `${VUE_APP_API_URL}/api/upload`,
|
||||
filePath: tempFilePath,
|
||||
header: {
|
||||
Authorization: 'Bearer ' + store.getters.token
|
||||
},
|
||||
name: 'file',
|
||||
success: response => {
|
||||
if (callback) {
|
||||
callback(JSON.parse(response.data).link)
|
||||
}
|
||||
},
|
||||
fail: err => {
|
||||
uni.showToast({
|
||||
title: '上传视频失败' + err,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
},
|
||||
complete: () => {
|
||||
uni.hideLoading()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function moreImage(count, callback) {
|
||||
uni.chooseImage({
|
||||
count,
|
||||
|
||||
Reference in New Issue
Block a user