七牛云组件更改

This commit is contained in:
WindowBird 2025-09-10 15:00:34 +08:00
parent 364c51b154
commit df890e5531

View File

@ -154,7 +154,12 @@ export default {
try {
// token
if (!this.qiniuToken) {
await this.getQiniuToken()
// await this.getQiniuToken()
uni.showToast({
title: '上传失败',
icon: 'error',
})
return
}
//
@ -208,22 +213,22 @@ export default {
async getQiniuToken() {
try {
const res = await getQiniuUploadToken()
console.log('Token响应:', res)
console.log('七牛云Token响应:', res)
if (res.code === 200) {
//
const token = res.data
if (token) {
this.qiniuToken = token
console.log('Token获取成功:', token.substring(0, 20) + '...')
console.log('七牛云Token获取成功:', token.substring(0, 20) + '...')
} else {
throw new Error('Token字段不存在')
throw new Error('七牛云oken字段不存在')
}
} else {
throw new Error(res.msg || '获取Token失败')
throw new Error(res.msg || '获取七牛云Token失败')
}
} catch (error) {
console.error('获取Token失败:', error)
console.error('获取七牛云Token失败:', error)
this.errorMessage = `获取上传凭证失败: ${error.message}`
this.$emit('error', error)
}