scan.vue 3.7 KB

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