Commit d4572b27 by Lin

feat(HomeFrame, prelearnBridge):添加 deductSkipCountAPI 方法并更新 prelearnContext

- 在 HomeFrame 和 prelearnBridgelearnBridge 组件中实现了 deductSkipCountAPI 方法,用于处理跳过次数的扣除。
- 更新了 prelearnContext,添加了新的活动和产品 ID,并包含员工信息以更好地管理上下文。
- 重构了 getCustomerProfileGroupInfoAPI 调用,使用空对象作为参数。
- 修改了 getPrelearnHome 方法,使其返回模拟响应以供测试使用。
1 parent 81af5080
...@@ -496,6 +496,16 @@ export default { ...@@ -496,6 +496,16 @@ export default {
this.getCustomerProfileGroupInfo() this.getCustomerProfileGroupInfo()
}, },
methods: { methods: {
async deductSkipCountAPI() {
let requestParams = {
serialVersionUID:'',
activityId:'',
activityProductId:'',
eventType:'',
}
const res = await uni.$api.commonApi.deductSkipCountAPI(requestParams)
console.log('deductSkipCountAPI***', res);
},
handleHomeContentTabClick(index) { handleHomeContentTabClick(index) {
this.homeContentTabIndex = index this.homeContentTabIndex = index
console.log('当前选中标签:', this.currentHomeContentTab) console.log('当前选中标签:', this.currentHomeContentTab)
...@@ -729,7 +739,7 @@ export default { ...@@ -729,7 +739,7 @@ export default {
} }
}, },
async getCustomerProfileGroupInfo() { async getCustomerProfileGroupInfo() {
const res = await uni.$api.customerApi.getCustomerProfileGroupInfoAPI() const res = await uni.$api.customerApi.getCustomerProfileGroupInfoAPI({})
console.log('查询客户建档分页查询-月按天分组:', res) console.log('查询客户建档分页查询-月按天分组:', res)
}, },
/** /**
...@@ -834,16 +844,24 @@ export default { ...@@ -834,16 +844,24 @@ export default {
* 查询预学习首页弹框信息 * 查询预学习首页弹框信息
*/ */
async getPrelearnHome() { async getPrelearnHome() {
const res = await uni.$api.commonApi.getPrelernHomePopupAPI() // const res = await uni.$api.commonApi.getPrelernHomePopupAPI()
// const res = { const res = {
// "activityId": null, "activityId": 22,
// "activityName": null, "activityName": "618年中促活动A",
// "packages": null, "packages": [
// "remainingSkipCount": null, {
// "shouldPopup": false, "activityProductId": "15",
// "muteReason": null, "packageName": "tttttttt",
// "remainingActivityCount": null "includes": [],
// } "learnStatus": "NOT_STUDY",
"scriptReady": true
}
],
"remainingSkipCount": 3,
"shouldPopup": false,
"muteReason": null,
"remainingActivityCount": null
}
console.log('查询预学习首页弹框信息:', res) console.log('查询预学习首页弹框信息:', res)
if (res) { if (res) {
this.showPreStudyPopup = res.shouldPopup this.showPreStudyPopup = res.shouldPopup
......
...@@ -65,14 +65,12 @@ export default { ...@@ -65,14 +65,12 @@ export default {
confirmText: '确认', confirmText: '确认',
}, },
prelearnContext: { prelearnContext: {
activityId: 'activity-demo-202606', activityId: '31',
packageId: 'package-main-film', activityProductId: '16',
caseId: 'case-demo-001', staffUuid: uni.$storage.get('userInfo').uuid,
}, staffName: uni.$storage.get('userInfo').name,
mockLoginUser: { merchantId: '44209880',
employeeId: 'EMP-DEMO-10086', entrySource: 'home_popup',
employeeName: '演示员工',
storeId: 'STORE-DEMO-001',
}, },
pendingAppBackTimer: null, pendingAppBackTimer: null,
pendingAppBackRequestId: null, pendingAppBackRequestId: null,
...@@ -160,6 +158,16 @@ export default { ...@@ -160,6 +158,16 @@ export default {
// #endif // #endif
}, },
methods: { methods: {
async deductSkipCountAPI() {
let requestParams = {
serialVersionUID:'',
activityId:'',
activityProductId:'',
eventType:'',
}
const res = await uni.$api.commonApi.deductSkipCountAPI(requestParams)
console.log('deductSkipCountAPI***', res);
},
applyWebviewInset() { applyWebviewInset() {
// #ifdef APP-PLUS // #ifdef APP-PLUS
const sys = uni.getSystemInfoSync() const sys = uni.getSystemInfoSync()
...@@ -320,28 +328,16 @@ export default { ...@@ -320,28 +328,16 @@ export default {
// #endif // #endif
}, },
createMockTicket() { createMockTicket() {
console.log('[prelearn bridge demo] issue ticket by app login user:', this.mockLoginUser, this.prelearnContext)
return { return {
ticket: `mock_prelearn_ticket_${Date.now()}_${Math.random().toString(16).slice(2)}`, ticket: `mock_prelearn_ticket_${Date.now()}_${Math.random().toString(16).slice(2)}`,
} }
}, },
callH5InitSession(payload, requestId) { callH5InitSession(payload, requestId) {
console.log('prelearnContext', this.prelearnContext); console.log('prelearnContext', this.prelearnContext);
let { merchantId, staffUuid, staffName } = uni.$storage.get('userInfo'); console.log('initPrelearningSession***', this.prelearnContext);
console.log('merchantId***', merchantId);
console.log('staffUuid***', staffUuid);
console.log('merchantName***', merchantName);
let params = {
activityId: '123',
activityProductId: '456',
staffUuid: staffUuid,
staffName: staffName,
merchantId: merchantId,
entrySource: 'home popup',
}
const script = ` const script = `
if (window.initPrelearningSession) { if (window.initPrelearningSession) {
window.initPrelearningSession(${JSON.stringify(params)}); window.initPrelearningSession(${JSON.stringify(this.prelearnContext)});
} }
if (${JSON.stringify(requestId)} && window.__PRELEARN_BRIDGE_CALLBACK__) { if (${JSON.stringify(requestId)} && window.__PRELEARN_BRIDGE_CALLBACK__) {
window.__PRELEARN_BRIDGE_CALLBACK__( window.__PRELEARN_BRIDGE_CALLBACK__(
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!