liudong
2024-08-19 7d1e44c728a8e436fede1ceb8a62b5c4fb848b09
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<template>
  <div class="item-container">
    <a-space :size="16" direction="vertical" fill>
      <a-descriptions
        v-for="(item, idx) in blockDataList"
        :key="idx"
        :label-style="{
          textAlign: 'right',
          width: '200px',
          paddingRight: '10px',
          color: 'rgb(var(--gray-8))',
        }"
        :value-style="{ width: '400px' }"
        :title="item.title"
        :data="item.data"
      >
        <template #value="{ value }">
          <a-skeleton v-if="loading" :animation="true">
            <a-skeleton-line :widths="['200px']" :rows="1" />
          </a-skeleton>
          <span v-else>{{ value }}</span>
        </template>
      </a-descriptions>
    </a-space>
  </div>
</template>
 
<script lang="ts" setup>
  import { computed, PropType } from 'vue';
  import { useI18n } from 'vue-i18n';
  import { ProfileBasicRes } from '@/api/profile';
 
  type BlockList = {
    title: string;
    data: {
      label: string;
      value: string;
    }[];
  }[];
 
  const props = defineProps({
    type: {
      type: String,
      default: '',
    },
    renderData: {
      type: Object as PropType<ProfileBasicRes>,
      required: true,
    },
    loading: {
      type: Boolean,
      default: false,
    },
  });
  const { t } = useI18n();
  const blockDataList = computed<BlockList>(() => {
    const { renderData } = props;
    const result = [];
    result.push({
      title:
        props.type === 'pre'
          ? t('basicProfile.title.preVideo')
          : t('basicProfile.title.video'),
      data: [
        {
          label: t('basicProfile.label.video.mode'),
          value: renderData?.video?.mode || '-',
        },
        {
          label: t('basicProfile.label.video.acquisition.resolution'),
          value: renderData?.video?.acquisition.resolution || '-',
        },
        {
          label: t('basicProfile.label.video.acquisition.frameRate'),
          value: `${renderData?.video?.acquisition.frameRate || '-'} fps`,
        },
        {
          label: t('basicProfile.label.video.encoding.resolution'),
          value: renderData?.video?.encoding.resolution || '-',
        },
        {
          label: t('basicProfile.label.video.encoding.rate.min'),
          value: `${renderData?.video?.encoding.rate.min || '-'} bps`,
        },
        {
          label: t('basicProfile.label.video.encoding.rate.max'),
          value: `${renderData?.video?.encoding.rate.max || '-'} bps`,
        },
        {
          label: t('basicProfile.label.video.encoding.rate.default'),
          value: `${renderData?.video?.encoding.rate.default || '-'} bps`,
        },
        {
          label: t('basicProfile.label.video.encoding.frameRate'),
          value: `${renderData?.video?.encoding.frameRate || '-'} fpx`,
        },
        {
          label: t('basicProfile.label.video.encoding.profile'),
          value: renderData?.video?.encoding.profile || '-',
        },
      ],
    } as never);
 
    result.push({
      title:
        props.type === 'pre'
          ? t('basicProfile.title.preAudio')
          : t('basicProfile.title.audio'),
      data: [
        {
          label: t('basicProfile.label.audio.mode'),
          value: renderData?.audio?.mode || '-',
        },
        {
          label: t('basicProfile.label.audio.acquisition.channels'),
          value: `${renderData?.audio?.acquisition.channels || '-'} ${t(
            'basicProfile.unit.audio.channels'
          )}`,
        },
        {
          label: t('basicProfile.label.audio.encoding.channels'),
          value: `${renderData?.audio?.encoding.channels || '-'} ${t(
            'basicProfile.unit.audio.channels'
          )}`,
        },
        {
          label: t('basicProfile.label.audio.encoding.rate'),
          value: `${renderData?.audio?.encoding.rate || '-'} kbps`,
        },
        {
          label: t('basicProfile.label.audio.encoding.profile'),
          value: renderData?.audio?.encoding.profile || '-',
        },
      ],
    } as never);
 
    return result;
  });
</script>
 
<style scoped lang="less">
  .item-container {
    padding-top: 20px;
    :deep(.arco-descriptions-item-label) {
      font-weight: normal;
    }
  }
</style>