hejianhao
2026-03-23 0c7bb96acea21fe43ee9b926c699f20b21dd3a35
feat: 更新埋点配置并添加用户行为追踪

- 更新生产环境埋点平台ID和数据源ID
- 在多个关键用户操作节点添加事件上报,包括协议同意、地址搜索、订单提交等
- 将"系统优惠"统一更名为"限时优惠"
- 修复评价弹窗图片删除按钮样式问题
- 优化路线初始化逻辑,确保地图正确渲染
10个文件已修改
129 ■■■■■ 已修改文件
config/prod.js 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/robotaxi/home/components/privacy-popup/index.tsx 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/robotaxi/home/index.tsx 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/begin-route/components/calling-car.tsx 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/begin-route/components/css-folder/evaluate-popup.less 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/begin-route/index.tsx 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/expense-description/index.tsx 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/expense-detail/index.tsx 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/site-search/index.tsx 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/Robotaxi-public-method.ts 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
config/prod.js
@@ -27,9 +27,9 @@
};
const GIO_CONFIG = {
  accountId: '"xxxxxxx"', // 埋点平台id
  accountId: '"84eafaa69d23412f"', // 埋点平台id
  dataSourceId: {
    weapp: '"xxxxxxx"', // 埋点数据源id
    weapp: '"b9aa24dc0aab9edb"', // 埋点数据源id
  },
  host: '"https://collect.xiaopeng.com"',
}
src/pages/robotaxi/home/components/privacy-popup/index.tsx
@@ -6,6 +6,7 @@
import uncheck from '../../../../../robotaxi/assets/uncheck.png'
import { privicyShowManager } from './utils'
import { submitAgreement } from '../../../../../robotaxi/api/home'
import { reportEvent } from '../../../../../utils/Robotaxi-public-method'
type Props = {
  show?: boolean;
@@ -54,6 +55,9 @@
  }, [isAgree]);
  const handleClose = () => {
    reportEvent('RT_xcx_protocol_click', {
      status_code: 0
    })
    privicyShowManager.setHasShow(false)
    onClose?.();
  };
@@ -64,6 +68,9 @@
      return
    };
    submitAgreement({ type: [1, 2, 3, 4] }).then((res: any) => {
      reportEvent('RT_xcx_protocol_click', {
        status_code: 1
      })
      privicyShowManager.setHasShow(true)
      onAgree?.();
    }).catch(() => {
src/pages/robotaxi/home/index.tsx
@@ -23,7 +23,8 @@
  getCityLocation,
  getCityInfoWithId,
  getLocationByIP,
  mapOrderStatusToTripStatus
  mapOrderStatusToTripStatus,
  reportEvent,
} from '../../../utils/Robotaxi-public-method';
import { jumpTo } from '../../../utils/jump';
import { _ROBOTAXI_WS_HOST, CDN } from '../../../constants/api';
@@ -1049,6 +1050,11 @@
      Taro.setStorageSync('startSite', currentSite);
      Taro.navigateTo({
        url: '/robotaxi/pages/select-map-site/index?pageType=' + type,
        success: () => {
          reportEvent('RT_xcx_protocol_click', {
            element_type: 'start'
          })
        }
      })
      return
    }
@@ -1063,7 +1069,12 @@
      Taro.setStorageSync('startSite', currentSite);
    }
    Taro.navigateTo({
      url: `/robotaxi/pages/site-search/index?pageType=${type}&electronicAreaId=${electronicAreaId}&longitude=${currentSite.longitude}&latitude=${currentSite.latitude}`
      url: `/robotaxi/pages/site-search/index?pageType=${type}&electronicAreaId=${electronicAreaId}&longitude=${currentSite.longitude}&latitude=${currentSite.latitude}`,
      success: () => {
        reportEvent('RT_xcx_protocol_click', {
          element_type: type == 'start' ? 'start' : 'dest',
        })
      }
    })
  }
src/robotaxi/pages/begin-route/components/calling-car.tsx
@@ -17,7 +17,8 @@
    getTypeLabel,
    formatMoney,
    formatTripDistance,
    formatTripDurationFromSeconds
    formatTripDurationFromSeconds,
    reportEvent
} from '../../../../utils/Robotaxi-public-method';
import {
    getWaitTime,
@@ -144,7 +145,9 @@
        queryFareBreakdown(targetOrderId).then((res: any) => {
            const data = res?.data ?? res?.result ?? res;
            setFareBreakdown(data);
        }).catch(() => { });
        }).catch(() => {
            reportEvent('RT_xcx_dest_arrive_fail', {})
        });
    };
    // 根据行程状态初始化等待/限停/倒计时/温度信息,并管理对应定时器
src/robotaxi/pages/begin-route/components/css-folder/evaluate-popup.less
@@ -139,7 +139,7 @@
                    width: 208px;
                    height: 208px;
                    border-radius: 16px;
                    overflow: hidden;
                    // overflow: hidden;
                    background: rgba(0, 0, 0, 0.03);
                }
@@ -190,9 +190,8 @@
                &-delete {
                    position: absolute;
                    top: 8px;
                    right: 8px;
                    box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
                    top: -10px;
                    right: -10px;
                    z-index: 2;
                    .delete-icon {
src/robotaxi/pages/begin-route/index.tsx
@@ -22,7 +22,6 @@
import wsManager from '../../../utils/websocket';
import {
  getWalkingRoute,
  formatDurationToClock,
  formatDateTime,
  clearOrderTripStorage,
  preloadImageToTemp,
@@ -32,8 +31,8 @@
  convertAdcodeToCityCode,
  getCityInfoWithId,
  getDistance,
  shouldUpdateRoute,
  mapOrderStatusToTripStatus
  mapOrderStatusToTripStatus,
  reportEvent
} from '../../../utils/Robotaxi-public-method';
import {
  saveOrder,
@@ -922,7 +921,9 @@
          orderRouteInitializedRef.current = true;
          currentFullRouteRef.current = [...points];
          lastErasedIndexRef.current = 0;
          applyRoutePoints(points);
          Taro.nextTick(() => {
            applyRoutePoints(points);
          });
        }
        if (firstPoint && typeof firstPoint.latitude === 'number' && typeof firstPoint.longitude === 'number') {
          updateVehicleLocationThrottled(firstPoint.latitude, firstPoint.longitude, true);
@@ -1684,7 +1685,7 @@
    const waitingTime = Number(fareEstimate?.waitingTime || 0);
    const estimatedTime = formatDateTime(new Date(Date.now() + waitingTime * 60 * 1000));
    const cachedCouponId = Taro.getStorageSync('selectedCouponId');
    const cachedCouponId = Taro.getStorageSync('selectedCouponId') || '';
    const payload: any = {
      endPointId: endSite.id,
      openCityId: openCityId,
@@ -1700,6 +1701,13 @@
    }
    try {
      const res = await saveOrder(payload);
      let status_code = res.orderId ? 1 : 0;
      reportEvent('RT_xcx_order_submit', {
        total_amount: fareEstimate.originalFare,
        payable_amount: fareEstimate.finalFare,
        coupon_id: cachedCouponId,
        status_code: status_code,
      })
      if (typeof res == 'string') {
        Taro.showToast({
          title: res,
@@ -1708,7 +1716,7 @@
        })
        setTimeout(() => {
          Taro.reLaunch({
            url: '/robotaxi/pages/begin-route/index',
            url: '/pages/home/index',
          })
        }, 1500);
        return
src/robotaxi/pages/expense-description/index.tsx
@@ -212,14 +212,14 @@
          {
            (fareData.orderMoney && !fareData.couponMoney) &&
            <View className='flex-between-card mt-16'>
              <View className='price-label'>系统优惠</View>
              <View className='price-label'>限时优惠</View>
              <View className='price-value color-red'>-{formatMoney(fareData.orderMoney)}元</View>
            </View>
          }
          {
            (fareData.orderMoney && fareData.couponMoney && fareData.orderMoney - fareData.couponMoney > 0) ?
              <View className='flex-between-card mt-16'>
                <View className='price-label'>系统优惠</View>
                <View className='price-label'>限时优惠</View>
                <View className='price-value color-red'>-{formatMoney(fareData.orderMoney - fareData.couponMoney)}元</View>
              </View>
              : ''
src/robotaxi/pages/expense-detail/index.tsx
@@ -110,7 +110,7 @@
        {
          (pricingCard.systemDiscount && pricingCard.systemDiscount > 0) &&
          <View className='flex-between-card'>
            <View className='price-label'>系统优惠</View>
            <View className='price-label'>限时优惠</View>
            <View className='price-value color-red'>-{pricingCard.systemDiscountStr}元</View>
          </View>
        }
src/robotaxi/pages/site-search/index.tsx
@@ -10,7 +10,7 @@
import { getOrderDistance } from '../../api/select-map-site';
import { AMAP_KEY, _UID } from '../../../constants/api';
import amapFile from '../../../libs/amap-wx.130.js';
import { checkOtp, getStorage } from '../../../utils/tools';
import { checkOtp } from '../../../utils/tools';
import TipPopup from '../select-map-site/components/tip-popup';
import { getNearestSite } from '../../api/home';
@@ -242,22 +242,6 @@
          return;
        }
      } catch { }
      // 埋点
      getStorage(_UID).then((uid) => {
        const $app: any = Taro.getApp().$app;
        $app.xpReportSend({
          eventId: 'RT_mp_user_address_searched',
          para: {
            eventId: 'RT_mp_user_address_searched',
            user_id: uid || '-1',
            search_type: pageType === 'start' ? 'pickup ' : 'dropoff ',
            geo_lat: item.latitude,
            geo_lng: item.longitude,
            odd_grid_id: item.electronicAreaId,
            timestamp: Date.now(),
          },
        });
      });
      Taro.setStorageSync('startSite', item);
      Taro.navigateBack()
    } else if (pageType == 'end') {
@@ -298,18 +282,6 @@
          }
        }
      } catch { }
      // 埋点
      getStorage(_UID).then((uid) => {
        const $app: any = Taro.getApp().$app;
        $app.xpReportSend({
          eventId: 'RT_mp_user_address_searched',
          para: {
            eventId: 'RT_mp_user_address_searched',
            user_id: uid || '-1',
            search_type: pageType === 'start' ? 'pickup ' : 'dropoff ',
          },
        });
      });
      Taro.setStorageSync('endSite', item)
      Taro.reLaunch({
        url: Taro.getStorageSync('orderId') ? '/robotaxi/pages/begin-route/index?skipPageFlag=1' : '/robotaxi/pages/begin-route/index',
src/utils/Robotaxi-public-method.ts
@@ -1,9 +1,11 @@
import amapFile from '../libs/amap-wx.130.js';
import { AMAP_KEY, _ROBOTAXI_HOST } from '../constants/api';
import { AMAP_KEY, _ROBOTAXI_HOST, _UID } from '../constants/api';
import Taro from '@tarojs/taro';
import request from './request';
import { getFenceCheck, getNearestSite } from '../robotaxi/api/home';
import { getOpenCity } from '../robotaxi/api/select-city';
import { getStorage, getOrCreateLocalId } from './tools';
// 辅助函数:计算两点之间的距离(单位:米)
export const getDistance = (lat1: number, lng1: number, lat2: number, lng2: number) => {
@@ -613,3 +615,32 @@
      return 0;
  }
}
// 埋点
export const reportEvent = async (eventId: string, para: any) => {
  let appVersion = '';
  const $app: any = Taro.getApp().$app;
  const { openId } = await $app.getIdData() || {};
  try {
    const accountInfo = Taro.getAccountInfoSync();
    appVersion = accountInfo?.miniProgram?.version || accountInfo?.miniProgram?.envVersion || '';
  } catch (e) {
    console.warn('获取小程序版本号失败:', e);
  }
  getStorage(_UID).then((uid) => {
    $app.xpReportSend({
      eventId,
      para: {
        ...para,
        user_id: uid || '-1',
        masked_device_id: openId,
        event_time: Date.now(),
        city: Taro.getStorageSync('selectedCity').name,
        orderId: Taro.getStorageSync('orderId') || '',
        os: Taro.getSystemInfoSync().system,
        app_ver: appVersion,
      },
    });
  });
}