CloudMainPanel.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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="iconUrl"
  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. imgFun: {
  46. type: Function,
  47. default: () => () => {}
  48. }
  49. },
  50. computed: {
  51. // 当前选择的云机分组名称
  52. activeGroupName() {
  53. return this.groupList.find(item => item.id === this.cloudInfo.groupId)?.groupName || '全部设备';
  54. },
  55. // 当前云机信息
  56. cloudInfo() {
  57. // 如果当前云机id为空, 那么就返回空对象
  58. if (!this.userCardId) {
  59. return {};
  60. }
  61. // 如果当前云机id不为空, 那么就返回当前云机的信息
  62. return this.cloudList.find(item => item.userCardId === +this.userCardId);
  63. },
  64. // 当前云机套餐的图标
  65. iconUrl() {
  66. return this.imgFun(this.cloudInfo.buyVipType, this.cloudInfo.androidVersion);
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. // 文字高亮颜色
  73. $active-color: #FEAE4D;
  74. .cloud-id-info-wrap{
  75. display: flex;
  76. color: #f9f9f9;
  77. font-size: 10px;
  78. line-height: 10px;
  79. background-color: #565656;
  80. padding: 12px 16px;
  81. .cloud-id-avatar-wrap{
  82. padding-right: 8px;
  83. }
  84. .cloud-id-desc-wrap{
  85. flex: 1;
  86. .cloud-id-name{
  87. text-align: left;
  88. }
  89. .cloud-id-detail-wrap{
  90. display: flex;
  91. flex-wrap: nowrap;
  92. justify-content: space-between;
  93. .cloud-id{
  94. color: $active-color;
  95. }
  96. }
  97. }
  98. }
  99. </style>