From 39fadd1544faff3a1d96a617702b9fd00bb77ae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E5=B0=8F=E5=A8=81?= Date: Tue, 26 Nov 2019 15:50:53 +0800 Subject: [PATCH 1/2] update --- package.json | 1 + prettier.config.js | 2 +- src/service/service.ts | 17 +++++++++------ src/utils/global-config.ts | 4 ---- src/views/test-client/example.ts | 37 ++++++++++++++++++++++++++------ tsconfig.json | 3 ++- vue.config.js | 16 ++++++++++++++ 7 files changed, 61 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index d428e8a..d7893b7 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ }, "devDependencies": { "@obv/obv-bimserver-client": "^1.0.10", + "@obv/obv": "^4.0.9-alpha.8", "@types/jest": "^23.3.13", "@types/jquery": "^3.3.29", "@types/nprogress": "^0.2.0", diff --git a/prettier.config.js b/prettier.config.js index df2d032..8f4ff48 100644 --- a/prettier.config.js +++ b/prettier.config.js @@ -40,5 +40,5 @@ module.exports = { // 箭头函数参数括号 默认avoid 可选 avoid| always // avoid 能省略括号的时候就省略 例如x => x // always 总是有括号 - arrowParens: 'always' + arrowParens: 'always', }; diff --git a/src/service/service.ts b/src/service/service.ts index 4f14581..9da577b 100644 --- a/src/service/service.ts +++ b/src/service/service.ts @@ -1,5 +1,6 @@ import { IStorageBuckets } from '@/business/model/storage-bucket'; import { IStorageObjects } from '@/business/model/storage-object'; +import RuntimeUtils from '@/utils/runtime-utils'; import * as BimserverClient from '@aecworks/obv-bimserver-client'; import AuthToken from '@/views/config/auth-token'; @@ -28,15 +29,17 @@ export default class Service { const storageServiceOptions = this._createOptions(); storageServiceOptions.setHeader('Authorization', `Bearer ${tokenInfo.accessToken}`); const storageClient = new BimserverClient.StorageClient(); - return await storageClient.getObjects(storageServiceOptions, bucketsKey); + return await storageClient.getObjects(storageServiceOptions, bucketsKey); } private static _createOptions() { - return new BimserverClient.StorageServiceOptions( - 'api.cloud-dev.pkpm.cn', - '443', - 'https:', - '/bimserver/storage/v3', - ); + const clientBaseUrlSplit = RuntimeUtils.instance.service.origin.split(':'); + const isHttps = clientBaseUrlSplit[0] === 'https'; + const options = new BimserverClient.StorageServiceOptions( + clientBaseUrlSplit[1], + isHttps ? '443' : '80', + clientBaseUrlSplit[0] + ':', + '/bimserver/storage/v3'); + return options; } } diff --git a/src/utils/global-config.ts b/src/utils/global-config.ts index 35eb33c..c950e17 100644 --- a/src/utils/global-config.ts +++ b/src/utils/global-config.ts @@ -2,10 +2,6 @@ export class GlobalConfig { public static env = 'https://api.cloud-dev.pkpm.cn'; public static clientId = 'demo'; // 'demo'; public static clientSecret = 'demosecret'; // 'demosecret'; - - // public static env = 'http://192.168.0.200'; - // public static clientId = '1u2dm52R6wW12fpDJH3tJTY5'; // 'demo'; - // public static clientSecret = '28VGJ22R6wW13VrO7HFobe'; // 'demosecret'; } // clientId: 'aecworks-obv-community', diff --git a/src/views/test-client/example.ts b/src/views/test-client/example.ts index 452ba80..4c4f107 100644 --- a/src/views/test-client/example.ts +++ b/src/views/test-client/example.ts @@ -1,19 +1,19 @@ import RuntimeUtils from '@/utils/runtime-utils'; -import {UploadService} from '@/utils/upload-service'; +import { UploadService } from '@/utils/upload-service'; import AuthToken from '@/views/config/auth-token'; -import {MessageHelper} from '@/utils/message-helper'; -import {Base64UrlSafe} from '@aecworks/base64-url-safe'; +import { MessageHelper } from '@/utils/message-helper'; +import { Base64UrlSafe } from '@aecworks/base64-url-safe'; const token = AuthToken.instance.tokenInfo.accessToken; let convertObj = ''; let uploadUrlData: any = ''; -const bucketKey = 'fbx_bucket'; -const objectKey = '44417382059'; // 44326038540; +const bucketKey = 'viewer_model_bucket'; +const objectKey = 'jinhuajiegou'; // 44326038540; let temp: any = ''; const ENV = { host: RuntimeUtils.instance.service.host, }; -const jobType = 'fbx-obv'; +const jobType = 'ifc-obv'; const authentication = { // credentials: { // client_id: '7OO7V2MhKqv2k4gxwAbaGh', // '4WL7jl41t4jQ2YdS451wG9du', @@ -219,6 +219,31 @@ function getDownloadFile(bucket: string, object: string) { }); } +function getTokenByPassword() { + // fetch('https://api.bimserver.jszxbim.cn/box/v1/auth/password', { + // body: JSON.stringify({ + // username: 'sjygsxxh@cscec.com', + // password: '123456', + // }), + // method: 'POST', + // headers: { + // 'Content-Type': 'application/json', + // }, + // }) + + $.ajax({ + type: 'POST', + url: 'https://api.bimserver.jszxbim.cn/box/v1/auth/password', + data: JSON.stringify({ + username: 'sjygsxxh@cscec.com', + password: '123456', + }), + beforeSend(request: any) { + request.setRequestHeader('Content-type', 'application/json'); + }, + }); +} + export { getAccessToken, createBucket, diff --git a/tsconfig.json b/tsconfig.json index 5f4f82b..ee80225 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -38,6 +38,7 @@ "tests/**/*.tsx" ], "exclude": [ - "node_modules" + "node_modules", + "@obv/obv" ] } diff --git a/vue.config.js b/vue.config.js index 978bda0..e4ed9b5 100644 --- a/vue.config.js +++ b/vue.config.js @@ -4,4 +4,20 @@ module.exports = { devServer: { port: 9009, }, + // ...其它 vue-cli 插件选项... + pwa: { + name: 'My App', + themeColor: '#4DBA87', + msTileColor: '#000000', + appleMobileWebAppCapable: 'yes', + appleMobileWebAppStatusBarStyle: 'black', + + // 配置 workbox 插件 + workboxPluginMode: 'InjectManifest', + workboxOptions: { + // InjectManifest 模式下 swSrc 是必填的。 + swSrc: 'dev/sw.js', + // ...其它 Workbox 选项... + } + } }; -- Gitee From bf8c7c52c1a8ec8aff2a16c111d40c839c626ee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E5=B0=8F=E5=A8=81?= Date: Mon, 13 Jan 2020 14:45:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 7 +++--- src/views/test-client/example.ts | 39 ++++++++++++++++---------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/public/index.html b/public/index.html index f27ede1..b8947ab 100644 --- a/public/index.html +++ b/public/index.html @@ -6,12 +6,13 @@ Collab Console - - + - + +