Browse Source

修改组卷作业显示

shmily1213 4 weeks ago
parent
commit
803797c75a
2 changed files with 16 additions and 9 deletions
  1. 15 9
      src/pagesStudy/components/paper-work-item.vue
  2. 1 0
      src/types/study.ts

+ 15 - 9
src/pagesStudy/components/paper-work-item.vue

@@ -4,7 +4,7 @@
       <view class="text-28 text-fore-light flex items-center">
         <view class="w-12 h-12 rounded-full bg-[#E5E5E5]"></view>
         <view class="ml-10">{{ publishTime }}</view>
-        <view class="ml-20">发布人: {{ data.publishUser }}</view>
+        <view class="ml-20">发布人: {{ data.publishUser || '-' }}</view>
       </view>
       <view :class="['text-28', data.state === EnumPaperWorkState.NOT_COMPLETED ? 'text-warning' : 'text-success']">
         {{ data.state === EnumPaperWorkState.NOT_COMPLETED ? '未完成' : '已完成' }}
@@ -12,7 +12,7 @@
     </view>
     <view class="px-46 py-30 relative">
       <view>
-        <text class="text-28 text-fore-title font-bold">{{ data.universityName }}-{{ data.majorName }}</text>
+        <text class="text-28 text-fore-title font-bold">{{ paperName }}</text>
         <text v-if="data.directed"
           class="ml-10 bg-[#F0FDF4] text-[#22C55E] border border-solid border-[#22C55E] text-20 rounded-4 px-10 py-2">定向</text>
       </view>
@@ -23,17 +23,17 @@
         </view>
         <view class="mt-14">
           <text class="text-fore-light">科目/批次:</text>
-          <text class="text-fore-title">{{ batchName }}</text>
+          <text class="text-fore-title">{{ batchName || '-' }}</text>
         </view>
         <view class="mt-14">
           <text class="text-fore-light">所属校区:</text>
-          <text class="text-fore-title">{{ data.campusName }}</text>
+          <text class="text-fore-title">{{ data.campusName || '-' }}</text>
         </view>
       </view>
       <view v-if="data.state === EnumPaperWorkState.COMPLETED"
         class="mt-20 bg-[#FFFBEB] py-18 px-20 rounded-5 text-24 text-[#F59E0B] flex items-center justify-between border border-solid border-[#FEF6DA]">
-        <text>提交时间:{{ data.endTime }}</text>
-        <text>做题时长:{{ formatSeconds(data.duration) }}</text>
+        <text>提交时间:{{ data.endTime || '-' }}</text>
+        <text>做题时长:{{ formatSeconds(data.duration) || '-' }}</text>
       </view>
       <view class="absolute right-50 top-100">
         <view v-if="data.state === EnumPaperWorkState.COMPLETED"
@@ -55,10 +55,16 @@ const { transferTo } = useTransferPage();
 const props = defineProps<{
   data: Study.PaperWork;
 }>();
-
+const paperName = computed(() => {
+  const { universityName, majorName, name } = props.data;
+  if (universityName && majorName) {
+    return `${universityName}-${majorName}`;
+  }
+  return name;
+});
 const batchName = computed(() => {
-  const names = props.data.name.split('_');
-  return `${names[1]}(${names[0]})`
+  const { subjectName, batchName } = props.data;
+  return `${subjectName}(${batchName || ''})`;
 });
 const publishTime = computed(() => {
   return uni.$ie.formatTime(props.data.publishTime, 'yyyy年mm月dd日 hh:MM:ss');

+ 1 - 0
src/types/study.ts

@@ -452,4 +452,5 @@ export interface PaperWork {
   universityName: string;
   endTime: string;
   duration: number;
+  batchName: string;
 }