xuting.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <svg
  3. version="1.1"
  4. id="XT"
  5. xmlns="http://www.w3.org/2000/svg"
  6. xmlns:xlink="http://www.w3.org/1999/xlink"
  7. x="0px"
  8. y="0px"
  9. viewBox="0 0 300 300"
  10. xml:space="preserve"
  11. >
  12. <g id="xt_1_">
  13. <circle id="xt_x5F_2" class="st0" cx="150.5" cy="150.6" r="147.9" />
  14. <circle id="xt_x5F_1" class="st0" cx="141.1" cy="133.4" r="99.4" />
  15. <g class="st1">
  16. <path
  17. class="st2"
  18. d="M213,284.3c60.5-28.4,95.9-95.6,81.7-163.9C281.5,56.4,229,10.9,167.5,3.5"
  19. />
  20. <path
  21. class="st2"
  22. d="M58.8,33.9C16,67.4-6.7,123.5,5.1,180.4c5.5,26.3,25.8,66.2,51.5,84.7"
  23. />
  24. <circle class="st3" cx="141.1" cy="132.9" r="99.4" />
  25. <path
  26. class="st4"
  27. d="M240.4,132.9c0,54.9-44.5,99.4-99.4,99.4c-39.3,0-73.3-22.9-89.5-55.9"
  28. />
  29. <circle class="st3" cx="150.4" cy="151.3" r="147.7" />
  30. </g>
  31. <g class="st5">
  32. <rect
  33. x="239.4"
  34. y="31.3"
  35. transform="matrix(0.6343 -0.7731 0.7731 0.6343 58.6197 199.8735)"
  36. class="st6"
  37. width="2.4"
  38. height="13.4"
  39. />
  40. <rect
  41. x="200.7"
  42. y="8.7"
  43. transform="matrix(0.3523 -0.9359 0.9359 0.3523 116.3282 198.9834)"
  44. class="st6"
  45. width="2.4"
  46. height="13.4"
  47. />
  48. <rect
  49. x="264.8"
  50. y="57.4"
  51. transform="matrix(0.8069 -0.5906 0.5906 0.8069 13.5263 169.4816)"
  52. class="st6"
  53. width="2.4"
  54. height="13.4"
  55. />
  56. <rect
  57. x="283"
  58. y="89.9"
  59. transform="matrix(0.9309 -0.3652 0.3652 0.9309 -15.6331 110.4542)"
  60. class="st6"
  61. width="2.4"
  62. height="13.4"
  63. />
  64. <rect
  65. x="291.8"
  66. y="124.1"
  67. transform="matrix(0.9917 -0.1285 0.1285 0.9917 -14.3734 38.7172)"
  68. class="st6"
  69. width="2.4"
  70. height="13.4"
  71. />
  72. <rect
  73. x="286.7"
  74. y="166.3"
  75. transform="matrix(0.1134 -0.9936 0.9936 0.1134 93.7222 439.9645)"
  76. class="st6"
  77. width="13.4"
  78. height="2.4"
  79. />
  80. <rect
  81. x="278.9"
  82. y="198.8"
  83. transform="matrix(0.3469 -0.9379 0.9379 0.3469 -1.0262 398.4525)"
  84. class="st6"
  85. width="13.4"
  86. height="2.4"
  87. />
  88. <rect
  89. x="261.5"
  90. y="233"
  91. transform="matrix(0.5784 -0.8158 0.8158 0.5784 -77.9707 317.5801)"
  92. class="st6"
  93. width="13.4"
  94. height="2.4"
  95. />
  96. </g>
  97. </g>
  98. <g id="point" :class="cls" @click="handleClick" @mouseleave="$emit('hoverPano',{})" @mouseover="hoverItem">
  99. <g :class="'xt-s1' + cls" id="xt-s1">
  100. <circle class="st7" cx="230.4" cy="48" r="7.7" />
  101. <circle class="st7" cx="230.4" cy="48" r="5.5" />
  102. </g>
  103. <g :class="'xt-s12' + cls" id="xt-s12">
  104. <circle class="st7" cx="197.7" cy="30.6" r="7.7" />
  105. <circle class="st7" cx="197.7" cy="30.6" r="5.5" />
  106. </g>
  107. <g :class="'xt-s2' + cls" id="xt-s2">
  108. <circle class="st7" cx="253.8" cy="73.1" r="7.7" />
  109. <circle class="st7" cx="253.8" cy="73.1" r="5.5" />
  110. </g>
  111. <g :class="'xt-s3' + cls" id="xt-s3">
  112. <ellipse
  113. transform="matrix(0.4641 -0.8858 0.8858 0.4641 53.577 294.2482)"
  114. class="st7"
  115. cx="270"
  116. cy="102.8"
  117. rx="7.7"
  118. ry="7.7"
  119. />
  120. <circle class="st7" cx="270" cy="102.9" r="5.5" />
  121. </g>
  122. <g :class="'xt-s9' + cls" id="xt-s9">
  123. <circle class="st7" cx="97" cy="186" r="7.7" />
  124. <circle class="st7" cx="97" cy="186" r="5.5" />
  125. </g>
  126. <g :class="'xt-s10' + cls" id="xt-s10">
  127. <circle class="st7" cx="162.1" cy="196.9" r="7.7" />
  128. <circle class="st7" cx="162.1" cy="196.9" r="5.5" />
  129. </g>
  130. <g :class="'xt-s11' + cls" id="xt-s11">
  131. <circle class="st7" cx="208.7" cy="158.1" r="7.7" />
  132. <circle class="st7" cx="208.7" cy="158.1" r="5.5" />
  133. </g>
  134. <g :class="'xt-s4' + cls" id="xt-s4">
  135. <circle class="st7" cx="277.1" cy="134.7" r="7.7" />
  136. <ellipse class="st7" cx="277.2" cy="134.6" rx="5.5" ry="5.5" />
  137. </g>
  138. <g :class="'xt-s5' + cls" id="xt-s5">
  139. <ellipse
  140. transform="matrix(0.6 -0.8 0.8 0.6 -21.7909 288.1162)"
  141. class="st7"
  142. cx="277.2"
  143. cy="165.8"
  144. rx="7.7"
  145. ry="7.7"
  146. />
  147. <circle class="st7" cx="277.2" cy="165.9" r="5.5" />
  148. </g>
  149. <g :class="'xt-s6' + cls" id="xt-s6">
  150. <circle class="st7" cx="270.6" cy="194.8" r="7.7" />
  151. <circle class="st7" cx="270.6" cy="194.8" r="5.5" />
  152. </g>
  153. <g :class="'xt-s7' + cls" id="xt-s7">
  154. <circle class="st7" cx="253.2" cy="223.2" r="7.7" />
  155. <ellipse
  156. transform="matrix(0.4641 -0.8858 0.8858 0.4641 -62.0468 343.9185)"
  157. class="st7"
  158. cx="253.2"
  159. cy="223.2"
  160. rx="5.5"
  161. ry="5.5"
  162. />
  163. </g>
  164. <g :class="'xt-s8' + cls" id="xt-s8">
  165. <circle class="st7" cx="31.5" cy="99.7" r="7.7" />
  166. <circle class="st7" cx="31.5" cy="99.7" r="5.5" />
  167. </g>
  168. </g>
  169. </svg>
  170. </template>
  171. <script>
  172. export default {
  173. props: ["data", "currentPanoid", "cls"],
  174. data() {
  175. let keysData = Object.keys(this.data);
  176. return {
  177. keysData,
  178. };
  179. },
  180. methods: {
  181. hoverItem(e){
  182. let target = e.target.parentElement;
  183. console.dir(target);
  184. let tt = this.data[target.id];
  185. this.$emit('hoverPano',tt||{})
  186. },
  187. handleClick(e) {
  188. let target = e.target.parentElement;
  189. let tt = this.data[target.id];
  190. if (tt) {
  191. this.$bus.$emit('ifrMessage',{
  192. events:'flyToPano',
  193. data:tt
  194. })
  195. }
  196. },
  197. },
  198. watch: {
  199. currentPanoid: {
  200. deep: true,
  201. immediate: true,
  202. handler: function(newVal) {
  203. let kk = this.keysData.find((item) => {
  204. let key = this.data[item].id;
  205. return key == newVal;
  206. });
  207. this.$emit('currentPano',this.data[kk]||{})
  208. document.querySelector("." + this.cls) &&
  209. Array.from(document.querySelector("." + this.cls).childNodes).forEach(
  210. (item) => {
  211. item.classList.remove("active");
  212. }
  213. );
  214. if (kk) {
  215. document.querySelector("." + kk + this.cls).classList.add("active");
  216. }
  217. },
  218. },
  219. },
  220. };
  221. </script>
  222. <style lang="less" scoped>
  223. @color: #b1302e;
  224. .st0 {
  225. opacity: 0.89;
  226. fill: #343434;
  227. }
  228. .st1 {
  229. opacity: 0.4;
  230. }
  231. .st2 {
  232. opacity: 0.4;
  233. fill: none;
  234. stroke: #ffffff;
  235. stroke-width: 4;
  236. stroke-linecap: round;
  237. stroke-linejoin: round;
  238. stroke-miterlimit: 10;
  239. }
  240. .st3 {
  241. opacity: 0.89;
  242. fill: none;
  243. stroke: #a0a0a0;
  244. stroke-width: 2;
  245. stroke-miterlimit: 10;
  246. }
  247. .st4 {
  248. opacity: 0.89;
  249. fill: none;
  250. stroke: #a0a0a0;
  251. stroke-width: 4;
  252. stroke-linecap: round;
  253. stroke-linejoin: round;
  254. stroke-miterlimit: 10;
  255. }
  256. .st5 {
  257. opacity: 0.6;
  258. }
  259. .st6 {
  260. opacity: 0.89;
  261. fill: #ffffff;
  262. }
  263. .st7 {
  264. opacity: 0.6;
  265. fill: #ffffff;
  266. }
  267. #XT {
  268. width: 51%;
  269. }
  270. #point {
  271. > g {
  272. cursor: pointer;
  273. &.active {
  274. ellipse,
  275. circle:last-of-type {
  276. fill: @color;
  277. opacity: 1!important;
  278. }
  279. circle:first-of-type {
  280. opacity: 1!important;
  281. }
  282. }
  283. &:hover{
  284. ellipse,
  285. circle:last-of-type {
  286. fill: #fff;
  287. opacity: 1!important;
  288. }
  289. circle:first-of-type {
  290. opacity: 1!important;
  291. fill: @color;
  292. }
  293. }
  294. }
  295. }
  296. </style>