陈鹏飞 3 years ago
parent
commit
e51db83bc8
  1. 2
      src/app/babylon/tool/babylon-tool.ts
  2. 28
      src/app/service/objects.service.ts

2
src/app/babylon/tool/babylon-tool.ts

@ -129,7 +129,7 @@ export class BabylonTool {
path = ConfigManager.c_resPath_assetsRoot + rootUrl;
}
else {
path = ObjectsService.baseUrl + path; //根据环境,动态改变桶名
path = ObjectsService.getFullPath(path); //根据环境,动态改变桶名
}
console.log("异步加载模型" + path + sceneFilename);

28
src/app/service/objects.service.ts

@ -29,7 +29,6 @@ export class ObjectsService {
static readonly c_apiRoot = "/api/Objects/";//普通上传的API根路径
static apiRoot_Multipart = "/api/";//分块上传的API根路径
/**
*
*/
@ -40,13 +39,23 @@ export class ObjectsService {
*/
static baseUrl;
/**
*
* @param extensionPath ,
* 1 extensionPath = ceshi/assets//outDoor/a.gltf /api/Objects/{}/ceshi/assets//outDoor/a.gltf
* 2extensionPath = ceshi/web/a.rgb /api/Objects/{}/ceshi/web/a.rgb
*/
static getFullPath(extensionPath: string) {
return ObjectsService.baseUrl + extensionPath;
}
/**
*
*/
obsRootByEnv = new Map<EnvironmentType, string>([
[EnvironmentType.DevelopEditor, "sinochemweb/"], //开发与编辑
[EnvironmentType.Test, "sinochem3d/"],//测试
[EnvironmentType.Production, "prod/"],//生产环境(根据需要设置)
[EnvironmentType.Production, "sinochem3d/"],//生产环境(根据需要设置)最好是与测试环境的桶名相同
]);
@ -55,13 +64,6 @@ export class ObjectsService {
ObjectsService.baseUrl = ObjectsService.c_apiRoot + bucketName;
}
/**
*
*/
static getFullPath() {
}
/**
*
*/
@ -69,9 +71,6 @@ export class ObjectsService {
return this.obsRootByEnv.get(ObjectsService.currentEnvironmentType);
}
/**
* 5M
*/
@ -79,12 +78,9 @@ export class ObjectsService {
let formData = new FormData()
formData.append("file", file, file.name)
let data = { keepOriginalName: 'true' }
return this.http.post(ObjectsService.baseUrl + extensionPath, formData, { params: data });
return this.http.post(ObjectsService.getFullPath(extensionPath), formData, { params: data });
}
//分块上传
postFile_MultipartUpload(extensionPath: string, file: File): Promise<Object> {
// let formData = new FormData()

Loading…
Cancel
Save