吃个甘蔗嚼一年 3 年之前
父節點
當前提交
d2e43703e4
共有 1 個檔案被更改,包括 19 行新增0 行删除
  1. 19
    0
      src/pages/index/index.jsx

+ 19
- 0
src/pages/index/index.jsx 查看文件

7
 import { getHotelDetail } from '@/services/landlord'
7
 import { getHotelDetail } from '@/services/landlord'
8
 import { getTaRoom } from '@/services/taRoom​'
8
 import { getTaRoom } from '@/services/taRoom​'
9
 import withLayout from '@/layouts'
9
 import withLayout from '@/layouts'
10
+import { trackClick } from '@/services/track'
10
 import { useModel } from "@/store";
11
 import { useModel } from "@/store";
11
 import { withSubscribeMessage } from '@/utils/subscribeMessage'
12
 import { withSubscribeMessage } from '@/utils/subscribeMessage'
12
 import { TPL_MESSAGE_HOTEL_CHECK_OUT } from '@/utils/constants'
13
 import { TPL_MESSAGE_HOTEL_CHECK_OUT } from '@/utils/constants'
43
   useDidShow(() => {
44
   useDidShow(() => {
44
     setIsDidShow(isDidShow + 1)
45
     setIsDidShow(isDidShow + 1)
45
   })
46
   })
47
+
48
+
46
   const handleTabChange = (e) => {
49
   const handleTabChange = (e) => {
47
     const { index } = e.detail
50
     const { index } = e.detail
48
     setCurrentTab(index)
51
     setCurrentTab(index)
49
 
52
 
53
+    if (roomId && hotelId) {
54
+
55
+      trackClick({
56
+        eventParams: `tab=${index}&hotelId=${hotelId}&roomId=${roomId}`,
57
+        //如果首页增加新页面,这个判断一定要改;
58
+        onVarified: `${index === 0 ? 'index_recommend' : index === 1 ? 'hotel_guide' : 'user_center'}`,
59
+        page: `/pages/index/index`
60
+      }).then((val) => {
61
+
62
+      })
63
+
64
+    } else {
65
+      trackClick({ eventParams: `tab=${index}`, page: `/pages/index/index` }).then((res) => {
66
+      })
67
+    }
68
+
50
     if (index === 1) {
69
     if (index === 1) {
51
       // 民宿离店消息
70
       // 民宿离店消息
52
       withSubscribeMessage([TPL_MESSAGE_HOTEL_CHECK_OUT])
71
       withSubscribeMessage([TPL_MESSAGE_HOTEL_CHECK_OUT])