|
@@ -34,6 +34,28 @@ export function getPanoInfo(ok, no) {
|
|
* @param {*} no
|
|
* @param {*} no
|
|
*/
|
|
*/
|
|
export function getFdkkInfo(data, ok, no) {
|
|
export function getFdkkInfo(data, ok, no) {
|
|
|
|
+ // 使用环境变量判断是否为离线模式
|
|
|
|
+ if (config.isOfflineMode) {
|
|
|
|
+ // 离线包环境,读取本地JSON文件
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
+ const vrId = data.num || browser.getURLParam("vr");
|
|
|
|
+ // 构建scene.json文件的路径
|
|
|
|
+ const sceneJsonPath = `/scene_view_data/${vrId}/data/scene.json`;
|
|
|
|
+
|
|
|
|
+ fetch(sceneJsonPath)
|
|
|
|
+ .then(response => response.json())
|
|
|
|
+ .then(data => {
|
|
|
|
+ console.log('读取本地scene.json成功:', data);
|
|
|
|
+ if (ok) ok(data);
|
|
|
|
+ resolve(data);
|
|
|
|
+ })
|
|
|
|
+ .catch(error => {
|
|
|
|
+ console.error('读取本地scene.json文件失败:', error);
|
|
|
|
+ if (no) no(error);
|
|
|
|
+ reject(error);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
return http.get(`${fdkkURL}api/scene/getInfo?num=${data.num}&_=${Math.random()}`, {}, ok, no);
|
|
return http.get(`${fdkkURL}api/scene/getInfo?num=${data.num}&_=${Math.random()}`, {}, ok, no);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -54,6 +76,24 @@ export function checkWork(ok, no) {
|
|
* @param {*} no
|
|
* @param {*} no
|
|
*/
|
|
*/
|
|
export function exchangeId(data, ok, no) {
|
|
export function exchangeId(data, ok, no) {
|
|
|
|
+ // 使用环境变量判断是否为离线模式
|
|
|
|
+ if (config.isOfflineMode) {
|
|
|
|
+ // 离线包环境,读取本地JSON文件
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
+ fetch(`${config.offlineBasePath}/web/common/getIdInfo`)
|
|
|
|
+ .then(response => response.json())
|
|
|
|
+ .then(data => {
|
|
|
|
+ console.log(data, 55555)
|
|
|
|
+ if (ok) ok(data);
|
|
|
|
+ resolve(data);
|
|
|
|
+ })
|
|
|
|
+ .catch(error => {
|
|
|
|
+ console.error('读取本地getIdInfo文件失败:', error);
|
|
|
|
+ if (no) no(error);
|
|
|
|
+ reject(error);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
return http.post(`${URL_FILL}/web/common/getIdInfo`, data, ok, no);
|
|
return http.post(`${URL_FILL}/web/common/getIdInfo`, data, ok, no);
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
@@ -63,5 +103,23 @@ export function exchangeId(data, ok, no) {
|
|
* @param {*} no
|
|
* @param {*} no
|
|
*/
|
|
*/
|
|
export function getWorkInfo(ok, no) {
|
|
export function getWorkInfo(ok, no) {
|
|
|
|
+ // 使用环境变量判断是否为离线模式
|
|
|
|
+ if (config.isOfflineMode) {
|
|
|
|
+ // 离线包环境,读取本地JSON文件
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
+ fetch(`${config.offlineBasePath}/work/view--workId=${number()}`)
|
|
|
|
+ .then(response => response.json())
|
|
|
|
+ .then(data => {
|
|
|
|
+ console.log(data, 55555)
|
|
|
|
+ if (ok) ok(data);
|
|
|
|
+ resolve(data);
|
|
|
|
+ })
|
|
|
|
+ .catch(error => {
|
|
|
|
+ console.error('读取本地getIdInfo文件失败:', error);
|
|
|
|
+ if (no) no(error);
|
|
|
|
+ reject(error);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
return http.get(`${URL_FILL}/work/view?workId=${number()}`, {}, ok, no);
|
|
return http.get(`${URL_FILL}/work/view?workId=${number()}`, {}, ok, no);
|
|
}
|
|
}
|