fix:打包报错调整

This commit is contained in:
小张 2025-08-19 02:21:57 +08:00
parent 7cc9a80297
commit b37cdd3ccc
2 changed files with 76 additions and 12 deletions

View File

@ -237,7 +237,7 @@
</svg>
{{ comment.likeCount }}
</button>
<button class="action-btn" @click="startReply(comment.id, comment.username)">回复</button>
<button class="action-btn" @click="startReply(comment.id, comment.userName)">回复</button>
</div>
<!-- 回复输入区域 -->
@ -271,7 +271,7 @@
</div>
<!-- 回复区域示例 -->
<div class="comment-replies" v-if="comment.id === 1">
<div class="comment-replies" v-if="comment.id === '1'">
<!-- 讲师回复 -->
<div class="reply-item instructor-reply">
<div class="reply-avatar">
@ -288,7 +288,7 @@
<div class="reply-footer">
<span class="reply-time">2025.07.23 17:30</span>
<div class="reply-actions">
<button class="reply-action-btn" @click="startReply(1, '张老师')">回复</button>
<button class="reply-action-btn" @click="startReply('1', '张老师')">回复</button>
</div>
</div>
</div>
@ -310,7 +310,7 @@
<div class="reply-footer">
<span class="reply-time">2025.07.23 18:15</span>
<div class="reply-actions">
<button class="reply-action-btn" @click="startReply(1, '李同学')">回复</button>
<button class="reply-action-btn" @click="startReply('1', '李同学')">回复</button>
</div>
</div>
</div>
@ -347,11 +347,11 @@
<span>笔记</span>
</div>
<span class="comment-time">2025.07.23 16:28</span>
<button class="action-btn" @click="startReply(1, '张老师')">回复</button>
<button class="action-btn" @click="startReply('1', '张老师')">回复</button>
</div>
<!-- 回复输入区域 -->
<div v-if="replyingTo === 1" class="reply-input-section">
<div v-if="replyingTo === '1'" class="reply-input-section">
<div class="reply-input-header">
<span class="reply-to-text">回复 @{{ replyToUsername }}</span>
<button class="cancel-reply-btn" @click="cancelReply">取消</button>
@ -661,7 +661,7 @@ const instructorsLoading = ref(false)
const instructorsError = ref('')
//
const comments = ref([])
const comments = ref<CourseComment[]>([])
const commentsLoading = ref(false)
const commentsError = ref('')
@ -701,6 +701,11 @@ const isUserEnrolled = computed(() => {
const enrollConfirmVisible = ref(false)
const enrollSuccessVisible = ref(false)
//
const replyingTo = ref<string | null>(null)
const replyToUsername = ref('')
const replyText = ref('')
//
interface ChapterGroup {
title: string
@ -1025,6 +1030,45 @@ const loadCourseComments = async () => {
}
}
//
const startReply = (commentId: string, username: string) => {
replyingTo.value = commentId
replyToUsername.value = username
replyText.value = ''
}
const cancelReply = () => {
replyingTo.value = null
replyToUsername.value = ''
replyText.value = ''
}
const submitReply = () => {
if (!replyText.value.trim()) return
console.log('提交回复:', {
commentId: replyingTo.value,
username: replyToUsername.value,
content: replyText.value
})
// API
//
cancelReply()
}
const adjustReplyTextareaHeight = (event: Event) => {
const textarea = event.target as HTMLTextAreaElement
textarea.style.height = 'auto'
textarea.style.height = textarea.scrollHeight + 'px'
}
const handleReplyTextareaClick = () => {
if (!userStore.isLoggedIn) {
showLoginModal()
}
}
// /
const toggleChapter = (chapterIndex: number) => {
console.log('点击切换章节,章节索引:', chapterIndex)
@ -3243,16 +3287,12 @@ onMounted(() => {
}
/* 讲师评论特殊样式 */
.reply-item.instructor-reply {}
.reply-item.instructor-reply .reply-username {
color: #666666;
font-weight: 500;
}
/* 用户评论样式 */
.reply-item.user-reply {}
.reply-item.user-reply .reply-username {
color: #666666;
font-weight: 500;

View File

@ -450,7 +450,7 @@ import { ref, onMounted, onUnmounted, computed, nextTick } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useUserStore } from '@/stores/user'
import { CourseApi } from '@/api/modules/course'
import type { Course, CourseSection, SectionVideo, VideoQuality } from '@/api/types'
import type { Course, CourseSection, SectionVideo, VideoQuality, CourseComment, Instructor } from '@/api/types'
import SafeAvatar from '@/components/common/SafeAvatar.vue'
import LearningProgressStats from '@/components/common/LearningProgressStats.vue'
import NotesModal from '@/components/common/NotesModal.vue'
@ -495,6 +495,9 @@ const instructors = ref<Instructor[]>([])
const instructorsLoading = ref(false)
const instructorsError = ref('')
//
const newComment = ref('')
//
const VIDEO_CONFIG = {
// 使
@ -1247,6 +1250,27 @@ const saveNote = (content: string) => {
//
}
//
const adjustTextareaHeight = (event: Event) => {
const textarea = event.target as HTMLTextAreaElement
textarea.style.height = 'auto'
textarea.style.height = textarea.scrollHeight + 'px'
}
const handleTextareaClick = () => {
//
console.log('评论输入框被点击')
}
const submitComment = () => {
if (!newComment.value.trim()) return
console.log('提交评论:', newComment.value)
// API
//
newComment.value = ''
}
onMounted(async () => {
console.log('已报名课程详情页加载完成课程ID:', courseId.value)
initializeEnrolledState() //