Commit be165e1d by xinla

修复 阿里云上传配置问题

1 parent d87324ea
......@@ -52,11 +52,11 @@ export function upload(data) {
}
// 获取cos配置
export function getCosConfig(data) {
export function getCosConfig(params) {
return request({
url: '/file/get/config',
params: data,
}).then(({ data }) => {
params,
}).then(({ 0 }) => {
let res = {}
Object.keys(data).forEach((key) => {
res[key] = decryptAES(data[key])
......
......@@ -148,23 +148,23 @@ export default {
created() {
getCosConfig().then((res) => {
this.cosConfig = res
console.log(this.cosConfig)
if (this.cosConfig.fileObject == 'tencentOss') {
// console.log(this.cosConfig)
if (res.fileObject == 'tencentOss') {
this.cosInstance = new Cos({
SecretId: res.secretId,
SecretKey: res.secretKey,
})
} else if (this.cosConfig.fileObject == 'local') {
} else if (res.fileObject == 'local') {
} else {
let region = this.cosConfig.region.split('//')[1]
// let region = res.region.split('//')[1]
this.ossObj = new OSS({
// yourRegion填写Bucket所在地域。Region填写为oss-cn-hangzhou。
region: region.split('.')[0],
region: res.region.split('.')[0],
// 从STS服务获取的临时访问密钥(AccessKey ID和AccessKey Secret)。
accessKeyId: this.cosConfig.secretId,
accessKeySecret: this.cosConfig.secretKey,
accessKeyId: res.secretId,
accessKeySecret: res.secretKey,
// 填写Bucket名称。
bucket: this.cosConfig.bucketName,
bucket: res.bucketName,
})
}
})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!