Toolbar.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <div class="app-view-toolbar" :class="{unable:!canEdit}" app-border dir-top>
  3. <div class="room-label" >
  4. <ul>
  5. <li
  6. :class="{ active: item.id === type }"
  7. @click="type = item.id"
  8. v-for="(item, i) in [$panoType[0],$panoType[1]]"
  9. :key="i"
  10. >
  11. {{ item.name }}
  12. </li>
  13. </ul>
  14. </div>
  15. <div class="clip-center">
  16. <div class="pano-con clip-scroller">
  17. <ul ref="clip">
  18. <li v-for="(item, i) in list" @click="activeItem = item" :class="{'li-active':item.sceneCode==activeItem.sceneCode}" :key="i">
  19. <div class="typeli">
  20. <i class="iconfont iconedit_type_3d" :class="{'iconedit_type_panorama':item.type!=='house'}"></i>
  21. </div>
  22. <div class="img">
  23. <img :src="item.icon" alt="">
  24. </div>
  25. <div class="ui-title">
  26. <span>{{item.fileName}}</span>
  27. </div>
  28. </li>
  29. </ul>
  30. </div>
  31. </div>
  32. </div>
  33. </template>
  34. <script>
  35. import { getPanoList } from "@/api";
  36. let $scroll = null;
  37. export default {
  38. data() {
  39. return {
  40. type: "building",
  41. list:[],
  42. activeItem:'',
  43. canEdit:true
  44. };
  45. },
  46. activated() {
  47. this.$nextTick(() => {
  48. if ($scroll == null) {
  49. $scroll = $(".clip-scroller")[0];
  50. var options = {
  51. horizontal: 1,
  52. itemNav: 'basic',
  53. speed: 300,
  54. mouseDragging: 1,
  55. touchDragging: 1
  56. };
  57. $scroll .sly(options);
  58. // var frame = new Sly('#frame', options).init();
  59. // new PerfectScrollbar($scroll, {
  60. // useBothWheelAxes: true,
  61. // suppressScrollY: true,
  62. // });
  63. }
  64. });
  65. },
  66. methods:{
  67. getPanoList(isFirst){
  68. getPanoList({
  69. pageNum: 0,
  70. pageSize: 0,
  71. searchKey: "",
  72. type: this.type,
  73. status:3
  74. },data=>{
  75. this.list = data.data.list
  76. isFirst&&(this.activeItem = this.list[0])
  77. })
  78. },
  79. },
  80. created() {
  81. this.getPanoList(true)
  82. },
  83. watch:{
  84. activeItem(newVal){
  85. newVal && this.$bus.emit('currentPcode',newVal)
  86. },
  87. type(){
  88. this.getPanoList()
  89. }
  90. },
  91. mounted(){
  92. this.$bus.on('canEdit',data=>{
  93. this.canEdit = data
  94. })
  95. }
  96. };
  97. </script>
  98. <style lang="less" scoped>
  99. .app-view-toolbar {
  100. overflow: visible;
  101. a {
  102. color: #fff;
  103. text-decoration: none;
  104. }
  105. .room-label {
  106. top: -32px;
  107. left: 10px;
  108. right: 0px;
  109. position: absolute;
  110. overflow: hidden;
  111. ul {
  112. display: flex;
  113. }
  114. li {
  115. cursor: pointer;
  116. width: 100px;
  117. height: 32px;
  118. line-height: 32px;
  119. padding: 0 5px;
  120. text-align: center;
  121. border-top: solid 1px #5d5d5d;
  122. border-right: solid 1px #5d5d5d;
  123. overflow: hidden;
  124. text-overflow: ellipsis;
  125. &:first-child {
  126. border-left: solid 1px #5d5d5d;
  127. }
  128. &.active {
  129. background-color: @color;
  130. }
  131. }
  132. }
  133. .clip-center {
  134. flex: 1;
  135. display: flex;
  136. overflow: hidden;
  137. .pano-con {
  138. width: 100%;
  139. padding: 0;
  140. background: none;
  141. margin: 0 10px;
  142. >ul{
  143. flex-wrap: unset;
  144. >li{
  145. height: 128px;
  146. width: 128px;
  147. cursor: pointer;
  148. &:first-of-type{
  149. margin-left: 0;
  150. }
  151. }
  152. }
  153. }
  154. .clip-scroller {
  155. width: 100%;
  156. height: 100%;
  157. position: relative;
  158. padding-right: 20px;
  159. }
  160. }
  161. }
  162. .unable{
  163. &::before{
  164. content: '';
  165. z-index: 22;
  166. position: absolute;
  167. width: 100%;
  168. top: -32px;
  169. height: calc(100% + 32px );
  170. background: rgba(0, 0, 0, 0.4);
  171. }
  172. }
  173. </style>