device.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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">
  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. },
  34. methods: {
  35. //获取用户常用设备
  36. getData() {
  37. this.$request.sendToken('/api/user/devices', {}, 'POST').then(res => {
  38. if (res.success == true) {
  39. this.devices = res.data;
  40. }
  41. })
  42. },
  43. }
  44. }
  45. </script>
  46. <style lang="scss" scoped>
  47. .devices {
  48. padding-top: 60rpx;
  49. margin: 0rpx 19rpx;
  50. .device-item {
  51. border-radius: 10rpx;
  52. background-color: #2c2b2b;
  53. padding: 19rpx;
  54. margin-bottom: 19rpx;
  55. color: #6e6c6b;
  56. .text.ip {
  57. float: right;
  58. }
  59. .info {
  60. margin-bottom: 19rpx;
  61. }
  62. }
  63. }
  64. .no-data {
  65. text-align: center;
  66. margin-top: 40%;
  67. color: #6e6c6b;
  68. .icon {
  69. width: 120rpx;
  70. height: 120rpx;
  71. margin: 0 auto;
  72. }
  73. }
  74. </style>