App.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <div id="app">
  3. <div :id="`fengMap${id}`" class="fengMap"></div>
  4. <router-view />
  5. </div>
  6. </template>
  7. <script>
  8. import { mapGetters, mapActions, mapMutations } from "vuex";
  9. import { SFengParser } from "@saga-web/feng-map";
  10. window.fengmapData = null;
  11. export default {
  12. data() {
  13. return {
  14. view: "",
  15. scene: "",
  16. id: "2",
  17. canvasID: "",
  18. key: "23f30a832a862c58637a4aadbf50a566",
  19. appName: "万达可视化系统",
  20. mapServerURL: `http://map.wanda.cn/editor`
  21. };
  22. },
  23. mounted() {
  24. // 监听页面刷新事件
  25. window.addEventListener("unload", this.unload);
  26. // 页面加载完成后,移除session里的存储的信息
  27. window.addEventListener("load", this.load);
  28. // 请求该项目下的楼层数据
  29. this.getFengMap();
  30. },
  31. computed: {
  32. ...mapGetters(["plazaId", "fmapID", "haveFengMap"])
  33. },
  34. methods: {
  35. ...mapActions(["getfmapID"]),
  36. ...mapMutations(["SETHAVEFENGMAP"]),
  37. unload() {
  38. // const { userInfo, projectId, menuStatus,manualAutoMode } = this.$store.state;
  39. const state = this.$store.state;
  40. sessionStorage.setItem("state", JSON.stringify(state));
  41. },
  42. load() {
  43. sessionStorage.clear();
  44. },
  45. getFengMap() {
  46. if (!this.fmapID) {
  47. this.getfmapID().then(() => {
  48. this.getMap();
  49. });
  50. return;
  51. }
  52. this.getMap();
  53. },
  54. getMap() {
  55. if (!window.fengmapData) {
  56. window.fengmapData = new SFengParser(
  57. `fengMap${this.id}`,
  58. `${this.mapServerURL}/fmap/${this.fmapID}`,
  59. this.key,
  60. this.appName,
  61. null
  62. );
  63. window.fengmapData.loadMap(this.fmapID, () => {
  64. // 获取主题数据
  65. window.fengmapData
  66. .loadTheme(
  67. `${this.mapServerURL}/webtheme/${this.fmapID}/${this.fmapID}.theme`
  68. )
  69. .then(res => {
  70. console.log("获取rf成功", res);
  71. this.SETHAVEFENGMAP()
  72. });
  73. });
  74. }
  75. }
  76. },
  77. };
  78. </script>
  79. <style lang="less">
  80. body,
  81. h1,
  82. h2,
  83. h3,
  84. h4,
  85. h5,
  86. h6,
  87. hr,
  88. p,
  89. blockquote,
  90. dl,
  91. dt,
  92. dd,
  93. ul,
  94. ol,
  95. li,
  96. pre,
  97. form,
  98. fieldset,
  99. legend,
  100. button,
  101. input,
  102. textarea,
  103. th,
  104. td {
  105. margin: 0;
  106. padding: 0;
  107. }
  108. body,
  109. button,
  110. input,
  111. select,
  112. textarea {
  113. font: 12px/1.5 Arial, "Microsoft YaHei", "\65b0\5b8b\4f53";
  114. }
  115. h1,
  116. h2,
  117. h3,
  118. h4,
  119. h5,
  120. h6 {
  121. font-size: 100%;
  122. }
  123. address,
  124. cite,
  125. dfn,
  126. var,
  127. em,
  128. i,
  129. u {
  130. font-style: normal;
  131. }
  132. ol,
  133. ul {
  134. list-style: none;
  135. }
  136. a {
  137. text-decoration: none;
  138. }
  139. a:hover {
  140. text-decoration: underline;
  141. }
  142. img {
  143. border: none;
  144. vertical-align: middle;
  145. }
  146. :focus {
  147. outline: 0;
  148. }
  149. button,
  150. input,
  151. select,
  152. textarea {
  153. font-size: 100%;
  154. }
  155. table {
  156. border-collapse: collapse;
  157. border-spacing: 0;
  158. }
  159. /* 滚动条样式 */
  160. body ::-webkit-scrollbar {
  161. width: 5px;
  162. height: 5px;
  163. }
  164. body ::-webkit-scrollbar-track {
  165. background-color: rgba(0, 0, 0, 0);
  166. border-radius: 3px;
  167. }
  168. body ::-webkit-scrollbar-thumb {
  169. border-radius: 3px;
  170. background: #e6e6e6;
  171. border: 1px solid #e6e6e6;
  172. }
  173. body ::-webkit-scrollbar-thumb:vertical:hover {
  174. background: #e6e6e6;
  175. border: 1px solid #e6e6e6;
  176. }
  177. .clearfix::after {
  178. content: ".";
  179. display: block;
  180. height: 0;
  181. clear: both;
  182. visibility: hidden;
  183. }
  184. .clearfix {
  185. zoom: 1;
  186. }
  187. .left {
  188. float: left;
  189. }
  190. .right {
  191. float: right;
  192. }
  193. html,
  194. body {
  195. width: 100%;
  196. height: 100%;
  197. // min-width: 1920px;
  198. // background: url('./assets/images/back.jpg') no-repeat;
  199. }
  200. #app {
  201. height: 100%;
  202. width: 100%;
  203. position: relative;
  204. .fengMap {
  205. position: fixed;
  206. width: 100px;
  207. height: 100px;
  208. z-index: -1;
  209. opacity: 0
  210. }
  211. }
  212. </style>