nav.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <view class="nav-content">
  3. <view class="nav">
  4. <view class="log" v-if="navtype" @tap="clickOrder">
  5. </view>
  6. <view class="nav-sech">
  7. <!-- <view class="secah">{{}}</view> -->
  8. <picker class="secah" @change="change" :value="index" :range="airportList">
  9. <view>{{airportList[index]}}</view>
  10. </picker>
  11. <view class="input-nav" @tap="test">
  12. {{ placeholder }}
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. data() {
  21. return {
  22. searchText: '', //搜索内容
  23. placeholder: '请输入航班号或行李号',
  24. array: [],
  25. airportList:[]
  26. }
  27. },
  28. props: {
  29. navname: {
  30. type: String,
  31. default: ''
  32. },
  33. navtype: {
  34. type: Boolean,
  35. default: true
  36. },
  37. navtypes: {
  38. type: Boolean,
  39. default: false
  40. },
  41. index:{
  42. type: Number,
  43. default: 0
  44. }
  45. },
  46. created(option) {
  47. this.airportList =this.$storage.getJson('airportList');
  48. if(!this.airportList){
  49. this.getAirportList()
  50. }
  51. },
  52. onUnload() {},
  53. onShow() {
  54. },
  55. mounted() {},
  56. methods: {
  57. async getAirportList(){
  58. let data={
  59. "serviceId": 14,
  60. "dataContent": [],
  61. "event": "0"
  62. }
  63. await this.$http.httpPost('/openApi/query',data).then(res => {
  64. if(res.code == "0"){
  65. res.returnData.map(item =>{
  66. this.airportList.push(item['IATACode'])
  67. })
  68. this.$storage.setJson('airportList',this.airportList);
  69. let num = this.index;
  70. this.$storage.set('airportName',this.airportList[num])
  71. }
  72. })
  73. },
  74. change(e){
  75. this.index = e.detail.value
  76. this.$emit('airport',this.airportList[this.index])
  77. this.$storage.set('airport',this.index);
  78. },
  79. test() {
  80. uni.navigateTo({
  81. url: "/pages/search/index"
  82. })
  83. },
  84. //搜索框输入事件
  85. inputSearch() {
  86. this.$emit('input', this.searchText)
  87. },
  88. clickOrder() {
  89. this.$emit('fall')
  90. }
  91. },
  92. }
  93. </script>
  94. <style lang="scss" scoped>
  95. .nav-content {
  96. >.nav {
  97. width: 100%;
  98. height: 2.375rem;
  99. display: flex;
  100. justify-content: center;
  101. align-items: center;
  102. padding-top: 2.25rem;
  103. color: rgb(255, 255, 255);
  104. font-family: Noto Sans SC;
  105. font-size: 1rem;
  106. position: relative;
  107. // background: rgba(234, 241, 245,0.2);
  108. >.log {
  109. width: .375rem;
  110. height: .75rem;
  111. font-size: .75rem;
  112. position: absolute;
  113. left: 1.5rem;
  114. background: url('../../static/ico.png') no-repeat;
  115. background-size: 100% 100%;
  116. }
  117. >.nav-sech {
  118. width: 18.5625rem;
  119. height: 1.875rem;
  120. display: flex;
  121. align-items: center;
  122. background: rgba(234, 241, 245, 0.2);
  123. border-radius: 4px;
  124. .secah {
  125. width: 3.75rem;
  126. height: 80%;
  127. display: flex;
  128. align-items: center;
  129. justify-content: center;
  130. color: rgb(255, 255, 255);
  131. font-family: Noto Sans SC;
  132. font-size: 14px;
  133. font-weight: 400;
  134. border-right: .0625rem solid rgb(255, 255, 255);
  135. }
  136. .my-input-placeholder {
  137. color: rgb(170, 195, 207);
  138. }
  139. .input-nav {
  140. padding-left: .625rem;
  141. color: rgb(170, 195, 207);
  142. }
  143. }
  144. >.up {
  145. position: absolute;
  146. right: 1.5rem;
  147. color: rgb(255, 255, 255);
  148. font-family: Noto Sans SC;
  149. font-size: .875rem;
  150. font-weight: 500;
  151. }
  152. }
  153. }
  154. </style>