const OSS = require('ali-oss') import Vue from 'vue' const { GenerateSTS, GetObjectStoreToken } = require('../api/user.js') import { getToken } from '@/utils/auth' Vue.prototype.OSSclientConfig = { } async function ossGenerateSTS() { let res = await GetObjectStoreToken() Vue.prototype.OSSclientConfig = { ...res.Result[res.Result.ObjectStoreUse] } Vue.prototype.OSSclientConfig.basePath = Vue.prototype.OSSclientConfig.ViewEndpoint switch (res.Result.ObjectStoreUse) { case 'AliyunOSS': Vue.prototype.OSSclientConfig.bucket = Vue.prototype.OSSclientConfig.bucketName Vue.prototype.OSSclient = new OSS(Vue.prototype.OSSclientConfig) break case 'MinIO': Vue.prototype.OSSclient = new OSS(Vue.prototype.OSSclientConfig) break } return } export const OSSclient = ossGenerateSTS