scan.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view class="help-container" >
  3. <view style="font-size: 22rpx;padding-bottom: 10rpx; background: rgb(228,240,255);
  4. color: #3E9CFC;
  5. height: 54rpx;
  6. line-height: 54rpx;
  7. border-radius: 48rpx;text-align: center">
  8. TIPS:请通过设备发送指令后,然后在该列表中绑定相应设备。
  9. </view>
  10. <view @click="getList" style="position: absolute; right: 50rpx;top: 40rpx;">
  11. <u-icon name="reload" ></u-icon>
  12. </view>
  13. <view>
  14. <uni-card title="管理员" extra="额外信息" padding="0" v-for="item in indexList">
  15. <template v-slot:cover>
  16. <view style="position: relative;display: flex;flex-direction: row;margin:20rpx;border-bottom: 1px solid lightgray;height: 60rpx">
  17. <view style="font-size: 24rpx;position: absolute;top: 8rpx;font-weight: bold">
  18. {{ item.deviceName }}
  19. </view>
  20. <view style="position: absolute;right:-14rpx;top:10rpx;
  21. color: #BBBBBB;font-size: 20rpx">
  22. {{ item.createTime }}
  23. </view>
  24. </view>
  25. </template>
  26. <template v-slot:title>
  27. <view style="position: relative;display: flex;flex-direction: column;margin:20rpx;height: 120rpx; line-height: 66rpx;
  28. color: #545454; ">
  29. <view>
  30. 设备编号:{{ item.deviceNo }}
  31. </view>
  32. <view>
  33. 产品名称:{{ item.productName }}
  34. </view>
  35. <view style="position: absolute;right:10rpx;top:20rpx" @click="scanCode(item.deviceNo)">
  36. <u-image :showLoading="true" src="/static/images/device/bind.png" width="60rpx" height="60rpx" ></u-image>
  37. <view style="text-align: center;font-size: 24rpx;position: relative;top:-10rpx">
  38. 绑定
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. </uni-card>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import { getDeviceMsg,bindDeviceQrcode } from '@/api/device/device.js'
  49. import UImage from "../../uni_modules/uview-ui/components/u--image/u--image";
  50. export default {
  51. components: {UImage},
  52. data() {
  53. return {
  54. headTitle:["设备编号","设备名称","产品编号","消息时间","操作"],
  55. indexList: [
  56. ]
  57. }
  58. },
  59. onShow(){
  60. this.getList();
  61. },
  62. methods: {
  63. scanCode(deviceNo){
  64. uni.scanCode({
  65. success: function (res) {
  66. console.log('条码内容:' + res.result);
  67. bindDeviceQrcode(res.result,deviceNo).then(res=>{
  68. let code = res.code
  69. if(code == '200'){
  70. uni.showToast({title:res.msg})
  71. }else{
  72. uni.showToast({title:res.msg,icon:"error"})
  73. }
  74. });
  75. }
  76. });
  77. },
  78. getList(){
  79. uni.showLoading();
  80. getDeviceMsg().then(res=>{
  81. uni.hideLoading();
  82. this.indexList = res.rows;
  83. });
  84. },
  85. handleText(item) {
  86. this.$tab.navigateTo(`/pages/common/textview/index?title=${item.title}&content=${item.content}`)
  87. }
  88. }
  89. }
  90. </script>
  91. <style lang="scss" scoped>
  92. page {
  93. background-color: white;
  94. }
  95. .help-container {
  96. margin-bottom: 100rpx;
  97. padding: 30rpx;
  98. background-color: white;
  99. }
  100. .list-title {
  101. margin-bottom: 30rpx;
  102. }
  103. .childList {
  104. background-color: white;
  105. box-shadow: 0px 0px 10rpx rgba(193, 193, 193, 0.2);
  106. border-radius: 16rpx;
  107. margin-top: 10rpx;
  108. }
  109. .line {
  110. width: 100%;
  111. height: 1rpx;
  112. background-color: #F5F5F5;
  113. }
  114. .text-title {
  115. color: #303133;
  116. font-size: 32rpx;
  117. font-weight: bold;
  118. margin-left: 10rpx;
  119. .iconfont {
  120. font-size: 16px;
  121. margin-right: 10rpx;
  122. }
  123. }
  124. .text-item {
  125. font-size: 28rpx;
  126. padding: 24rpx;
  127. }
  128. .question {
  129. color: #606266;
  130. font-size: 28rpx;
  131. }
  132. </style>