feat: 3.5版本规划
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
parseMiniProgramUrl,
|
||||
stashPendingCategoryTabId,
|
||||
} from '../../utils/index';
|
||||
import tracker from '../../utils/tracker';
|
||||
import {
|
||||
HOME_DAILY_CHECKIN_ITEMS,
|
||||
HOME_NOTICES,
|
||||
@@ -124,6 +125,23 @@ function navigateByPath(path?: string, fallbackTitle?: string) {
|
||||
});
|
||||
}
|
||||
|
||||
function worksheetIdFromPath(path?: string): string {
|
||||
if (!path) return '';
|
||||
return String(parseMiniProgramUrl(path).query.id || '');
|
||||
}
|
||||
|
||||
function trackWorksheetClick(
|
||||
path: string | undefined,
|
||||
title: string | undefined,
|
||||
source: string,
|
||||
) {
|
||||
tracker.reportWorksheetClick('pages/home/home', {
|
||||
worksheet_id: worksheetIdFromPath(path),
|
||||
worksheet_title: title || '',
|
||||
source,
|
||||
});
|
||||
}
|
||||
|
||||
// ── Skeleton data ──
|
||||
|
||||
function skeletonItem(id: string): HomeDisplayItemView {
|
||||
@@ -196,6 +214,7 @@ Page({
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
tracker.reportPageView('pages/home/home');
|
||||
void this.initData();
|
||||
},
|
||||
|
||||
@@ -274,12 +293,14 @@ Page({
|
||||
onTapFeatured(e: WechatMiniprogram.TouchEvent) {
|
||||
const path = e.currentTarget.dataset.path as string | undefined;
|
||||
const title = e.currentTarget.dataset.title as string | undefined;
|
||||
trackWorksheetClick(path, title, 'home_featured');
|
||||
navigateByPath(path, title);
|
||||
},
|
||||
|
||||
onTapHotRecommend(e: WechatMiniprogram.TouchEvent) {
|
||||
const path = e.currentTarget.dataset.path as string | undefined;
|
||||
const title = e.currentTarget.dataset.title as string | undefined;
|
||||
trackWorksheetClick(path, title, 'home_hot');
|
||||
navigateByPath(path, title);
|
||||
},
|
||||
|
||||
@@ -310,6 +331,7 @@ Page({
|
||||
const title =
|
||||
detail.title ||
|
||||
(e.currentTarget.dataset.title as string | undefined);
|
||||
trackWorksheetClick(path, title, 'home_section');
|
||||
navigateByPath(path, title);
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user