Commit ee3faae3 by 胡悦

(学习中心)功能:增强事件处理和令牌管理

- 在学习中心添加了自定义事件监听器,以便在“返回学习中心”事件发生时刷新课程任务和学习看板。
- 从“我的任务”组件中移除了事件监听器,以简化功能。
- 在“推荐课程”中引入异步方法,在组件挂载期间获取并存储北森 SSO 令牌
1 parent afb8ff07
...@@ -129,13 +129,13 @@ export default { ...@@ -129,13 +129,13 @@ export default {
} }
} }
}, },
created () { // created () {
// 监听自定义事件 // // 监听自定义事件
uni.$on('backStudyCenter', () => { // uni.$on('backStudyCenter', () => {
console.log('backStudyCenter') // console.log('backStudyCenter')
this.getCourseTaskPage(this.tabIndex) // this.getCourseTaskPage(this.tabIndex)
}) // })
}, // },
mounted() { mounted() {
this.getCourseTaskPage(this.tabIndex) this.getCourseTaskPage(this.tabIndex)
}, },
......
...@@ -55,6 +55,7 @@ export default { ...@@ -55,6 +55,7 @@ export default {
}, },
mounted() { mounted() {
this.getCourseTaskPage() this.getCourseTaskPage()
this.asyncfindBeiSenSSOToken()
}, },
methods: { methods: {
// 获取我的任务接口, completeStatus: 完成状态 0=待完成 1=已完成, courseType: 课程类型 1=短课程 2=长课程 // 获取我的任务接口, completeStatus: 完成状态 0=待完成 1=已完成, courseType: 课程类型 1=短课程 2=长课程
...@@ -102,7 +103,11 @@ export default { ...@@ -102,7 +103,11 @@ export default {
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/studyDetail/detail?type=recommendation&index=${index}&recommendCourseList=${encodeURIComponent(JSON.stringify(this.recommendCourseList))}&pageNum=${pageNum}&pageSize=${pageSize}&total=${total}`
}) })
} },
async asyncfindBeiSenSSOToken () {
const res = await uni.$api.commonApi.findBeiSenSSOToken({})
uni.$storage.set('beisenToken', res.data)
},
} }
} }
</script> </script>
......
...@@ -74,6 +74,14 @@ export default { ...@@ -74,6 +74,14 @@ export default {
isYb: false, // 当前驻店人员所关联的门店是否是延保业务 isYb: false, // 当前驻店人员所关联的门店是否是延保业务
} }
}, },
created () {
// 监听自定义事件
uni.$on('backStudyCenter', () => {
console.log('backStudyCenter')
this.$refs.myTask.getCourseTaskPage(this.tabIndex)
this.getStudyBoard()
})
},
mounted() { mounted() {
const beisenToken = uni.$storage.get('beisenToken') const beisenToken = uni.$storage.get('beisenToken')
const studyCenterPermission = uni.$storage.get('studyCenterPermission') const studyCenterPermission = uni.$storage.get('studyCenterPermission')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!