Commit 1c4a7e97 by 胡悦

feat(学习中心): 新增课程详情页和考试结果查询功能

重构学习中心页面,增加课程详情页路由和API接口。优化考试结果查询逻辑,添加北森SSO token验证。调整样式和布局,修复已知问题。

- 新增课程详情页和考试结果查询API
- 优化学习中心页面布局和样式
- 添加北森token验证逻辑
- 修复筛选条件和排序功能
- 更新图标资源和样式配置
1 parent 34c2de92
...@@ -537,5 +537,21 @@ module.exports = { ...@@ -537,5 +537,21 @@ module.exports = {
projectName: 'pad', projectName: 'pad',
...data ...data
}) })
} },
// 新学习中心 - 考试结果
getExamResult(data={}) {
return http.post({
method: 'dj.api.pad.learning.center.beisen.exam.result',
projectName: 'pad',
...data
})
},
// 限制录单
getLimitRecord(data={}) {
return http.post({
method: 'dj.api.pad.learning.center.study.permission',
projectName: 'pad',
...data
})
},
} }
...@@ -249,6 +249,8 @@ ...@@ -249,6 +249,8 @@
background-position: calc(100vmin * (1173 / 768) * -0.4761295822676897) calc(100vmin * (1173 / 768) * -0.19138959931798807);} background-position: calc(100vmin * (1173 / 768) * -0.4761295822676897) calc(100vmin * (1173 / 768) * -0.19138959931798807);}
.icon-pbjd-icon { width: calc(100vmin * (1173 / 768) * 0.017050298380221655); height: calc(100vmin * (1173 / 768) * 0.017050298380221655); .icon-pbjd-icon { width: calc(100vmin * (1173 / 768) * 0.017050298380221655); height: calc(100vmin * (1173 / 768) * 0.017050298380221655);
background-position: calc(100vmin * (1173 / 768) * -0.340153452685422) calc(100vmin * (1173 / 768) * -0.15601023017902813);} background-position: calc(100vmin * (1173 / 768) * -0.340153452685422) calc(100vmin * (1173 / 768) * -0.15601023017902813);}
.icon-pdf-xl { width: calc(100vmin * (1173 / 768) * 0.04774083546462063); height: calc(100vmin * (1173 / 768) * 0.04774083546462063);
background-position: calc(100vmin * (1173 / 768) * -0.1658141517476556) calc(100vmin * (1173 / 768) * -0.4825234441602728);}
.icon-pdf { width: calc(100vmin * (1173 / 768) * 0.017050298380221655); height: calc(100vmin * (1173 / 768) * 0.017050298380221655); .icon-pdf { width: calc(100vmin * (1173 / 768) * 0.017050298380221655); height: calc(100vmin * (1173 / 768) * 0.017050298380221655);
background-position: calc(100vmin * (1173 / 768) * -0.5336743393009378) calc(100vmin * (1173 / 768) * -0.38064791133844844);} background-position: calc(100vmin * (1173 / 768) * -0.5336743393009378) calc(100vmin * (1173 / 768) * -0.38064791133844844);}
.icon-pen-active { width: calc(100vmin * (1173 / 768) * 0.05115089514066496); height: calc(100vmin * (1173 / 768) * 0.05115089514066496); .icon-pen-active { width: calc(100vmin * (1173 / 768) * 0.05115089514066496); height: calc(100vmin * (1173 / 768) * 0.05115089514066496);
...@@ -260,7 +262,7 @@ ...@@ -260,7 +262,7 @@
.icon-point-active { width: calc(100vmin * (1173 / 768) * 0.04774083546462063); height: calc(100vmin * (1173 / 768) * 0.04859335038363171); .icon-point-active { width: calc(100vmin * (1173 / 768) * 0.04774083546462063); height: calc(100vmin * (1173 / 768) * 0.04859335038363171);
background-position: calc(100vmin * (1173 / 768) * -0.05754475703324808) calc(100vmin * (1173 / 768) * -0.4825234441602728);} background-position: calc(100vmin * (1173 / 768) * -0.05754475703324808) calc(100vmin * (1173 / 768) * -0.4825234441602728);}
.icon-point { width: calc(100vmin * (1173 / 768) * 0.04774083546462063); height: calc(100vmin * (1173 / 768) * 0.04774083546462063); .icon-point { width: calc(100vmin * (1173 / 768) * 0.04774083546462063); height: calc(100vmin * (1173 / 768) * 0.04774083546462063);
background-position: calc(100vmin * (1173 / 768) * -0.1658141517476556) calc(100vmin * (1173 / 768) * -0.4825234441602728);} background-position: calc(100vmin * (1173 / 768) * -0.21994884910485935) calc(100vmin * (1173 / 768) * -0.4825234441602728);}
.icon-points { width: calc(100vmin * (1173 / 768) * 0.027280477408354646); height: calc(100vmin * (1173 / 768) * 0.027280477408354646); .icon-points { width: calc(100vmin * (1173 / 768) * 0.027280477408354646); height: calc(100vmin * (1173 / 768) * 0.027280477408354646);
background-position: calc(100vmin * (1173 / 768) * -0.4514066496163683) calc(100vmin * (1173 / 768) * -0.6381074168797954);} background-position: calc(100vmin * (1173 / 768) * -0.4514066496163683) calc(100vmin * (1173 / 768) * -0.6381074168797954);}
.icon-promotion { width: calc(100vmin * (1173 / 768) * 0.020460358056265986); height: calc(100vmin * (1173 / 768) * 0.020460358056265986); .icon-promotion { width: calc(100vmin * (1173 / 768) * 0.020460358056265986); height: calc(100vmin * (1173 / 768) * 0.020460358056265986);
...@@ -300,7 +302,7 @@ ...@@ -300,7 +302,7 @@
.icon-reception-share { width: calc(100vmin * (1173 / 768) * 0.02216538789428815); height: calc(100vmin * (1173 / 768) * 0.02216538789428815); .icon-reception-share { width: calc(100vmin * (1173 / 768) * 0.02216538789428815); height: calc(100vmin * (1173 / 768) * 0.02216538789428815);
background-position: calc(100vmin * (1173 / 768) * -0.7020460358056266) calc(100vmin * (1173 / 768) * -0.05711849957374254);} background-position: calc(100vmin * (1173 / 768) * -0.7020460358056266) calc(100vmin * (1173 / 768) * -0.05711849957374254);}
.icon-record-active { width: calc(100vmin * (1173 / 768) * 0.04774083546462063); height: calc(100vmin * (1173 / 768) * 0.04774083546462063); .icon-record-active { width: calc(100vmin * (1173 / 768) * 0.04774083546462063); height: calc(100vmin * (1173 / 768) * 0.04774083546462063);
background-position: calc(100vmin * (1173 / 768) * -0.21994884910485935) calc(100vmin * (1173 / 768) * -0.4825234441602728);} background-position: calc(100vmin * (1173 / 768) * -0.27408354646206307) calc(100vmin * (1173 / 768) * -0.4825234441602728);}
.icon-record { width: calc(100vmin * (1173 / 768) * 0.0443307757885763); height: calc(100vmin * (1173 / 768) * 0.0443307757885763); .icon-record { width: calc(100vmin * (1173 / 768) * 0.0443307757885763); height: calc(100vmin * (1173 / 768) * 0.0443307757885763);
background-position: calc(100vmin * (1173 / 768) * -0.050724637681159424) calc(100vmin * (1173 / 768) * -0.5400682011935208);} background-position: calc(100vmin * (1173 / 768) * -0.050724637681159424) calc(100vmin * (1173 / 768) * -0.5400682011935208);}
.icon-revoke { width: calc(100vmin * (1173 / 768) * 0.04092071611253197); height: calc(100vmin * (1173 / 768) * 0.04092071611253197); .icon-revoke { width: calc(100vmin * (1173 / 768) * 0.04092071611253197); height: calc(100vmin * (1173 / 768) * 0.04092071611253197);
...@@ -423,5 +425,3 @@ ...@@ -423,5 +425,3 @@
background-position: calc(100vmin * (1173 / 768) * -0.18414322250639387) calc(100vmin * (1173 / 768) * -0.6751918158567775);} background-position: calc(100vmin * (1173 / 768) * -0.18414322250639387) calc(100vmin * (1173 / 768) * -0.6751918158567775);}
.icon-zj-icon { width: calc(100vmin * (1173 / 768) * 0.013640238704177323); height: calc(100vmin * (1173 / 768) * 0.013640238704177323); .icon-zj-icon { width: calc(100vmin * (1173 / 768) * 0.013640238704177323); height: calc(100vmin * (1173 / 768) * 0.013640238704177323);
background-position: calc(100vmin * (1173 / 768) * -0.1402387041773231) calc(100vmin * (1173 / 768) * -0.6986359761295823);} background-position: calc(100vmin * (1173 / 768) * -0.1402387041773231) calc(100vmin * (1173 / 768) * -0.6986359761295823);}
\ No newline at end of file \ No newline at end of file
.icon-pdf-xl { width: calc(100vmin * (1173 / 768) * 0.04774083546462063); height: calc(100vmin * (1173 / 768) * 0.04774083546462063);
background-position: calc(100vmin * (1173 / 768) * -0.27408354646206307) calc(100vmin * (1173 / 768) * -0.4825234441602728);}
\ No newline at end of file \ No newline at end of file

2.92 MB | W: | H:

2.92 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -2,24 +2,24 @@ ...@@ -2,24 +2,24 @@
<view class="exam-submit-popup-wrapper"> <view class="exam-submit-popup-wrapper">
<!-- 标题 --> <!-- 标题 -->
<view :class="['exam-title', { 'title-loading': isLoading }]">是否已提交考试</view> <view :class="['exam-title', { 'title-loading': isLoading }]">是否已提交考试</view>
<!-- 加载状态 --> <!-- 加载状态 -->
<template v-if="isLoading"> <template v-if="isLoading">
<view class="loading-text">正在查询考试结果,请稍后...</view> <view class="loading-text">正在查询考试结果,请稍后...</view>
<image <image
class="loading-gif" class="loading-gif"
:src="require('@/assets/images/common/loadding.gif')" :src="require('@/assets/images/common/loadding.gif')"
mode="aspectFit"
/> />
</template> </template>
<template v-if="showError">
<view class="error-text">未查询到考试结果,请重新确认</view>
</template>
<!-- 按钮组(始终显示) --> <!-- 按钮组(始终显示) -->
<view class="button-group"> <view class="button-group">
<view class="cancel-button" @click="handleCancel"> <view class="cancel-button" @click="handleCancel">
未提交 未提交
</view> </view>
<view class="confirm-button" @click="handleConfirm"> <view class="confirm-button" @click="handleConfirm">
确认已提交 {{ confirmText }}
</view> </view>
</view> </view>
...@@ -34,6 +34,14 @@ export default { ...@@ -34,6 +34,14 @@ export default {
isLoading: { isLoading: {
type: Boolean, type: Boolean,
default: false default: false
},
showError: {
type: Boolean,
default: false
},
confirmText: {
type: String,
default: '确认'
} }
}, },
watch: { watch: {
...@@ -48,17 +56,20 @@ export default { ...@@ -48,17 +56,20 @@ export default {
handleConfirm() { handleConfirm() {
console.log('handleConfirm clicked') console.log('handleConfirm clicked')
this.$emit('confirm') this.$emit('confirm')
} },
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.exam-submit-popup-wrapper { .exam-submit-popup-wrapper {
position: relative;
width: 100%; width: 100%;
min-height: toRpx(400);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
padding-bottom: toRpx(48);
} }
.exam-title { .exam-title {
...@@ -69,8 +80,7 @@ export default { ...@@ -69,8 +80,7 @@ export default {
font-weight: 500; font-weight: 500;
font-family: "HarmonyOSSansSC"; font-family: "HarmonyOSSansSC";
text-align: center; text-align: center;
margin-top: toRpx(96); margin-top: toRpx(48);
margin-bottom: toRpx(136);
} }
.exam-title.title-loading { .exam-title.title-loading {
...@@ -92,15 +102,21 @@ export default { ...@@ -92,15 +102,21 @@ export default {
.loading-gif { .loading-gif {
width: toRpx(64); width: toRpx(64);
height: toRpx(64); height: toRpx(64);
margin-bottom: toRpx(48); margin-bottom: toRpx(76);
}
.error-text {
color: #6c6f75;
font-size: toRpx(32);
font-weight: 400;
line-height: toRpx(48);
margin-top: toRpx(48);
} }
.button-group { .button-group {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: toRpx(16); gap: toRpx(16);
margin-bottom: toRpx(48); margin-top: auto;
} }
.cancel-button { .cancel-button {
......
...@@ -8,20 +8,22 @@ ...@@ -8,20 +8,22 @@
<view class="recommend-course-item" v-for="(item, index) in recommendCourseList" :key="index" <view class="recommend-course-item" v-for="(item, index) in recommendCourseList" :key="index"
@click="startStudy(item, index)" :style="cardWidth > 0 ? `width: ${cardWidth}rpx` : ''"> @click="startStudy(item, index)" :style="cardWidth > 0 ? `width: ${cardWidth}rpx` : ''">
<!-- 左上角:必修/选修标签 --> <!-- 左上角:必修/选修标签 -->
<image v-if="!simplified && item.required !== undefined" class="course-tag-left" <template v-if="item.planCourseType">
:src="item.required ? require('@/assets/images/studyCenter/Required.png') : require('@/assets/images/studyCenter/Elective.png')" <image class="course-tag-left"
:src="item.planCourseType == 1 ? require('@/assets/images/studyCenter/Required.png') : require('@/assets/images/studyCenter/Elective.png')"
mode="aspectFit" /> mode="aspectFit" />
</template>
<!-- 右上角:文档/视频标签 --> <!-- 右上角:文档/视频标签 -->
<view v-if="!simplified && item.courseType" class="course-tag-right"> <view class="course-tag-right" v-if="item.courseFileType">
<text class="tag-text">{{ item.courseType === 'video' ? '视频' : '文档' }}</text> <text class="tag-text">{{ COURSE_TYPE[item.courseFileType].name}}</text>
</view> </view>
<image class="recommend-course-item-img" <image class="recommend-course-item-img"
src="../../../../assets/images/common/recommend-course-default.webp" mode="scaleToFill" /> src="../../../../assets/images/common/recommend-course-default.webp" mode="scaleToFill" />
<view class="recommend-course-content"> <view class="recommend-course-content">
<view class="recommend-course-item-title"> <view class="recommend-course-item-title">
{{ item.courseName }} {{ item.title }}
</view> </view>
<view class="recommend-course-item-text"> <view class="recommend-course-item-text">
<text class="duration-value">课程时长</text> <text class="duration-value">课程时长</text>
...@@ -30,12 +32,12 @@ ...@@ -30,12 +32,12 @@
</view> </view>
<!-- 评分星星 --> <!-- 评分星星 -->
<view v-if="!simplified && item.rating !== undefined" class="course-rating"> <view v-if="item.totalStar !== undefined" class="course-rating">
<view class="star-list"> <view class="star-list">
<image v-for="star in 5" :key="star" class="star-icon" :src="getStarIcon(item.rating, star)" <image v-for="star in 5" :key="star" class="star-icon" :src="getStarIcon(item.totalStar, star)"
mode="aspectFit" /> mode="aspectFit" />
</view> </view>
<text class="rating-text">{{ item.rating }}</text> <text class="rating-text">{{ item.totalStar / 2 }}</text>
</view> </view>
<!-- 学习人数 --> <!-- 学习人数 -->
...@@ -60,6 +62,7 @@ ...@@ -60,6 +62,7 @@
</view> </view>
</template> </template>
<script> <script>
import { COURSE_TYPE } from '../../../../pages/common/studyCenter/contant'
export default { export default {
name: 'RecommendCourse', name: 'RecommendCourse',
props: { props: {
...@@ -72,6 +75,10 @@ export default { ...@@ -72,6 +75,10 @@ export default {
simplified: { simplified: {
type: Boolean, type: Boolean,
default: false default: false
},
searchParams: {
type: Object,
default: () => ({})
} }
}, },
data() { data() {
...@@ -80,8 +87,9 @@ export default { ...@@ -80,8 +87,9 @@ export default {
nothing: false, nothing: false,
total: 0, total: 0,
pageNum: 1, pageNum: 1,
pageSize: 12, pageSize: 9,
scrollTop: 0, scrollTop: 0,
COURSE_TYPE
} }
}, },
computed: { computed: {
...@@ -100,7 +108,7 @@ export default { ...@@ -100,7 +108,7 @@ export default {
methods: { methods: {
// 获取星星图标 // 获取星星图标
getStarIcon(rating, position) { getStarIcon(rating, position) {
const roundedRating = Math.round(rating * 2) / 2 // 四舍五入到0.5 const roundedRating = Math.round(rating) / 2 // 四舍五入到0.5
const diff = roundedRating - (position - 1) const diff = roundedRating - (position - 1)
if (diff >= 1) { if (diff >= 1) {
...@@ -120,11 +128,13 @@ export default { ...@@ -120,11 +128,13 @@ export default {
uni.showLoading({ uni.showLoading({
mask: true mask: true
}) })
const { pageNum, pageSize } = this const { pageNum, pageSize, searchParams } = this
console.log(searchParams, 'searchParams')
const params = { const params = {
staffPhone: uni.$storage.get('userInfo').phone, // 推荐状态 0=无推荐 1=推荐课程 staffPhone: uni.$storage.get('userInfo').phone, // 推荐状态 0=无推荐 1=推荐课程
pageNum, pageNum,
pageSize pageSize,
...searchParams
} }
const res = await uni.$api.commonApi.getALlCourse(params) const res = await uni.$api.commonApi.getALlCourse(params)
console.log(res, '全部课程') console.log(res, '全部课程')
...@@ -164,10 +174,18 @@ export default { ...@@ -164,10 +174,18 @@ export default {
} }
}, },
startStudy(item, index) { startStudy(item, index) {
const beisenToken = uni.$storage.get('beisenToken')
if (!beisenToken) {
uni.showToast({
title: '培训账号未创建',
icon: 'none'
})
return
}
let { pageNum, total, nothing = 'nothing', pageSize } = this; let { pageNum, total, nothing = 'nothing', pageSize } = this;
uni.$track.add({ eventCode: 'app_recommend_course', businessId: item.id, pagePath: '/pages/equity/index' }) // uni.$track.add({ eventCode: 'app_recommend_course', businessId: item.id, pagePath: '/pages/equity/index' })
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/studyDetail/detail?type=recommendation&index=${index}&recommendCourseList=${encodeURIComponent(JSON.stringify(this.recommendCourseList))}&pageNum=${pageNum}&pageSize=${pageSize}&total=${total}` url: `/pages/common/studyCenter/courseDetail?apiType=getALlCourse&index=${index}&courseList=${encodeURIComponent(JSON.stringify(this.recommendCourseList))}&pageNum=${pageNum}&pageSize=${pageSize}&total=${total}`
}) })
}, },
async asyncfindBeiSenSSOToken() { async asyncfindBeiSenSSOToken() {
......
...@@ -27,11 +27,11 @@ ...@@ -27,11 +27,11 @@
<!-- 最高得分 --> <!-- 最高得分 -->
<view class="exam-score"> <view class="exam-score">
<text class="score-label">最高得分</text> <text class="score-label">最高得分</text>
<text class="score-value failed">{{ filterValue(item.highestScore, '分') }}|未通过</text> <text class="score-value failed">{{ filterValue(item.maxTotalScore, '分') }}|未通过</text>
</view> </view>
<!-- 重新考试按钮 --> <!-- 重新考试按钮 -->
<view v-if="item.remainingTimes > 0" class="retake-btn" @click.stop="retakeExam(item)"> <view v-if="item.remainingTimes > 0" class="retake-btn">
<text class="retake-text">重新考试</text> <text class="retake-text">重新考试</text>
</view> </view>
</view> </view>
...@@ -48,11 +48,32 @@ ...@@ -48,11 +48,32 @@
<view class="end-text">到底了!</view> <view class="end-text">到底了!</view>
</template> </template>
</scroll-view> </scroll-view>
<!-- 考试提交确认弹窗 -->
<StudyPopup
:show.sync="showExamPopup"
title=""
:width="848"
:closeButton="true"
:height="examPopInfo.isExamLoading ? 740 : 656"
:topImage="require('@/assets/images/common/warning-notice.png')"
:topImageWidth="848"
:topImageHeight="248"
>
<ExamSubmitPopup
:isLoading="examPopInfo.isExamLoading"
:showError="examPopInfo.showError"
:confirmText="examPopInfo.confirmText"
@cancel="handleExamCancel"
@confirm="handleExamConfirm"
/>
</StudyPopup>
</view> </view>
</template> </template>
<script> <script>
import utils from '@/utils/utils' import utils from '@/utils/utils'
import StudyPopup from '../../../StudyPopup.vue'
import ExamSubmitPopup from '../../../ExamSubmitPopup.vue'
export default { export default {
name: 'FailedExam', name: 'FailedExam',
props: { props: {
...@@ -61,6 +82,10 @@ export default { ...@@ -61,6 +82,10 @@ export default {
default: 0 default: 0
} }
}, },
components: {
StudyPopup,
ExamSubmitPopup
},
data() { data() {
return { return {
examList: [], examList: [],
...@@ -69,6 +94,13 @@ export default { ...@@ -69,6 +94,13 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 12, pageSize: 12,
scrollTop: 0, scrollTop: 0,
showExamPopup: false,
examPopInfo: {
isExamLoading: false,
showError: false,
confirmText: '确认提交'
},
currentExam: {}
} }
}, },
computed: { computed: {
...@@ -96,7 +128,7 @@ export default { ...@@ -96,7 +128,7 @@ export default {
}) })
const { pageNum, pageSize } = this const { pageNum, pageSize } = this
const params = { const params = {
examResult: 2, // 不通过 examResult: 2, // 2不通过
pageNum, pageNum,
pageSize, pageSize,
staffPhone: uni.$storage.get('userInfo').phone staffPhone: uni.$storage.get('userInfo').phone
...@@ -105,7 +137,7 @@ export default { ...@@ -105,7 +137,7 @@ export default {
const res = await uni.$api.commonApi.getExamPage(params) const res = await uni.$api.commonApi.getExamPage(params)
console.log(res) console.log(res)
if (pageNum == 1) { if (pageNum == 1) {
this.examList = res.list.concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list) this.examList = res.list
} else { } else {
this.examList = this.examList.concat(res.list) this.examList = this.examList.concat(res.list)
} }
...@@ -126,13 +158,95 @@ export default { ...@@ -126,13 +158,95 @@ export default {
this.pageNum++ this.pageNum++
this.getExamList() this.getExamList()
}, },
viewExam(item) { // 跳转北森考试详情页
async viewExam(item) {
console.log('查看考试', item) console.log('查看考试', item)
if (item.remainingTimes <= 0) return
// TODO: 跳转到考试详情页 // TODO: 跳转到考试详情页
this.showStudyPopup = false
this.currentExam = item
try {
// 获取北森 token
uni.showLoading({ title: '加载中...' })
const token = await this.findBeiSenSSOToken()
// const token = uni.$storage.get('beisenToken')
console.log('🔑 获取到的 token:', token)
uni.hideLoading()
if (token) {
// const COURSE_ID = 'c6d20419-fae9-4d35-a1d1-bd2b35c0c619';
const baseUrl = 'https://cloud.italent.cn/PageHome/Index';
const params = {
product: 'Learning',
keyName: 'Nusion',
pageCode: 'LearningExamTraineePage',
appCode: 'Learning',
examId: item.examination
};
const queryString = Object.entries(params)
.map(([key, value]) => `${key}=${value}`)
.join('&');
const tokenUrl = this.tokenUrl || uni.$storage.get('beisenToken')
// this.setWebviewStyle()
const url = encodeURIComponent(`${baseUrl}?${queryString}#/viewDynamic?1=1`);
this.jumpUrl = `${tokenUrl}&return_url=${url}`;
uni.navigateTo({
url: `/pages/common/studyWebview?url=${encodeURIComponent(this.jumpUrl)}&pageTitle=学习测评`
})
} else {
throw new Error('获取 token 失败')
}
} catch (error) {
uni.hideLoading()
console.error('❌ 获取 token 失败:', error)
uni.showToast({
title: '培训账号未创建',
icon: 'none'
})
}
},
// 获取北森 SSO Token(参考 detail.vue 的方法)
findBeiSenSSOToken() {
return new Promise((resolve, reject) => {
uni.$api.commonApi.findBeiSenSSOToken({}).then(res => {
uni.$storage.set('beisenToken', res.data)
resolve(res.data || '')
}).catch(err => {
reject(err)
})
})
},
// 处理考试确认(用户选择已提交)
async handleExamConfirm() {
console.log('确认提交考试:', this.currentExam)
this.examPopInfo.isExamLoading = true
this.examPopInfo.showError = false
const { examination } = this.currentExam
try {
const params = {
examId: examination,
invokeType: 1 // 0:等级考试 1:课后考试
}
// TODO: 这里后续调用后端查询接口
const result = await uni.$api.commonApi.getExamResult(params)
console.log('查询到的考试结果:', result)
// 查询完成后关闭弹窗
this.examPopInfo.isExamLoading = false
console.log('查询完成,关闭弹窗')
this.showExamPopup = false
if (result) {
// 查询成功刷新考试列表
this.pageNum = 1
this.getExamList()
}
} catch (error) {
uni.showToast({
title: '未查询到考试结果',
icon: 'none'
})
}
}, },
retakeExam(item) { handleExamCancel() {
console.log('重新考试', item) this.showExamPopup = false
// TODO: 跳转到考试页面
} }
} }
} }
......
...@@ -26,11 +26,11 @@ ...@@ -26,11 +26,11 @@
<!-- 最高得分 --> <!-- 最高得分 -->
<view class="exam-score"> <view class="exam-score">
<text class="score-label">最高得分</text> <text class="score-label">最高得分</text>
<text class="score-value passed">{{ filterValue(item.highestScore, '分') }}|已通过</text> <text class="score-value passed">{{ filterValue(item.maxTotalScore, '分') }}|已通过</text>
</view> </view>
<!-- 重新考试按钮 --> <!-- 重新考试按钮 -->
<view class="retake-btn" @click.stop="retakeExam(item)"> <view v-if="item.remainingTimes > 0" class="retake-btn">
<text class="retake-text">重新考试</text> <text class="retake-text">重新考试</text>
</view> </view>
</view> </view>
...@@ -47,11 +47,33 @@ ...@@ -47,11 +47,33 @@
<view class="end-text">到底了!</view> <view class="end-text">到底了!</view>
</template> </template>
</scroll-view> </scroll-view>
<!-- 考试提交确认弹窗 -->
<StudyPopup
:show.sync="showExamPopup"
title=""
:width="848"
:closeButton="true"
:height="examPopInfo.isExamLoading ? 740 : 656"
:topImage="require('@/assets/images/common/warning-notice.png')"
:topImageWidth="848"
:topImageHeight="248"
>
<ExamSubmitPopup
:isLoading="examPopInfo.isExamLoading"
:showError="examPopInfo.showError"
:confirmText="examPopInfo.confirmText"
@cancel="handleExamCancel"
@confirm="handleExamConfirm"
/>
</StudyPopup>
</view> </view>
</template> </template>
<script> <script>
import utils from '@/utils/utils' import utils from '@/utils/utils'
import StudyPopup from '../../../StudyPopup.vue'
import ExamSubmitPopup from '../../../ExamSubmitPopup.vue'
export default { export default {
name: 'PassedExam', name: 'PassedExam',
props: { props: {
...@@ -60,6 +82,10 @@ export default { ...@@ -60,6 +82,10 @@ export default {
default: 0 default: 0
} }
}, },
components: {
StudyPopup,
ExamSubmitPopup
},
data() { data() {
return { return {
examList: [], examList: [],
...@@ -68,6 +94,13 @@ export default { ...@@ -68,6 +94,13 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 12, pageSize: 12,
scrollTop: 0, scrollTop: 0,
showExamPopup: false,
examPopInfo: {
isExamLoading: false,
showError: false,
confirmText: '确认提交'
},
currentExam: {}
} }
}, },
computed: { computed: {
...@@ -87,6 +120,7 @@ export default { ...@@ -87,6 +120,7 @@ export default {
filterValue(val, unit) { filterValue(val, unit) {
return utils.filterValue(val, unit) return utils.filterValue(val, unit)
}, },
// 获取考试列表
async getExamList() { async getExamList() {
console.log(11) console.log(11)
try { try {
...@@ -95,7 +129,7 @@ export default { ...@@ -95,7 +129,7 @@ export default {
}) })
const { pageNum, pageSize } = this const { pageNum, pageSize } = this
const params = { const params = {
examResult: 1, // 已通过 examResult: 1, // 1已通过
pageNum, pageNum,
pageSize, pageSize,
staffPhone: uni.$storage.get('userInfo').phone staffPhone: uni.$storage.get('userInfo').phone
...@@ -104,7 +138,7 @@ export default { ...@@ -104,7 +138,7 @@ export default {
const res = await uni.$api.commonApi.getExamPage(params) const res = await uni.$api.commonApi.getExamPage(params)
console.log(res) console.log(res)
if (pageNum == 1) { if (pageNum == 1) {
this.examList = res.list.concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list).concat(res.list) this.examList = res.list
} else { } else {
this.examList = this.examList.concat(res.list) this.examList = this.examList.concat(res.list)
} }
...@@ -116,6 +150,7 @@ export default { ...@@ -116,6 +150,7 @@ export default {
uni.hideLoading() uni.hideLoading()
} }
}, },
// 到底了
pageonReachBottom() { pageonReachBottom() {
if (this.nothing) return if (this.nothing) return
if (this.examList.length >= this.total && this.pageNum > 1) { if (this.examList.length >= this.total && this.pageNum > 1) {
...@@ -125,13 +160,95 @@ export default { ...@@ -125,13 +160,95 @@ export default {
this.pageNum++ this.pageNum++
this.getExamList() this.getExamList()
}, },
viewExam(item) { // 跳转北森考试详情页
async viewExam(item) {
console.log('查看考试', item) console.log('查看考试', item)
if (item.remainingTimes <= 0) return
// TODO: 跳转到考试详情页 // TODO: 跳转到考试详情页
this.showStudyPopup = false
this.currentExam = item
try {
// 获取北森 token
uni.showLoading({ title: '加载中...' })
const token = await this.findBeiSenSSOToken()
// const token = uni.$storage.get('beisenToken')
console.log('🔑 获取到的 token:', token)
uni.hideLoading()
if (token) {
// const COURSE_ID = 'c6d20419-fae9-4d35-a1d1-bd2b35c0c619';
const baseUrl = 'https://cloud.italent.cn/PageHome/Index';
const params = {
product: 'Learning',
keyName: 'Nusion',
pageCode: 'LearningExamTraineePage',
appCode: 'Learning',
examId: item.examination
};
const queryString = Object.entries(params)
.map(([key, value]) => `${key}=${value}`)
.join('&');
const tokenUrl = this.tokenUrl || uni.$storage.get('beisenToken')
// this.setWebviewStyle()
const url = encodeURIComponent(`${baseUrl}?${queryString}#/viewDynamic?1=1`);
this.jumpUrl = `${tokenUrl}&return_url=${url}`;
uni.navigateTo({
url: `/pages/common/studyWebview?url=${encodeURIComponent(this.jumpUrl)}&pageTitle=学习测评`
})
} else {
throw new Error('获取 token 失败')
}
} catch (error) {
uni.hideLoading()
console.error('❌ 获取 token 失败:', error)
uni.showToast({
title: '培训账号未创建',
icon: 'none'
})
}
},
// 获取北森 SSO Token(参考 detail.vue 的方法)
findBeiSenSSOToken() {
return new Promise((resolve, reject) => {
uni.$api.commonApi.findBeiSenSSOToken({}).then(res => {
uni.$storage.set('beisenToken', res.data)
resolve(res.data || '')
}).catch(err => {
reject(err)
})
})
},
// 处理考试确认(用户选择已提交)
async handleExamConfirm() {
console.log('确认提交考试:', this.currentExam)
this.examPopInfo.isExamLoading = true
this.examPopInfo.showError = false
const { examination } = this.currentExam
try {
const params = {
examId: examination,
invokeType: 1 // 0:等级考试 1:课后考试
}
// TODO: 这里后续调用后端查询接口
const result = await uni.$api.commonApi.getExamResult(params)
console.log('查询到的考试结果:', result)
// 查询完成后关闭弹窗
this.examPopInfo.isExamLoading = false
console.log('查询完成,关闭弹窗')
this.showExamPopup = false
if (result) {
// 查询成功刷新考试列表
this.pageNum = 1
this.getExamList()
}
} catch (error) {
uni.showToast({
title: '未查询到考试结果',
icon: 'none'
})
}
}, },
retakeExam(item) { handleExamCancel() {
console.log('重新考试', item) this.showExamPopup = false
// TODO: 跳转到考试页面
} }
} }
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
class="task-list-box"> class="task-list-box">
<template v-if="taskList.length"> <template v-if="taskList.length">
<view class="task-list"> <view class="task-list">
<view class="task-item" v-for="(item, index) in taskList" :key="index" @click="handleTaskItemClick(item)"> <view class="task-item" v-for="(item, index) in taskList" :key="index" @click="handleTaskItemClick(item, index)">
<!-- <view class="time-limit-tag"></view> --> <!-- <view class="time-limit-tag"></view> -->
<!-- 左上角:必修/选修标签 --> <!-- 左上角:必修/选修标签 -->
<template v-if="item.planCourseType"> <template v-if="item.planCourseType">
...@@ -52,36 +52,8 @@ ...@@ -52,36 +52,8 @@
</view> </view>
</template> </template>
<script> <script>
const COURSE_TYPE = {
10: { import { COURSE_TYPE } from '../../../../pages/common/studyCenter/contant'
name: '视频',
image: 'short-course-default'
},
80: {
name: '音频',
image: 'course-default-bg'
},
20: {
name: '混合',
image: 'short-course-default'
},
30: {
name: '文档',
image: 'course-default-bg'
},
40: {
name: 'H5',
image: 'course-default-bg'
},
70: {
name: 'URL',
image: 'course-default-bg'
},
120: {
name: '图文',
image: 'course-default-bg'
}
}
import dayjs from 'dayjs' import dayjs from 'dayjs'
export default { export default {
name: 'MyTask', name: 'MyTask',
...@@ -99,6 +71,7 @@ export default { ...@@ -99,6 +71,7 @@ export default {
}, },
mounted() { mounted() {
this.getCourseTaskPage(this.tabIndex) this.getCourseTaskPage(this.tabIndex)
this.asyncfindBeiSenSSOToken()
}, },
beforeDestroy() { beforeDestroy() {
// 移除事件监听,防止内存泄漏 // 移除事件监听,防止内存泄漏
...@@ -154,19 +127,36 @@ export default { ...@@ -154,19 +127,36 @@ export default {
this.nothing = true; this.nothing = true;
} }
}, },
handleTaskItemClick(item) { handleTaskItemClick(item, index) {
console.log(item) console.log(item)
}, const beisenToken = uni.$storage.get('beisenToken')
findBeiSenSSOToken() { if (!beisenToken) {
return new Promise(resolve => { uni.showToast({
const url = 'https%3A%2F%2Fcloud.italent.cn%2FPageHome%2FIndex%3Fproduct%3DLearning%26keyName%3DNusion%26pageCode%3DLearningNewHomepage%26appCode%3DLearning%26_qsrcapp%3DLearning%26_qrt%3Dhtml%26quark_s%3D5102bff371c00da5b19968ee53a8c3f1499ecd2447a19f72f3e3ba2390cc9617%23%2FviewDynamic%3Fshadow_context%3D%257BappModel%253A%2522italent%2522%252Cuppid%253A%25221%2522%257D%26quark_s%3D028930f1066f8ef8d28790940d53ae64337f44bde3a44cf89a290e4a3611e3e2' title: '培训账号未创建',
uni.$api.commonApi.findBeiSenSSOToken({}).then(res => { icon: 'none'
uni.$storage.set('beisenToken', res.data)
const studyUrl = res.data ? `${res.data}&return_url=${url}` : ''
resolve(studyUrl)
}) })
return
}
let { pageNum, total, nothing = 'nothing', pageSize } = this;
// uni.$track.add({ eventCode: 'app_recommend_course', businessId: item.id, pagePath: '/pages/equity/index' })
uni.navigateTo({
url: `/pages/common/studyCenter/courseDetail?apiType=getMyCourseList&index=${index}&courseList=${encodeURIComponent(JSON.stringify(this.taskList))}&pageNum=${pageNum}&pageSize=${pageSize}&total=${total}&learnStatus=1`
}) })
}, },
async asyncfindBeiSenSSOToken() {
const res = await uni.$api.commonApi.findBeiSenSSOToken({})
uni.$storage.set('beisenToken', res.data)
},
// findBeiSenSSOToken() {
// return new Promise(resolve => {
// const url = 'https%3A%2F%2Fcloud.italent.cn%2FPageHome%2FIndex%3Fproduct%3DLearning%26keyName%3DNusion%26pageCode%3DLearningNewHomepage%26appCode%3DLearning%26_qsrcapp%3DLearning%26_qrt%3Dhtml%26quark_s%3D5102bff371c00da5b19968ee53a8c3f1499ecd2447a19f72f3e3ba2390cc9617%23%2FviewDynamic%3Fshadow_context%3D%257BappModel%253A%2522italent%2522%252Cuppid%253A%25221%2522%257D%26quark_s%3D028930f1066f8ef8d28790940d53ae64337f44bde3a44cf89a290e4a3611e3e2'
// uni.$api.commonApi.findBeiSenSSOToken({}).then(res => {
// uni.$storage.set('beisenToken', res.data)
// const studyUrl = res.data ? `${res.data}&return_url=${url}` : ''
// resolve(studyUrl)
// })
// })
// },
} }
} }
</script> </script>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
red: dataInfo.monHourRatio > 0, red: dataInfo.monHourRatio > 0,
green: dataInfo.monHourRatio < 0, green: dataInfo.monHourRatio < 0,
normal: dataInfo.monHourRatio === 0 normal: dataInfo.monHourRatio === 0
}">{{ dataInfo.monHourRatio == null ? '-' : dataInfo.monHourRatio + '%' }}</text> }">{{ dataInfo.monHourRatio == null ? '-' : Math.abs(dataInfo.monHourRatio) + '%' }}</text>
<template v-if="dataInfo.monHourRatio != null"> <template v-if="dataInfo.monHourRatio != null">
<view v-if="dataInfo.monHourRatio > 0" class="sprite-icon icon-up-arrow"></view> <view v-if="dataInfo.monHourRatio > 0" class="sprite-icon icon-up-arrow"></view>
<view v-else-if="dataInfo.monHourRatio < 0" class="sprite-icon icon-green-arrow"></view> <view v-else-if="dataInfo.monHourRatio < 0" class="sprite-icon icon-green-arrow"></view>
...@@ -81,13 +81,13 @@ ...@@ -81,13 +81,13 @@
<!-- 搜索框 --> <!-- 搜索框 -->
<view class="search-container"> <view class="search-container">
<view class="search-box" @click="focusSearch"> <view class="search-box" @click="focusSearch">
<view v-if="!searchKeyword" class="search-placeholder-wrapper"> <view v-show="!searchKeyword" class="search-placeholder-wrapper">
<uni-icons type="search" size="20" color="#999ea8" class="search-icon"></uni-icons>
<text class="placeholder-text">搜索课程</text> <text class="placeholder-text">搜索课程</text>
<uni-icons type="search" size="20" color="#999ea8" class="search-icon"></uni-icons>
</view> </view>
<input ref="searchInput" class="search-input" v-model="searchKeyword" placeholder="" confirm-type="search" <input ref="searchInput" class="search-input" v-model="searchKeyword" placeholder="" confirm-type="search"
@confirm="handleSearch" /> @confirm="handleSearch" />
<view class="clear-btn" @click.stop="clearSearch" v-if="searchKeyword"> <view class="clear-btn" @click.stop="clearSearch" v-show="searchKeyword">
<uni-icons type="closeempty" size="16" color="#999ea8"></uni-icons> <uni-icons type="closeempty" size="16" color="#999ea8"></uni-icons>
</view> </view>
</view> </view>
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
<view class="sprite-icon icon-study-tips"></view> <view class="sprite-icon icon-study-tips"></view>
<view class="tips-text">本周学习时长X小时,超过X%的人</view> <view class="tips-text">本周学习时长X小时,超过X%的人</view>
</view> --> </view> -->
<Course ref="recommendCourse" /> <Course ref="allCourse" :searchParams="searchParams" />
</template> </template>
</view> </view>
</view> </view>
...@@ -194,10 +194,10 @@ export default { ...@@ -194,10 +194,10 @@ export default {
}, },
courseConfig: courseConfig, // 课程筛选配置 courseConfig: courseConfig, // 课程筛选配置
sortOptions: [ sortOptions: [
{ label: '综合排序', value: 'default' }, // { label: '综合排序', value: 'default' },
{ label: '最多人学', value: 'popular' }, { label: '最多人学', value: 0 },
{ label: '最高评分', value: 'rating' }, { label: '最高评分', value: 1 },
{ label: '最新发布', value: 'latest' } { label: '最新发布', value: 2 }
], ],
categoryOptions: [ categoryOptions: [
{ {
...@@ -223,7 +223,10 @@ export default { ...@@ -223,7 +223,10 @@ export default {
] ]
} }
], ],
currentSortValue: 'default', currentSortValue: 0,
searchParams: {
sortType: 0
}
} }
}, },
created() { created() {
...@@ -264,7 +267,7 @@ export default { ...@@ -264,7 +267,7 @@ export default {
const res = await uni.$api.commonApi.getStudyCenterTimeStatistics({ const res = await uni.$api.commonApi.getStudyCenterTimeStatistics({
staffPhone: uni.$storage.get('userInfo').phone staffPhone: uni.$storage.get('userInfo').phone
}) })
console.log(res, 'res') console.log(res, 'getMyStudyTime')
if (res) { if (res) {
this.dataInfo = res || {} this.dataInfo = res || {}
} }
...@@ -284,7 +287,10 @@ export default { ...@@ -284,7 +287,10 @@ export default {
...((item.children && Array.isArray(item.children)) ? item.children : []) ...((item.children && Array.isArray(item.children)) ? item.children : [])
] ]
})) }))
this.categoryOptions = filtered this.categoryOptions = [
{ categoryName: '全部分类', children: [{ categoryName: '全部' }] },
...filtered
]
} }
}, },
// 聚焦搜索框 // 聚焦搜索框
...@@ -294,31 +300,55 @@ export default { ...@@ -294,31 +300,55 @@ export default {
// 处理搜索 // 处理搜索
handleSearch() { handleSearch() {
console.log('搜索关键词:', this.searchKeyword) console.log('搜索关键词:', this.searchKeyword)
this.searchParams.title = this.searchKeyword
this.$refs.allCourse.getALlCourse()
// TODO: 调用课程列表接口,传入搜索关键词 // TODO: 调用课程列表接口,传入搜索关键词
}, },
// 清空搜索 // 清空搜索
clearSearch() { clearSearch() {
this.searchKeyword = '' this.searchKeyword = ''
delete this.searchParams.title
this.handleSearch() this.handleSearch()
}, },
// 打开筛选弹窗 // 打开筛选弹窗
openFilter() { openFilter() {
this.$refs.orderScreen.open() this.$refs.orderScreen.open()
}, },
// 处理排序变化 // 处理排序变化 综合排序、最多人学、最高评分、最新发布
handleSortChange({ item, index }) { handleSortChange({ item, index }) {
console.log('排序变化:', item, index) console.log('排序变化:', item, index)
this.currentSortValue = item.value this.currentSortValue = item.value
// TODO: 调用课程列表接口,传入排序参数 // TODO: 调用课程列表接口,传入排序参数
// if (item.value == 'default') {
// // 综合排序不用传参数
// delete this.searchParams.sortType
// } else {
this.searchParams.sortType = item.value
// }
this.searchParams.title = this.searchKeyword
this.$refs.allCourse.getALlCourse()
}, },
// 处理分类变化 // 处理分类变化
handleCategoryChange({ item, level, parent }) { handleCategoryChange({ item, level, parent }) {
console.log('分类变化:', item, level, parent) console.log('分类变化:', item, level, parent)
this.searchParams.courseCategoryId = item.id
this.searchParams.title = this.searchKeyword
this.$refs.allCourse.getALlCourse()
// TODO: 调用课程列表接口,传入分类参数 // TODO: 调用课程列表接口,传入分类参数
}, },
// 处理筛选确认 // 处理筛选确认
handleFilterConfirm(filterData) { handleFilterConfirm(filterData) {
console.log('筛选条件:', 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)
}
this.searchParams.title = this.searchKeyword
this.$refs.allCourse.getALlCourse()
// TODO: 调用课程列表接口,传入筛选条件 // TODO: 调用课程列表接口,传入筛选条件
}, },
// 跳转到我的课程 // 跳转到我的课程
......
...@@ -162,23 +162,25 @@ ...@@ -162,23 +162,25 @@
v-if="showBeisen" v-if="showBeisen"
></web-view> --> ></web-view> -->
<!-- 学习中心弹窗 --> <!-- 学习中心 等级考试弹窗 -->
<StudyPopup <StudyPopup
:show.sync="showStudyPopup" :show.sync="showStudyPopup"
title="开始学习学之旅" title="开始您的学习之旅"
:topImage="require('@/assets/images/common/study-center-bg.webp')" :topImage="require('@/assets/images/common/study-center-bg.webp')"
:topImageWidth="848"
:topImageHeight="248"
> >
<StudyPopupContent <StudyPopupContent
cardTitle="个性化学习路径" cardTitle="个性化学习路径"
description="根据你的岗位和考卷,我们打造针对性的学习课程内容,帮助你循序渐进,实现快速通关" description="根据您当前的学习情况,我们将为您定制专属的学习计划,帮助您高效提升技能,实现职业突破。"
:listItems="[ :listItems="[
'基于当前岗位定制课程', '基于当前能力水平评估',
'根据你的发展规划匹配你的学习', '结合岗位发展目标制定',
'定期推送学习提醒与激励' '定期跟踪学习进度和效果'
]" ]"
tipText="true" tipText="true"
courseName="XXX" :courseName="courseInfo.title"
buttonText="开始学习" buttonText="开始测评"
@button-click="handleStartAssessment" @button-click="handleStartAssessment"
/> />
</StudyPopup> </StudyPopup>
...@@ -188,13 +190,15 @@ ...@@ -188,13 +190,15 @@
:show.sync="showExamPopup" :show.sync="showExamPopup"
title="" title=""
:width="848" :width="848"
:height="isExamLoading ? 740 : 656" :height="examPopInfo.isExamLoading ? 740 : 656"
:topImage="require('@/assets/images/common/warning-notice.png')" :topImage="require('@/assets/images/common/warning-notice.png')"
:topImageWidth="848" :topImageWidth="848"
:topImageHeight="248" :topImageHeight="248"
> >
<ExamSubmitPopup <ExamSubmitPopup
:isLoading="isExamLoading" :isLoading="examPopInfo.isExamLoading"
:showError="examPopInfo.showError"
:confirmText="examPopInfo.confirmText"
@cancel="handleExamCancel" @cancel="handleExamCancel"
@confirm="handleExamConfirm" @confirm="handleExamConfirm"
/> />
...@@ -289,8 +293,15 @@ export default { ...@@ -289,8 +293,15 @@ export default {
previewOff: false, previewOff: false,
showStudyPopup: false, showStudyPopup: false,
showExamPopup: false, showExamPopup: false,
examPopInfo: {
isExamLoading: false, isExamLoading: false,
showStudyPermissionPopup: false showError: false,
confirmText: '确认已提交'
},
showStudyPermissionPopup: false,
courseInfo: {
title: ''
}
} }
}, },
created() { created() {
...@@ -335,29 +346,31 @@ export default { ...@@ -335,29 +346,31 @@ export default {
// 处理开始测评(参考 detail.vue 的实现) // 处理开始测评(参考 detail.vue 的实现)
async handleStartAssessment() { async handleStartAssessment() {
this.showStudyPopup = false this.showStudyPopup = false
try { try {
// 获取北森 token // 获取北森 token
uni.showLoading({ title: '加载中...' }) uni.showLoading({ title: '加载中...' })
const token = await this.findBeiSenSSOToken() const token = await this.findBeiSenSSOToken()
console.log('🔑 获取到的 token:', token) console.log('🔑 获取到的 token:', token)
uni.hideLoading() uni.hideLoading()
if (token) { if (token) {
// 将目标 URL 编码 // const COURSE_ID = 'c6d20419-fae9-4d35-a1d1-bd2b35c0c619';
const targetUrl = 'https://cloud.italent.cn/PageHome/Index?product=Learning&keyName=Nusion&pageCode=LearningExamList&appCode=Learning#/viewDynamic' const baseUrl = 'https://cloud.italent.cn/PageHome/Index';
const params = {
console.log('🎯 目标 URL:', targetUrl) product: 'Learning',
keyName: 'Nusion',
const encodedUrl = encodeURIComponent(targetUrl) pageCode: 'LearningExamTraineePage',
console.log('📝 编码后的 URL:', encodedUrl) appCode: 'Learning',
examId: this.courseInfo.examId
// 拼接完整 URL:token&return_url=编码后的目标URL };
const fullUrl = `${token}&return_url=${encodedUrl}` const queryString = Object.entries(params)
console.log('✅ 完整拼接的 URL (直接传递给 webview):', fullUrl) .map(([key, value]) => `${key}=${value}`)
.join('&');
const tokenUrl = this.tokenUrl || uni.$storage.get('beisenToken')
// this.setWebviewStyle()
const url = encodeURIComponent(`${baseUrl}?${queryString}#/viewDynamic?1=1`);
this.jumpUrl = `${tokenUrl}&return_url=${url}`;
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/studyWebview?url=${encodeURIComponent(fullUrl)}&pageTitle=学习测评` url: `/pages/common/studyWebview?url=${encodeURIComponent(this.jumpUrl)}&pageTitle=学习测评`
}) })
} else { } else {
throw new Error('获取 token 失败') throw new Error('获取 token 失败')
...@@ -365,10 +378,10 @@ export default { ...@@ -365,10 +378,10 @@ export default {
} catch (error) { } catch (error) {
uni.hideLoading() uni.hideLoading()
console.error('❌ 获取 token 失败:', error) console.error('❌ 获取 token 失败:', error)
uni.showToast({ // uni.showToast({
title: '获取授权失败,请重试', // title: '获取授权失败,请重试',
icon: 'none' // icon: 'none'
}) // })
} }
}, },
// 获取北森 SSO Token(参考 detail.vue 的方法) // 获取北森 SSO Token(参考 detail.vue 的方法)
...@@ -385,6 +398,12 @@ export default { ...@@ -385,6 +398,12 @@ export default {
// 处理考试取消(用户选择未提交) // 处理考试取消(用户选择未提交)
handleExamCancel() { handleExamCancel() {
this.showExamPopup = false this.showExamPopup = false
this.examPopInfo = {
isExamLoading: false,
showError: false,
confirmText: '确认已提交'
}
this.getLevelExamInfo()
}, },
handleStudyPermissionConfirm() { handleStudyPermissionConfirm() {
this.showStudyPermissionPopup = false this.showStudyPermissionPopup = false
...@@ -434,25 +453,39 @@ export default { ...@@ -434,25 +453,39 @@ export default {
}, },
// 处理考试确认(用户选择已提交) // 处理考试确认(用户选择已提交)
async handleExamConfirm() { async handleExamConfirm() {
console.log('handleExamConfirm 执行开始') this.examPopInfo.isExamLoading = true
this.isExamLoading = true this.examPopInfo.showError = false
console.log('isExamLoading 设置为 true:', this.isExamLoading) const { examId, levelExamId } = this.courseInfo
try { try {
const params = {
examId,
invokeType: 0,
levelExamId
}
// TODO: 这里后续调用后端查询接口 // TODO: 这里后续调用后端查询接口
// const result = await uni.$api.commonApi.checkExamResult({...}) const result = await uni.$api.commonApi.getExamResult(params)
console.log('查询到的考试结果:', result)
// 模拟延迟 // 模拟延迟
await new Promise(resolve => setTimeout(resolve, 2000)) // await new Promise(resolve => setTimeout(resolve, 2000))
if (result) {
// 查询完成后关闭弹窗 // 查询完成后关闭弹窗
this.isExamLoading = false this.examPopInfo.isExamLoading = false
console.log('查询完成,关闭弹窗') console.log('查询完成,关闭弹窗')
this.showExamPopup = false this.showExamPopup = false
this.getLevelExamInfo()
// 关闭后刷新学习中心的学习时长
if (this.$refs.pointRef && typeof this.$refs.pointRef.getMyStudyTime === 'function') {
this.$refs.pointRef.getMyStudyTime()
}
} else {
this.examPopInfo.isExamLoading = false
this.examPopInfo.showError = true
this.examPopInfo.confirmText = '重新确认'
}
} catch (error) { } catch (error) {
console.error('查询考试结果失败:', error) console.error('查询考试结果失败:', error)
this.isExamLoading = false
uni.showToast({ uni.showToast({
title: '查询失败,请重试', title: '未查询到考试结果,请重新确认',
icon: 'none' icon: 'none'
}) })
} }
...@@ -464,10 +497,15 @@ export default { ...@@ -464,10 +497,15 @@ export default {
// 切换到学习中心时显示弹窗 // 切换到学习中心时显示弹窗
if (item.name === 'StudyCenter') { if (item.name === 'StudyCenter') {
this.getLevelExamInfo()
}
},
// 查询等级弹窗信息
async getLevelExamInfo() {
const res = await uni.$api.commonApi.startExam() const res = await uni.$api.commonApi.startExam()
if (res) { if (res) {
this.showStudyPopup = true this.showStudyPopup = true
} this.courseInfo = res
} }
}, },
handleFooter (val) { handleFooter (val) {
......
...@@ -3,10 +3,10 @@ const screenList = [ ...@@ -3,10 +3,10 @@ const screenList = [
title: '选必修', title: '选必修',
componentName: 'CourseOptionList', componentName: 'CourseOptionList',
params: { params: {
idKey: 'required', idKey: 'planCourseType',
options: [ options: [
{ label: '必修', value: 'required' }, { label: '必修', value: 1 },
{ label: '选修', value: 'optional' } { label: '选修', value: 2 }
] ]
} }
}, },
...@@ -14,10 +14,15 @@ const screenList = [ ...@@ -14,10 +14,15 @@ const screenList = [
title: '课程类型', title: '课程类型',
componentName: 'CourseOptionList', componentName: 'CourseOptionList',
params: { params: {
idKey: 'courseType', idKey: 'courseFileType',
options: [ options: [
{ label: '视频', value: 'video' }, { label: '视频', value: 10 },
{ label: '文档', value: 'document' } { label: '音频', value: 80 },
{ label: '混合', value: 20 },
{ label: '文档', value: 30 },
{ label: 'H5', value: 40 },
{ label: 'URL', value: 70 },
{ label: '图文', value: 120 }
] ]
} }
}, },
...@@ -25,10 +30,10 @@ const screenList = [ ...@@ -25,10 +30,10 @@ const screenList = [
title: '评分', title: '评分',
componentName: 'CourseOptionList', componentName: 'CourseOptionList',
params: { params: {
idKey: 'rating', idKey: 'totalStar',
options: [ options: [
{ label: '4星以上', value: '4' }, { label: '4星以上', value: 8 },
{ label: '3星以上', value: '3' } { label: '3星以上', value: 6 }
] ]
} }
} }
......
...@@ -10,7 +10,12 @@ ...@@ -10,7 +10,12 @@
<!-- 第二段描述(橙色) --> <!-- 第二段描述(橙色) -->
<view class="highlight-text"> <view class="highlight-text">
<template v-if="lockReason === 0">
到学习中心-我的课程-待学习,完成课程学习后,即可解锁开单权限。 到学习中心-我的课程-待学习,完成课程学习后,即可解锁开单权限。
</template>
<template v-if="lockReason === 1">
到学习中心-我的任务,完成长课程学习任务后,即可解锁开单权限。
</template>
</view> </view>
<!-- 第三段描述 --> <!-- 第三段描述 -->
...@@ -27,6 +32,12 @@ ...@@ -27,6 +32,12 @@
<script> <script>
export default { export default {
props: {
lockReason: {
type: Number,
default: 0
}
},
name: 'StudyCenterPermissionPopup', name: 'StudyCenterPermissionPopup',
methods: { methods: {
handleGoToStudy() { handleGoToStudy() {
...@@ -42,6 +53,7 @@ export default { ...@@ -42,6 +53,7 @@ export default {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
padding-bottom: toRpx(48);
} }
.popup-title { .popup-title {
...@@ -63,16 +75,18 @@ export default { ...@@ -63,16 +75,18 @@ export default {
font-family: "HarmonyOSSansSC"; font-family: "HarmonyOSSansSC";
text-align: center; text-align: center;
line-height: toRpx(48); line-height: toRpx(48);
margin-bottom: toRpx(48); margin-bottom: toRpx(40);
} }
.highlight-text { .highlight-text {
width: toRpx(656); background-color: #FEF5EA;
padding: toRpx(8) toRpx(32);
border-radius: toRpx(8);
width: toRpx(720);
min-height: toRpx(104); min-height: toRpx(104);
color: #ff9d0a; color: #ff9d0a;
font-size: toRpx(32); font-size: toRpx(32);
font-weight: 400; font-weight: 400;
font-family: "HarmonyOSSansSC";
text-align: center; text-align: center;
line-height: toRpx(52); line-height: toRpx(52);
margin-bottom: toRpx(64); margin-bottom: toRpx(64);
...@@ -100,7 +114,8 @@ export default { ...@@ -100,7 +114,8 @@ export default {
font-family: "HarmonyOSSansSC"; font-family: "HarmonyOSSansSC";
text-align: center; text-align: center;
line-height: toRpx(80); line-height: toRpx(80);
margin-bottom: toRpx(48); // margin-bottom: toRpx(48);
margin-top: auto;
&:active { &:active {
opacity: 0.8; opacity: 0.8;
......
<!-- 开始学习之旅 -->
<template> <template>
<view v-if="show" class="study-popup-mask" @click="handleMaskClick"> <view v-if="show" class="study-popup-mask" @click="handleMaskClick">
<view <view
...@@ -11,9 +12,12 @@ ...@@ -11,9 +12,12 @@
class="top-image" class="top-image"
:src="topImage" :src="topImage"
:style="topImageStyle" :style="topImageStyle"
mode="aspectFill"
/> />
<view v-if="closeButton" @click.stop="closePopup">
<view class="sprite-icon icon-evaluationClose"></view>
</view>
<!-- 标题 --> <!-- 标题 -->
<view v-if="title" class="popup-title">{{ title }}</view> <view v-if="title" class="popup-title">{{ title }}</view>
...@@ -63,6 +67,10 @@ export default { ...@@ -63,6 +67,10 @@ export default {
maskClosable: { maskClosable: {
type: Boolean, type: Boolean,
default: false default: false
},
closeButton: {
type: Boolean,
default: false
} }
}, },
computed: { computed: {
...@@ -91,6 +99,9 @@ export default { ...@@ -91,6 +99,9 @@ export default {
close() { close() {
this.$emit('update:show', false) this.$emit('update:show', false)
this.$emit('close') this.$emit('close')
},
closePopup() {
this.close()
} }
} }
} }
...@@ -120,7 +131,11 @@ export default { ...@@ -120,7 +131,11 @@ export default {
max-height: toRpx(740); max-height: toRpx(740);
overflow-y: auto; overflow-y: auto;
} }
.sprite-icon {
top: toRpx(48);
right: toRpx(48);
position: absolute;
}
.top-image { .top-image {
width: 100%; width: 100%;
display: block; display: block;
......
...@@ -82,47 +82,45 @@ export default { ...@@ -82,47 +82,45 @@ export default {
} }
.content-card { .content-card {
width: 720rpx; width: toRpx(720);
opacity: 1; opacity: 1;
border-radius: 20rpx; border-radius: toRpx(20);
background: rgba(247, 248, 250, 1); background: rgba(247, 248, 250, 1);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: flex-start; justify-content: flex-start;
align-items: flex-start; align-items: flex-start;
padding: 32rpx 40rpx; padding: toRpx(32) toRpx(40);
box-sizing: border-box; box-sizing: border-box;
} }
.card-title { .card-title {
font-size: 36rpx; font-size: toRpx(36);
font-weight: 500; font-weight: 500;
letter-spacing: 0; letter-spacing: 0;
line-height: 40rpx; line-height: toRpx(40);
color: rgba(41, 45, 51, 1); color: rgba(41, 45, 51, 1);
text-align: left; text-align: left;
margin-bottom: 16rpx; margin-bottom: toRpx(16);
} }
.description-text { .description-text {
width: 640rpx; width: toRpx(640);
font-size: 32rpx; font-size: toRpx(32);
font-weight: 400; font-weight: 400;
letter-spacing: 0; letter-spacing: 0;
line-height: 48rpx; line-height: toRpx(48);
color: rgba(108, 111, 117, 1); color: rgba(108, 111, 117, 1);
margin-bottom: 16rpx;
} }
.list-wrapper { .list-wrapper {
width: 100%; width: 100%;
margin-top: 16rpx; margin-top: toRpx(16);
} }
.list-item { .list-item {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
margin-bottom: 8rpx;
&:last-child { &:last-child {
margin-bottom: 0; margin-bottom: 0;
...@@ -130,32 +128,32 @@ export default { ...@@ -130,32 +128,32 @@ export default {
} }
.dot { .dot {
width: 8rpx; width: toRpx(8);
height: 8rpx; height: toRpx(8);
border-radius: 50%; border-radius: 50%;
background: rgba(108, 111, 117, 1); background: rgba(108, 111, 117, 1);
margin-top: 18rpx; margin-top: toRpx(18);
margin-right: 12rpx; margin-right: toRpx(12);
flex-shrink: 0; flex-shrink: 0;
} }
.list-text { .list-text {
flex: 1; flex: 1;
font-size: 32rpx; font-size: toRpx(32);
font-weight: 400; font-weight: 400;
letter-spacing: 0; letter-spacing: 0;
line-height: 52rpx; line-height: toRpx(52);
color: rgba(108, 111, 117, 1); color: rgba(108, 111, 117, 1);
} }
.tip-text { .tip-text {
width: 720rpx; width: toRpx(720);
font-size: 28rpx; font-size: toRpx(28);
font-weight: 500; font-weight: 500;
letter-spacing: 0; letter-spacing: 0;
line-height: 32.82rpx; line-height: toRpx(32.82);
color: rgba(108, 111, 117, 1); color: rgba(108, 111, 117, 1);
margin-top: 56rpx; margin-top: toRpx(56);
text-align: center; text-align: center;
.highlight { .highlight {
...@@ -164,19 +162,19 @@ export default { ...@@ -164,19 +162,19 @@ export default {
} }
.action-button { .action-button {
width: 720rpx; width: toRpx(720);
height: 80rpx; height: toRpx(80);
border-radius: 48rpx; 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%);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
margin-top: 16rpx; margin-top: toRpx(16);
font-size: 28rpx; font-size: toRpx(28);
font-weight: 500; font-weight: 500;
letter-spacing: 0; letter-spacing: 0;
line-height: 40rpx; line-height: toRpx(40);
color: rgba(255, 255, 255, 1); color: rgba(255, 255, 255, 1);
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
......
<template> <template>
<view class="two-level-select-box"> <view class="two-level-select-box">
<view <view class="select" @click.stop="toggleSelect">
class="select"
@click.stop="isSelect = !isSelect"
>
{{ currentLabel }} {{ currentLabel }}
<view class="sprite-icon icon-arrow-bottom"></view> <view class="sprite-icon icon-arrow-bottom"></view>
</view> </view>
<view <view class="pop-box" v-if="isSelect">
class="pop-box" <view class="first-level-box ">
v-if="isSelect" <view v-for="(item, index) in selectList" :key="index" class="type-item flex" :class="getItemClass(index, item)"
> @click="chooseFirstLevel(index, item)">
<view class="first-level-box">
<view
v-for="(item, index) in selectList"
:key="index"
class="type-item flex"
:class="getItemClass(index, item)"
@click="chooseFirstLevel(index, item)"
>
<view class="item-label">{{ item[labelKey] }}</view> <view class="item-label">{{ item[labelKey] }}</view>
</view> </view>
</view> </view>
<view <view class="second-level-box" v-if="showSecondLevel && currentFirstLevel && currentFirstLevel.children && currentFirstLevel.children.length">
class="second-level-box" <view v-for="(child, childIndex) in currentFirstLevel.children" :key="childIndex" class="type-item flex"
> :class="childIndex === selectSecondIndex ? 'active' : ''" @click.stop="chooseSecondLevel(childIndex, child)">
<view
v-for="(child, childIndex) in currentFirstLevel.children"
:key="childIndex"
class="type-item flex"
:class="childIndex === selectSecondIndex ? 'active' : ''"
@click.stop="chooseSecondLevel(childIndex, child)"
>
{{ child[labelKey] }} {{ child[labelKey] }}
</view> </view>
</view> </view>
...@@ -54,11 +36,27 @@ export default { ...@@ -54,11 +36,27 @@ export default {
selectFirstIndex: 0, selectFirstIndex: 0,
selectSecondIndex: -1, selectSecondIndex: -1,
isSelect: false, isSelect: false,
currentFirstLevel: [{ showSecondLevel: false,
categoryName: '全部分类', currentFirstLevel: null
id: 'all', }
children: [{ categoryName: '全部', id: 'all_all' }] },
}] watch: {
selectList: {
immediate: true,
handler (n) {
if (Array.isArray(n) && n.length) {
this.selectFirstIndex = 0
this.currentFirstLevel = n[0]
if (this.currentFirstLevel.children && this.currentFirstLevel.children.length) {
this.showSecondLevel = true
const idx = this.currentFirstLevel.children.findIndex(c => c[this.labelKey] === '全部')
this.selectSecondIndex = idx !== -1 ? idx : 0
} else {
this.showSecondLevel = false
this.selectSecondIndex = -1
}
}
}
} }
}, },
computed: { computed: {
...@@ -68,7 +66,11 @@ export default { ...@@ -68,7 +66,11 @@ export default {
// 如果有选中的二级分类 // 如果有选中的二级分类
if (this.selectSecondIndex >= 0 && firstItem.children && firstItem.children[this.selectSecondIndex]) { if (this.selectSecondIndex >= 0 && firstItem.children && firstItem.children[this.selectSecondIndex]) {
return firstItem.children[this.selectSecondIndex][this.labelKey] console.log(111111)
const child = firstItem.children[this.selectSecondIndex]
const childLabel = child[this.labelKey]
if (childLabel === '全部') return firstItem[this.labelKey]
return childLabel
} }
// 否则显示一级分类 // 否则显示一级分类
...@@ -78,7 +80,7 @@ export default { ...@@ -78,7 +80,7 @@ export default {
methods: { methods: {
getItemClass(index, item) { getItemClass(index, item) {
const classes = [] const classes = []
if (index === this.selectFirstIndex && this.selectSecondIndex === -1) { if (index === this.selectFirstIndex) {
classes.push('active') classes.push('active')
} }
if (item.children && item.children.length) { if (item.children && item.children.length) {
...@@ -89,12 +91,24 @@ export default { ...@@ -89,12 +91,24 @@ export default {
hideSelect() { hideSelect() {
this.isSelect = false this.isSelect = false
}, },
toggleSelect() {
this.isSelect = !this.isSelect
if (this.isSelect && this.currentFirstLevel && this.currentFirstLevel.children && this.currentFirstLevel.children.length) {
this.showSecondLevel = true
}
},
chooseFirstLevel(index, item) { chooseFirstLevel(index, item) {
// 如果有二级菜单,显示二级菜单 // 如果有二级菜单,显示二级菜单
if (item.children && item.children.length) { if (item.children && item.children.length) {
this.currentFirstLevel = item this.currentFirstLevel = item
this.selectFirstIndex = index this.selectFirstIndex = index
// this.selectSecondIndex = -1 this.showSecondLevel = true
const idx = item.children.findIndex(c => c[this.labelKey] === '全部')
this.selectSecondIndex = idx !== -1 ? idx : 0
if(item.children.length === 1 && item.children[0][this.labelKey] === '全部') {
this.isSelect = false
this.$emit('chooseType', { item, index, level: 1 })
}
} else { } else {
// 没有二级菜单,直接选中 // 没有二级菜单,直接选中
this.selectFirstIndex = index this.selectFirstIndex = index
...@@ -106,6 +120,14 @@ export default { ...@@ -106,6 +120,14 @@ export default {
chooseSecondLevel(childIndex, child) { chooseSecondLevel(childIndex, child) {
this.selectSecondIndex = childIndex this.selectSecondIndex = childIndex
this.isSelect = false this.isSelect = false
const isAll = child && child[this.labelKey] === '全部'
if (isAll) {
this.$emit('chooseType', {
item: this.currentFirstLevel,
index: this.selectFirstIndex,
level: 1
})
} else {
this.$emit('chooseType', { this.$emit('chooseType', {
item: child, item: child,
index: childIndex, index: childIndex,
...@@ -115,6 +137,7 @@ export default { ...@@ -115,6 +137,7 @@ export default {
}) })
} }
} }
}
} }
</script> </script>
...@@ -138,8 +161,6 @@ export default { ...@@ -138,8 +161,6 @@ export default {
position: absolute; position: absolute;
top: toRpx(100); top: toRpx(100);
left: 0; left: 0;
// width: 100%;
// width: toRpx(592);
background: #ffffff; background: #ffffff;
box-shadow: 0 0 toRpx(16) 0 #99999933; box-shadow: 0 0 toRpx(16) 0 #99999933;
border-radius: toRpx(16); border-radius: toRpx(16);
...@@ -148,26 +169,29 @@ export default { ...@@ -148,26 +169,29 @@ export default {
display: flex; display: flex;
.first-level-box { .first-level-box {
min-width: toRpx(176); text-align: left;
.item-label {
display: inline-block;
white-space: nowrap;
}
} }
.second-level-box { .second-level-box {
width: toRpx(400); width: toRpx(400);
// border-left: 1px solid #f0f0f0; max-height: toRpx(400);
overflow-y: auto
} }
.type-item { .type-item {
padding: 0 toRpx(28); padding: 0 toRpx(28);
margin-bottom: toRpx(8); margin-bottom: toRpx(8);
height: toRpx(84); height: toRpx(84);
justify-content: center; // justify-content: center;
align-items: center; align-items: center;
&:last-child { &:last-child {
margin-bottom: 0; margin-bottom: 0;
} } &.active {
&.active {
background-color: #ecf1ff; background-color: #ecf1ff;
} }
} }
......
...@@ -248,6 +248,21 @@ export default { ...@@ -248,6 +248,21 @@ export default {
confirmColor: '#347BFF' confirmColor: '#347BFF'
}) })
return Promise.resolve(data) return Promise.resolve(data)
} },
// 限制录单
async getLimitRecord () {
const data = await uni.$api.commonApi.getLimitRecord()
if (data)
console.log(data, '限制录单')
// uni.showModal({
// title: '温馨提示',
// content: '您已到学习次数上限,禁止录单!\n请在平板电脑上展业助手-学习中心完成学习。',
// showCancel: false,
// cancelColor: '#292D33',
// confirmText: '确定',
// confirmColor: '#347BFF'
// })
return Promise.resolve(data)
},
} }
} }
...@@ -140,6 +140,12 @@ ...@@ -140,6 +140,12 @@
} }
}, },
{ {
"path": "pages/common/studyCenter/courseDetail",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/common/msgwebview" "path": "pages/common/msgwebview"
}, },
{ {
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
</template> </template>
<template v-else> <template v-else>
<view class="nothing flex"> <view class="nothing flex">
<image class="icon" src="../../../../assets/images/boutique/nothing.png" /> <image class="icon" src="../../../../assets/images/common/noData.png" />
暂无数据 暂无数据
</view> </view>
</template> </template>
...@@ -118,12 +118,20 @@ export default { ...@@ -118,12 +118,20 @@ export default {
} }
}, },
startStudy(item, index) { startStudy(item, index) {
const beisenToken = uni.$storage.get('beisenToken')
if (!beisenToken) {
uni.showToast({
title: '培训账号未创建',
icon: 'none'
})
return
}
let { pageNum, total, nothing = 'nothing', pageSize } = this; let { pageNum, total, nothing = 'nothing', pageSize } = this;
uni.$track.add({ eventCode: 'app_completed_course', businessId: item.id, pagePath: '/pages/common/studyCenter/myCourse' }) // uni.$track.add({ eventCode: 'app_recommend_course', businessId: item.id, pagePath: '/pages/equity/index' })
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/studyDetail/detail?type=completed&index=${index}&completedCourseList=${encodeURIComponent(JSON.stringify(this.completedCourseList))}&pageNum=${pageNum}&pageSize=${pageSize}&total=${total}` url: `/pages/common/studyCenter/courseDetail?apiType=getMyCourseList&index=${index}&courseList=${encodeURIComponent(JSON.stringify(this.completedCourseList))}&pageNum=${pageNum}&pageSize=${pageSize}&total=${total}&learnStatus=2`
}) })
} },
} }
} }
</script> </script>
...@@ -237,19 +245,20 @@ export default { ...@@ -237,19 +245,20 @@ export default {
} }
} }
.nothing { .nothing {
width: 100%; display: flex;
align-items: center;
justify-content: center;
flex-direction: column; flex-direction: column;
margin-top: toRpx(380); height: toRpx(1000);
font-size: toRpx(28);
color: #999999; color: #999999;
font-size: toRpx(24);
.icon { .icon {
width: toRpx(678); width: toRpx(344);
height: toRpx(284); height: toRpx(208);
margin-bottom: toRpx(24); }
} }
}
.end-text { .end-text {
color: #999; color: #999;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
class="task-list-box"> class="task-list-box">
<template v-if="taskList.length"> <template v-if="taskList.length">
<view class="task-list"> <view class="task-list">
<view class="task-item" v-for="(item, index) in taskList" :key="index" @click="handleTaskItemClick(item)"> <view class="task-item" v-for="(item, index) in taskList" :key="index" @click="handleTaskItemClick(item, index)">
<!-- 左上角:必修/选修标签 --> <!-- 左上角:必修/选修标签 -->
<template v-if="item.planCourseType"> <template v-if="item.planCourseType">
<image class="course-tag-left" <image class="course-tag-left"
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</template> </template>
<template v-else> <template v-else>
<view class="nothing flex"> <view class="nothing flex">
<image class="icon" src="../../../../assets/images/boutique/nothing.png" /> <image class="icon" src="../../../../assets/images/common/noData.png" />
暂无数据 暂无数据
</view> </view>
</template> </template>
...@@ -153,17 +153,20 @@ export default { ...@@ -153,17 +153,20 @@ export default {
this.nothing = true; this.nothing = true;
} }
}, },
handleTaskItemClick(item) { handleTaskItemClick(item, index) {
console.log(item) console.log(item)
}, const beisenToken = uni.$storage.get('beisenToken')
findBeiSenSSOToken() { if (!beisenToken) {
return new Promise(resolve => { uni.showToast({
const url = 'https%3A%2F%2Fcloud.italent.cn%2FPageHome%2FIndex%3Fproduct%3DLearning%26keyName%3DNusion%26pageCode%3DLearningNewHomepage%26appCode%3DLearning%26_qsrcapp%3DLearning%26_qrt%3Dhtml%26quark_s%3D5102bff371c00da5b19968ee53a8c3f1499ecd2447a19f72f3e3ba2390cc9617%23%2FviewDynamic%3Fshadow_context%3D%257BappModel%253A%2522italent%2522%252Cuppid%253A%25221%2522%257D%26quark_s%3D028930f1066f8ef8d28790940d53ae64337f44bde3a44cf89a290e4a3611e3e2' title: '培训账号未创建',
uni.$api.commonApi.findBeiSenSSOToken({}).then(res => { icon: 'none'
uni.$storage.set('beisenToken', res.data)
const studyUrl = res.data ? `${res.data}&return_url=${url}` : ''
resolve(studyUrl)
}) })
return
}
let { pageNum, total, nothing = 'nothing', pageSize } = this;
// uni.$track.add({ eventCode: 'app_recommend_course', businessId: item.id, pagePath: '/pages/equity/index' })
uni.navigateTo({
url: `/pages/common/studyCenter/courseDetail?apiType=getMyCourseList&index=${index}&courseList=${encodeURIComponent(JSON.stringify(this.taskList))}&pageNum=${pageNum}&pageSize=${pageSize}&total=${total}&learnStatus=1`
}) })
}, },
} }
...@@ -254,7 +257,7 @@ export default { ...@@ -254,7 +257,7 @@ export default {
} }
.task-list-box { .task-list-box {
// margin-top: toRpx(24); margin-top: toRpx(40);
height: 100%; height: 100%;
} }
...@@ -397,16 +400,17 @@ export default { ...@@ -397,16 +400,17 @@ export default {
} }
.nothing { .nothing {
width: 100%; display: flex;
align-items: center;
justify-content: center;
flex-direction: column; flex-direction: column;
margin-top: toRpx(270); height: toRpx(1000);
font-size: toRpx(28);
color: #999999; color: #999999;
font-size: toRpx(24);
.icon { .icon {
width: toRpx(678); width: toRpx(344);
height: toRpx(284); height: toRpx(208);
margin-bottom: toRpx(24);
} }
} }
......
...@@ -33,12 +33,12 @@ ...@@ -33,12 +33,12 @@
</view> </view>
<!-- 评分星星 --> <!-- 评分星星 -->
<view v-if="!simplified && item.rating !== undefined" class="course-rating"> <view v-if="item.totalStar !== undefined" class="course-rating">
<view class="star-list"> <view class="star-list">
<image v-for="star in 5" :key="star" class="star-icon" :src="getStarIcon(item.rating, star)" <image v-for="star in 5" :key="star" class="star-icon" :src="getStarIcon(item.totalStar, star)"
mode="aspectFit" /> mode="aspectFit" />
</view> </view>
<text class="rating-text">{{ item.rating }}</text> <text class="rating-text">{{ item.totalStar / 2 }}</text>
</view> </view>
<!-- 学习人数 --> <!-- 学习人数 -->
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
</template> </template>
<template v-else> <template v-else>
<view class="nothing flex"> <view class="nothing flex">
<image class="icon" src="../../../../assets/images/boutique/nothing.png" /> <image class="icon" src="../../../../assets/images/common/noData.png" />
暂无数据 暂无数据
</view> </view>
</template> </template>
...@@ -100,12 +100,11 @@ export default { ...@@ -100,12 +100,11 @@ export default {
}, },
mounted() { mounted() {
this.getALlCourse() this.getALlCourse()
this.asyncfindBeiSenSSOToken()
}, },
methods: { methods: {
// 获取星星图标 // 获取星星图标
getStarIcon(rating, position) { getStarIcon(rating, position) {
const roundedRating = Math.round(rating * 2) / 2 // 四舍五入到0.5 const roundedRating = Math.round(rating) / 2 // 四舍五入到0.5
const diff = roundedRating - (position - 1) const diff = roundedRating - (position - 1)
if (diff >= 1) { if (diff >= 1) {
...@@ -127,11 +126,11 @@ export default { ...@@ -127,11 +126,11 @@ export default {
}) })
const { pageNum, pageSize } = this const { pageNum, pageSize } = this
const params = { const params = {
staffPhone: uni.$storage.get('userInfo').phone, // 推荐状态 0=无推荐 1=推荐课程 learnStatus: 0, // 学习状态 0:待学习 1: 正在学习 2:已学完
pageNum, pageNum,
pageSize pageSize
} }
const res = await uni.$api.commonApi.getALlCourse(params) const res = await uni.$api.commonApi.getMyCourseList(params)
console.log(res, '全部课程') console.log(res, '全部课程')
// 临时添加测试数据字段 // 临时添加测试数据字段
const listWithTestData = res.list.map((item, index) => ({ const listWithTestData = res.list.map((item, index) => ({
...@@ -169,16 +168,21 @@ export default { ...@@ -169,16 +168,21 @@ export default {
} }
}, },
startStudy(item, index) { startStudy(item, index) {
console.log(item)
const beisenToken = uni.$storage.get('beisenToken')
if (!beisenToken) {
uni.showToast({
title: '培训账号未创建',
icon: 'none'
})
return
}
let { pageNum, total, nothing = 'nothing', pageSize } = this; let { pageNum, total, nothing = 'nothing', pageSize } = this;
uni.$track.add({ eventCode: 'app_recommend_course', businessId: item.id, pagePath: '/pages/equity/index' }) // uni.$track.add({ eventCode: 'app_recommend_course', businessId: item.id, pagePath: '/pages/equity/index' })
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/studyDetail/detail?type=recommendation&index=${index}&recommendCourseList=${encodeURIComponent(JSON.stringify(this.recommendCourseList))}&pageNum=${pageNum}&pageSize=${pageSize}&total=${total}` url: `/pages/common/studyCenter/courseDetail?apiType=getMyCourseList&index=${index}&courseList=${encodeURIComponent(JSON.stringify(this.recommendCourseList))}&pageNum=${pageNum}&pageSize=${pageSize}&total=${total}&learnStatus=0`
}) })
}, },
async asyncfindBeiSenSSOToken() {
const res = await uni.$api.commonApi.findBeiSenSSOToken({})
uni.$storage.set('beisenToken', res.data)
},
} }
} }
</script> </script>
...@@ -357,19 +361,20 @@ export default { ...@@ -357,19 +361,20 @@ export default {
} }
} }
.nothing { .nothing {
width: 100%; display: flex;
align-items: center;
justify-content: center;
flex-direction: column; flex-direction: column;
margin-top: toRpx(280); height: toRpx(1000);
font-size: toRpx(28);
color: #999999; color: #999999;
font-size: toRpx(24);
.icon { .icon {
width: toRpx(678); width: toRpx(344);
height: toRpx(284); height: toRpx(208);
margin-bottom: toRpx(24); }
} }
}
.end-text { .end-text {
color: #999; color: #999;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<view class="back" @click="back"> <view class="back" @click="back">
<uni-icons type="left" :size="20" color="#000000"></uni-icons> <uni-icons type="left" :size="20" color="#000000"></uni-icons>
</view> </view>
<view class="title">我的课程1</view> <view class="title">我的课程</view>
</view> </view>
</view> </view>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</view> </view>
</view> </view>
<!-- 提示信息 --> <!-- 提示信息-->
<view class="tips" v-if="residueInfo.remindType != 0"> <view class="tips" v-if="residueInfo.remindType != 0">
<view class="sprite-icon icon-study-tips"></view> <view class="sprite-icon icon-study-tips"></view>
<view class="tips-text" v-if="residueInfo.remindType == '1'">剩余{{ residueInfo.residueDays }}天完成必修课学习及通过课后考试,过期将锁定开单权限</view> <view class="tips-text" v-if="residueInfo.remindType == '1'">剩余{{ residueInfo.residueDays }}天完成必修课学习及通过课后考试,过期将锁定开单权限</view>
...@@ -68,6 +68,7 @@ export default { ...@@ -68,6 +68,7 @@ export default {
console.log('MyCoursePage mounted') console.log('MyCoursePage mounted')
this.getMyCourseTabCount() this.getMyCourseTabCount()
this.getStudyCenterResidueTime() this.getStudyCenterResidueTime()
this.asyncfindBeiSenSSOToken() // 获取北森权限
}, },
methods: { methods: {
back() { back() {
...@@ -87,7 +88,11 @@ export default { ...@@ -87,7 +88,11 @@ export default {
async getStudyCenterResidueTime() { async getStudyCenterResidueTime() {
const res = await uni.$api.commonApi.getStudyCenterResidueTime() const res = await uni.$api.commonApi.getStudyCenterResidueTime()
this.residueInfo = res this.residueInfo = res
} },
async asyncfindBeiSenSSOToken() {
const res = await uni.$api.commonApi.findBeiSenSSOToken({})
uni.$storage.set('beisenToken', res.data)
},
} }
} }
</script> </script>
......
...@@ -44,11 +44,26 @@ export default { ...@@ -44,11 +44,26 @@ export default {
return { return {
currentTab: 0, currentTab: 0,
tabList: [ tabList: [
{ label: '已通过', count: '3' }, { label: '已通过', count: '0' },
{ label: '未通过', count: '2' } { label: '未通过', count: '0' }
] ]
} }
}, },
created() {
// 在组件创建时就开始监听,确保事件能被捕获
uni.$on('showExamSubmitPopup', () => {
console.log('接收到考试提交弹窗事件')
if (this.currentTab === 1) {
this.$refs.failedExam.showExamPopup = true
} else if (this.currentTab === 0) {
this.$refs.passedExam.showExamPopup = true
}
})
},
beforeDestroy() {
// 组件销毁前移除监听
uni.$off('showExamSubmitPopup')
},
mounted() { mounted() {
this.getExamStatistics() this.getExamStatistics()
}, },
......
...@@ -120,10 +120,10 @@ export default { ...@@ -120,10 +120,10 @@ export default {
this.wv = wv this.wv = wv
// 设置 webview 从导航栏下方开始显示 // 设置 webview 从导航栏下方开始显示
wv.setStyle({ wv.setStyle({
top: '56', // 状态栏(48) + 导航栏(88) = 136rpx 转换为 68px top: '26', // 状态栏(48) + 导航栏(88) = 136rpx 转换为 68px
left: '0', left: '0',
width: '100%', width: '100%',
height: 'calc(100% - 136rpx)' // 减去顶部导航栏高度 height: '724' // 减去顶部导航栏高度
}) })
console.log('✅ webview 样式设置成功') console.log('✅ webview 样式设置成功')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!