device.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view class="page" style="position: relative;">
  3. <view class="content">
  4. <loading isFullScreen color="#59a5f0" :active="isloading" text="开门中..."></loading>
  5. <view @click="open" class="device u-border-bottom" v-for="(item,index) in device_list" :key="index">
  6. <text>{{item.name}}</text>
  7. <view class="cu-btn bg-blue round sm">
  8. <text class="cuIcon-lock padding-right-10"></text>
  9. <text>开门</text>
  10. </view>
  11. </view>
  12. </view>
  13. <u-tabbar v-model="tabbarCurr"
  14. :icon-size="tabbar.iconSize"
  15. :active-color="tabbar.activeColor"
  16. :mid-button-size="tabbar.MinButtonSize"
  17. :list="tabbar.list" :mid-button="true">
  18. </u-tabbar>
  19. </view>
  20. </template>
  21. <script>
  22. var app=getApp()
  23. var that;
  24. import loading from "@/components/loading/loading.vue"
  25. import {tabbar} from "@/assets/js/tabbar.js"
  26. export default {
  27. components:{
  28. loading
  29. },
  30. data() {
  31. return {
  32. //tabbar
  33. tabbarCurr:1,
  34. tabbar:tabbar,
  35. //是否已开门
  36. isopen:false,
  37. //是否展示动画
  38. isloading:false,
  39. //设备列表
  40. device_list:[
  41. {
  42. id:'3265',
  43. name:'德锐斯工业园大门'
  44. },
  45. {
  46. id:'5678',
  47. name:'德锐斯工业园南门'
  48. },
  49. {
  50. id:'1577',
  51. name:'德锐斯工业园北门'
  52. },
  53. ]
  54. };
  55. },
  56. onLoad() {
  57. that=this
  58. },
  59. methods:{
  60. open(){
  61. //进度条加载
  62. this.isloading=true
  63. setTimeout(()=>{
  64. that.isloading=false
  65. that.isopen=true
  66. that.$showModel('开门成功',false)
  67. },2300)
  68. },
  69. /**
  70. * 立即开门
  71. */
  72. openDoor() {
  73. let params = {};
  74. params['member_id'] = app.globalData.member.id;
  75. params['device_id'] = device_id;
  76. let operation = 'member/openDoor';
  77. app.globalData.postRequest(params, operation, function (res) {
  78. that.isloading=false
  79. that.isopen=true
  80. app.globalData.oneFailHint(res.data.result_msg,function(){
  81. that.isopen=false
  82. });
  83. });
  84. },
  85. }
  86. };
  87. </script>
  88. <style lang="scss" scoped>
  89. page{
  90. background-color: #F1F1F1;
  91. }
  92. .device{
  93. background-color: #FFFFFF;
  94. display: flex;
  95. justify-content: space-between;
  96. padding: 30rpx;
  97. .bg-blue{
  98. background-color: #59a5f0;
  99. color: #FFFFFF;
  100. }
  101. }
  102. </style>