Commit 12a71291 by 胡悦

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

- 在考试页面增加不限考试次数的显示逻辑
- 修改StudyPopupContent组件样式并添加取消按钮
- 优化学习中心搜索和筛选功能,重置页码并添加排序参数
- 统一多个页面的分页大小为12条
- 修复MyTask.vue中重复数据的问题
- 重命名StudyPopupContent组件为StudyCenterPermissionPopup
1 parent 833b6e0b
...@@ -87,7 +87,7 @@ export default { ...@@ -87,7 +87,7 @@ export default {
nothing: false, nothing: false,
total: 0, total: 0,
pageNum: 1, pageNum: 1,
pageSize: 9, pageSize: 12,
scrollTop: 0, scrollTop: 0,
COURSE_TYPE COURSE_TYPE
} }
......
...@@ -21,7 +21,10 @@ ...@@ -21,7 +21,10 @@
<!-- 考试次数 --> <!-- 考试次数 -->
<view class="exam-times"> <view class="exam-times">
<text class="times-value">剩余考试次数</text> <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> </view>
<!-- 最高得分 --> <!-- 最高得分 -->
...@@ -31,7 +34,7 @@ ...@@ -31,7 +34,7 @@
</view> </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> <text class="retake-text">重新考试</text>
</view> </view>
</view> </view>
......
...@@ -20,7 +20,10 @@ ...@@ -20,7 +20,10 @@
<!-- 考试次数 --> <!-- 考试次数 -->
<view class="exam-times"> <view class="exam-times">
<text class="times-value">剩余考试次数</text> <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> </view>
<!-- 最高得分 --> <!-- 最高得分 -->
...@@ -30,7 +33,7 @@ ...@@ -30,7 +33,7 @@
</view> </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> <text class="retake-text">重新考试</text>
</view> </view>
</view> </view>
......
...@@ -222,7 +222,8 @@ export default { ...@@ -222,7 +222,8 @@ export default {
], ],
currentSortValue: 0, currentSortValue: 0,
searchParams: { searchParams: {
sortType: 0 sortType: 0,
sortOrder: 'desc'
} }
} }
}, },
...@@ -293,6 +294,7 @@ export default { ...@@ -293,6 +294,7 @@ export default {
handleSearch() { handleSearch() {
console.log('搜索关键词:', this.searchKeyword) console.log('搜索关键词:', this.searchKeyword)
this.searchParams.title = this.searchKeyword this.searchParams.title = this.searchKeyword
this.$refs.allCourse.pageNum = 1
this.$refs.allCourse.getALlCourse() this.$refs.allCourse.getALlCourse()
// TODO: 调用课程列表接口,传入搜索关键词 // TODO: 调用课程列表接口,传入搜索关键词
}, },
...@@ -318,6 +320,7 @@ export default { ...@@ -318,6 +320,7 @@ export default {
this.searchParams.sortType = item.value this.searchParams.sortType = item.value
// } // }
this.searchParams.title = this.searchKeyword this.searchParams.title = this.searchKeyword
this.$refs.allCourse.pageNum = 1
this.$refs.allCourse.getALlCourse() this.$refs.allCourse.getALlCourse()
}, },
// 处理分类变化 // 处理分类变化
...@@ -325,21 +328,28 @@ export default { ...@@ -325,21 +328,28 @@ export default {
console.log('分类变化:', item, level, parent) console.log('分类变化:', item, level, parent)
this.searchParams.courseCategoryId = item.id this.searchParams.courseCategoryId = item.id
this.searchParams.title = this.searchKeyword this.searchParams.title = this.searchKeyword
this.$refs.allCourse.pageNum = 1
this.$refs.allCourse.getALlCourse() this.$refs.allCourse.getALlCourse()
// TODO: 调用课程列表接口,传入分类参数 // TODO: 调用课程列表接口,传入分类参数
}, },
// 处理筛选确认 // 处理筛选确认
handleFilterConfirm(filterData) { handleFilterConfirm(filterData) {
console.log('筛选条件:', filterData) console.log('筛选条件:', filterData)
const {planCourseType, courseFileType, totalStar} = this.searchParams const keys = ['planCourseType', 'courseFileType', 'totalStar']
if (Object.keys(filterData).length === 0) { keys.forEach(k => {
planCourseType && delete this.searchParams.planCourseType if (Object.prototype.hasOwnProperty.call(filterData, k)) {
courseFileType && delete this.searchParams.courseFileType this.searchParams[k] = filterData[k]
totalStar && delete this.searchParams.totalStar } else {
} else { delete this.searchParams[k]
this.searchParams = Object.assign(this.searchParams, filterData) }
} })
Object.keys(filterData).forEach(k => {
if (!keys.includes(k)) {
this.searchParams[k] = filterData[k]
}
})
this.searchParams.title = this.searchKeyword this.searchParams.title = this.searchKeyword
this.$refs.allCourse.pageNum = 1
this.$refs.allCourse.getALlCourse() this.$refs.allCourse.getALlCourse()
// TODO: 调用课程列表接口,传入筛选条件 // TODO: 调用课程列表接口,传入筛选条件
}, },
...@@ -416,7 +426,8 @@ export default { ...@@ -416,7 +426,8 @@ export default {
this.currentSortValue = 0 this.currentSortValue = 0
this.$refs.orderScreen.clear() this.$refs.orderScreen.clear()
this.searchParams = { this.searchParams = {
sortType: 0 sortType: 0,
sortOrder: 'desc'
} }
} }
} }
...@@ -959,4 +970,4 @@ export default { ...@@ -959,4 +970,4 @@ export default {
margin-right: toRpx(8); margin-right: toRpx(8);
} }
} }
</style>
\ No newline at end of file \ No newline at end of file
</style>
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
<!-- 学习中心 等级考试弹窗 --> <!-- 学习中心 等级考试弹窗 -->
<StudyPopup :show.sync="showStudyPopup" title="开始您的学习之旅" :topImage="require('@/assets/images/common/study-center-bg.png')" :topImageWidth="848" :topImageHeight="248"> <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> </StudyPopup>
<!-- 考试提交确认弹窗 --> <!-- 考试提交确认弹窗 -->
...@@ -322,6 +322,19 @@ export default { ...@@ -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() { async checkStudyCenterPermission() {
try { try {
......
...@@ -30,8 +30,13 @@ ...@@ -30,8 +30,13 @@
</view> </view>
<!-- 按钮 --> <!-- 按钮 -->
<view v-if="buttonText" class="action-button" @click="handleButtonClick"> <view class="button-group">
{{ buttonText }} <view class="cancel-button" @click="handleCancel">
暂不测评
</view>
<view v-if="buttonText" class="action-button" @click="handleButtonClick">
{{ buttonText }}
</view>
</view> </view>
</view> </view>
</template> </template>
...@@ -68,6 +73,9 @@ export default { ...@@ -68,6 +73,9 @@ export default {
methods: { methods: {
handleButtonClick() { handleButtonClick() {
this.$emit('button-click') this.$emit('button-click')
},
handleCancel() {
this.$emit('cancel')
} }
} }
} }
...@@ -160,9 +168,28 @@ export default { ...@@ -160,9 +168,28 @@ export default {
color: rgba(59, 115, 255, 1); 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 { .action-button {
width: toRpx(720); width: toRpx(360);
height: toRpx(80); height: toRpx(80);
border-radius: toRpx(48); border-radius: toRpx(48);
background: linear-gradient(180deg, rgba(44, 102, 247, 1) 0%, rgba(72, 166, 255, 1) 100%); 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' ...@@ -129,7 +129,7 @@ import utils from '@/utils/utils'
import { checkDailyReport, showNextModal } from '@/utils/modalUtils' import { checkDailyReport, showNextModal } from '@/utils/modalUtils'
import PublishPopup from '@/components/PublishPopup.vue' import PublishPopup from '@/components/PublishPopup.vue'
import StudyPopup from '@/components/StudyPopup.vue' import StudyPopup from '@/components/StudyPopup.vue'
import StudyPopupContent from '@/components/StudyPopupContent.vue' import StudyCenterPermissionPopup from '@/components/StudyCenterPermissionPopup.vue'
import { debounce } from 'lodash' import { debounce } from 'lodash'
export default { export default {
mixins: [interceptionMixin], mixins: [interceptionMixin],
...@@ -143,7 +143,7 @@ export default { ...@@ -143,7 +143,7 @@ export default {
components: { components: {
PublishPopup, PublishPopup,
StudyPopup, StudyPopup,
StudyPopupContent StudyCenterPermissionPopup
}, },
computed: { computed: {
payType() { payType() {
......
...@@ -109,7 +109,7 @@ export default { ...@@ -109,7 +109,7 @@ export default {
nothing: false, nothing: false,
total: 0, total: 0,
pageNum: 1, pageNum: 1,
pageSize: 9, pageSize: 12,
scrollTop: 0, scrollTop: 0,
taskList: [], taskList: [],
timer: null // 只需要一个定时器 timer: null // 只需要一个定时器
...@@ -291,7 +291,7 @@ export default { ...@@ -291,7 +291,7 @@ export default {
this.initCountdownFieldsForList(newList); this.initCountdownFieldsForList(newList);
} }
if (pageNum == 1) { if (pageNum == 1) {
this.taskList = newList.concat(newList) this.taskList = newList
} else { } else {
// 合并新数据到已有数据 // 合并新数据到已有数据
this.taskList = this.taskList.concat(newList) 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!