提交 0a8e7a13 编写于 作者: guangjun.yang's avatar guangjun.yang

环境变量等

上级 340e5c4e
......@@ -37,7 +37,11 @@ export const envConfig = {
excelUrl: 'https://dev-file.yunqueyi.com/File/template/portal/',
itemFileUrl: 'http://pica-test-huabei2.oss-cn-beijing.aliyuncs.com/File/template/portal/',
cmsUrl: ' https://dev-cms.yunqueyi.com/',
// resource_url: "https://test-file.yunqueyi.com",
ossImgUrl: 'https://test-file.yunqueyi.com/',
stsUrl: "https://dev-api.yunqueyi.com/middle/oss/token/", //sts服务器
bucketName: "pica-test-huabei2",
endpoint: "oss-cn-beijing.aliyuncs.com",
},
dev: {
baseUrl: 'https://dev-sc.yunqueyi.com/',
......@@ -57,6 +61,9 @@ export const envConfig = {
itemFileUrl: 'http://pica-test-huabei2.oss-cn-beijing.aliyuncs.com/File/template/portal/',
cmsUrl: ' https://dev-cms.yunqueyi.com/',
ossImgUrl: 'https://test-file.yunqueyi.com/',
stsUrl: "https://dev-api.yunqueyi.com/middle/oss/token/", //sts服务器
bucketName: "pica-test-huabei2",
endpoint: "oss-cn-beijing.aliyuncs.com",
},
test: {
baseUrl: 'https://test1-sc.yunqueyi.com/',
......@@ -76,6 +83,9 @@ export const envConfig = {
itemFileUrl: 'http://pica-test-huabei2.oss-cn-beijing.aliyuncs.com/File/template/portal/',
cmsUrl: ' https://test1-cms.yunqueyi.com/',
ossImgUrl: 'https://test-file.yunqueyi.com/',
stsUrl: "https://test1-api.yunqueyi.com/middle/oss/token/", //sts服务器
bucketName: "pica-test-huabei2",
endpoint: "oss-cn-beijing.aliyuncs.com",
},
test2: {
baseUrl: 'https://test2-work.yunqueyi.com/sc/',
......@@ -94,6 +104,9 @@ export const envConfig = {
itemFileUrl: 'http://pica-test-huabei2.oss-cn-beijing.aliyuncs.com/File/template/portal/',
cmsUrl: ' https://test2-cms.yunqueyi.com/',
ossImgUrl: 'https://test-file.yunqueyi.com/',
stsUrl: "https://test2-api.yunqueyi.com/middle/oss/token/", //sts服务器
bucketName: "pica-test-huabei2",
endpoint: "oss-cn-beijing.aliyuncs.com",
},
uat: {
baseUrl: 'https://uat-sc.yunqueyi.com/',
......@@ -112,8 +125,11 @@ export const envConfig = {
excelUrl: 'https://test-file.yunqueyi.com/File/template/portal/',
itemFileUrl: 'http://pica-test-huabei2.oss-cn-beijing.aliyuncs.com/File/template/portal/',
cmsUrl: ' https://uat-cms.yunqueyi.com/',
ossImgUrl: 'https://test-file.yunqueyi.com/',
},
ossImgUrl: 'https://file.yunqueyi.com/',
stsUrl: "https://uat-api.yunqueyi.com/middle/oss/token/", //sts服务器
bucketName: "pica-pro",
endpoint: "oss-cn-shanghai.aliyuncs.com",
},
pro: {
baseUrl: 'https://sc.yunqueyi.com/',
apiUrl: 'https://api.yunqueyi.com/',
......@@ -132,5 +148,8 @@ export const envConfig = {
itemFileUrl: 'http://pica-test-huabei2.oss-cn-beijing.aliyuncs.com/File/template/portal/',
cmsUrl: ' https://cms.yunqueyi.com/',
ossImgUrl: 'https://file.yunqueyi.com/',
}
stsUrl: "https://api.yunqueyi.com/middle/oss/token/", //sts服务器
bucketName: "pica-pro",
endpoint: "oss-cn-shanghai.aliyuncs.com"
}
}
......@@ -201,12 +201,36 @@ export function getWorkDomain(url) {
return getConfigByEnvType('workApiSrc') + url
}
/*
* OSS相关参数
*/
// 获取OSS域名
export function getOSSImgUrl() {
return getConfigByEnvType('ossImgUrl')
}
// 获取stsUrl域名
export function getSTSUrl() {
return getConfigByEnvType('stsUrl')
}
// 获取bucketName
export function getBucketName() {
return getConfigByEnvType('bucketName')
}
// 获取endpoint
export function getEndpoint() {
return getConfigByEnvType('endpoint')
}
// 根据不同环境,生成URL
function getConfigByEnvType(urlType) {
return envConfig[process.env.BUILD_ENV][urlType]
}
// 获取report服务器域名地址
export function getReportUrl(url) {
return getConfigByEnvType('reportUrl') + url
......@@ -227,6 +251,8 @@ export function getCmsUrl(url) {
return getConfigByEnvType('cmsUrl') + url
}
// 转换时间格式
export function convertTime(time, isToSlash = true) {
console.log('#########time', time);
......
......@@ -9,11 +9,7 @@ export default async(url = '', data = {}, type = 'POST', method = 'fetch',server
url = localStorage.getItem("Url") + url;
}
// url =
console.log('@@@@@@@@@@@@@in oss fetch' , url);
// @@@@@@@@@@@@@in oss fetch null/5DF4291EDDA34BA08AD234C6BB7BE65D
// https://dev-api.yunqueyi.com/middle/oss/token/B1A7745D85D74EB4966125A4E0979ACE
console.log("完整url:",url)
if (type == 'GET' && data) {
let dataStr = ''; //数据拼接字符串
......
import {isEmptyUtils, isNotEmptyUtils, subString} from "@/utils/index";
import {isEmptyUtils, isNotEmptyUtils, subString, getBucketName, getEndpoint, getSTSUrl} from "@/utils/index";
import fetch from './fetch.js';
/**
......@@ -15,8 +15,11 @@ contentTypeMap.set("xlsx", "application/vnd.openxmlformats-officedocument.spread
// let bucketName = localStorage.getItem("bucketName");
// let endpoint = localStorage.getItem("endpoint");
let bucketName = 'pica-test-huabei2';
let endpoint = 'oss-cn-beijing.aliyuncs.com';
// let bucketName = 'pica-test-huabei2';
// let endpoint = 'oss-cn-beijing.aliyuncs.com';
let bucketName = getBucketName();
let endpoint = getEndpoint();
console.log(bucketName, endpoint);
......@@ -39,9 +42,11 @@ const doOSSAction = () => {
//sts服务器
// let stsUrl = localStorage.getItem("stsUrl") + "/" + localStorage.getItem("token");
// let stsUrl = 'https://dev-api.yunqueyi.com/middle/oss/token/' + localStorage.getItem("token");
let stsUrl = 'https://dev-api.yunqueyi.com/middle/oss/token/D1AA498C1C1C4298B712B3678EF9BD07'
// let stsUrl = 'https://dev-api.yunqueyi.com/middle/oss/token/D1AA498C1C1C4298B712B3678EF9BD07'
// let stsUrl = 'https://dev-api.yunqueyi.com/middle/oss/token/' + localStorage.getItem("token");
let stsUrl = getSTSUrl() + localStorage.getItem("token");
return new Promise(function (resolve, reject) {
fetch(stsUrl, {}, 'GET').then(function (result) {
let client = null;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册