Feat(店铺入驻):增加视频封面配置

This commit is contained in:
lifizer
2024-03-20 16:26:32 +08:00
parent 686e5d3eaa
commit 326010949b
2 changed files with 169 additions and 34 deletions
+45
View File
@@ -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,