From 5f6454220651b761fc9afd6121bb51ef0aee2267 Mon Sep 17 00:00:00 2001
From: zjk <852185829@qq.com>
Date: 星期五, 06 三月 2026 11:19:06 +0800
Subject: [PATCH] Merge branch 'develop' of http://gitlab.xiaopeng.local:18080/robotaxi1/xp-robotaxi-miniprogram into develop
---
src/pages/webpage/index.tsx | 2 +-
src/utils/request.ts | 8 +++++++-
src/pages/user/login.tsx | 18 ++++++++++++++++--
src/utils/Robotaxi-public-method.ts | 6 +++---
4 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/src/pages/user/login.tsx b/src/pages/user/login.tsx
index be63c31..2559c8a 100644
--- a/src/pages/user/login.tsx
+++ b/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(() => {
diff --git a/src/pages/webpage/index.tsx b/src/pages/webpage/index.tsx
index f43d0a5..d164215 100644
--- a/src/pages/webpage/index.tsx
+++ b/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} />
diff --git a/src/utils/Robotaxi-public-method.ts b/src/utils/Robotaxi-public-method.ts
index f94191e..9ba781d 100644
--- a/src/utils/Robotaxi-public-method.ts
+++ b/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);
diff --git a/src/utils/request.ts b/src/utils/request.ts
index 199bb58..7606b84 100644
--- a/src/utils/request.ts
+++ b/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);
--
Gitblit v1.7.1