Commit 58fc3df5 authored by 张九刚's avatar 张九刚

feat: 生长工具分享

parent bcb03ac5
......@@ -217,13 +217,13 @@
</template>
<script setup>
import { onMounted, ref, getCurrentInstance,watch } from 'vue'
import { onMounted, ref, getCurrentInstance, watch } from 'vue'
import BabySwitchPopup from '@/components/BabySwitchPopup.vue'
import BabyFeedSwitchPopup from '@/components/BabyFeedSwitchPopup.vue'
import DatePickerPopup from '@/components/DatePickerPopup.vue'
import BabyTestTipsPopup from '@/components/BabyTestTipsPopup.vue'
import { growthHome, guideCompleted, getGrowthCurveData, fetchShengzhangToolsJSON } from '../../api/shengzhangTools'
import { onLoad, onShow , onShareAppMessage, onShareTimeline} from "@dcloudio/uni-app";
import { onLoad, onShow, onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
import { throttleTap, jump, JumpType, formatDate } from '../../utils/index.js';
import { useShengzhangStore } from '../../stores/shengzhangResult.js';
import { useUserStore } from "@/stores/user";
......@@ -732,7 +732,8 @@ const guideHandler = async () => {
}
}
const userStore = useUserStore();
const { babyInfo } = storeToRefs(userStore)
// 获取页面参数
onLoad((options) => {
if (options.babyId) {
......@@ -740,6 +741,15 @@ onLoad((options) => {
console.log('获取到的babyId:', babyId.value)
}
})
watch(babyInfo, async (newVal, oldVal) => {
console.log(oldVal,'-----babyId发生变化,重新获取数据', newVal)
if((!oldVal || !oldVal?.content?.id) && newVal?.content?.id){
console.log('start重新获取数据', newVal)
await babyRefresh();
}
})
onShow(async () => {
......@@ -755,8 +765,7 @@ const onRegisterConfirm = async () => {
const onBabyChange1 = async () => {
await babyRefresh();
}
const userStore = useUserStore();
const { babyInfo } = storeToRefs(userStore)
const refreshBabyInfo = async () => {
const userStore = useUserStore();
babyId.value = userStore.babyInfo?.content?.id;
......@@ -811,15 +820,15 @@ const babyRefresh = async () => {
) {
isNotLogin.value = true;
}
console.log(babyInfo?.babyStage+'--------------------',babyInfo)
console.log(babyInfo?.babyStage + '--------------------', babyInfo)
if (babyInfo && babyInfo.babyStage == 2) {
isTip.value = false
await refreshBabyInfo();
} else {
isTip.value = true;
}
}
const shengzhangToolsData = ref({
......
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