hookehuyr

feat(StudyCoursePage): 添加goToStudyDetail方法并移除无用注释

在StudyCoursePage.vue中添加了goToStudyDetail方法,用于处理课程详情页面的跳转逻辑,并移除了无用的注释代码。同时,在main.js中添加了Array.prototype.at的polyfill,以支持旧版浏览器。
/*
* @Date: 2025-03-20 20:36:36
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-05-08 12:23:36
* @LastEditTime: 2025-05-16 16:42:32
* @FilePath: /mlaj/src/main.js
* @Description: 文件描述
*/
......@@ -23,6 +23,15 @@ import { faCirclePause, faCirclePlay, faPlay, faPause, faBackwardStep, faForward
/* add icons to the library */
library.add(faCirclePause, faCirclePlay, faPlay, faPause, faBackwardStep, faForwardStep, faVolumeUp, faRedo, faRepeat, faList, faChevronDown, faVolumeOff, faXmark, faFileAlt, faTimes, faEye, faFilePdf, faExternalLinkAlt, faSpinner, faExclamationCircle, faDownload )
if (!Array.prototype.at) {
Array.prototype.at = function(n) {
n = Math.trunc(n) || 0;
if (n < 0) n += this.length;
if (n < 0 || n >= this.length) return undefined;
return this[n];
};
}
const app = createApp(App)
// 屏蔽警告信息
app.config.warnHandler = () => null;
......
......@@ -73,11 +73,11 @@
<div id="catalog" class="py-4">
<div v-if="course_lessons.length" class="space-y-4">
<div v-for="(lesson, index) in course_lessons" :key="index"
@click="router.push(`/studyDetail/${lesson.id}`)"
@click="goToStudyDetail(lesson.id)"
class="bg-white p-4 cursor-pointer hover:bg-gray-50 transition-colors border-b border-gray-200 relative">
<div v-if="lesson.progress > 0 && lesson.progress < 100"
<!-- <div v-if="lesson.progress > 0 && lesson.progress < 100"
class="absolute top-2 right-2 px-2 py-1 bg-green-100 text-green-600 text-xs rounded">
没有字段=>上次看到</div>
没有字段=>上次看到</div> -->
<div class="text-black text-base font-medium mb-2">{{ lesson.title }}</div>
<div class="flex items-center text-sm text-gray-500">
<span>{{ course_type_maps[lesson.course_type] }}</span>
......@@ -317,6 +317,10 @@ const handleTabChange = (name) => {
// }
// ]
// });
const goToStudyDetail = (lessonId) => {
router.push(`/studyDetail/${lessonId}`);
};
</script>
<style scoped>
......