zjk
2026-03-06 5f6454220651b761fc9afd6121bb51ef0aee2267
Merge branch 'develop' of http://gitlab.xiaopeng.local:18080/robotaxi1/xp-robotaxi-miniprogram into develop
4个文件已修改
34 ■■■■■ 已修改文件
src/pages/user/login.tsx 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/webpage/index.tsx 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/Robotaxi-public-method.ts 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/request.ts 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/user/login.tsx
@@ -280,6 +280,7 @@
    console.log('dispatchMobileBind,sessionCode: ', this.sessionCode);
    this.props.dispatchMobileBind(params, false)
      .then(bindPhoneRes => {
        console.log('dispatchMobileBind res: ', bindPhoneRes);
        if (ENV === 'weapp' || ENV === 'tt') {
          // "loginFlag":"0",  0:旧用户 1:新用户注册
          this.loginFlagStr = bindPhoneRes.loginFlag;
@@ -299,13 +300,18 @@
          }
        }
        console.log('setStorage bindPhoneRes');
        return Promise.all([
          Taro.setStorage({ key: _UID, data: bindPhoneRes.uid }),
          Taro.setStorage({ key: 'otp', data: bindPhoneRes.otp }),
        ])
          .then(() => this.requestXpUserInfo());
          .then(() => {
            console.log('requestXpUserInfo');
            return this.requestXpUserInfo();
          });
      })
      .then(xpUserRes => {
        console.log('xpUserRes: ', xpUserRes);
        Taro.hideLoading();
        if (xpUserRes) {
          // 微信小程序新用户注册时特定入口出现购车计划
@@ -449,6 +455,13 @@
  requestXpUserInfo = () => {
    return this.props.dispatchGetXpUserInfo({}, false)
      .then(xpUserRes => {
        console.log('dispatchGetXpUserInfo res: ', xpUserRes);
        console.log('dispatchGetXpUserInfo res type: ', typeof xpUserRes);
        console.log(xpUserRes);
        if (!xpUserRes) {
          console.warn('⚠️ xpUserRes 为空,请检查 API 响应或网络请求');
          throw new Error('获取用户信息失败:API 返回为空');
        }
        if (xpUserRes) {
          /**
           * 为了配合数据中台统计数据,每次登录时使用gdp('setUserId', id)来上报用户id
@@ -484,7 +497,8 @@
        }
        return xpUserRes;
      })
      .catch(() => {
      .catch((err) => {
        console.error('dispatchGetXpUserInfo: ', err);
        // 待公共处理
        Taro.setStorage({ key: 'otp', data: '' })
          .then(() => {
src/pages/webpage/index.tsx
@@ -3,7 +3,7 @@
export default function WebViewPage() {
  const router = useRouter();
  const url = decodeURIComponent(router.params.url || '');
  const url = decodeURIComponent(router.params.pageUrl || '');
  return (
    <WebView src={url} />
src/utils/Robotaxi-public-method.ts
@@ -117,7 +117,7 @@
export const extractPointsFromPolygons = (polygons: any[]) => {
  const points: any[] = [];
  if (!polygons || !Array.isArray(polygons)) return points;
  polygons.forEach(polygon => {
    if (polygon.points && Array.isArray(polygon.points)) {
      points.push(...polygon.points);
@@ -169,7 +169,7 @@
  } else if (jumpType === 3) {
    if (jumpUrl) {
      Taro.navigateTo({
        url: `/pages/webpage/index?url=${encodeURIComponent(jumpUrl)}`
        url: `/pages/webpage/index?pageUrl=${encodeURIComponent(jumpUrl)}`
      });
    }
  }
@@ -291,7 +291,7 @@
export const getCityInfoWithId = async (cityCode: string, cityName: string) => {
  try {
    const res: any = await getOpenCity();
    let cityId = 0;
    if (Array.isArray(res.cities)) {
      const target = res.cities.find(item => item.adcode === cityCode);
src/utils/request.ts
@@ -59,6 +59,12 @@
      let { code } = res.data;
      code = code ? code : res.data.status;
      // DEBUG: 当 data 为空时打印原始响应,排查接口返回格式问题
      if (data === undefined || data === null) {
        console.warn(`⚠️ [request] API 返回 data 为空, url: ${url}`);
        console.warn('⚠️ [request] 原始响应 res.data:', res.data);
      }
      if (skipException) { // 跳过异常处理
        const authExpired = CODE_AUTH_EXPIRED_ARRAY.indexOf(code) !== -1;
        if (authExpired && autoLogin && needLogin) { // 登录相关的异常除外
@@ -183,7 +189,7 @@
      'XP-Nonce': header['XP-Nonce'],
      // 'XP-Signature': PUBLIC_HEADER['XP-Signature'],
      'XP-Deviceid': header['XP-Deviceid'],
      'XP-Sort-Payload': header['XP-Sort-Payload'],
      'XP-Sort-Payload': header['XP-Sort-Payload'],
      ...extraData,
    }
    const sign_1st = makeSign(method, midData, payload, _XP_SECRET);