CloudMainPanel.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. <!-- 图片加载中显示 -->
  12. <template v-slot:loading>
  13. <van-loading type="spinner" size="20" />
  14. </template>
  15. </van-image>
  16. </div>
  17. <!-- 云机名称和ID -->
  18. <div class="cloud-id-desc-wrap">
  19. <div class="cloud-id-name mb-1">{{ cloudInfo.diskName }}</div>
  20. <div class="cloud-id-detail-wrap">
  21. <div class="cloud-id">ID {{ userCardId }}</div>
  22. <div class="cloud-id-active-group">当前分组:{{ activeGroupName }}</div>
  23. </div>
  24. </div>
  25. </div>
  26. </template>
  27. <script>
  28. /**
  29. * 头部云机id等信息
  30. */
  31. export default {
  32. name: 'CloudMainPanel',
  33. props: {
  34. // 当前云机id
  35. userCardId: {
  36. type: [String, Number],
  37. default: ''
  38. },
  39. // 云机列表
  40. cloudList: {
  41. type: Array,
  42. default: () => ([])
  43. },
  44. // 分组栏目列表
  45. groupList: {
  46. type: Array,
  47. default: () => []
  48. },
  49. // 云机套餐的图标
  50. imgFun: {
  51. type: Function,
  52. default: () => () => {}
  53. }
  54. },
  55. computed: {
  56. // 当前选择的云机分组名称
  57. activeGroupName() {
  58. return this.groupList.find(item => item.id === this.cloudInfo.groupId)?.groupName || '全部设备';
  59. },
  60. // 当前云机信息
  61. cloudInfo() {
  62. // 如果当前云机id为空, 那么就返回空对象
  63. if (!this.userCardId) {
  64. return {};
  65. }
  66. // 如果当前云机id不为空, 那么就返回当前云机的信息
  67. return this.cloudList.find(item => item.userCardId === +this.userCardId) ?? {};
  68. },
  69. // 当前云机套餐的图标
  70. iconUrl() {
  71. return Object.keys(this.cloudInfo).length ? this.imgFun(this.cloudInfo.buyVipType, this.cloudInfo.androidVersion) : require(`~/assets/image/rtc/userMealUpgradeVO_icon.png`)
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss" scoped>
  77. // 文字高亮颜色
  78. $active-color: #FEAE4D;
  79. .cloud-id-info-wrap{
  80. display: flex;
  81. color: #f9f9f9;
  82. font-size: 10px;
  83. line-height: 10px;
  84. background-color: #565656;
  85. padding: 12px 16px;
  86. .cloud-id-avatar-wrap{
  87. padding-right: 8px;
  88. }
  89. .cloud-id-desc-wrap{
  90. flex: 1;
  91. .cloud-id-name{
  92. text-align: left;
  93. }
  94. .cloud-id-detail-wrap{
  95. display: flex;
  96. flex-wrap: nowrap;
  97. justify-content: space-between;
  98. .cloud-id{
  99. color: $active-color;
  100. }
  101. }
  102. }
  103. }
  104. </style>