QingXiCheAndQvMain.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. <script setup>
  2. import { CommonVal } from "@/components/ChengGuangYuanJing/store/CommonVal.js";
  3. import { QingXiCheAndQvMyThreeWorldStore } from "./store/QingXiCheAndQvMyThreeWorldStore.js";
  4. import ThreeWorldEventMainQingXiCheAndQv from "./ThreeWorldEventMainQingXiCheAndQv.vue";
  5. import { QingXiCheAndQvThreeWorldEventMain } from "./js/QingXiCheAndQvThreeWorldEventMain.js";
  6. import LoadingDemo from "./LoadingDemo.vue";
  7. import MapGps from "./MapGps.vue";
  8. import QingXiCheAndQvProcessEvent from "./event/QingXiCheAndQvProcessEvent.vue";
  9. import { QingXiCheAndQvProcessEventStore } from "./event/store/QingXiCheAndQvProcessEventStore.js";
  10. import { QingXiCheAndQvCarEvent } from "./js/QingXiCheAndQvCarEvent.js";
  11. import { watch, ref } from "vue";
  12. import WindowTxt from "../WindowQingXiCheAndQv/WindowTxt.vue";
  13. import { WindowTxtStore } from "@/components/WindowQingXiCheAndQv/store/WindowTxtStore.js";
  14. import WindowVideo from "../WindowQingXiCheAndQv/WindowVideo.vue";
  15. import { WindowVideoStore } from "@/components/WindowQingXiCheAndQv/store/WindowVideoStore.js";
  16. import WindowCountdown from "../WindowQingXiCheAndQv/WindowCountdown.vue";
  17. import { WindowCountdownStore } from "@/components/WindowQingXiCheAndQv/store/WindowCountdownStore.js";
  18. import WindowVideoRemoveColor from "../WindowQingXiCheAndQv/WindowVideoRemoveColor.vue";
  19. import { WindowVideoRemoveColorStore } from "@/components/WindowQingXiCheAndQv/store/WindowVideoRemoveColorStore.js";
  20. import { WindowEvent } from "../WindowQingXiCheAndQv/js/WindowEvent.js";
  21. const videoJson = {
  22. "01" : new URL("../assets/res/video/01.mp4", import.meta.url).href,
  23. "02" : new URL("../assets/res/video/02.mp4", import.meta.url).href,
  24. "03" : new URL("../assets/res/video/03.mp4", import.meta.url).href,
  25. "04" : new URL("../assets/res/video/04.mp4", import.meta.url).href,
  26. // "01" : "#/Video?id=01",
  27. // "02" : "#/Video?id=02",
  28. // "03" : "#/Video?id=03",
  29. // "04" : "#/Video?id=04",
  30. };
  31. // 当前点击播放视频的地址
  32. let videoUrl = ref("");
  33. // 弹出pdf的内容
  34. let menuListIndex = ref(-1);
  35. /**
  36. * 控制在管道里的检测车,重新回到初始流程
  37. */
  38. let timeResetInitGroundDownCar = ref("0");
  39. /**
  40. * 接下来要操作的步骤
  41. * json
  42. */
  43. const callbackProcessEvent = (json) => {
  44. let type = json["type"];
  45. let config = json["config"];
  46. // 进入触发当前步骤的逻辑
  47. QingXiCheAndQvCarEvent.find().typeEvent(config.name);
  48. }
  49. /**
  50. * 选择菜单
  51. */
  52. const SelectEventCallbackExit = (json) => {
  53. // console.log(
  54. // "SelectEventCallbackExit", json
  55. // );
  56. QingXiCheAndQvMyThreeWorldStore().obj.SelectEventConfig = json;
  57. if (QingXiCheAndQvMyThreeWorldStore().obj.SelectEventConfig.name == "巡查调度虚拟仿真") {
  58. menuEvent("mapGps");
  59. joinEvent();
  60. return;
  61. }
  62. QingXiCheAndQvMyThreeWorldStore().obj.SelectEventViewOpen = false;
  63. QingXiCheAndQvMyThreeWorldStore().obj.SelectTypeEventViewOpen = true;
  64. }
  65. /**
  66. * 选择类型
  67. * json
  68. */
  69. const SelectTypeEventCallbackExit = (json) => {
  70. // console.log(
  71. // "SelectTypeEventCallbackExit", json
  72. // );
  73. if (typeof json == 'undefined' || json == null || json == undefined) {
  74. QingXiCheAndQvMyThreeWorldStore().obj.SelectEventViewOpen = true;
  75. QingXiCheAndQvMyThreeWorldStore().obj.SelectTypeEventViewOpen = false;
  76. return;
  77. }
  78. QingXiCheAndQvMyThreeWorldStore().obj.SelectTypeEventConfig = json;
  79. SelectTypeEventConfigEvent();
  80. }
  81. /**
  82. * 统一返回到首页
  83. */
  84. const ComReturnCallbackExit = () => {
  85. // QingXiCheAndQvMyThreeWorldStore().obj.ComReturnViewOpen = false;
  86. // QingXiCheAndQvMyThreeWorldStore().obj.SelectEventViewOpen = true;
  87. // 改成返回上一级
  88. WindowEvent.find().WindowTxtViewOpenExit();
  89. WindowEvent.find().WindowVideoViewOpenExit();
  90. WindowEvent.find().WindowCountdownExit();
  91. WindowEvent.find().WindowVideoRemoveColorExit();
  92. QingXiCheAndQvMyThreeWorldStore().obj.VideoViewOpen = false;
  93. QingXiCheAndQvMyThreeWorldStore().obj.ComReturnViewOpen = false;
  94. QingXiCheAndQvMyThreeWorldStore().obj.SelectEventViewOpen = false;
  95. if (QingXiCheAndQvMyThreeWorldStore().obj.SelectEventConfig.name == "巡查调度虚拟仿真") {
  96. QingXiCheAndQvMyThreeWorldStore().obj.SelectTypeEventViewOpen = false;
  97. QingXiCheAndQvMyThreeWorldStore().obj.SelectEventViewOpen = true;
  98. } else {
  99. QingXiCheAndQvMyThreeWorldStore().obj.SelectTypeEventViewOpen = true;
  100. }
  101. }
  102. /**
  103. * 视频返回事件触发
  104. */
  105. const VideoCallbackExit = () => {
  106. QingXiCheAndQvMyThreeWorldStore().obj.VideoViewOpen = false;
  107. }
  108. /**
  109. * 根据菜单 和 类别,触发对应的逻辑
  110. */
  111. const SelectTypeEventConfigEvent = () => {
  112. console.log(
  113. "SelectTypeEventConfigEvent",
  114. QingXiCheAndQvMyThreeWorldStore().obj.SelectEventConfig,
  115. QingXiCheAndQvMyThreeWorldStore().obj.SelectTypeEventConfig
  116. );
  117. if (QingXiCheAndQvMyThreeWorldStore().obj.SelectTypeEventConfig.type == "video") {
  118. // console.log("弹出视频", QingXiCheAndQvMyThreeWorldStore().obj.SelectEventConfig.name);
  119. switch (QingXiCheAndQvMyThreeWorldStore().obj.SelectEventConfig.name) {
  120. case "巡查调度虚拟仿真":
  121. // window.open(videoJson["01"], '_blank');
  122. videoUrl.value = videoJson["01"];
  123. QingXiCheAndQvMyThreeWorldStore().obj.VideoViewOpen = true;
  124. break;
  125. case "维护清洗虚拟仿真":
  126. // window.open(videoJson["02"], '_blank');
  127. videoUrl.value = videoJson["02"];
  128. QingXiCheAndQvMyThreeWorldStore().obj.VideoViewOpen = true;
  129. break;
  130. case "检测虚拟仿真":
  131. // window.open(videoJson["03"], '_blank');
  132. videoUrl.value = videoJson["03"];
  133. QingXiCheAndQvMyThreeWorldStore().obj.VideoViewOpen = true;
  134. break;
  135. case "数智修复虚拟仿真":
  136. // window.open(videoJson["04"], '_blank');
  137. videoUrl.value = videoJson["04"];
  138. QingXiCheAndQvMyThreeWorldStore().obj.VideoViewOpen = true;
  139. break;
  140. }
  141. return;
  142. }
  143. if (QingXiCheAndQvMyThreeWorldStore().obj.SelectTypeEventConfig.type == "vr") {
  144. // console.log("弹出虚拟仿真", QingXiCheAndQvMyThreeWorldStore().obj.SelectEventConfig.name);
  145. switch (QingXiCheAndQvMyThreeWorldStore().obj.SelectEventConfig.name) {
  146. case "巡查调度虚拟仿真":
  147. break;
  148. case "维护清洗虚拟仿真":
  149. menuEvent("waterPipe");
  150. break;
  151. case "检测虚拟仿真":
  152. menuEvent("look");
  153. break;
  154. case "数智修复虚拟仿真":
  155. menuEvent("repair");
  156. break;
  157. }
  158. joinEvent();
  159. return;
  160. }
  161. if (QingXiCheAndQvMyThreeWorldStore().obj.SelectTypeEventConfig.type == "test") {
  162. // console.log(
  163. // "弹出PDF", QingXiCheAndQvMyThreeWorldStore().obj.SelectEventConfig.name
  164. // );
  165. switch (QingXiCheAndQvMyThreeWorldStore().obj.SelectEventConfig.name) {
  166. case "巡查调度虚拟仿真":
  167. break;
  168. case "维护清洗虚拟仿真":
  169. menuListIndex.value = 0;
  170. break;
  171. case "检测虚拟仿真":
  172. menuListIndex.value = 1;
  173. break;
  174. case "数智修复虚拟仿真":
  175. menuListIndex.value = 2;
  176. break;
  177. }
  178. // pdfUrl.value = "lookpdf/index.html?pdfUrl=" + url;
  179. // pdfUrl.value = url;
  180. return;
  181. }
  182. }
  183. /**
  184. * 统一进入实验要触发的逻辑
  185. */
  186. const joinEvent = () => {
  187. QingXiCheAndQvMyThreeWorldStore().obj.SelectEventViewOpen = false;
  188. QingXiCheAndQvMyThreeWorldStore().obj.SelectTypeEventViewOpen = false;
  189. QingXiCheAndQvMyThreeWorldStore().obj.VideoViewOpen = false;
  190. QingXiCheAndQvMyThreeWorldStore().obj.ComReturnViewOpen = true;
  191. }
  192. /**
  193. * 切换菜单,触发不同逻辑
  194. * name 切换的菜单
  195. */
  196. const menuEvent = (name) => {
  197. for (let key in QingXiCheAndQvMyThreeWorldStore().obj.menu) {
  198. QingXiCheAndQvMyThreeWorldStore().obj.menu[key] = false;
  199. }
  200. QingXiCheAndQvMyThreeWorldStore().obj.menu[name] = true;
  201. let thisTime = new Date().getTime();
  202. // console.log(
  203. // "QingXiCheAndQvMyThreeWorldStore().obj.menu", QingXiCheAndQvMyThreeWorldStore().obj.menu
  204. // );
  205. QingXiCheAndQvProcessEventStore().obj.listIndex = -1;
  206. // 城市供水管道巡查调度虚拟仿真
  207. if (QingXiCheAndQvMyThreeWorldStore().obj.menu.mapGps == true) {
  208. return;
  209. }
  210. // 城市供水管道维护清洗虚拟仿真
  211. if (QingXiCheAndQvMyThreeWorldStore().obj.menu.waterPipe == true) {
  212. // QingXiCheAndQvCarEvent.find().evnetInit_1();
  213. // // 自动触发到第1个步骤
  214. // QingXiCheAndQvProcessEventStore().obj.listIndex = 0;
  215. // 循环找到指定名字的流程,来开始
  216. for (let processEventStoreListI = 0; processEventStoreListI < QingXiCheAndQvProcessEventStore().obj.list.length; processEventStoreListI++) {
  217. let thisList = QingXiCheAndQvProcessEventStore().obj.list[processEventStoreListI];
  218. if (thisList.name == "仿真模拟") {
  219. // if (thisList.name == "下车确定安全灯显示是否正常") {
  220. QingXiCheAndQvProcessEventStore().obj.listIndex = processEventStoreListI;
  221. }
  222. }
  223. // 进入触发当前步骤的逻辑
  224. QingXiCheAndQvCarEvent.find().typeEvent(
  225. QingXiCheAndQvProcessEventStore().obj.list[QingXiCheAndQvProcessEventStore().obj.listIndex].name
  226. );
  227. // 上一步按钮是否展示
  228. QingXiCheAndQvCarEvent.find().tipsBtnsUpOpenEventCallback = function(openBool) {
  229. QingXiCheAndQvProcessEventStore().obj.btnUp = openBool;
  230. };
  231. // 下一步按钮是否展示
  232. QingXiCheAndQvCarEvent.find().tipsBtnsDownOpenEventCallback = function(openBool) {
  233. QingXiCheAndQvProcessEventStore().obj.btnDown = openBool;
  234. };
  235. setTimeout(function() {
  236. QingXiCheAndQvThreeWorldEventMain.find().commonBirthplaceUpdate();
  237. }, 1600);
  238. return;
  239. }
  240. // 城市供水管道检测虚拟仿真
  241. if (QingXiCheAndQvMyThreeWorldStore().obj.menu.look == true) {
  242. timeResetInitGroundDownCar.value = "" + thisTime;
  243. return;
  244. }
  245. // 城市供水管道数智修复虚拟仿真
  246. if (QingXiCheAndQvMyThreeWorldStore().obj.menu.repair == true) {
  247. // 循环找到指定名字的流程,来开始
  248. for (let processEventStoreListI = 0; processEventStoreListI < QingXiCheAndQvProcessEventStore().obj.list.length; processEventStoreListI++) {
  249. let thisList = QingXiCheAndQvProcessEventStore().obj.list[processEventStoreListI];
  250. // if (thisList.name == "数字修复虚拟仿真-将橡胶垫片放置到正确的位置") {
  251. if (thisList.name == "数字修复虚拟仿真-将阀门关闭停止水流") {
  252. QingXiCheAndQvProcessEventStore().obj.listIndex = processEventStoreListI;
  253. }
  254. }
  255. // 进入触发当前步骤的逻辑
  256. QingXiCheAndQvCarEvent.find().typeEvent(
  257. QingXiCheAndQvProcessEventStore().obj.list[QingXiCheAndQvProcessEventStore().obj.listIndex].name
  258. );
  259. // 上一步按钮是否展示
  260. QingXiCheAndQvCarEvent.find().tipsBtnsUpOpenEventCallback = function(openBool) {
  261. QingXiCheAndQvProcessEventStore().obj.btnUp = openBool;
  262. };
  263. // 下一步按钮是否展示
  264. QingXiCheAndQvCarEvent.find().tipsBtnsDownOpenEventCallback = function(openBool) {
  265. QingXiCheAndQvProcessEventStore().obj.btnDown = openBool;
  266. };
  267. QingXiCheAndQvProcessEventStore().obj.btnUp = false;
  268. QingXiCheAndQvProcessEventStore().obj.btnDown = false;
  269. setTimeout(function() {
  270. QingXiCheAndQvThreeWorldEventMain.find().commonBirthplaceUpdate();
  271. }, 1600);
  272. return;
  273. }
  274. // 回到人物视角
  275. if (QingXiCheAndQvMyThreeWorldStore().obj.menu.roleLook == true) {
  276. QingXiCheAndQvThreeWorldEventMain.find().toRoleEvent();
  277. return;
  278. }
  279. }
  280. </script>
  281. <template>
  282. <div class="QingXiCheAndQvMain">
  283. <!-- 自定义自己建的加载3d场景的逻辑 -->
  284. <ThreeWorldEventMainQingXiCheAndQv
  285. v-show="QingXiCheAndQvMyThreeWorldStore().obj.menu.waterPipe == true || QingXiCheAndQvMyThreeWorldStore().obj.menu.repair == true"
  286. ></ThreeWorldEventMainQingXiCheAndQv>
  287. <!-- 自定义加载百分比 -->
  288. <LoadingDemo
  289. v-if="CommonVal().loadSuccess == false"
  290. ></LoadingDemo>
  291. <!-- <LoadingDemo></LoadingDemo> -->
  292. <WindowTxt
  293. v-if="WindowTxtStore().obj.WindowTxtViewOpen == true"
  294. ></WindowTxt>
  295. <WindowVideo
  296. v-if="WindowVideoStore().obj.WindowVideoViewOpen == true"
  297. ></WindowVideo>
  298. <WindowCountdown
  299. v-if="WindowCountdownStore().obj.viewOpen == true"
  300. ></WindowCountdown>
  301. <WindowVideoRemoveColor
  302. v-if="WindowVideoRemoveColorStore().obj.viewOpen == true"
  303. ></WindowVideoRemoveColor>
  304. <!-- 我们会通过一个全局的变量,来控制什么组件是否显示 CommonVal().loadSuccess 是一种方式,3d场景加载完成后会变成 true -->
  305. <div
  306. v-if="CommonVal().loadSuccess == true"
  307. >
  308. <MapGps v-show="QingXiCheAndQvMyThreeWorldStore().obj.menu.mapGps == true" ></MapGps>
  309. <QingXiCheAndQvProcessEvent @callbackProcess="callbackProcessEvent"
  310. v-show="QingXiCheAndQvProcessEventStore().obj.listIndex > -1" ></QingXiCheAndQvProcessEvent>
  311. </div>
  312. </div>
  313. </template>
  314. <style lang="less" >
  315. * {
  316. box-sizing:border-box;
  317. -moz-box-sizing:border-box; /* Firefox */
  318. -webkit-box-sizing:border-box; /* Safari */
  319. }
  320. </style>
  321. <style lang="less" scoped>
  322. .QingXiCheAndQvMain * {
  323. -moz-user-select: none;
  324. -webkit-user-select: none;
  325. -ms-user-select: none;
  326. -khtml-user-select: none;
  327. user-select: none;
  328. }
  329. .QingXiCheAndQvMain {
  330. position: fixed;
  331. z-index: 0;
  332. width: 100%;
  333. height: 100%;
  334. top: 0px;
  335. left: 0px;
  336. }
  337. </style>