feat:bug修复
This commit is contained in:
parent
2e3b6a6cf7
commit
9aa5fbcea0
@ -720,11 +720,12 @@ export interface Repo {
|
||||
id: string
|
||||
title: string
|
||||
remark: string
|
||||
questionCount?: number
|
||||
createBy: string
|
||||
createTime: string
|
||||
updateBy: string
|
||||
updateTime: string
|
||||
question_count?: number // 匹配API返回的字段名
|
||||
create_by: string // 匹配API返回的字段名
|
||||
create_time: string // 匹配API返回的字段名
|
||||
update_by: string // 匹配API返回的字段名
|
||||
update_time: string // 匹配API返回的字段名
|
||||
createByName?: string // 创建人姓名
|
||||
courseId?: string // 所属课程ID
|
||||
courseName?: string // 所属课程名称
|
||||
}
|
||||
|
@ -152,9 +152,12 @@
|
||||
<button class="btn-nav btn-prev" @click="previousPracticeQuestion" :disabled="currentQuestionIndex === 0">
|
||||
上一题
|
||||
</button>
|
||||
<button class="btn-nav btn-next" @click="nextPracticeQuestion">
|
||||
<button v-if="currentQuestionIndex < practiceQuestions.length - 1" class="btn-nav btn-next" @click="nextPracticeQuestion">
|
||||
下一题
|
||||
</button>
|
||||
<button v-else class="btn-nav btn-return" @click="exitPracticeMode">
|
||||
返回学习
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -327,7 +330,7 @@
|
||||
<span class="icon-download"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="interaction-right">
|
||||
<div class="interaction-right" style="display: none;">
|
||||
<div class="comment-input">
|
||||
<input type="text" placeholder="成功报名学习才能发送弹幕哦~" />
|
||||
<button class="send-btn">发送</button>
|
||||
@ -419,8 +422,8 @@
|
||||
|
||||
<!-- 课程描述 -->
|
||||
<div class="course-description">
|
||||
<div class="course-description-text" style="display: none;">本课程中的部分图片、音频和视频素材来源于网络,仅供教学使用。如有问题,请点击 <span @click="openComplaintModal('feedback')">这里</span> 反馈</div>
|
||||
<span @click="openComplaintModal('complaint')">稿件投诉</span>
|
||||
<div class="course-description-text">本课程中的部分图片、音频和视频素材来源于网络,仅供教学使用。如有问题,请点击 <span @click="openComplaintModal('feedback')">这里</span> 反馈</div>
|
||||
<span @click="openComplaintModal('complaint')" style="display: none;">稿件投诉</span>
|
||||
</div>
|
||||
|
||||
|
||||
@ -430,12 +433,13 @@
|
||||
<!-- 课程标签页 -->
|
||||
<div class="course-tabs">
|
||||
<div class="tab-nav">
|
||||
<button class="tab-btn" :class="{ active: courseActiveTab === 'comments' }"
|
||||
@click="courseActiveTab = 'comments'">评论({{ commentsCount }})</button>
|
||||
<button class="tab-btn" :class="{ active: courseActiveTab === 'summary' }"
|
||||
@click="courseActiveTab = 'summary'">课程总结</button>
|
||||
<button class="tab-btn" :class="{ active: courseActiveTab === 'subtitles' }"
|
||||
@click="courseActiveTab = 'subtitles'">字幕列表</button>
|
||||
<button class="tab-btn" :class="{ active: courseActiveTab === 'comments' }"
|
||||
@click="courseActiveTab = 'comments'">评论({{ commentsCount }})</button>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- 标签页内容区域 -->
|
||||
@ -1299,6 +1303,31 @@
|
||||
</div>
|
||||
</div>
|
||||
</n-modal>
|
||||
|
||||
<!-- 下载确认弹窗 -->
|
||||
<n-modal v-model:show="downloadConfirmVisible" style="width: 400px;">
|
||||
<div class="download-confirm-modal">
|
||||
<div class="download-confirm-header">
|
||||
<div class="download-confirm-title">确认下载</div>
|
||||
</div>
|
||||
|
||||
<div class="download-confirm-content">
|
||||
<p>确定要下载该资料吗?</p>
|
||||
<p v-if="pendingDownloadSection" class="download-section-name">
|
||||
{{ pendingDownloadSection.name }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="download-confirm-actions">
|
||||
<n-button @click="cancelDownload" style="margin-right: 12px;">
|
||||
取消
|
||||
</n-button>
|
||||
<n-button type="primary" @click="confirmDownload">
|
||||
确认下载
|
||||
</n-button>
|
||||
</div>
|
||||
</div>
|
||||
</n-modal>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@ -2236,7 +2265,23 @@ const getLessonTypeBadgeClass = (section: CourseSection) => {
|
||||
|
||||
// 处理下载操作
|
||||
const handleDownload = async (section: CourseSection) => {
|
||||
console.log('📄 获取章节资料:', section)
|
||||
console.log('📄 点击下载按钮:', section)
|
||||
|
||||
// 显示确认弹窗
|
||||
pendingDownloadSection.value = section
|
||||
downloadConfirmVisible.value = true
|
||||
}
|
||||
|
||||
// 确认下载
|
||||
const confirmDownload = async () => {
|
||||
if (!pendingDownloadSection.value) return
|
||||
|
||||
const section = pendingDownloadSection.value
|
||||
console.log('📄 确认下载章节资料:', section)
|
||||
|
||||
// 关闭确认弹窗
|
||||
downloadConfirmVisible.value = false
|
||||
pendingDownloadSection.value = null
|
||||
|
||||
try {
|
||||
// 调用章节资料API
|
||||
@ -2560,6 +2605,30 @@ const nextPracticeQuestion = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 退出练习模式
|
||||
const exitPracticeMode = () => {
|
||||
console.log('🔙 退出练习模式,返回学习')
|
||||
|
||||
// 重置练习相关状态
|
||||
practiceMode.value = false
|
||||
practiceStarted.value = false
|
||||
practiceFinished.value = false
|
||||
currentQuestionIndex.value = 0
|
||||
practiceQuestions.value = []
|
||||
practiceAnswers.value = []
|
||||
fillAnswers.value = []
|
||||
essayAnswers.value = []
|
||||
currentPracticeSection.value = null
|
||||
|
||||
message.success('已退出练习模式')
|
||||
}
|
||||
|
||||
// 取消下载
|
||||
const cancelDownload = () => {
|
||||
downloadConfirmVisible.value = false
|
||||
pendingDownloadSection.value = null
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -3049,6 +3118,10 @@ const complaintContent = ref('')
|
||||
const complaintType = ref<'feedback' | 'complaint'>('feedback')
|
||||
const uploadFileList = ref([])
|
||||
|
||||
// 下载确认弹窗相关
|
||||
const downloadConfirmVisible = ref(false)
|
||||
const pendingDownloadSection = ref<CourseSection | null>(null)
|
||||
|
||||
// 打开投诉弹窗
|
||||
const openComplaintModal = (type: 'feedback' | 'complaint') => {
|
||||
complaintType.value = type
|
||||
@ -4418,9 +4491,9 @@ onActivated(() => {
|
||||
color: #999999;
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
margin-right: 10px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.course-description span {
|
||||
@ -6560,12 +6633,16 @@ onActivated(() => {
|
||||
}
|
||||
|
||||
.instructors-section,
|
||||
.course-description,
|
||||
.course-header {
|
||||
padding-left: 24px;
|
||||
padding-right: 24px;
|
||||
}
|
||||
|
||||
.course-description {
|
||||
padding-left: 24px;
|
||||
padding-right: 24px;
|
||||
}
|
||||
|
||||
/* 响应式设计 */
|
||||
/* 大屏幕 - 使用120px左右边距 */
|
||||
@media (min-width: 1400px) {
|
||||
@ -8408,6 +8485,17 @@ onActivated(() => {
|
||||
border-color: #40a9ff;
|
||||
}
|
||||
|
||||
.btn-return {
|
||||
background: #52c41a;
|
||||
color: white;
|
||||
border-color: #52c41a;
|
||||
}
|
||||
|
||||
.btn-return:hover {
|
||||
background: #73d13d;
|
||||
border-color: #73d13d;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.practice-layout {
|
||||
flex-direction: column;
|
||||
@ -9440,4 +9528,43 @@ onActivated(() => {
|
||||
height: 40px;
|
||||
background: #EDEDED;
|
||||
}
|
||||
|
||||
/* 下载确认弹窗样式 */
|
||||
.download-confirm-modal {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.download-confirm-header {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.download-confirm-title {
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.download-confirm-content {
|
||||
margin-bottom: 24px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.download-confirm-content p {
|
||||
margin: 8px 0;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.download-section-name {
|
||||
font-weight: 500;
|
||||
color: #333 !important;
|
||||
}
|
||||
|
||||
.download-confirm-actions {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
@ -277,6 +277,9 @@ const questionBankList = ref<QuestionBank[]>([]);
|
||||
// 课程列表状态
|
||||
const courseOptions = ref<CourseOption[]>([]);
|
||||
|
||||
// 当前用户信息
|
||||
const currentUser = ref<string>('');
|
||||
|
||||
// 新建/编辑题库相关状态
|
||||
const showCreateModal = ref(false);
|
||||
const isEditMode = ref(false);
|
||||
@ -405,7 +408,20 @@ const createColumns = ({
|
||||
title: '权限',
|
||||
key: 'permissions',
|
||||
width: 160,
|
||||
align: 'center' as const
|
||||
align: 'center' as const,
|
||||
render(row: QuestionBank) {
|
||||
const hasPermission = currentUser.value === (row as any).createBy;
|
||||
return h(
|
||||
'span',
|
||||
{
|
||||
style: {
|
||||
color: hasPermission ? '#52c41a' : '#ff4d4f',
|
||||
fontWeight: '500'
|
||||
}
|
||||
},
|
||||
hasPermission ? '有' : '无'
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '创建人',
|
||||
@ -546,12 +562,12 @@ const loadQuestionBanks = async () => {
|
||||
sequence: index + 1,
|
||||
name: repo.title,
|
||||
description: repo.remark || '暂无描述',
|
||||
questionCount: repo.questionCount || 0,
|
||||
creator: repo.createBy || '未知',
|
||||
createTime: repo.createTime || '',
|
||||
lastModified: repo.updateTime || '',
|
||||
questionCount: repo.question_count || 0,
|
||||
creator: repo.createByName || '未知',
|
||||
createTime: repo.create_time || '',
|
||||
lastModified: repo.update_time || '',
|
||||
courseName: repo.courseName || '暂无课程',
|
||||
createBy: repo.createBy // 添加createBy字段用于权限检查
|
||||
createBy: repo.create_by // 添加createBy字段用于权限检查,使用正确的字段名
|
||||
} as QuestionBank & { createBy: string }));
|
||||
|
||||
// 应用搜索筛选
|
||||
@ -1120,8 +1136,22 @@ const handleContextMenu = (e: MouseEvent) => {
|
||||
// 右键菜单功能可以在这里实现
|
||||
};
|
||||
|
||||
// 获取当前用户信息
|
||||
const getCurrentUser = async () => {
|
||||
try {
|
||||
const userInfo = await AuthApi.getUserInfo();
|
||||
if (userInfo.success && userInfo.result) {
|
||||
currentUser.value = userInfo.result.baseInfo.username;
|
||||
console.log('🔍 当前用户username:', currentUser.value);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('❌ 获取当前用户信息失败:', error);
|
||||
}
|
||||
};
|
||||
|
||||
// 组件挂载时加载数据
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
await getCurrentUser();
|
||||
loadCourseList();
|
||||
loadQuestionBanks();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user