list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. <template>
  2. <div class="list">
  3. <div class="l-con" :class="showList?'active':''">
  4. <div class="pic-con">
  5. <ul class="pic-list" v-if="scenes.length>0">
  6. <li @click="handleVR(item)" v-for="(item,i) in scenes" :key="i">
  7. <div :class="{active:selected.sceneCode==item.sceneCode}">
  8. <img :src="item.icon+`?${Math.random()}`" alt="" />
  9. <i class="iconfont" :class="item.type!='4dkk'?'iconjump':'iconscene_map_3d'"></i>
  10. <rollName :offset="20" :active="selected.sceneCode==item.sceneCode" class="pic-name" :myref="'subw'+item.id" :name="item.sceneTitle"/>
  11. </div>
  12. </li>
  13. </ul>
  14. <ul class="tap " v-if="childTab.length > 1" >
  15. <li @click="tabtowActive = item" v-for="(item,i) in childTab" :key="i">
  16. <rollName :offset="30" :mgin="20" :active="item.id == tabtowActive.id" class="btn pic-rect" :class="{active:item.id == tabtowActive.id}" :myref="'ww'+item.id" :name="item.name"/>
  17. </li>
  18. </ul>
  19. </div>
  20. <ul class="tap" v-if="showInfo.catalogRoot.length > 1">
  21. <li @click="taboneActive = item" :class="{ active: item.id == taboneActive.id }" v-for="(item,i) in showInfo.catalogRoot" :key="i">
  22. <rollName :offset="30" :mgin="20" :active="item.id == taboneActive.id" class="btn rect" :class="{active:item.id == taboneActive.id}" :myref="'zw'+item.id" :name="item.name"/>
  23. </li>
  24. </ul>
  25. </div>
  26. <div v-if="selected.type=='4dkk'" class="menu">
  27. <div class="menucon" :class="{shouqi:shouqi}">
  28. <ul>
  29. <li @click="handleDL" v-if="isShowDL">
  30. <i class="iconfont" :class="isDaolan?'iconshow_suspension':'iconshow_playback'"></i>
  31. <span title="导览" >导览</span>
  32. </li>
  33. <template v-if="currentActive!='2d'&&currentActive!='3d'">
  34. <li v-for="(item,i) in menu" @click="handleMenu(item)" :key="i">
  35. <i class="iconfont" :class="currentActive==item.id?item.active:item.icon"></i>
  36. <span :title="item.name" >{{item.name}}</span>
  37. <!-- <i style="font-size:10px; margin-left:6px" v-if="item.id == 'daolan'" class="iconfont iconshow_drop-down"></i> -->
  38. </li>
  39. </template>
  40. </ul>
  41. <i @click="shouqi = !shouqi" class="iconfont iconshow_function_collect"></i>
  42. </div>
  43. <div class="scenedl">
  44. <i class="iconfont" @click="showList=!showList" :class="showList?'iconnav_scene_down':'iconnav_scene_up'"></i>
  45. </div>
  46. </div>
  47. <div class="btn dl" @click="showList=!showList" v-else>
  48. <i class="iconfont " :class="showList?'iconnav_scene_down':'iconnav_scene_up'"></i>场景导航
  49. </div>
  50. </div>
  51. </template>
  52. <script>
  53. import { mapGetters } from "vuex";
  54. import config from "@/config";
  55. import rollName from "@/components/rollName";
  56. export default {
  57. props:['select'],
  58. components:{rollName},
  59. data(){
  60. let menu = [{
  61. id:'pano',
  62. name:'漫游',
  63. icon:'iconshow_roaming_normal',
  64. active:'iconshow_roaming_selected',
  65. params:'pano'
  66. },{
  67. id:'2d',
  68. name:'平面',
  69. icon:'iconshow_plane_normal',
  70. active:'iconshow_plane_selected',
  71. params:'2d'
  72. },{
  73. id:'3d',
  74. name:'三维',
  75. icon:'iconshow_3d_normal',
  76. active:'iconshow_3d_selected',
  77. params:'3d'
  78. }]
  79. return{
  80. isDaolan:false,
  81. isShowDL:'',
  82. currentActive:'pano',
  83. taboneActive:{children:[]},
  84. tabtowActive:'',
  85. childTab:[],
  86. sceneNum: config.sceneNum,
  87. scenes:[],
  88. menu,
  89. showList:true,
  90. loadFirst: true,
  91. shouqi:false,
  92. canClick:true
  93. }
  94. },
  95. computed: {
  96. ...mapGetters({
  97. showInfo: "showInfo"
  98. }),
  99. selected(){
  100. return {...this.select}
  101. }
  102. },
  103. mounted(){
  104. this.$bus.on('guideRoomsData',data=>{
  105. if (data.length>0) {
  106. this.isShowDL = true
  107. }
  108. })
  109. this.$bus.on('currentMode',data=>{
  110. this.delHandle()
  111. this.currentActive = data.data.mode || 'pano'
  112. // this.menu.findItem(item=>item.params == data.data.mode)
  113. })
  114. },
  115. methods:{
  116. handleDL(){
  117. this.isDaolan = !this.isDaolan
  118. let ele = document.getElementById('showifr');
  119. ele.contentWindow.postMessage({
  120. source: "mingyuan",
  121. event: this.isDaolan?'guide-start':'guide-pause',
  122. },"*")
  123. },
  124. delHandle(){
  125. this.canClick = false
  126. setTimeout(() => {
  127. this.canClick = true
  128. }, 1800);
  129. },
  130. handleMenu(data){
  131. if (this.canClick) {
  132. this.currentActive = data.id
  133. let ele = document.getElementById('showifr');
  134. ele.contentWindow.postMessage({
  135. source: "mingyuan",
  136. event: 'mode',
  137. params: data.params,
  138. },"*")
  139. this.delHandle()
  140. }
  141. },
  142. handleVR(item){
  143. history.replaceState(null, null, "".concat(window.location.pathname, "?").concat(`id=${this.showInfo.id}&vr=${item.sceneCode}`));
  144. this.sceneNum = item.sceneCode
  145. }
  146. },
  147. watch:{
  148. taboneActive: {
  149. handler: function (newVal) {
  150. let temp = []
  151. newVal.children && newVal.children.forEach(item=>{
  152. this.showInfo.catalogs.forEach(sub=>{
  153. if (item==sub.id) {
  154. temp.push(sub)
  155. }
  156. })
  157. })
  158. this.childTab = temp
  159. if (!this.loadFirst) {
  160. this.tabtowActive = ''
  161. }
  162. },
  163. },
  164. tabtowActive: {
  165. handler: function (newVal) {
  166. if (!newVal) {
  167. this.tabtowActive = this.childTab[0]
  168. } else{
  169. let arr = this.showInfo.scenes.filter(item=>{
  170. return newVal.id == item.category
  171. })
  172. this.scenes = arr.sort((a,b)=>a.weight-b.weight)
  173. }
  174. }
  175. },
  176. sceneNum:{
  177. deep:true,
  178. immediate:true,
  179. handler:function (newVal) {
  180. if (!newVal) {
  181. let tmp = this.showInfo.firstScene||this.showInfo.scenes[0]
  182. this.handleVR(tmp)
  183. return
  184. }
  185. let val = this.showInfo.scenes.find(item=>item.sceneCode==newVal)
  186. let tmp = this.showInfo.catalogs.find(item=>item.id==val.category)
  187. let rootTmp = this.showInfo.catalogRoot.find(item => {
  188. return item.children.indexOf(tmp.id)>-1
  189. });
  190. this.taboneActive = rootTmp
  191. this.tabtowActive = tmp
  192. setTimeout(() => {
  193. this.$emit('select',val)
  194. this.loadFirst = false
  195. });
  196. }
  197. },
  198. selected:{
  199. handler:function (newVal) {
  200. this.handleVR(newVal)
  201. if (newVal.type == '4dkk') {
  202. this.showList = false
  203. }
  204. }
  205. }
  206. }
  207. }
  208. </script>
  209. <style lang="less" scoped>
  210. .btn{
  211. display: inline-block;
  212. margin: 0 auto;
  213. padding: 0 20px;
  214. height: 26px;
  215. line-height: 26px;
  216. background: rgba(0, 0, 0, 0.5);
  217. border: 1px solid rgba(255, 255, 255, 0.5);
  218. color: rgba(255, 255, 255, 0.5);
  219. border-radius: 4px;
  220. min-width: 78px;
  221. max-width: 200px;
  222. text-overflow: ellipsis;
  223. overflow: hidden;
  224. white-space: nowrap;
  225. &.active {
  226. border: 1px solid rgba(255, 255, 255, 1);
  227. color: rgba(255, 255, 255, 1);
  228. }
  229. }
  230. .pic-rect {
  231. border-radius: 4px;
  232. height: 24px;
  233. line-height: 24px;
  234. padding: 0;
  235. padding-bottom: 10px;
  236. background: none;
  237. border: none;
  238. &.active {
  239. border: none;
  240. color: rgba(255, 255, 255, 1);
  241. position: relative;
  242. &::before {
  243. content: "";
  244. display: inline-block;
  245. position: absolute;
  246. bottom: 0;
  247. width: 20px;
  248. height: 2px;
  249. z-index: 9999;
  250. left: 50%;
  251. transform: translateX(-50%);
  252. background: #0076f6;
  253. }
  254. }
  255. }
  256. .line{
  257. background:#0076F6;
  258. width: 100%;
  259. height: 0.1px;
  260. opacity: 0.5;
  261. }
  262. .list{
  263. position: fixed;
  264. bottom: 10px;
  265. left: 0;
  266. text-align: right;
  267. width: 100%;
  268. .dl{
  269. background: rgba(0, 0, 0, 0.3);
  270. border-radius: 18px;
  271. border: 1px solid rgba(255, 255, 255, 0.2);
  272. margin-top: 10px;
  273. margin-right: 10px;
  274. padding: 0 10px;
  275. height: 36px;
  276. line-height: 36px;
  277. >i{
  278. margin-right: 8px;
  279. vertical-align: bottom;
  280. font-size: 18px;
  281. }
  282. }
  283. .menu{
  284. margin: 10px 0 12px;
  285. .menucon{
  286. float: left;
  287. display: flex;
  288. border: 1px solid rgba(255, 255, 255, 0.10196078431372549);
  289. border-radius: 0px 24px 24px 0px;
  290. background: rgba(0, 0, 0, 0.3);
  291. padding-right: 30px;
  292. position: relative;
  293. transition: all 0.3s ease;
  294. >ul{
  295. display: flex;
  296. overflow: hidden;
  297. >li{
  298. color: #fff;
  299. margin: 0;
  300. height: 46px;
  301. line-height: 46px;
  302. padding: 0 5px;
  303. background: none;
  304. >span{
  305. display: inline-block;
  306. margin-left: 6px;
  307. }
  308. }
  309. }
  310. >i{
  311. font-size: 10px;
  312. position: absolute;
  313. right: 14px;
  314. top: 50%;
  315. transform: translateY(-50%);
  316. }
  317. }
  318. .shouqi{
  319. >ul{
  320. max-width: 0;
  321. width: 0;
  322. }
  323. >i{
  324. transform: translateY(-50%) rotate(180deg);
  325. }
  326. }
  327. .scenedl{
  328. width: 48px;
  329. height: 48px;
  330. background: rgba(0, 0, 0, 0.3);
  331. border: 1px solid rgba(255, 255, 255, 0.1);
  332. display: inline-block;
  333. border-radius: 50%;
  334. position: relative;
  335. margin-right: 10px;
  336. >i{
  337. top: 50%;
  338. left: 50%;
  339. position: absolute;
  340. transform: translate(-50%,-50%);
  341. font-size: 18px;
  342. }
  343. }
  344. }
  345. .l-con{
  346. width: 100%;
  347. transition: all ease 0.3s;
  348. max-height: 0px;
  349. overflow: hidden;
  350. .pic-con{
  351. background: rgba(0, 0, 0, 0.5);
  352. border-radius: 4px;
  353. }
  354. ul{
  355. padding-left: 10px!important;
  356. align-items: center;
  357. display: flex;
  358. li{
  359. margin: 0 5px;
  360. text-align: center;
  361. }
  362. }
  363. .tap{
  364. padding: 12px 10px;
  365. overflow-x: auto;
  366. &::-webkit-scrollbar{
  367. display: none;
  368. }
  369. > li {
  370. position: relative;
  371. &.active {
  372. @size:8px;
  373. &::before {
  374. content: "";
  375. display: inline-block;
  376. width: 0;
  377. height: 0;
  378. border-left: @size * 1.5 solid transparent;
  379. border-right: @size * 1.5 solid transparent;
  380. border-top: @size*2 solid rgba(0, 0, 0, 0.5);
  381. position: absolute;
  382. top: -18px;
  383. left: 50%;
  384. transform: translateX(-50%);
  385. }
  386. }
  387. }
  388. }
  389. .pic-list{
  390. padding: 12px 0;
  391. overflow-x: auto;
  392. &::-webkit-scrollbar {
  393. display: none;
  394. }
  395. >li{
  396. cursor: pointer;
  397. >div{
  398. width: 72px;
  399. height: 72px;
  400. border: 2px solid #FFFFFF;
  401. opacity: 1;
  402. border-radius: 4px;
  403. overflow: hidden;
  404. position: relative;
  405. cursor: pointer;
  406. >img{
  407. position: absolute;
  408. top: 50%;
  409. left: 50%;
  410. transform: translate(-50%,-50%);
  411. }
  412. .iconfont{
  413. position: absolute;
  414. left: 4px;
  415. top: 4px;
  416. z-index: 99;
  417. }
  418. >span{
  419. display: inline-block;
  420. background: rgba(0, 0, 0, 0.3);
  421. position: absolute;
  422. text-overflow: ellipsis;
  423. overflow: hidden;
  424. white-space: nowrap;
  425. left: 0;
  426. bottom: 0;
  427. width: 100%;
  428. }
  429. &.active{
  430. border: 2px solid #0076F6;
  431. }
  432. }
  433. .pic-name{
  434. background: rgba(0, 0, 0, 0.3);
  435. position: absolute;
  436. left: 0;
  437. bottom: 0;
  438. /deep/ span{
  439. word-break: keep-all;
  440. white-space:nowrap;
  441. }
  442. }
  443. }
  444. }
  445. &.active{
  446. max-height: 200px;
  447. }
  448. }
  449. }
  450. @media screen and (max-width: 350px) {
  451. .list{
  452. .menu{
  453. .menucon{
  454. padding-right: 10px;
  455. >ul{
  456. >li{
  457. color: #fff;
  458. margin: 0;
  459. height: 36px;
  460. line-height: 36px;
  461. padding: 0 4px;
  462. background: none;
  463. >span{
  464. display: inline-block;
  465. margin-left: 6px;
  466. }
  467. &:last-of-type{
  468. padding-right: 14px;
  469. }
  470. }
  471. }
  472. >i{
  473. font-size: 12px;
  474. right: 8px;
  475. top: 50%;
  476. transform: translateY(-50%);
  477. }
  478. }
  479. .shouqi{
  480. padding-right: 30px;
  481. >ul{
  482. max-width: 0;
  483. width: 0;
  484. }
  485. >i{
  486. transform: translateY(-50%) rotate(180deg);
  487. }
  488. }
  489. .scenedl{
  490. width: 36px;
  491. height: 36px;
  492. >i{
  493. top: 50%;
  494. left: 50%;
  495. position: absolute;
  496. transform: translate(-50%,-50%);
  497. font-size: 14px;
  498. }
  499. }
  500. }
  501. }
  502. }
  503. </style>