|
|
@@ -1,7 +1,8 @@
|
|
|
import Vue from 'vue'
|
|
|
import Vuex from 'vuex'
|
|
|
|
|
|
-import browser from "@/utils/browser";
|
|
|
+import browser from "@/utils/browser"
|
|
|
+import { deepClone } from "@/utils/other.js";
|
|
|
|
|
|
Vue.use(Vuex)
|
|
|
|
|
|
@@ -9,20 +10,20 @@ const store = new Vuex.Store({
|
|
|
state: {
|
|
|
userAvatar: '',
|
|
|
userNickName: '',
|
|
|
-
|
|
|
- info:'',
|
|
|
- backupInfo:'',
|
|
|
- showInfo:'',
|
|
|
- hotspot:'',
|
|
|
- backupHotSpot:'',
|
|
|
- initScene:'',
|
|
|
- tablist:[],
|
|
|
- temptablist:[],
|
|
|
- vrlist:[],
|
|
|
- allVrlist:[],
|
|
|
- sceneList:[],
|
|
|
- activeItem:'',
|
|
|
- isEditing:false,
|
|
|
+
|
|
|
+ info: '',
|
|
|
+ backupInfo: '',
|
|
|
+ showInfo: '',
|
|
|
+ hotspot: '',
|
|
|
+ backupHotSpot: '',
|
|
|
+ initScene: '',
|
|
|
+ tablist: [],
|
|
|
+ temptablist: [],
|
|
|
+ vrlist: [],
|
|
|
+ allVrlist: [],
|
|
|
+ sceneList: [],
|
|
|
+ activeItem: '',
|
|
|
+ isEditing: false,
|
|
|
isShow: false,
|
|
|
|
|
|
uploadStatusListAudio: [],
|
|
|
@@ -34,20 +35,55 @@ const store = new Vuex.Store({
|
|
|
userAvatar: state => state.userAvatar,
|
|
|
userNickName: state => state.userNickName,
|
|
|
|
|
|
- isEditing:state=>state.isEditing,
|
|
|
- info:state=>state.info,
|
|
|
- showInfo:state=>state.showInfo,
|
|
|
- backupInfo:state=>state.backupInfo,
|
|
|
- hotspot:state=>state.hotspot,
|
|
|
- backupHotSpot:state=>state.backupHotSpot,
|
|
|
- initScene:state=>state.initScene,
|
|
|
- activeItem:state=>state.activeItem,
|
|
|
- vrlist:state=>state.vrlist,
|
|
|
- tablist:state=>state.tablist,
|
|
|
- temptablist:state=>state.temptablist,
|
|
|
- sceneList:state=>state.sceneList,
|
|
|
- isShow:state=>state.isShow,
|
|
|
- allVrlist:state=>state.allVrlist,
|
|
|
+ isEditing: state => state.isEditing,
|
|
|
+ info: state => state.info,
|
|
|
+ catalogTopology: (state) => {
|
|
|
+ if (!state.info) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //四层:root,level1(一级分类),level2(二级分类或直属于一级分类的场景), level3(场景)
|
|
|
+ let root = deepClone(state.info.catalogRoot)
|
|
|
+ // 对于每个一级分类
|
|
|
+ for (const itemLevel1 of root) {
|
|
|
+ // 指定每个一级分类的下级
|
|
|
+ itemLevel1.childrenTemp = []
|
|
|
+ for (const itemLevel2Id of itemLevel1.children) {
|
|
|
+ for (const catalogsItem of state.info.catalogs) {
|
|
|
+ if (itemLevel2Id === catalogsItem.id) {
|
|
|
+ itemLevel1.childrenTemp.push(deepClone(catalogsItem))
|
|
|
+
|
|
|
+ // 对于该二级分类
|
|
|
+ const itemLevel2 = itemLevel1.childrenTemp[itemLevel1.childrenTemp.length - 1]
|
|
|
+ itemLevel2.children = []
|
|
|
+ // 对于每个三级分类
|
|
|
+ for (const itemLevel3 of state.info.scenes) {
|
|
|
+ // 如果属于上述二级分类
|
|
|
+ if (itemLevel2.id === itemLevel3.category /* 注意拼写!!! */) {
|
|
|
+ itemLevel2.children.push(deepClone(itemLevel3))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ itemLevel1.children = itemLevel1.childrenTemp
|
|
|
+ delete itemLevel1.childrenTemp
|
|
|
+ }
|
|
|
+ return root
|
|
|
+ },
|
|
|
+ showInfo: state => state.showInfo,
|
|
|
+ backupInfo: state => state.backupInfo,
|
|
|
+ hotspot: state => state.hotspot,
|
|
|
+ backupHotSpot: state => state.backupHotSpot,
|
|
|
+ initScene: state => state.initScene,
|
|
|
+ activeItem: state => state.activeItem,
|
|
|
+ vrlist: state => state.vrlist,
|
|
|
+ tablist: state => state.tablist,
|
|
|
+ temptablist: state => state.temptablist,
|
|
|
+ sceneList: state => state.sceneList,
|
|
|
+ isShow: state => state.isShow,
|
|
|
+ allVrlist: state => state.allVrlist,
|
|
|
|
|
|
uploadStatusListAudio: state => state.uploadStatusListAudio,
|
|
|
uploadStatusListImage: state => state.uploadStatusListImage,
|
|
|
@@ -65,7 +101,7 @@ const store = new Vuex.Store({
|
|
|
state.userNickName = nickName
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
SetTabList(state, list) {
|
|
|
state.tablist = list
|
|
|
},
|
|
|
@@ -98,19 +134,19 @@ const store = new Vuex.Store({
|
|
|
},
|
|
|
SetInfo(state, data) {
|
|
|
state.info = data
|
|
|
- this.commit("BackupInfo", browser.CloneObject(data));
|
|
|
+ this.commit("BackupInfo", browser.CloneObject(data))
|
|
|
},
|
|
|
BackupInfo(state, data) {
|
|
|
state.backupInfo = data
|
|
|
},
|
|
|
SetHotspot(state, data) {
|
|
|
state.hotspot = data
|
|
|
- this.commit("BackupHotSpot", browser.CloneObject(data));
|
|
|
+ this.commit("BackupHotSpot", browser.CloneObject(data))
|
|
|
},
|
|
|
BackupHotSpot(state, data) {
|
|
|
state.backupHotSpot = data
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
actions: {
|
|
|
refreshUserInfo(context) {
|