CloudMainPanel.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <!-- 头部云机id等信息 -->
  3. <div class="cloud-id-info-wrap">
  4. <!-- 云机套餐头像 -->
  5. <div class="cloud-id-avatar-wrap">
  6. <van-image
  7. width="24"
  8. height="24"
  9. src="https://img01.yzcdn.cn/vant/cat.jpeg"
  10. />
  11. </div>
  12. <!-- 云机名称和ID -->
  13. <div class="cloud-id-desc-wrap">
  14. <div class="cloud-id-name mb-1">{{ cloudInfo.diskName }}</div>
  15. <div class="cloud-id-detail-wrap">
  16. <div class="cloud-id">ID {{ userCardId }}</div>
  17. <div class="cloud-id-active-group">当前分组:{{ activeGroupName }}</div>
  18. </div>
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. /**
  24. * 头部云机id等信息
  25. */
  26. export default {
  27. name: 'CloudMainPanel',
  28. props: {
  29. // 当前云机id
  30. userCardId: {
  31. type: [String, Number],
  32. default: ''
  33. },
  34. // 云机列表
  35. cloudList: {
  36. type: Array,
  37. default: () => ([])
  38. },
  39. // 分组栏目列表
  40. groupList: {
  41. type: Array,
  42. default: () => []
  43. }
  44. },
  45. computed: {
  46. // 当前选择的云机分组名称
  47. activeGroupName() {
  48. return this.cloudInfo?.groupName || '全部设备';
  49. },
  50. // 当前云机信息
  51. cloudInfo() {
  52. // 如果当前云机id为空, 那么就返回空对象
  53. if (!this.userCardId) {
  54. return {};
  55. }
  56. // 如果当前云机id不为空, 那么就返回当前云机的信息
  57. return this.cloudList.find(item => item.userCardId === +this.userCardId);
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss" scoped>
  63. // 文字高亮颜色
  64. $active-color: #FEAE4D;
  65. .cloud-id-info-wrap{
  66. display: flex;
  67. color: #f9f9f9;
  68. font-size: 10px;
  69. line-height: 10px;
  70. background-color: #565656;
  71. padding: 12px 16px;
  72. .cloud-id-avatar-wrap{
  73. padding-right: 8px;
  74. }
  75. .cloud-id-desc-wrap{
  76. flex: 1;
  77. .cloud-id-name{
  78. text-align: left;
  79. }
  80. .cloud-id-detail-wrap{
  81. display: flex;
  82. flex-wrap: nowrap;
  83. justify-content: space-between;
  84. .cloud-id{
  85. color: $active-color;
  86. }
  87. }
  88. }
  89. }
  90. </style>