提交 f87ab374 authored 作者: lhh's avatar lhh

修改问题

上级 37f1ea21
...@@ -14,8 +14,8 @@ const listOptions = $computed(() => { ...@@ -14,8 +14,8 @@ const listOptions = $computed(() => {
remote: { remote: {
httpRequest: getLiveList, httpRequest: getLiveList,
params: { params: {
experiment_id: props.data.eid, experiment_id: props.data?.eid,
student_id: props.data.sid student_id: props.data?.sid
}, },
callback(res: any) { callback(res: any) {
return { list: res.items } return { list: res.items }
...@@ -26,7 +26,13 @@ const listOptions = $computed(() => { ...@@ -26,7 +26,13 @@ const listOptions = $computed(() => {
{ label: '选手姓名', prop: 'student_name' }, { label: '选手姓名', prop: 'student_name' },
{ label: '商品名称', prop: 'live_commodity.title' }, { label: '商品名称', prop: 'live_commodity.title' },
{ label: '直播时长', prop: 'live_duration' }, { label: '直播时长', prop: 'live_duration' },
{ label: '文件大小(M)', prop: 'live_video_size' }, {
label: '文件大小(M)',
prop: 'live_video_size',
computed({ row }: { row: any }) {
return convertBytes(row.live_video_size, 'MB')
}
},
{ label: '上传时间', prop: 'live_end_time' }, { label: '上传时间', prop: 'live_end_time' },
{ label: '操作', slots: 'table-x', width: 130 } { label: '操作', slots: 'table-x', width: 130 }
] ]
...@@ -37,6 +43,31 @@ const handleViewLive = function (row: any) { ...@@ -37,6 +43,31 @@ const handleViewLive = function (row: any) {
`https://saas-dml-pro.ezijing.com/one/live/test/view?experiment_id=${props.data.eid}&id=${row.live_practice_id}&record_id=${row.id}&student_id=${props.data.sid}` `https://saas-dml-pro.ezijing.com/one/live/test/view?experiment_id=${props.data.eid}&id=${row.live_practice_id}&record_id=${row.id}&student_id=${props.data.sid}`
) )
} }
/**
* 将字节转换为指定单位
* @param {number} bytes - 字节数
* @param {string} unit - 转换目标单位 ('KB', 'MB', 'GB', 'TB')
* @param {number} [decimalPlaces=2] - 保留的小数位数
* @returns {number} - 转换后的值
*/
function convertBytes(bytes: any, unit: any, decimalPlaces = 2) {
const units: any = {
KB: 1024,
MB: 1024 * 1024,
GB: 1024 * 1024 * 1024,
TB: 1024 * 1024 * 1024 * 1024
}
if (!units[unit]) {
throw new Error("无效的单位,请选择 'KB', 'MB', 'GB', 或 'TB'")
}
const result = bytes / units[unit]
return parseFloat(result.toFixed(decimalPlaces))
}
console.log(convertBytes(1048576, 'MB'), 'convertBytes(1048576,')
</script> </script>
<template> <template>
......
...@@ -120,7 +120,7 @@ const listOptions = $computed(() => { ...@@ -120,7 +120,7 @@ const listOptions = $computed(() => {
// return getModuleStatus(row, 5) // return getModuleStatus(row, 5)
// } // }
// }, // },
{ label: '操作', slots: 'table-x', width: 130 } { label: '操作', slots: 'table-x', width: 140 }
] ]
} }
}) })
...@@ -234,17 +234,21 @@ const handleViewLive = function (row: any) { ...@@ -234,17 +234,21 @@ const handleViewLive = function (row: any) {
>评分</el-button >评分</el-button
> >
<br /> <br />
<el-button text type="primary" @click="handleViewReport(row)" v-if="row.competition_report_count !== '0'" <template v-if="row.competition_report_count !== '0'">
>查看报告</el-button <el-button text type="primary" @click="handleViewReport(row)" v-if="row.competition_report_count !== '0'"
><br /> >查看报告</el-button
<el-button ><br />
text </template>
type="primary" <template v-if="row.competition_competitor_pictures && row.competition_competitor_pictures?.pictures">
@click="handleViewPicture(row)" <el-button
v-if="row.competition_competitor_pictures && row.competition_competitor_pictures?.pictures" text
>查看截图</el-button type="primary"
> @click="handleViewPicture(row)"
<br /> v-if="row.competition_competitor_pictures && row.competition_competitor_pictures?.pictures"
>查看截图</el-button
>
<br />
</template>
<el-button <el-button
text text
type="primary" type="primary"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论