|
@@ -63,7 +63,7 @@ export type Params = {
|
|
|
laserRoot: string;
|
|
|
panoOSSRoot: string;
|
|
|
ossRoot: string;
|
|
|
- root: string
|
|
|
+ root: string;
|
|
|
laserOSSRoot: string;
|
|
|
service: string;
|
|
|
fileUrl?: string;
|
|
@@ -98,45 +98,50 @@ export const getResource = (uri: string) => {
|
|
|
// /fusion
|
|
|
|
|
|
if (import.meta.env.DEV) {
|
|
|
- params.ip = 'http://192.168.0.62'
|
|
|
- params.static = '/profile'
|
|
|
- params.laserServicePort = '9008'
|
|
|
- params.servicePort = '8808'
|
|
|
+ // params.ip = "http://192.168.0.62";
|
|
|
+ // params.static = "/profile";
|
|
|
+ // params.laserServicePort = "9008";
|
|
|
+ // params.servicePort = "8808";
|
|
|
} else {
|
|
|
- params.ip = params.ip || ''
|
|
|
- params.static = params.static || ''
|
|
|
- params.laserServicePort = params.laserServicePort || ''
|
|
|
- params.servicePort = params.servicePort || ''
|
|
|
+ params.ip = params.ip || "";
|
|
|
+ params.static = params.static || "";
|
|
|
+ params.laserServicePort = params.laserServicePort || "";
|
|
|
+ params.servicePort = params.servicePort || "";
|
|
|
}
|
|
|
|
|
|
-const ip = params.ip + ':';
|
|
|
-params.root = `${ip}${params.laserServicePort}`
|
|
|
-params.ossRoot = `${ip}${params.laserServicePort}/${params.static}/`
|
|
|
+const ip = params.ip + ":";
|
|
|
+params.root = `${ip}${params.laserServicePort}`;
|
|
|
+params.ossRoot = `${ip}${params.laserServicePort}/${params.static}/`;
|
|
|
params.serviceUrl = `${ip}${params.servicePort}/fusion`;
|
|
|
-params.laserRoot = params.root
|
|
|
+params.laserRoot = params.root;
|
|
|
|
|
|
// params.laserOSSRoot = 'asd/'
|
|
|
|
|
|
-params.serviceUrl = '/fusion'
|
|
|
+params.serviceUrl = "/fusion";
|
|
|
export let namespace = params.serviceUrl;
|
|
|
|
|
|
-
|
|
|
export const getResources = (uri: string) => {
|
|
|
+ uri = uri.replaceAll("\\", "/");
|
|
|
if (
|
|
|
!params.ossRoot ||
|
|
|
- ~uri.indexOf('base64') ||
|
|
|
- ~uri.indexOf('bolb') ||
|
|
|
- ~uri.indexOf('//')
|
|
|
+ ~uri.indexOf("base64") ||
|
|
|
+ ~uri.indexOf("bolb") ||
|
|
|
+ ~uri.indexOf("//")
|
|
|
)
|
|
|
- return uri
|
|
|
+ return uri;
|
|
|
|
|
|
- const root = uri.indexOf('/' + params.static) === 0 ? `${ip}${params.laserServicePort}` : params.ossRoot
|
|
|
- const baseURL = new URL(root)
|
|
|
- const url = new URL(uri, root)
|
|
|
+ const root =
|
|
|
+ uri.indexOf(params.static.substring(1)) === 0 ||
|
|
|
+ uri.indexOf(params.static) === 0
|
|
|
+ ? `${ip}${params.laserServicePort}`
|
|
|
+ : params.ossRoot;
|
|
|
+ const baseURL = new URL(root);
|
|
|
+ const url = new URL(uri, root);
|
|
|
+ console.log(root, uri);
|
|
|
const basePath =
|
|
|
- baseURL.pathname[baseURL.pathname.length - 1] === '/'
|
|
|
+ baseURL.pathname[baseURL.pathname.length - 1] === "/"
|
|
|
? baseURL.pathname.substring(0, baseURL.pathname.length - 1)
|
|
|
- : baseURL.pathname
|
|
|
- url.pathname = basePath + url.pathname
|
|
|
- return url.href
|
|
|
-}
|
|
|
+ : baseURL.pathname;
|
|
|
+ url.pathname = basePath + url.pathname;
|
|
|
+ return url.href;
|
|
|
+};
|