Commit 12a71291 by 胡悦

feat(学习中心): 增加不限考试次数支持和优化页面功能

- 在考试页面增加不限考试次数的显示逻辑
- 修改StudyPopupContent组件样式并添加取消按钮
- 优化学习中心搜索和筛选功能,重置页码并添加排序参数
- 统一多个页面的分页大小为12条
- 修复MyTask.vue中重复数据的问题
- 重命名StudyPopupContent组件为StudyCenterPermissionPopup
1 parent 833b6e0b
......@@ -87,7 +87,7 @@ export default {
nothing: false,
total: 0,
pageNum: 1,
pageSize: 9,
pageSize: 12,
scrollTop: 0,
COURSE_TYPE
}
......
......@@ -21,7 +21,10 @@
<!-- 考试次数 -->
<view class="exam-times">
<text class="times-value">剩余考试次数</text>
<text>{{ filterValue(item.remainingTimes) }}/{{ filterValue(item.examTimes) }}次</text>
<template v-if="!item.examTimes">不限次数</template>
<template v-else>
<text>{{ filterValue(item.remainingTimes) }}/{{ filterValue(item.examTimes) }}次</text>
</template>
</view>
<!-- 最高得分 -->
......@@ -31,7 +34,7 @@
</view>
<!-- 重新考试按钮 -->
<view v-if="item.remainingTimes > 0" class="retake-btn">
<view v-if="!item.examTimes || item.remainingTimes > 0" class="retake-btn">
<text class="retake-text">重新考试</text>
</view>
</view>
......
......@@ -20,7 +20,10 @@
<!-- 考试次数 -->
<view class="exam-times">
<text class="times-value">剩余考试次数</text>
<text>{{ filterValue(item.remainingTimes) }}/{{ filterValue(item.examTimes) }}次</text>
<template v-if="!item.examTimes">不限次数</template>
<template v-else>
<text>{{ filterValue(item.remainingTimes) }}/{{ filterValue(item.examTimes) }}次</text>
</template>
</view>
<!-- 最高得分 -->
......@@ -30,7 +33,7 @@
</view>
<!-- 重新考试按钮 -->
<view v-if="item.remainingTimes > 0" class="retake-btn">
<view v-if="!item.examTimes || item.remainingTimes > 0" class="retake-btn">
<text class="retake-text">重新考试</text>
</view>
</view>
......
......@@ -222,7 +222,8 @@ export default {
],
currentSortValue: 0,
searchParams: {
sortType: 0
sortType: 0,
sortOrder: 'desc'
}
}
},
......@@ -293,6 +294,7 @@ export default {
handleSearch() {
console.log('搜索关键词:', this.searchKeyword)
this.searchParams.title = this.searchKeyword
this.$refs.allCourse.pageNum = 1
this.$refs.allCourse.getALlCourse()
// TODO: 调用课程列表接口,传入搜索关键词
},
......@@ -318,6 +320,7 @@ export default {
this.searchParams.sortType = item.value
// }
this.searchParams.title = this.searchKeyword
this.$refs.allCourse.pageNum = 1
this.$refs.allCourse.getALlCourse()
},
// 处理分类变化
......@@ -325,21 +328,28 @@ export default {
console.log('分类变化:', item, level, parent)
this.searchParams.courseCategoryId = item.id
this.searchParams.title = this.searchKeyword
this.$refs.allCourse.pageNum = 1
this.$refs.allCourse.getALlCourse()
// TODO: 调用课程列表接口,传入分类参数
},
// 处理筛选确认
handleFilterConfirm(filterData) {
console.log('筛选条件:', filterData)
const {planCourseType, courseFileType, totalStar} = this.searchParams
if (Object.keys(filterData).length === 0) {
planCourseType && delete this.searchParams.planCourseType
courseFileType && delete this.searchParams.courseFileType
totalStar && delete this.searchParams.totalStar
} else {
this.searchParams = Object.assign(this.searchParams, filterData)
}
const keys = ['planCourseType', 'courseFileType', 'totalStar']
keys.forEach(k => {
if (Object.prototype.hasOwnProperty.call(filterData, k)) {
this.searchParams[k] = filterData[k]
} else {
delete this.searchParams[k]
}
})
Object.keys(filterData).forEach(k => {
if (!keys.includes(k)) {
this.searchParams[k] = filterData[k]
}
})
this.searchParams.title = this.searchKeyword
this.$refs.allCourse.pageNum = 1
this.$refs.allCourse.getALlCourse()
// TODO: 调用课程列表接口,传入筛选条件
},
......@@ -416,7 +426,8 @@ export default {
this.currentSortValue = 0
this.$refs.orderScreen.clear()
this.searchParams = {
sortType: 0
sortType: 0,
sortOrder: 'desc'
}
}
}
......@@ -959,4 +970,4 @@ export default {
margin-right: toRpx(8);
}
}
</style>
\ No newline at end of file
</style>
......@@ -90,7 +90,7 @@
<!-- 学习中心 等级考试弹窗 -->
<StudyPopup :show.sync="showStudyPopup" title="开始您的学习之旅" :topImage="require('@/assets/images/common/study-center-bg.png')" :topImageWidth="848" :topImageHeight="248">
<StudyPopupContent cardTitle="个性化学习路径" description="根据您当前的学习情况,我们将为您定制专属的学习计划,帮助您高效提升技能,实现职业突破。" :listItems="['基于当前能力水平评估', '结合岗位发展目标制定', '定期跟踪学习进度和效果']" tipText="true" :courseName="courseInfo.title" buttonText="开始测评" @button-click="handleStartAssessment" />
<StudyPopupContent cardTitle="个性化学习路径" description="根据您当前的学习情况,我们将为您定制专属的学习计划,帮助您高效提升技能,实现职业突破。" :listItems="['基于当前能力水平评估', '结合岗位发展目标制定', '定期跟踪学习进度和效果']" tipText="true" :courseName="courseInfo.title" buttonText="开始测评" @cancel="handleStudyPopupCancel" @button-click="handleStartAssessment" />
</StudyPopup>
<!-- 考试提交确认弹窗 -->
......@@ -322,6 +322,19 @@ export default {
}
}
},
// 处理学习弹窗取消
handleStudyPopupCancel() {
this.showStudyPopup = false
// 切换到学习中心 tab
const tabs = this.$refs.leftBox?.tabs
if (tabs) {
const homeIndex = tabs.findIndex(tab => tab.name === 'HomeSlot')
if (homeIndex !== -1) {
this.tabIndex = homeIndex
this.changeTab({ item: tabs[homeIndex], index: homeIndex })
}
}
},
// 检查学习中心权限
async checkStudyCenterPermission() {
try {
......
......@@ -30,8 +30,13 @@
</view>
<!-- 按钮 -->
<view v-if="buttonText" class="action-button" @click="handleButtonClick">
{{ buttonText }}
<view class="button-group">
<view class="cancel-button" @click="handleCancel">
暂不测评
</view>
<view v-if="buttonText" class="action-button" @click="handleButtonClick">
{{ buttonText }}
</view>
</view>
</view>
</template>
......@@ -68,6 +73,9 @@ export default {
methods: {
handleButtonClick() {
this.$emit('button-click')
},
handleCancel() {
this.$emit('cancel')
}
}
}
......@@ -160,9 +168,28 @@ export default {
color: rgba(59, 115, 255, 1);
}
}
.button-group {
display: flex;
align-items: center;
justify-content: center;
gap: toRpx(16);
margin-top: auto;
}
.cancel-button {
width: toRpx(344);
height: toRpx(80);
border-radius: toRpx(64);
background: #f0f1f5;
color: #1a1a1a;
font-size: toRpx(28);
font-weight: 400;
font-family: "HarmonyOSSansSC";
text-align: center;
line-height: toRpx(80);
}
.action-button {
width: toRpx(720);
width: toRpx(360);
height: toRpx(80);
border-radius: toRpx(48);
background: linear-gradient(180deg, rgba(44, 102, 247, 1) 0%, rgba(72, 166, 255, 1) 100%);
......
......@@ -129,7 +129,7 @@ import utils from '@/utils/utils'
import { checkDailyReport, showNextModal } from '@/utils/modalUtils'
import PublishPopup from '@/components/PublishPopup.vue'
import StudyPopup from '@/components/StudyPopup.vue'
import StudyPopupContent from '@/components/StudyPopupContent.vue'
import StudyCenterPermissionPopup from '@/components/StudyCenterPermissionPopup.vue'
import { debounce } from 'lodash'
export default {
mixins: [interceptionMixin],
......@@ -143,7 +143,7 @@ export default {
components: {
PublishPopup,
StudyPopup,
StudyPopupContent
StudyCenterPermissionPopup
},
computed: {
payType() {
......
......@@ -109,7 +109,7 @@ export default {
nothing: false,
total: 0,
pageNum: 1,
pageSize: 9,
pageSize: 12,
scrollTop: 0,
taskList: [],
timer: null // 只需要一个定时器
......@@ -291,7 +291,7 @@ export default {
this.initCountdownFieldsForList(newList);
}
if (pageNum == 1) {
this.taskList = newList.concat(newList)
this.taskList = newList
} else {
// 合并新数据到已有数据
this.taskList = this.taskList.concat(newList)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!