device.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <view class="main">
  3. <view class="devices" v-if="devices.length<=0">
  4. <view class="no-data">
  5. <image class="icon" src="/static/icons/no-data.png" mode=""></image>
  6. <view class="text">
  7. -- {{lang.no_data}} --
  8. </view>
  9. </view>
  10. </view>
  11. <view class="devices" v-else>
  12. <view class="device-item" v-for="(v,k) in devices" :key="k">
  13. <view class="info">
  14. <text class="text device">{{v.device}}</text>
  15. <text class="text ip">{{v.ip}}</text>
  16. </view>
  17. <view class="time">
  18. {{v.time_text}}
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. data() {
  27. return {
  28. devices: [],
  29. }
  30. },
  31. created() {
  32. this.getData();
  33. uni.setNavigationBarTitle({
  34. title: this.lang.device_title
  35. })
  36. },
  37. methods: {
  38. //获取用户常用设备
  39. getData() {
  40. this.$request.sendToken('/api/user/devices', {}, 'POST').then(res => {
  41. if (res.success == true) {
  42. this.devices = res.data;
  43. }
  44. })
  45. },
  46. }
  47. }
  48. </script>
  49. <style lang="scss" scoped>
  50. .devices {
  51. padding-top: 60rpx;
  52. margin: 0rpx 19rpx;
  53. .device-item {
  54. border-radius: 10rpx;
  55. background-color: #2c2b2b;
  56. padding: 19rpx;
  57. margin-bottom: 19rpx;
  58. color: #6e6c6b;
  59. .text.ip {
  60. float: right;
  61. }
  62. .info {
  63. margin-bottom: 19rpx;
  64. }
  65. }
  66. }
  67. .no-data {
  68. text-align: center;
  69. margin-top: 40%;
  70. color: #6e6c6b;
  71. .icon {
  72. width: 120rpx;
  73. height: 120rpx;
  74. margin: 0 auto;
  75. }
  76. }
  77. </style>