footer-bar.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <view class="footer">
  3. <view class="footer-bar">
  4. <view class="footer-item" @click="tabarClick(0)">
  5. <image src="../../static/image/home-fill.png" mode="" v-if="page==0"></image>
  6. <image src="../../static/image/home.png" mode="" v-else ></image>
  7. <view class="footer-text" >首页</view>
  8. </view>
  9. <view class="footer-item" @click="tabarClick(1)">
  10. <image src="../../static/image/mine-fill.png" mode="" class="mine" v-if="page==1"></image>
  11. <image src="../../static/image/mine.png" mode="" class="mine" v-else></image>
  12. <view class="footer-text" >我的</view>
  13. </view>
  14. <view class="scan" @click="scanCode()">
  15. <view class="scan-icon">
  16. <image src="../../static/image/scan.png" mode=""></image>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. var app=getApp()
  24. export default {
  25. name: 'footer-bar',
  26. data() {
  27. return{}
  28. },
  29. props: {
  30. page: {
  31. type: [Number],
  32. default: 0
  33. },
  34. },
  35. methods: {
  36. tabarClick: function(e) {
  37. if (e == 0) {
  38. uni.reLaunch({
  39. url:'../../pages/index/index'
  40. })
  41. } else if (e == 1) {
  42. uni.reLaunch({
  43. url:'../../pages/mine/mine'
  44. })
  45. }
  46. },
  47. //扫描二维码
  48. scanCode:function(){
  49. if(app.globalData.is_auth==true){
  50. uni.scanCode({
  51. success: function (res) {
  52. console.log('条码类型:' + res.scanType);
  53. console.log('条码内容:' + res.result);
  54. let scan=res.result
  55. let n1 = scan.length;//地址的总长度
  56. let n2 = scan.indexOf("=");//取得=号的位置
  57. let id = scan.substr(n2 + 1, n1 - n2);//从=号后面的内容
  58. console.log(id,'_)_)_)_)_')
  59. uni.navigateTo({
  60. url:'../../pages/index/service?device_no='+ id
  61. })
  62. }
  63. });
  64. }
  65. else{
  66. this.$emit("getFrame",true);
  67. }
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. .footer {
  74. height: 120rpx;
  75. position: fixed;
  76. bottom: 0;
  77. width: 100%;
  78. background-color: #fffdfd;
  79. .footer-bar {
  80. padding-top: 17upx;
  81. display: flex;
  82. position: relative;
  83. .footer-item {
  84. flex: 1;
  85. text-align: center;
  86. image {
  87. height:50upx;
  88. width: 50upx;
  89. }
  90. .mine {}
  91. .footer-text {
  92. font-size: 26upx;
  93. }
  94. }
  95. .scan {
  96. height: 142upx;
  97. width: 142upx;
  98. border-radius: 50%;
  99. position: absolute;
  100. background-color: #FFFFFF;
  101. bottom: 37upx;
  102. left: 41%;
  103. .scan-icon {
  104. height: 122upx;
  105. width: 122upx;
  106. margin: 0 auto;
  107. margin-top: 10upx;
  108. border-radius: 50%;
  109. background-color: $mine-background-color;
  110. image {
  111. height: 77upx;
  112. width: 82upx;
  113. margin-top: 25upx;
  114. margin-left: 21upx;
  115. }
  116. }
  117. }
  118. }
  119. }
  120. </style>