| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <template>
- <view class="h-full">
- <ie-table v-if="data.length > 0" :table-columns="tableColumns" :table-config="tableConfig" :data="data" @rowClick="handleRowClick">
- <template #name="{ item }">
- <view class="flex items-center justify-center gap-10">
- <!-- <ie-image :src="item.avatar" class="w-60 h-60 bg-back" :round="999" /> -->
- <text class="flex-1 min-w-1 ellipsis-1">{{ item.name }}</text>
- </view>
- </template>
- <template #rate="{ item }">
- <text :class="[item.rate < 70 ? 'text-danger' : 'text-fore-title']">{{ item.rate }}%</text>
- </template>
- </ie-table>
- <view v-else class="bg-[#F6F8FA] text-center py-50 text-26 text-fore-light rounded-5">暂无数据</view>
- </view>
- </template>
- <script lang="ts" setup>
- import { TableColumnConfig, TableConfig } from '@/types';
- import { TeachClass, StudentPlanStudyRecord } from '@/types/study';
- const props = defineProps({
- teachClass: {
- type: Object as PropType<TeachClass>,
- default: () => ({})
- },
- data: {
- type: Array as PropType<StudentPlanStudyRecord[]>,
- default: () => []
- }
- });
- const tableConfig: TableConfig = {
- border: true,
- stripe: false,
- emptyText: '暂无数据',
- loading: false,
- rowKey: 'id'
- }
- const tableColumns: TableColumnConfig[] = [
- {
- prop: '',
- label: '序号',
- type: 'index',
- flex: 0.5
- },
- {
- prop: 'name',
- label: '姓名',
- slot: 'name'
- },
- {
- prop: 'total',
- label: '题量',
- flex: 0.6
- },
- {
- prop: 'time',
- label: '天数',
- flex: 0.6
- },
- {
- prop: 'rate',
- label: '正确率',
- slot: 'rate'
- }
- ]
- const emit = defineEmits<{
- rowClick: [row: StudentPlanStudyRecord]
- }>();
- const handleRowClick = (row: StudentPlanStudyRecord) => {
- emit('rowClick', row);
- }
- // const openKnowledgeDetail = inject(OPEN_KNOWLEDGE_DETAIL);
- // const handleRowClick = (row: StudentPlanStudyRecord) => {
- // openKnowledgeDetail?.(row.id, row.name);
- // }
- </script>
- <style lang="scss" scoped></style>
|