t-i-navbar.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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">
  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. data() {
  48. return {
  49. mine_code:"",
  50. // 当前温度
  51. temperature_curr:"",
  52. };
  53. },
  54. created() {
  55. // 初始化当前煤矿编码
  56. this.mine_code = uni.getStorageSync('mine_code')
  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. }
  76. }
  77. </script>
  78. <style lang="scss">
  79. .content{
  80. position: fixed;
  81. top: 0;
  82. left: 0;
  83. z-index: 999;
  84. width: 750rpx;
  85. background-image: url(./icon/bg_img.jpg);
  86. background-size: 750rpx 334rpx;
  87. background-repeat: no-repeat;
  88. }
  89. .navbar{
  90. box-sizing: border-box;
  91. padding: 10rpx 25rpx;
  92. display: flex;
  93. align-items: center;
  94. justify-content: space-between;
  95. height: 88rpx;
  96. .left{
  97. display: flex;
  98. align-items: center;
  99. width: 170rpx;
  100. image{
  101. width: 165rpx;
  102. height: 48rpx;
  103. margin-right: 10rpx;
  104. }
  105. }
  106. .search{
  107. width: 370rpx;
  108. .box{
  109. display: flex;
  110. justify-content: space-between;
  111. align-items: center;
  112. height: 68rpx;
  113. background-color: rgba(255,255,255,.4);
  114. border-radius: 50rpx;
  115. box-sizing: border-box;
  116. padding: 0 20rpx;
  117. .left{
  118. display: flex;
  119. .icon{
  120. image{
  121. width: 21rpx;
  122. height: 21rpx;
  123. }
  124. }
  125. .text{
  126. color: #FFFFFF;
  127. font-size: 24rpx;
  128. }
  129. }
  130. .scan{
  131. image{
  132. width: 27rpx;
  133. height: 25rpx;
  134. }
  135. }
  136. }
  137. }
  138. .right{
  139. white-space: nowrap;
  140. color: #FFFFFF;
  141. font-size: 24rpx;
  142. width: 124rpx;
  143. margin-left: 20rpx;
  144. border-left: 2rpx solid #FFFFFF;
  145. box-sizing: border-box;
  146. padding-left: 20rpx;
  147. display: flex;
  148. align-items: center;
  149. justify-content: space-around;
  150. height: 40rpx;
  151. .icon{
  152. margin-right: 10rpx;
  153. image{
  154. width: 40rpx;
  155. height: 40rpx;
  156. }
  157. }
  158. .num{
  159. color: #FFFFFF;
  160. font-size: 24rpx;
  161. }
  162. }
  163. }
  164. </style>