hookehuyr

feat(product): 添加预览前的登录验证和埋点统计

在商品详情页的预览功能中增加登录验证,未登录用户会收到提示
并引导至登录页面。同时添加预览操作的埋点统计,用于追踪用户行为
...@@ -366,7 +366,16 @@ export default { ...@@ -366,7 +366,16 @@ export default {
366 }); 366 });
367 } 367 }
368 }, 368 },
369 - preview (item) { 369 + async preview (item) {
370 + const canPreview = await this.ensureLogin({
371 + title: '登录后可预览资料',
372 + message: '当前预览操作需要先登录,是否现在前往登录页面?',
373 + });
374 + if (!canPreview) {
375 + return;
376 + }
377 + // TAG: 统计埋点
378 + this.maEvent({ p: 'h5_product/detail', event: 'document_preview' });
370 window.open(item.value, '_blank'); 379 window.open(item.value, '_blank');
371 }, 380 },
372 splitArrayIntoChunks(list) { 381 splitArrayIntoChunks(list) {
......
...@@ -366,7 +366,16 @@ export default { ...@@ -366,7 +366,16 @@ export default {
366 }); 366 });
367 } 367 }
368 }, 368 },
369 - preview (item) { 369 + async preview (item) {
370 + const canPreview = await this.ensureLogin({
371 + title: '登录后可预览资料',
372 + message: '当前预览操作需要先登录,是否现在前往登录页面?',
373 + });
374 + if (!canPreview) {
375 + return;
376 + }
377 + // TAG: 统计埋点
378 + this.maEvent({ p: 'h5_product/detail_lite', event: 'document_preview' });
370 window.open(item.value, '_blank'); 379 window.open(item.value, '_blank');
371 }, 380 },
372 splitArrayIntoChunks(list) { 381 splitArrayIntoChunks(list) {
......