yuhongqi 20 часов назад
Родитель
Сommit
a0482349f8
1 измененных файлов с 65 добавлено и 18 удалено
  1. 65 18
      src/views/course/userCoursePeriod/courseStatistics.vue

+ 65 - 18
src/views/course/userCoursePeriod/courseStatistics.vue

@@ -303,7 +303,18 @@
             </template>
             </template>
           </el-table-column>
           </el-table-column>
           <el-table-column label="分公司名称" align="center" prop="companyName" width="150" />
           <el-table-column label="分公司名称" align="center" prop="companyName" width="150" />
-          <el-table-column label="销售名称" align="center" prop="salesName" />
+          <el-table-column label="销售名称" align="center" prop="salesName" width="120" />
+          <el-table-column
+            label="课程评分"
+            align="center"
+            prop="courseRating"
+            min-width="260"
+            show-overflow-tooltip
+          >
+            <template slot-scope="scope">
+              <span class="course-rating-cell">{{ formatCourseRating(scope.row.courseRating) }}</span>
+            </template>
+          </el-table-column>
         </el-table>
         </el-table>
 
 
         <!-- 分页 -->
         <!-- 分页 -->
@@ -532,9 +543,10 @@ export default {
       this.userDetailDialog.loading = true;
       this.userDetailDialog.loading = true;
       getCourseStatisticsUserDetailList(this.userDetailDialog.queryParams).then(response => {
       getCourseStatisticsUserDetailList(this.userDetailDialog.queryParams).then(response => {
         if (response.code === 200 && response.data) {
         if (response.code === 200 && response.data) {
-          const d = response.data;
+          const raw = response.data;
+          const d = raw.data != null && raw.list == null && raw.rows == null ? raw.data : raw;
           this.userDetailDialog.list = d.list || d.rows || [];
           this.userDetailDialog.list = d.list || d.rows || [];
-          this.userDetailDialog.total = d.total ?? 0;
+          this.userDetailDialog.total = d.total != null ? d.total : 0;
         } else {
         } else {
           this.userDetailDialog.list = [];
           this.userDetailDialog.list = [];
           this.userDetailDialog.total = 0;
           this.userDetailDialog.total = 0;
@@ -571,23 +583,46 @@ export default {
         });
         });
       }).catch(() => {});
       }).catch(() => {});
     },
     },
-      /** 格式化时长 */
-      formatDuration(seconds) {
-          if (seconds == null || isNaN(seconds)) return '0秒';
-          let total = Math.abs(seconds);
-          const hours = Math.floor(total / 3600);
-          const minutes = Math.floor((total % 3600) / 60);
-          const secs = Math.floor(total % 60);
-
-          const parts = [];
-          if (hours > 0) parts.push(`${hours}小时`);
-          if (minutes > 0) parts.push(`${minutes}分`);
-          if (secs > 0 || parts.length === 0) {
-              parts.push(`${secs}秒`);
-          }
+    /**
+     * 课程评分:后端在关闭「看课校验答案」时返回作答解析后的展示值(courseRating);否则为空
+     */
+    formatCourseRating(val) {
+      if (val == null || val === '') {
+        return '—';
+      }
+      if (typeof val === 'string') {
+        const s = val.trim();
+        if (!s) return '—';
+        try {
+          const parsed = JSON.parse(s);
+          return typeof parsed === 'object' ? JSON.stringify(parsed) : String(val);
+        } catch (e) {
+          return val;
+        }
+      }
+      try {
+        return typeof val === 'object' ? JSON.stringify(val) : String(val);
+      } catch (e) {
+        return String(val);
+      }
+    },
+    /** 格式化时长 */
+    formatDuration(seconds) {
+      if (seconds == null || isNaN(seconds)) return '0秒';
+      let total = Math.abs(seconds);
+      const hours = Math.floor(total / 3600);
+      const minutes = Math.floor((total % 3600) / 60);
+      const secs = Math.floor(total % 60);
 
 
-          return parts.join('');
+      const parts = [];
+      if (hours > 0) parts.push(`${hours}小时`);
+      if (minutes > 0) parts.push(`${minutes}分`);
+      if (secs > 0 || parts.length === 0) {
+        parts.push(`${secs}秒`);
       }
       }
+
+      return parts.join('');
+    }
   }
   }
 };
 };
 </script>
 </script>
@@ -635,4 +670,16 @@ export default {
     overflow-y: auto;
     overflow-y: auto;
   }
   }
 }
 }
+
+.course-rating-cell {
+  display: inline-block;
+  max-width: 100%;
+  text-align: left;
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  font-size: 12px;
+  line-height: 1.4;
+  vertical-align: middle;
+}
 </style>
 </style>