t-i-navbar.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <view>
  3. <view class="content">
  4. <view class="status_bar">
  5. <!-- 这里是状态栏 -->
  6. </view>
  7. <view class="navbar">
  8. <view class="left" @click="switch_kuang()">
  9. <image v-if="mine_code == 'ningdongyunying'" src="./icon/ningdongyunying.png" mode=""></image>
  10. <image v-if="mine_code == 'zaoquan'" src="./icon/zaoquan.png" mode=""></image>
  11. <uni-icons type="arrowdown" color="#fff" v-if="mine_code == 'ningdongyunying'"></uni-icons>
  12. </view>
  13. <view class="search">
  14. <view class="box">
  15. <view class="left" @click="go_search()">
  16. <view class="icon">
  17. <image src="./icon/search.png" mode=""></image>
  18. </view>
  19. <view class="text">搜索</view>
  20. </view>
  21. <view class="scan">
  22. <image src="./icon/saoma.png" mode=""></image>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="right">
  27. <view class="icon">
  28. <image src="./icon/day.png" mode=""></image>
  29. </view>
  30. <view class="num">{{temperature_curr}}</view>
  31. </view>
  32. <!-- <view class="right" v-show="show">
  33. <view class="icon" style="margin-right: 4rpx;">
  34. 积分
  35. </view>
  36. <view class="num">999分</view>
  37. </view> -->
  38. </view>
  39. </view>
  40. <view class="status_bar"></view>
  41. <view style="height: 88rpx;"></view>
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. name: "t-i-navbar",
  47. props: [
  48. "mine_code"
  49. ],
  50. data() {
  51. return {
  52. // 当前温度
  53. temperature_curr:"",
  54. };
  55. },
  56. created() {
  57. // 当前温度
  58. uni.request({
  59. url:"http://api.k780.com/?app=weather.today&weaId=286&appkey=10003&sign=b59bc3ef6191eb9f747dd4e83c99f2a4&format=json",
  60. method:"GET",
  61. success:(res)=> {
  62. console.log(res.data.result.temperature_curr)
  63. this.temperature_curr = res.data.result.temperature_curr
  64. }
  65. })
  66. },
  67. methods:{
  68. switch_kuang(){
  69. if(this.mine_code == 'ningdongyunying'){
  70. uni.navigateTo({
  71. url:"../../index/switch-kuang/switch-kuang"
  72. })
  73. }
  74. },
  75. go_search(){
  76. uni.navigateTo({
  77. url:"../../index/search/search?mine_code=" + this.mine_code
  78. })
  79. }
  80. }
  81. }
  82. </script>
  83. <style lang="scss">
  84. .content{
  85. position: fixed;
  86. top: 0;
  87. left: 0;
  88. z-index: 999;
  89. width: 750rpx;
  90. background-image: url(./icon/bg_img.jpg);
  91. background-size: 750rpx 334rpx;
  92. background-repeat: no-repeat;
  93. }
  94. .navbar{
  95. box-sizing: border-box;
  96. padding: 10rpx 25rpx;
  97. display: flex;
  98. align-items: center;
  99. justify-content: space-between;
  100. height: 88rpx;
  101. .left{
  102. display: flex;
  103. align-items: center;
  104. width: 170rpx;
  105. image{
  106. width: 165rpx;
  107. height: 48rpx;
  108. margin-right: 10rpx;
  109. }
  110. }
  111. .search{
  112. width: 370rpx;
  113. .box{
  114. display: flex;
  115. justify-content: space-between;
  116. align-items: center;
  117. height: 68rpx;
  118. background-color: rgba(255,255,255,.4);
  119. border-radius: 50rpx;
  120. box-sizing: border-box;
  121. padding: 0 20rpx;
  122. .left{
  123. display: flex;
  124. height: 68rpx;
  125. width: 300rpx;
  126. .icon{
  127. image{
  128. width: 21rpx;
  129. height: 21rpx;
  130. }
  131. }
  132. .text{
  133. color: #FFFFFF;
  134. font-size: 24rpx;
  135. }
  136. }
  137. .scan{
  138. width: 68rpx;
  139. text-align: right;
  140. line-height: 68rpx;
  141. image{
  142. width: 27rpx;
  143. height: 25rpx;
  144. }
  145. }
  146. }
  147. }
  148. .right{
  149. white-space: nowrap;
  150. color: #FFFFFF;
  151. font-size: 24rpx;
  152. width: 124rpx;
  153. margin-left: 20rpx;
  154. border-left: 2rpx solid #FFFFFF;
  155. box-sizing: border-box;
  156. padding-left: 20rpx;
  157. display: flex;
  158. align-items: center;
  159. justify-content: space-around;
  160. height: 40rpx;
  161. .icon{
  162. margin-right: 10rpx;
  163. image{
  164. width: 40rpx;
  165. height: 40rpx;
  166. }
  167. }
  168. .num{
  169. color: #FFFFFF;
  170. font-size: 24rpx;
  171. }
  172. }
  173. }
  174. </style>