index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <div class="vsearch" @click.stop @keydown.stop @touchstart.stop>
  3. <img class="searchbg" :src="require(`@/assets/images/mobile/kuangti/daka_${theme}.png`)" alt="">
  4. <div class="brightness"></div>
  5. <div class="vinput">
  6. <img @click="$emit('closeSearch')" :src="require(`@/assets/images/project/icon/jiantoul.png`)" alt="">
  7. <div>
  8. <img :src="require(`@/assets/images/project/icon/search.png`)" alt="">
  9. <input type="text" placeholder="请输入关键字…" v-model="key">
  10. </div>
  11. <span>搜索</span>
  12. </div>
  13. <div class="cpylist">
  14. <p>参展项目及企业</p>
  15. <ul v-if="region.length>0">
  16. <li v-for="(item,i) in region" :key="i">
  17. <p>{{item.name}}</p>
  18. <ul>
  19. <li @click="handleItem(sub)" class="textActive" v-for="(sub,idx) in item.company" :key="idx">
  20. {{sub.name}}
  21. </li>
  22. </ul>
  23. </li>
  24. </ul>
  25. <ul v-else>
  26. <li>未搜索到该项目</li>
  27. </ul>
  28. </div>
  29. </div>
  30. </template>
  31. <script>
  32. import {Booth,region} from '@/data/raw'
  33. let gregion = region.map(item=>{
  34. let tmp = []
  35. item.company.forEach(sub=> {
  36. let ii = Booth.find(son=>son.id==sub)
  37. if (ii) {
  38. tmp.push(ii)
  39. }
  40. })
  41. let tt = tmp.filter(item=>(item.mapId.indexOf('xt')<=-1))
  42. item.company = tt
  43. return item
  44. })
  45. console.log(gregion);
  46. let arr = []
  47. export default {
  48. data(){
  49. this.u_extend(arr,gregion)
  50. return {
  51. key:'',
  52. region:arr,
  53. }
  54. },
  55. watch:{
  56. key(newVal){
  57. let tmpregion = []
  58. this.u_extend(tmpregion,gregion)
  59. if (!newVal) {
  60. this.region = tmpregion
  61. }
  62. else{
  63. this.region = tmpregion.filter(item=>{
  64. item.company = item.company.filter(sub=>{
  65. if (sub.name.indexOf(newVal)>-1) {
  66. return sub
  67. }
  68. })
  69. if (item.company.length>0) {
  70. return item
  71. }
  72. })
  73. }
  74. }
  75. },
  76. methods:{
  77. handleItem(item){
  78. this.$bus.$emit('ifrMessage',{
  79. events:'flyToPano',
  80. data:item
  81. })
  82. this.$emit('closeSearch')
  83. }
  84. }
  85. }
  86. </script>
  87. <style lang="less" scoped>
  88. ::-webkit-scrollbar {
  89. width: 2px;
  90. height: 2px;
  91. }
  92. ::-webkit-scrollbar-thumb {
  93. height: 2px;
  94. background-color: rgba(255, 255, 255, 0.4);
  95. outline: 2px solid rgba(255, 255, 255, 0.4);
  96. }
  97. ::-webkit-scrollbar-thumb:hover {
  98. height: 2px;
  99. background-color: rgba(255, 255, 255, 0.4);
  100. }
  101. @w:100%;
  102. .vsearch{
  103. width: @w;
  104. height: 100%;
  105. position: fixed;
  106. top: 0;
  107. left: 0;
  108. z-index: 99999;
  109. .searchbg{
  110. width: @w;
  111. height: 100%;
  112. position: absolute;
  113. top: 0;
  114. left: 0;
  115. z-index: -1;
  116. }
  117. .brightness{
  118. &::before{
  119. z-index: -2;
  120. }
  121. }
  122. .vinput{
  123. display: flex;
  124. justify-content: space-between;
  125. align-items: center;
  126. padding: 10px 15px 0 20px;
  127. width: 100%;
  128. >img{
  129. cursor: pointer;
  130. width: 10px;
  131. flex-shrink: 0;
  132. margin-right: 20px;
  133. }
  134. >div{
  135. display: flex;
  136. justify-content: flex-start;
  137. align-items: center;
  138. background-color: rgba(255, 255, 255, 0.2);
  139. border-radius: 20px;
  140. overflow: hidden;
  141. padding: 0 10px;
  142. flex: auto;
  143. >input{
  144. line-height: 35px;
  145. height: 35;
  146. width: 80%;
  147. margin-left: 10px;
  148. color: #fff;
  149. }
  150. >img{
  151. width: 20px;
  152. }
  153. }
  154. >span{
  155. display: inline-block;
  156. margin-left: 10px;
  157. flex-shrink: 0;
  158. min-width: 30px;
  159. }
  160. }
  161. .cpylist{
  162. padding: 25px 30px 0 44px;
  163. height: 100%;
  164. >p{
  165. font-size: 16px;
  166. padding: 0 10px;
  167. }
  168. >ul{
  169. max-height: calc(100% - 110px);
  170. overflow-y: auto;
  171. padding:0 15px 0;
  172. >li{
  173. margin: 18px 0;
  174. &:last-of-type{
  175. margin-bottom: 0;
  176. }
  177. >p{
  178. font-size: 16px;
  179. font-weight: bold;
  180. }
  181. >ul{
  182. margin-left: 20px;
  183. >li{
  184. line-height: 1.2;
  185. margin: 12px 0;
  186. color: rgba(255, 255, 255, 0.6);
  187. }
  188. }
  189. }
  190. }
  191. }
  192. }
  193. </style>