Commit 7b5c9196 authored by 王炽's avatar 王炽

Merge remote-tracking branch 'origin/master' into dev

parents 4d2598c4 0a6cca46
......@@ -119,31 +119,86 @@ export const useUserStore = defineStore("userInfo", {
/**
* 获取宝宝信息
*/
async loadBabyInfo() {
const { data } = await fetchBabyInfo();
console.log("babyInfo", data);
if (data?.memberId !== "not_login") {
this.babyInfo = data;
if (this.babyInfo.babyAge == "0月龄") {
this.babyInfo.babyAge = "1月龄";
}
console.log("this.11111", this.babyNickCache, data?.content?.id);
const findItem = this.babyNickCache.find(
(item) => item.id == data?.content?.id
);
if (data?.content?.id && findItem) {
this.babyInfo.babyName = findItem.name;
this.babyInfo.allBabyBaseInfo.forEach((item) => {
if (item.id == data?.content?.id) {
item.babyName = findItem.name;
}
});
}
}
},
// async loadBabyInfo() {
// const { data } = await fetchBabyInfo();
// console.log("babyInfo", data);
// if (data?.memberId !== "not_login") {
// this.babyInfo = data;
// console.log("this.11111", this.babyNickCache, data?.content?.id);
// const findItem = this.babyNickCache.find(
// (item) => item.id == data?.content?.id
// );
// if (data?.content?.id && findItem) {
// this.babyInfo.babyName = findItem.name;
// this.babyInfo.allBabyBaseInfo.forEach((item) => {
// if (item.id == data?.content?.id) {
// item.babyName = findItem.name;
// }
// });
// }
// }
// },
async loadBabyInfo(retryCount = 0) {
const MAX_RETRIES = 3;
const RETRY_DELAY = 1000; // 1 second
try {
const { data } = await fetchBabyInfo();
console.log("babyInfo-宝宝信息", data);
if (data?.memberId !== "not_login") {
if (data.allBabyBaseInfo) {
this.babyInfo = data;
if (this.babyInfo.babyAge == "0月龄") {
this.babyInfo.babyAge = "1月龄";
}
console.log("this.11111", this.babyNickCache, data?.content?.id);
const findItem = this.babyNickCache.find(
(item) => item.id == data?.content?.id
);
if (data?.content?.id && findItem) {
this.babyInfo.babyName = findItem.name;
this.babyInfo.allBabyBaseInfo.forEach((item) => {
if (item.id == data?.content?.id) {
item.babyName = findItem.name;
}
});
}
return; // Success case, exit the function
} else {
console.log("this.babyInfo", '重新请求接口');
if (retryCount < MAX_RETRIES - 1) {
await new Promise(resolve => setTimeout(resolve, RETRY_DELAY));
return this.loadBabyInfo(retryCount + 1);
} else {
console.log("Max retries reached, giving up");
// Show user notification when max retries reached
uni.showToast({
title: "系统繁忙,请稍后再试",
icon: "none",
});
}
}
}
} catch (error) {
console.log("🚀 ~ loadBabyInfo ~ error:", error);
if (retryCount >= MAX_RETRIES - 1) {
// Show user notification when max retries reached with error
uni.showToast({
title: "系统繁忙,请稍后再试",
icon: "none",
});
}
}
},
/**
* 获取用户积分信息
*/
......
......@@ -416,8 +416,8 @@
"tupianBanben": "1008",
"swiper": [
{
"bannerImg": "integralBannerBg0.png",
"url": "subPackages/shopMainList/topicNew/index?id=1000916",
"bannerImg": "integralBannerBg1.png",
"url": "",
"type": 2,
"extra": {
"appId": "wx4205ec55b793245e",
......@@ -595,15 +595,6 @@
]
},
"vipActive": [
{
"img": "vipAct0.png",
"url": "subPackages/shopMainList/topicNew/index?id=1000911",
"type": 2,
"extra": {
"appId": "wx4205ec55b793245e",
"envVersion": "release"
}
},
{
"img": "vipAct1.png",
"url": "subPackages/shopMainList/topicNew/index?id=1000912",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment