pano.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. <template>
  2. <div class="ifrcon">
  3. <!-- 待完善 -->
  4. <!-- :src="`https://airshow.4dkankan.com/spc.html?m=${selected.id}`" frameborder="0"></iframe>
  5. -->
  6. <iframe v-if="selectExh.type==='4dkk'" allowfullscreen="true" ref="iframe" :key="selected.id+selectExh.id"
  7. :src="`https://www.4dkankan.com/spg.html?m=${selected.id}&hideNav`" frameborder="0"></iframe>
  8. <div v-else id="pano" class="pano"></div>
  9. <div v-if="selected && selectExh.type != '4dkk'" class="title">{{ selected.sceneTitle }}</div>
  10. <mbui :type="type" :class="{ uicon: exhibition }" :isShow="isShowM" @close="isShowM = false">
  11. <div class="img_ul clip-scroller" slot="imgList">
  12. <ul>
  13. <li v-for="(item, i) in currentScenes" @click="handleItem(item)" :key="i"
  14. :class="{ active: selected.id == item.id }">
  15. <div>
  16. <img :src="item.icon" alt="" />
  17. <rollName :offset="20" :active="selected.id == item.id" class="pic-name" :myref="'subw' + item.id"
  18. :name="item.sceneTitle || item.title" />
  19. </div>
  20. <span class="bar"></span>
  21. </li>
  22. </ul>
  23. </div>
  24. <div class="txt_ul clip-scroller" slot="txtList" v-if="!exhibition">
  25. <ul>
  26. <li v-for="(item, i) in list" @click="selectExh = item" :key="i" :class="{ active: selectExh.id == item.id }">
  27. <span>{{ item.title }}</span>
  28. </li>
  29. </ul>
  30. </div>
  31. <div v-if="!isShowM" @click="isShowM = true" class="btn_zhankai" slot="btn_zhankai">
  32. <i class="iconfont icon-more"></i>
  33. </div>
  34. <vAside class="ui_header" slot="aside" />
  35. <vSelect slot="select" v-if="!exhibition" :type="type"></vSelect>
  36. </mbui>
  37. </div>
  38. </template>
  39. <script>
  40. import mbui from "./ui";
  41. import vAside from "./ui/aside.vue";
  42. import vSelect from "./ui/select.vue";
  43. export default {
  44. props: ['type', 'exhibition','area'],
  45. components: {
  46. mbui,
  47. vSelect,
  48. vAside
  49. },
  50. data() {
  51. return {
  52. params: "",
  53. isShowM: true,
  54. selected: {},
  55. selectExh: {},
  56. currentScenes: [],
  57. list: [],
  58. isFirst: true,
  59. loadFinish: false
  60. };
  61. },
  62. watch: {
  63. selectExh: {
  64. deep: true,
  65. handler: function (newVal) {
  66. if (newVal) {
  67. this.isFirst = true
  68. if (newVal.type === '4dkk') {
  69. this.selectExh = this.list.find(v=>v.id===newVal.id)
  70. this.selected = this.selectExh.scenes[0]
  71. this.currentScenes = this.selectExh.scenes.map(item => {
  72. return {
  73. ...item,
  74. // 待完善
  75. // icon: `https://4dkk.4dage.com/images/images${item.id}/floor_0.png?t=1667802021476?v=0&rnd=0.5813201205835572&x-oss-process=image/resize,m_fill,w_80,h_60/quality,q_70`
  76. icon: `https://4dkk.4dage.com/scene_view_data/${item.id}/user/thumb-2k.jpg?_=5`
  77. }
  78. })
  79. this.loadFinish = true
  80. }
  81. else {
  82. window.$.ajax({
  83. dataType: 'json',
  84. url: `https://airshow.4dkankan.com/pano/${newVal.id}/someData.json?_=${Math.random()}`, success: (data) => {
  85. this.selected = data.scenes[0]
  86. this.currentScenes = data.scenes
  87. this.loadFinish = false
  88. }
  89. })
  90. }
  91. }
  92. }
  93. },
  94. selected: {
  95. deep: true,
  96. handler: function (newVal) {
  97. window.vrViewFn = () => {
  98. try {
  99. this.loadFilsh = true
  100. if (this.isFirst) {
  101. this.isFirst = false
  102. }
  103. setTimeout(() => {
  104. this.loadFinish = true
  105. }, 4000);
  106. } catch (error) {
  107. error;
  108. }
  109. };
  110. var settings = {
  111. "events[skin_events].onloadcomplete": "js(window.vrViewFn());",
  112. "skin_settings.littleplanetintro": this.isFirst,
  113. "view.vlookat": newVal.initVisual ? newVal.initVisual.vlookat : 0,
  114. "view.hlookat": newVal.initVisual ? newVal.initVisual.hlookat : 0,
  115. };
  116. window.$("#pano").empty();
  117. window.removepano("#pano");
  118. if (this.selectExh.type != '4dkk') {
  119. window.embedpano({
  120. // https://4dkk.4dage.com/720yun_fd_manage/fd720_FC5BmPHcV/vtour/tour.xml
  121. // xml: "%HTMLPATH%/static/template/tour.xml",
  122. xml: `https://airshow.4dkankan.com/pano/${this.selectExh.id}/${newVal.sceneCode}/vtour/tour.xml`,
  123. swf: `${this.g_CDN}resource/tour.swf`,
  124. target: "pano",
  125. html5: "auto",
  126. mobilescale: 1,
  127. vars: settings,
  128. passQueryParameters: true,
  129. });
  130. }
  131. }
  132. }
  133. },
  134. methods: {
  135. handleItem(item) {
  136. if (this.loadFinish) {
  137. this.selected = item
  138. }
  139. },
  140. getList() {
  141. // window.$.ajax({url:`code/pano/data.json`,success:(data)=>{
  142. window.$.ajax({
  143. url: `${this.g_CDN}pano/data.json`, success: (data) => {
  144. this.list = data.list
  145. if (this.area) {
  146. this.selectExh = this.list.find(item => item.id == this.area)
  147. } else {
  148. this.selectExh = this.list[0]
  149. }
  150. }
  151. })
  152. }
  153. },
  154. mounted() {
  155. this.getList()
  156. this.$nextTick(() => {
  157. let el1 = window.$(".clip-scroller > ul")
  158. Array.from(el1).forEach(item => {
  159. let frame1 = new window.PerfectScrollbar(item, {
  160. useBothWheelAxes: true,
  161. suppressScrollY: true,
  162. wheelSpeed: 0.8,
  163. });
  164. window.$(item).data("scrollbar", frame1);
  165. })
  166. });
  167. }
  168. };
  169. </script>
  170. <style lang="less" scoped>
  171. .ifrcon {
  172. width: 100%;
  173. height: 100%;
  174. background: #fcfcfc;
  175. text-align: center;
  176. >iframe {
  177. width: 100%;
  178. height: 100%;
  179. }
  180. .pano {
  181. width: 100%;
  182. height: 100%;
  183. }
  184. .title {
  185. --height: 40px;
  186. position: fixed;
  187. z-index: 99;
  188. margin: 0;
  189. height: var(--height);
  190. line-height: var(--height);
  191. font-size: 18px;
  192. font-weight: 700;
  193. color: #fff;
  194. padding: 0 15px;
  195. display: inline-block;
  196. text-shadow: 1px 0 2px rgb(0 0 0 / 16%);
  197. left: 50%;
  198. -webkit-transform: translateX(-50%) translateY(0);
  199. transform: translateX(-50%) translateY(0);
  200. -webkit-transition: background 0.3s ease, min-width 0.3s ease,
  201. border-radius 0.3s ease;
  202. transition: background 0.3s ease, min-width 0.3s ease,
  203. border-radius 0.3s ease;
  204. width: 40%;
  205. top: 20px;
  206. background: -webkit-gradient(linear,
  207. left top,
  208. right top,
  209. from(transparent),
  210. color-stop(29%, rgba(0, 0, 0, 0.2)),
  211. color-stop(69%, rgba(0, 0, 0, 0.2)),
  212. to(transparent));
  213. background: linear-gradient(90deg,
  214. transparent,
  215. rgba(0, 0, 0, 0.2) 29%,
  216. rgba(0, 0, 0, 0.2) 69%,
  217. transparent);
  218. margin-top: 0;
  219. text-align: center;
  220. }
  221. .uicon {
  222. & /deep/ .btm-menu {
  223. height: 250px;
  224. }
  225. }
  226. .img_ul {
  227. position: relative;
  228. display: inline-block;
  229. min-width: 50%;
  230. max-width: 100%;
  231. >ul {
  232. display: inline-block;
  233. white-space: nowrap;
  234. background: linear-gradient(to right, rgba(32, 32, 32, 0), rgba(32, 32, 32, 1), rgba(32, 32, 32, 0));
  235. width: 100%;
  236. >li {
  237. cursor: pointer;
  238. list-style: none;
  239. display: inline-block;
  240. margin: 8px 10px;
  241. position: relative;
  242. padding-bottom: 8px;
  243. >div {
  244. width: 68px;
  245. height: 68px;
  246. overflow: hidden;
  247. position: relative;
  248. border-radius: 4px;
  249. cursor: pointer;
  250. color: rgba(256, 256, 256, 0.4);
  251. >img {
  252. position: absolute;
  253. top: 50%;
  254. left: 50%;
  255. height: 100%;
  256. transform: translate(-50%, -50%);
  257. }
  258. .iconfont {
  259. position: absolute;
  260. left: 4px;
  261. top: 4px;
  262. z-index: 99;
  263. }
  264. >span {
  265. text-align: center;
  266. display: inline-block;
  267. background: rgba(0, 0, 0, 0.3);
  268. position: absolute;
  269. text-overflow: ellipsis;
  270. overflow: hidden;
  271. white-space: nowrap;
  272. left: 0;
  273. bottom: 0;
  274. width: 100%;
  275. }
  276. }
  277. .bar {
  278. display: none;
  279. }
  280. .pic-name {
  281. background: rgba(0, 0, 0, 0.6);
  282. position: absolute;
  283. left: 0;
  284. bottom: 0;
  285. text-align: center;
  286. /deep/ span {
  287. word-break: keep-all;
  288. white-space: nowrap;
  289. font-size: 12px;
  290. }
  291. }
  292. &.active {
  293. .bar {
  294. display: inline-block;
  295. position: absolute;
  296. bottom: 0px;
  297. width: 80%;
  298. left: 50%;
  299. transform: translateX(-50%);
  300. height: 2px;
  301. background: @color;
  302. }
  303. >div {
  304. color: rgba(256, 256, 256, 1);
  305. }
  306. }
  307. }
  308. }
  309. }
  310. .txt_ul {
  311. margin: 18px auto;
  312. border: 2px solid @color;
  313. border-radius: 30px;
  314. padding: 6px 15px;
  315. display: block;
  316. position: relative;
  317. max-width: 864px;
  318. >ul {
  319. width: 100%;
  320. display: inline-block;
  321. white-space: nowrap;
  322. >li {
  323. border: 1px solid rgba(256, 256, 256, 0.4);
  324. border-radius: 24px;
  325. padding: 6px 9px;
  326. margin: 0 5px;
  327. cursor: pointer;
  328. display: inline-block;
  329. >span {
  330. font-size: 16px;
  331. display: inline-block;
  332. vertical-align: middle;
  333. line-height: 1.2;
  334. word-break: keep-all;
  335. color: rgba(256, 256, 256, 0.4);
  336. }
  337. &.active {
  338. padding: 6px 12px;
  339. border: 1px solid @color;
  340. >span {
  341. color: #fff;
  342. }
  343. }
  344. }
  345. }
  346. }
  347. .btn_zhankai {
  348. position: fixed;
  349. left: 50%;
  350. bottom: 8px;
  351. transform: translateX(-50%);
  352. background: rgba(0, 0, 0, .3);
  353. border-radius: 50%;
  354. padding: 6px;
  355. cursor: pointer;
  356. >i {
  357. font-size: 28px;
  358. cursor: pointer;
  359. }
  360. }
  361. }
  362. </style>
  363. <style lang="less">
  364. .ps__thumb-x {
  365. width: 0px !important;
  366. }
  367. </style>