|
@@ -39,7 +39,12 @@ export default {
|
|
|
this.$bus.on("canLoad", (data) => {
|
|
|
this.canLoad = data;
|
|
|
if (data) {
|
|
|
- this.getInfo();
|
|
|
+ this.getInfo().then((res) => {
|
|
|
+ // getInfo里调用了后端接口,底层用了jquery的网络请求方法,为啥会导致promise嵌套没有展平,res拿到的不是promise 对象的resolve值而是promise对象本身????
|
|
|
+ res.then(() => {
|
|
|
+ this.$store.commit("TakeInfoSnapShotAtSave")
|
|
|
+ })
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -85,7 +90,6 @@ export default {
|
|
|
}
|
|
|
return item;
|
|
|
});
|
|
|
-
|
|
|
saveWorks(
|
|
|
{
|
|
|
password: this.info.password,
|
|
@@ -142,35 +146,43 @@ export default {
|
|
|
document.title = this.info.name;
|
|
|
this.getInfo();
|
|
|
this.$store.commit("UpdateIsShowState", true);
|
|
|
+ this.$store.commit("TakeInfoSnapShotAtSave")
|
|
|
},
|
|
|
() => {}
|
|
|
);
|
|
|
},
|
|
|
getInfo() {
|
|
|
- checkLogin().then((res) => {
|
|
|
- if (res.code == 0) {
|
|
|
- getPanoInfo("", (data) => {
|
|
|
- this.$store.commit("SetInfo", data);
|
|
|
- this.$store.commit("scene/setScenes", data.scenes);
|
|
|
+ return checkLogin().then((res) => {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ if (res.code == 0) {
|
|
|
+ getPanoInfo("", (data) => {
|
|
|
+ this.$store.commit("SetInfo", data);
|
|
|
+ this.$store.commit("scene/setScenes", data.scenes);
|
|
|
|
|
|
- let firstScene = "";
|
|
|
-
|
|
|
- if (data.firstScene) {
|
|
|
- firstScene = data.scenes.find((item) => item.sceneCode == data.firstScene.sceneCode);
|
|
|
- }
|
|
|
- this.$store.commit("scene/setCurrentScene", firstScene || data.scenes[0]);
|
|
|
+ let firstScene = "";
|
|
|
|
|
|
- // 查询初始场景的所在1级分组
|
|
|
- let catalog = data.catalogs.find((item) => item.id == this.currentScene.category);
|
|
|
- data.catalogRoot.forEach((item) => {
|
|
|
- let temp = item.children && item.children.find((sub) => sub == catalog.id);
|
|
|
- if (temp) {
|
|
|
- this.$store.commit("scene/setCurrentCatalogRoot", item);
|
|
|
- return;
|
|
|
+ if (data.firstScene) {
|
|
|
+ firstScene = data.scenes.find((item) => item.sceneCode == data.firstScene.sceneCode);
|
|
|
}
|
|
|
+ this.$store.commit("scene/setCurrentScene", firstScene || data.scenes[0]);
|
|
|
+
|
|
|
+ // 查询初始场景的所在1级分组
|
|
|
+ let catalog = data.catalogs.find((item) => item.id == this.currentScene.category);
|
|
|
+ data.catalogRoot.forEach((item) => {
|
|
|
+ let temp = item.children && item.children.find((sub) => sub == catalog.id);
|
|
|
+ if (temp) {
|
|
|
+ this.$store.commit("scene/setCurrentCatalogRoot", item);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ resolve()
|
|
|
+ }, (err) => {
|
|
|
+ reject(err)
|
|
|
});
|
|
|
- });
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ reject()
|
|
|
+ }
|
|
|
+ })
|
|
|
});
|
|
|
},
|
|
|
},
|