list.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. <template>
  2. <div class="list">
  3. <div class="l-con" :class="showList ? 'active' : ''" v-if="!(showInfo.catalogRoot.length == 1 && scenes.length == 1 && showInfo.catalogs.length == 1)">
  4. <div class="pic-con">
  5. <div class="clip-scroller" ref="sw" v-swiper:mySwiper="swiperOptions" v-if="scenes.length > 0">
  6. <ul class="pic-list swiper-wrapper">
  7. <li class="swiper-slide" :title="item.sceneTitle" @click="handleVR(item,$event)" v-for="(item, i) in scenes" :key="i">
  8. <div :class="{ active: selected.sceneCode == item.sceneCode }">
  9. <img :src="item.icon + `?${Math.random()}`" alt="" />
  10. <i class="iconfont iconedit_type_3d" :class="{ iconedit_type_panorama: item.type !== '4dkk' }"></i>
  11. <rollName :offset="20" :active="selected.sceneCode == item.sceneCode" class="pic-name" :myref="'subw' + item.id" :name="item.sceneTitle" />
  12. </div>
  13. </li>
  14. </ul>
  15. </div>
  16. <div class="clip-scroller" ref="sw1" v-swiper:mySwipera="swiperOptions" v-if="childTab.length > 1">
  17. <ul class="pp-tap swiper-wrapper">
  18. <li class="swiper-slide" @click="tabtowActive = item" v-for="(item, i) in childTab" :key="i">
  19. <rollName
  20. :offset="30"
  21. :mgin="20"
  22. :active="item.id == tabtowActive.id"
  23. class="btn pic-rect"
  24. :class="{ active: item.id == tabtowActive.id }"
  25. :myref="'ww' + item.id"
  26. :name="item.name"
  27. />
  28. </li>
  29. </ul>
  30. </div>
  31. </div>
  32. <div class="clip-scroller" ref="sw2" v-swiper:mySwiperb="swiperOptions" v-if="showInfo.catalogRoot.length > 0 && showInfo.catalogs.length > 1">
  33. <ul class="tap swiper-wrapper">
  34. <li class="swiper-slide" @click="taboneActive = item" :class="{ active: item.id == taboneActive.id }" v-for="(item, i) in showInfo.catalogRoot" :key="i">
  35. <rollName
  36. :offset="30"
  37. :mgin="20"
  38. :active="item.id == taboneActive.id"
  39. class="btn"
  40. :class="{ active: item.id == taboneActive.id }"
  41. :myref="'zw' + item.id"
  42. :name="item.name"
  43. />
  44. </li>
  45. </ul>
  46. </div>
  47. </div>
  48. <div class="btn dl" v-if="!(showInfo.catalogRoot.length == 1 && scenes.length == 1 && showInfo.catalogs.length == 1)" @click="showList = !showList"><i class="iconfont " :class="showList ? 'iconnav_scene_down' : 'iconnav_scene_up'"></i>场景导航</div>
  49. </div>
  50. </template>
  51. <script>
  52. import { mapGetters } from "vuex";
  53. import config from "@/config";
  54. import rollName from "@/components/rollName";
  55. import { directive } from "vue-awesome-swiper";
  56. // import style (<= Swiper 5.x)
  57. // import "swiper/css/swiper.css";
  58. let $scroll = null;
  59. export default {
  60. props: ["select"],
  61. components: { rollName },
  62. directives: {
  63. swiper: directive,
  64. },
  65. data() {
  66. return {
  67. taboneActive: { children: [] },
  68. tabtowActive: "",
  69. childTab: [],
  70. scenes: [],
  71. showList: true,
  72. loadFirst: true,
  73. menuWidth: 0,
  74. sceneNum: config.sceneNum,
  75. SlyArr:[]
  76. };
  77. },
  78. computed: {
  79. ...mapGetters({
  80. showInfo: "showInfo",
  81. }),
  82. selected() {
  83. return { ...this.select };
  84. },
  85. swiperOptions() {
  86. return {
  87. slidesPerView: "auto",
  88. // observer:true,
  89. // observeParents: true,
  90. centeredSlides : true,
  91. centerInsufficientSlides: true,
  92. centeredSlidesBounds: true,
  93. on:{
  94. click: function(e){
  95. console.log(e);
  96. },
  97. },
  98. };
  99. },
  100. },
  101. methods: {
  102. getCWidth(ref) {
  103. if (this.$refs[ref]) {
  104. return this.$refs[ref][0].clientWidth;
  105. }
  106. },
  107. handleVR(item,e=null) {
  108. history.replaceState(null, null, "".concat(window.location.pathname, "?").concat(`id=${this.showInfo.id}&vr=${item.sceneCode}`));
  109. this.sceneNum = item.sceneCode;
  110. console.dir(e&& $(e.target));
  111. },
  112. },
  113. mounted() {
  114. },
  115. watch: {
  116. taboneActive: {
  117. handler: function(newVal) {
  118. let temp = [];
  119. newVal.children &&
  120. newVal.children.forEach((item) => {
  121. this.showInfo.catalogs.forEach((sub) => {
  122. if (item == sub.id) {
  123. temp.push(sub);
  124. }
  125. });
  126. });
  127. this.childTab = temp;
  128. if (!this.loadFirst) {
  129. this.tabtowActive = "";
  130. }
  131. },
  132. },
  133. tabtowActive: {
  134. deep: true,
  135. handler: function(newVal) {
  136. if (!newVal) {
  137. this.tabtowActive = this.childTab[0];
  138. } else {
  139. let arr = this.showInfo.scenes.filter((item) => {
  140. return newVal.id == item.category;
  141. });
  142. this.scenes = arr.sort((a, b) => a.weight - b.weight);
  143. }
  144. },
  145. },
  146. sceneNum: {
  147. deep: true,
  148. immediate: true,
  149. handler: function(newVal) {
  150. if (!newVal) {
  151. let tmp = this.showInfo.firstScene || this.showInfo.scenes[0];
  152. this.handleVR(tmp);
  153. return;
  154. }
  155. let val = this.showInfo.scenes.find((item) => item.sceneCode == newVal);
  156. let tmp = this.showInfo.catalogs.find((item) => item.id == val.category);
  157. let rootTmp = this.showInfo.catalogRoot.find((item) => {
  158. return item.children.indexOf(tmp.id) > -1;
  159. });
  160. this.taboneActive = rootTmp;
  161. this.tabtowActive = tmp;
  162. setTimeout(() => {
  163. this.$emit("select", val);
  164. this.loadFirst = false;
  165. });
  166. },
  167. },
  168. selected: {
  169. handler: function(newVal) {
  170. this.handleVR(newVal);
  171. if (newVal.type == "4dkk") {
  172. this.showList = false;
  173. }
  174. },
  175. },
  176. },
  177. };
  178. </script>
  179. <style lang="less" scoped>
  180. .btn {
  181. display: inline-block;
  182. margin: 0 auto;
  183. padding: 0 20px;
  184. height: 26px;
  185. line-height: 26px;
  186. background: rgba(0, 0, 0, 0.5);
  187. border: 1px solid rgba(255, 255, 255, 0.5);
  188. color: rgba(255, 255, 255, 0.5);
  189. border-radius: 4px;
  190. cursor: pointer;
  191. word-break: keep-all;
  192. max-width: 150px;
  193. text-overflow: ellipsis;
  194. overflow: hidden;
  195. white-space: nowrap;
  196. &.active {
  197. border: 1px solid rgba(255, 255, 255, 1);
  198. color: rgba(255, 255, 255, 1);
  199. }
  200. }
  201. .pic-rect {
  202. border-radius: 4px;
  203. height: 24px;
  204. line-height: 24px;
  205. padding: 0;
  206. padding-bottom: 10px;
  207. background: none;
  208. border: none;
  209. &.active {
  210. border: none;
  211. color: rgba(255, 255, 255, 1);
  212. position: relative;
  213. &::before {
  214. content: "";
  215. display: inline-block;
  216. position: absolute;
  217. bottom: 0;
  218. width: 20px;
  219. height: 2px;
  220. z-index: 9999;
  221. left: 50%;
  222. transform: translateX(-50%);
  223. background: #0076f6;
  224. }
  225. }
  226. }
  227. .line {
  228. background: #0076f6;
  229. width: 100%;
  230. height: 0.1px;
  231. opacity: 0.5;
  232. }
  233. .list {
  234. position: fixed;
  235. bottom: 10px;
  236. left: 50%;
  237. transform: translateX(-50%);
  238. z-index: 999;
  239. text-align: center;
  240. // width: 100%;
  241. max-width: 1396px;
  242. pointer-events: none;
  243. .dl {
  244. background: rgba(0, 0, 0, 0.3);
  245. border-radius: 18px;
  246. border: 1px solid rgba(255, 255, 255, 0.2);
  247. margin-top: 10px;
  248. pointer-events: auto;
  249. height: 38px;
  250. line-height: 38px;
  251. color: #fff;
  252. > i {
  253. margin-right: 8px;
  254. vertical-align: bottom;
  255. font-size: 18px;
  256. }
  257. }
  258. .l-con {
  259. width: 100%;
  260. transition: all ease 0.3s;
  261. max-height: 0px;
  262. overflow: hidden;
  263. pointer-events: auto;
  264. .pic-con {
  265. background: rgba(0, 0, 0, 0.5);
  266. border-radius: 4px;
  267. padding: 0 20px;
  268. }
  269. .clip-scroller{
  270. position: relative;
  271. border-radius: 4px;
  272. }
  273. ul {
  274. // display: inline-block;
  275. white-space: nowrap;
  276. position: relative;
  277. li {
  278. margin: 0 5px;
  279. display: inline-block;
  280. }
  281. }
  282. .pp-tap {
  283. padding: 0 0 16px;
  284. > li {
  285. width: 150px;
  286. }
  287. }
  288. .tap {
  289. padding: 16px 0;
  290. > li {
  291. position: relative;
  292. width: 116px;
  293. .btn{
  294. width: 100%;
  295. padding: 0;
  296. }
  297. &.active {
  298. @size:5px;
  299. &::before {
  300. content: "";
  301. display: inline-block;
  302. width: 0;
  303. height: 0;
  304. border-left: @size * 1.5 solid transparent;
  305. border-right: @size * 1.5 solid transparent;
  306. border-top: @size*2 solid rgba(0, 0, 0, 0.5);
  307. position: absolute;
  308. top: -18px;
  309. left: 50%;
  310. transform: translateX(-50%);
  311. }
  312. }
  313. }
  314. }
  315. .pic-list {
  316. padding: 12px 0;
  317. > li {
  318. cursor: pointer;
  319. width: 72px;
  320. height: 72px;
  321. > div {
  322. width: 100%;
  323. height: 100%;
  324. border: 2px solid #ffffff;
  325. opacity: 1;
  326. border-radius: 4px;
  327. overflow: hidden;
  328. position: relative;
  329. cursor: pointer;
  330. .pic-name {
  331. background: rgba(0, 0, 0, 0.5);
  332. position: absolute;
  333. left: 0;
  334. bottom: 0;
  335. }
  336. > img {
  337. position: absolute;
  338. top: 50%;
  339. left: 50%;
  340. transform: translate(-50%, -50%);
  341. z-index: -1;
  342. }
  343. .iconfont {
  344. position: absolute;
  345. left: 4px;
  346. top: 4px;
  347. z-index: 99;
  348. &::after{
  349. background: rgba(0, 0, 0, 0.3);
  350. content: '';
  351. width: 14px;
  352. height: 14px;
  353. display: inline-block;
  354. position: absolute;
  355. top: 50%;
  356. left: 50%;
  357. transform: translate(-50%,-50%);
  358. z-index: -1;
  359. filter: blur(4px);
  360. }
  361. }
  362. > span {
  363. display: inline-block;
  364. background: rgba(0, 0, 0, 0.5);
  365. position: absolute;
  366. text-overflow: ellipsis;
  367. overflow: hidden;
  368. white-space: nowrap;
  369. left: 0;
  370. bottom: 0;
  371. width: 100%;
  372. }
  373. &.active {
  374. border: 2px solid #0076f6;
  375. }
  376. }
  377. }
  378. }
  379. .onecls {
  380. background: rgba(0, 0, 0, 0.3);
  381. display: inline-block;
  382. width: 100%;
  383. }
  384. .towcls {
  385. background: rgba(0, 0, 0, 0.3);
  386. }
  387. &.active {
  388. max-height: 250px;
  389. }
  390. }
  391. }
  392. </style>