forked from gxwebsoft/mp-10550
feat(user): 添加用户卡片统计数据接口和优化性能
- 新增 UserCardStats 接口定义余额/积分/优惠券/礼品卡数据结构 - 实现 getUserCardStats 函数聚合返回用户卡片统计数据 - 替换原有多个独立请求为单一聚合接口提升性能 - 修改 useUserData Hook 使用新聚合接口并调整数据类型 - 移除废弃的 pageShopOrder 和相关 API 导入 - 优化用户登录后自动刷新卡片统计数据逻辑
This commit is contained in:
@@ -65,6 +65,8 @@ const UserCard = forwardRef<any, any>((_, ref) => {
|
||||
setUserInfo(data)
|
||||
setIsLogin(true);
|
||||
Taro.setStorageSync('UserId', data.userId)
|
||||
// 登录态已就绪后刷新卡片统计(余额/积分/券/礼品卡)
|
||||
refresh().then()
|
||||
|
||||
// 获取openId
|
||||
if (!data.openid) {
|
||||
@@ -162,6 +164,8 @@ const UserCard = forwardRef<any, any>((_, ref) => {
|
||||
Taro.setStorageSync('UserId', res.data.data.user.userId)
|
||||
setUserInfo(res.data.data.user)
|
||||
setIsLogin(true)
|
||||
// 登录态已就绪后刷新卡片统计(余额/积分/券/礼品卡)
|
||||
refresh().then()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user