feat:bug修复
This commit is contained in:
parent
2e3b6a6cf7
commit
9aa5fbcea0
@ -720,13 +720,14 @@ export interface Repo {
|
|||||||
id: string
|
id: string
|
||||||
title: string
|
title: string
|
||||||
remark: string
|
remark: string
|
||||||
questionCount?: number
|
question_count?: number // 匹配API返回的字段名
|
||||||
createBy: string
|
create_by: string // 匹配API返回的字段名
|
||||||
createTime: string
|
create_time: string // 匹配API返回的字段名
|
||||||
updateBy: string
|
update_by: string // 匹配API返回的字段名
|
||||||
updateTime: string
|
update_time: string // 匹配API返回的字段名
|
||||||
courseId?: string // 所属课程ID
|
createByName?: string // 创建人姓名
|
||||||
courseName?: string // 所属课程名称
|
courseId?: string // 所属课程ID
|
||||||
|
courseName?: string // 所属课程名称
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Question {
|
export interface Question {
|
||||||
|
@ -152,9 +152,12 @@
|
|||||||
<button class="btn-nav btn-prev" @click="previousPracticeQuestion" :disabled="currentQuestionIndex === 0">
|
<button class="btn-nav btn-prev" @click="previousPracticeQuestion" :disabled="currentQuestionIndex === 0">
|
||||||
上一题
|
上一题
|
||||||
</button>
|
</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>
|
||||||
|
<button v-else class="btn-nav btn-return" @click="exitPracticeMode">
|
||||||
|
返回学习
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -327,7 +330,7 @@
|
|||||||
<span class="icon-download"></span>
|
<span class="icon-download"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="interaction-right">
|
<div class="interaction-right" style="display: none;">
|
||||||
<div class="comment-input">
|
<div class="comment-input">
|
||||||
<input type="text" placeholder="成功报名学习才能发送弹幕哦~" />
|
<input type="text" placeholder="成功报名学习才能发送弹幕哦~" />
|
||||||
<button class="send-btn">发送</button>
|
<button class="send-btn">发送</button>
|
||||||
@ -419,8 +422,8 @@
|
|||||||
|
|
||||||
<!-- 课程描述 -->
|
<!-- 课程描述 -->
|
||||||
<div class="course-description">
|
<div class="course-description">
|
||||||
<div class="course-description-text" style="display: none;">本课程中的部分图片、音频和视频素材来源于网络,仅供教学使用。如有问题,请点击 <span @click="openComplaintModal('feedback')">这里</span> 反馈</div>
|
<div class="course-description-text">本课程中的部分图片、音频和视频素材来源于网络,仅供教学使用。如有问题,请点击 <span @click="openComplaintModal('feedback')">这里</span> 反馈</div>
|
||||||
<span @click="openComplaintModal('complaint')">稿件投诉</span>
|
<span @click="openComplaintModal('complaint')" style="display: none;">稿件投诉</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@ -430,12 +433,13 @@
|
|||||||
<!-- 课程标签页 -->
|
<!-- 课程标签页 -->
|
||||||
<div class="course-tabs">
|
<div class="course-tabs">
|
||||||
<div class="tab-nav">
|
<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' }"
|
<button class="tab-btn" :class="{ active: courseActiveTab === 'summary' }"
|
||||||
@click="courseActiveTab = 'summary'">课程总结</button>
|
@click="courseActiveTab = 'summary'">课程总结</button>
|
||||||
<button class="tab-btn" :class="{ active: courseActiveTab === 'subtitles' }"
|
<button class="tab-btn" :class="{ active: courseActiveTab === 'subtitles' }"
|
||||||
@click="courseActiveTab = 'subtitles'">字幕列表</button>
|
@click="courseActiveTab = 'subtitles'">字幕列表</button>
|
||||||
<button class="tab-btn" :class="{ active: courseActiveTab === 'comments' }"
|
|
||||||
@click="courseActiveTab = 'comments'">评论({{ commentsCount }})</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 标签页内容区域 -->
|
<!-- 标签页内容区域 -->
|
||||||
@ -1299,6 +1303,31 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</n-modal>
|
</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>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@ -2236,7 +2265,23 @@ const getLessonTypeBadgeClass = (section: CourseSection) => {
|
|||||||
|
|
||||||
// 处理下载操作
|
// 处理下载操作
|
||||||
const handleDownload = async (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 {
|
try {
|
||||||
// 调用章节资料API
|
// 调用章节资料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 complaintType = ref<'feedback' | 'complaint'>('feedback')
|
||||||
const uploadFileList = ref([])
|
const uploadFileList = ref([])
|
||||||
|
|
||||||
|
// 下载确认弹窗相关
|
||||||
|
const downloadConfirmVisible = ref(false)
|
||||||
|
const pendingDownloadSection = ref<CourseSection | null>(null)
|
||||||
|
|
||||||
// 打开投诉弹窗
|
// 打开投诉弹窗
|
||||||
const openComplaintModal = (type: 'feedback' | 'complaint') => {
|
const openComplaintModal = (type: 'feedback' | 'complaint') => {
|
||||||
complaintType.value = type
|
complaintType.value = type
|
||||||
@ -4418,9 +4491,9 @@ onActivated(() => {
|
|||||||
color: #999999;
|
color: #999999;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-right: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.course-description span {
|
.course-description span {
|
||||||
@ -6560,12 +6633,16 @@ onActivated(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.instructors-section,
|
.instructors-section,
|
||||||
.course-description,
|
|
||||||
.course-header {
|
.course-header {
|
||||||
padding-left: 24px;
|
padding-left: 24px;
|
||||||
padding-right: 24px;
|
padding-right: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.course-description {
|
||||||
|
padding-left: 24px;
|
||||||
|
padding-right: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
/* 响应式设计 */
|
/* 响应式设计 */
|
||||||
/* 大屏幕 - 使用120px左右边距 */
|
/* 大屏幕 - 使用120px左右边距 */
|
||||||
@media (min-width: 1400px) {
|
@media (min-width: 1400px) {
|
||||||
@ -8408,6 +8485,17 @@ onActivated(() => {
|
|||||||
border-color: #40a9ff;
|
border-color: #40a9ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-return {
|
||||||
|
background: #52c41a;
|
||||||
|
color: white;
|
||||||
|
border-color: #52c41a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-return:hover {
|
||||||
|
background: #73d13d;
|
||||||
|
border-color: #73d13d;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.practice-layout {
|
.practice-layout {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@ -9440,4 +9528,43 @@ onActivated(() => {
|
|||||||
height: 40px;
|
height: 40px;
|
||||||
background: #EDEDED;
|
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>
|
</style>
|
@ -277,6 +277,9 @@ const questionBankList = ref<QuestionBank[]>([]);
|
|||||||
// 课程列表状态
|
// 课程列表状态
|
||||||
const courseOptions = ref<CourseOption[]>([]);
|
const courseOptions = ref<CourseOption[]>([]);
|
||||||
|
|
||||||
|
// 当前用户信息
|
||||||
|
const currentUser = ref<string>('');
|
||||||
|
|
||||||
// 新建/编辑题库相关状态
|
// 新建/编辑题库相关状态
|
||||||
const showCreateModal = ref(false);
|
const showCreateModal = ref(false);
|
||||||
const isEditMode = ref(false);
|
const isEditMode = ref(false);
|
||||||
@ -405,7 +408,20 @@ const createColumns = ({
|
|||||||
title: '权限',
|
title: '权限',
|
||||||
key: 'permissions',
|
key: 'permissions',
|
||||||
width: 160,
|
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: '创建人',
|
title: '创建人',
|
||||||
@ -546,12 +562,12 @@ const loadQuestionBanks = async () => {
|
|||||||
sequence: index + 1,
|
sequence: index + 1,
|
||||||
name: repo.title,
|
name: repo.title,
|
||||||
description: repo.remark || '暂无描述',
|
description: repo.remark || '暂无描述',
|
||||||
questionCount: repo.questionCount || 0,
|
questionCount: repo.question_count || 0,
|
||||||
creator: repo.createBy || '未知',
|
creator: repo.createByName || '未知',
|
||||||
createTime: repo.createTime || '',
|
createTime: repo.create_time || '',
|
||||||
lastModified: repo.updateTime || '',
|
lastModified: repo.update_time || '',
|
||||||
courseName: repo.courseName || '暂无课程',
|
courseName: repo.courseName || '暂无课程',
|
||||||
createBy: repo.createBy // 添加createBy字段用于权限检查
|
createBy: repo.create_by // 添加createBy字段用于权限检查,使用正确的字段名
|
||||||
} as QuestionBank & { createBy: string }));
|
} 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();
|
loadCourseList();
|
||||||
loadQuestionBanks();
|
loadQuestionBanks();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user