Commit 7b0ffcdf by Lin

refactor(PreStudyPopup):简化学习开始逻辑并移除不必要的API调用

- 移除了预学习数据的API调用,直接触发start-study事件。
- 更新导航逻辑,使用组件状态中的prelearnData。
1 parent 983700ac
......@@ -63,34 +63,18 @@ export default {
if (!includes?.length) return ''
return `包含:${includes.join(' + ')}`
},
async handleStartStudy(item, index) {
handleStartStudy(item, index) {
if (item.learnStatus !== 'NOT_STUDY') return
try {
const res = await uni.$api.commonApi.getPrelernHomePopupAPI()
console.log('getPrelernHomePopupAPI res***', res)
if (!res) return
const freshItem = res.packages?.find(
(pkg) => pkg.activityProductId === item.activityProductId
)
console.log('freshItem***', freshItem)
if (!freshItem?.scriptReady) {
uni.showToast({ title: '话术未就绪,请稍后重试', icon: 'none' })
return
this.$emit('start-study', item, index)
const prelearnDataStr = encodeURIComponent(JSON.stringify(this.prelearnData))
console.log('预学习桥接页跳转***', prelearnDataStr);
uni.navigateTo({
url: `/pages/common/prelearnBridge?prelearnData=${prelearnDataStr}&entrySource=home_popup`,
fail: (err) => {
console.error('预学习桥接页跳转失败:', err)
}
this.$emit('start-study', freshItem, index)
const prelearnDataStr = encodeURIComponent(JSON.stringify(res))
uni.navigateTo({
url: `/pages/common/prelearnBridge?prelearnData=${prelearnDataStr}&entrySource=home_popup`,
fail: (err) => {
console.error('预学习桥接页跳转失败:', err)
}
})
} catch (err) {
console.error('预学习首页弹框查询失败:', err)
}
})
},
handleCancel() {
this.$emit('cancel')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!