Commit b30f907d authored by spc's avatar spc

feeding

parents 33f625f8 85c42be1
import requestModule from './request.js';
const {
api
} = requestModule;
/**
* 获取首页信息
* @returns
* {
* 返回值
timestamp number
非必须
当前服务器时间戳
lastRecordType number
非必须
上次喂养方式:喂养方式:0-无记录 1-母乳亲喂, 2-母乳瓶喂, 3-奶粉喂养, 4-辅食
lastBreastMilkVolume number
非必须
上次母乳瓶喂喂养量(lastRecordType=2时有值)
lastFormulaVolume number
非必须
上次奶粉瓶喂喂养量(lastRecordType=3时有值)
leftTimerRunning boolean
非必须
左边计时器是否在进行
leftTimerDuration number
非必须
有正在进行中的母乳喂养计时器:左侧累计时长(ms)
rightTimerRunning boolean
非必须
右边计时器是否在进行
rightTimerDuration number
非必须
有正在进行中的母乳喂养计时器:右侧累计时长(ms)
}
*/
export const feedingHome = (babyId) => api.get('/c/feeding/home', { babyId });
/**
*
* @param {*} recordId
* @param {*} babyId
* @param {*} recordTime
* @param {*} feedingType
* @param {*} durationLeftSeconds
* @param {*} durationRightSeconds
* @param {*} totalDurationSeconds
* @param {*} volume
* @param {*} foodDetails
* @returns
*/
export const feedingRecords = (data) => api.post('/c/feeding/records', {
recordId:data.recordId,
babyId:data.babyId,
recordTime:data.recordTime,
feedingType:data.feedingType,//1-母乳亲喂, 2-母乳瓶喂, 3-奶粉喂养, 4-辅食
durationLeftSeconds:data.durationLeftSeconds,//左侧喂养时长(秒)
durationRightSeconds:data.durationRightSeconds,//右侧喂养时长(秒)
totalDurationSeconds:data.totalDurationSeconds,//总时长(秒), 手动记录时使用
volume:data.volume,//容量(ml)
foodDetails:data.foodDetails//辅食详情
});
// 根据宝宝ID和指定日期(格式:YYYY-MM-DD)获取当天的所有喂养记录。
export const feedingRecordsByDate = (data) => api.get('/c/feeding/records', {
babyId:data.babyId,
date:data.date
});
// 获取喂养记录的日历状态
export const feedingRecordsCalendarStatus = (data) => api.get('/c/feeding/records/calendar-status', {
babyId:data.babyId,
month:data.month
});
// 获取喂养记录的统计信息
export const feedingRecordsStatisticsPeriod = (data) => api.get('/c/feeding/statistics/period', {
babyId:data.babyId,
sdate:data.sdate,
edate:data.edate
});
// 获取自定义辅食
/**
*
* @param {*} data
* @returns
* foodId integer
非必须
辅食ID
format: int64
foodName string
非必须
辅食名称
foodType number
必须
1-主食 2-蔬菜 3-水果 4-其它
*/
export const feedingFoodsCustom = (data) => api.get('/c/feeding/foods/custom');
// 添加自定义辅食
export const feedingFoodsCustomAdd = (data) => api.post('/c/feeding/foods/custom/add', {
foodName:data.foodName,
foodType:data.foodType
});
// 删除自定义辅食
export const feedingFoodsCustomDelete = (data) => api.post('/c/feeding/foods/custom/delete', {
foodIds:data.foodIds,//多个ID,逗号分隔
});
// 开始计时
export const feedingTimerStart = (data) => api.post('/c/feeding/timer/start', {
babyId:data.babyId,
side:data.side
});
export const feedingTimerStop = (data) => api.post('/c/feeding/timer/stop', {
babyId:data.babyId,
side:data.side
});
// 上传语音
/**
*
* @param {*} data
* @returns
* taskId
**/
export const feedingVoiceUpload = (data) => api.post('/c/feeding/voice/upload', {
audioData:data.audioData,//base64
});
// 获取语音识别结果
export const feedingVoiceResult = (data) => api.get('/c/feeding/voice/result', {
taskId:data.taskId,
});
// 删除自定义辅食
// export const fetchHomeJSON = () => api.get('/c/front/content',{type:'home'});
\ No newline at end of file
......@@ -17,7 +17,9 @@ const {
// 通常可以吧 baseUrl 单独放在一个 js 文件了
// const baseUrl = "http://172.16.224.178:7777/pmall";
// const baseUrl = "https://momclub-uat.feihe.com/pmall";//测试环境
const baseUrl = "https://momclub.feihe.com/pmall";//生产环境
// let baseUrl = "https://momclub.feihe.com/pmall";//生产环境
// const baseUrl = "https://docs.dui88.com/mock/1956/api";//mock
const baseUrl = "https://feihe.m.duibatest.com.cn/pmall"
const request = (options = {}) => {
// 在这里可以对请求头进行一些设置
......@@ -28,6 +30,7 @@ const request = (options = {}) => {
// if(options.url == '/c/ai/chat/query'){
// baseUrl = "https://docs.dui88.com/mock/1956";
// }
return new Promise((resolve, reject) => {
uni
.request({
......@@ -40,7 +43,7 @@ const request = (options = {}) => {
},
})
.then((data) => {
// console.log('request data ===>', data);
console.log('request data6666666 ===>', data);
if (data.statusCode !== HTTP_STATUS.SUCCESS) {
uni.showToast({
title: data.errMsg,
......@@ -48,14 +51,16 @@ const request = (options = {}) => {
});
reject(data);
globalStore.setIsShowLoading(false);
} else if (!data.data?.ok) {
}
else if (!data.data?.ok) {
uni.showToast({
title: data.data?.message,
icon: 'none'
});
reject(data.data);
globalStore.setIsShowLoading(false);
} else {
}
else {
resolve(data.data);
}
})
......@@ -67,6 +72,7 @@ const request = (options = {}) => {
};
const get = (url, data, options = {}) => {
console.log('6666666666');
options.type = "GET";
options.data = data;
options.url = url;
......@@ -74,6 +80,8 @@ const get = (url, data, options = {}) => {
};
const post = (url, data, options = {}) => {
console.log('5555555555=', url, data, options);
options.type = "POST";
options.data = data;
options.url = url;
......
import requestModule from './request.js';
const {
api
} = requestModule;
/**
* 获取首页信息
* @returns
*/
export const growthHome = (babyId) => api.post('/c/growth/home', { babyId });
export const guideCompleted = () => api.post('/c/growth/guide/Completed');
export const assessmentSave = (data) => api.post('/c/growth/assessment/save', data);
// export const fetchHomeJSON = () => api.get('/c/front/content',{type:'home'});
\ No newline at end of file
<template>
<view v-if="visible" class="popup-overlay">
<view class="popup-content" @click.stop>
<!-- 喂养方式列表 -->
<view class="feed-list">
<view
v-for="(item, index) in feedOptions"
:key="index"
class="feed-item"
:class="{ selected: selectedIndex === index }"
@click="selectFeed(index)"
>
<!-- 选中背景 -->
<image
v-if="selectedIndex === index"
class="feed-item-bg"
src="/static/shengzhangTool/changeFeed/itemBg.png"
mode="aspectFit"
/>
<!-- 喂养方式文本 -->
<text class="feed-text">{{ item.name }}</text>
</view>
</view>
<!-- 底部按钮 -->
<view class="bottom-buttons">
<image
class="cancel-btn"
:class="{'cancel-btn-active': isCancelPressed}"
src="/static/shengzhangTool/changeFeed/cancelBtn.png"
@touchstart="handleCancelTouchStart"
@touchend="handleCancelTouchEnd"
mode="aspectFit"
/>
<image
class="ok-btn"
:class="{'ok-btn-active': isOkPressed}"
src="/static/shengzhangTool/changeFeed/okBtn.png"
@touchstart="handleOkTouchStart"
@touchend="handleOkTouchEnd"
mode="aspectFit"
/>
</view>
</view>
</view>
</template>
<script setup>
import { ref, defineEmits, defineProps } from 'vue'
const props = defineProps({
visible: {
type: Boolean,
default: false
},
selectedIndex: {
type: Number,
default: 0
}
})
const emit = defineEmits(['update:visible', 'update:selectedIndex', 'change'])
// 喂养方式选项
const feedOptions = ref([
{ name: '纯母乳', value: 'pure_breast' },
{ name: '母乳+奶粉混合喂养', value: 'mixed_feeding' },
{ name: '纯奶粉', value: 'pure_formula' },
{ name: '奶粉+辅食', value: 'formula_food' },
{ name: '母乳+辅食', value: 'breast_food' }
])
const selectIndex = ref(props.selectedIndex)
// 按钮状态
const isCancelPressed = ref(false)
const isOkPressed = ref(false)
// 添加加载状态
const isLoadingFeed = ref(false)
// 喂养方式相关数据
const showFeedSwitchPopup = ref(false)
const currentFeedIndex = ref(1) // 默认选中"母乳+奶粉混合喂养"
const selectedFeedText = ref('母乳+奶粉混合喂养')
// 选择喂养方式
const selectFeed = (index) => {
selectIndex.value = index
emit('update:selectedIndex', index)
}
// 取消按钮事件
const handleCancelTouchStart = () => {
isCancelPressed.value = true
}
const handleCancelTouchEnd = () => {
isCancelPressed.value = false
closePopup()
}
// 确认按钮事件
const handleOkTouchStart = () => {
isOkPressed.value = true
}
const handleOkTouchEnd = () => {
isOkPressed.value = false
const index = selectIndex.value
const selectedFeed = feedOptions.value[index]
// 发送事件通知主页面
emit('change', selectedFeed, index)//只能传一个参数
closePopup()
}
// 点击喂养方式选择
const openFeedSelector = () => {
console.log('打开喂养方式选择器')
showFeedSwitchPopup.value = true
}
// 处理喂养方式选择变化
const onFeedChange = (feedOption, index) => {
isLoadingFeed.value = true
console.log('选择了喂养方式:', feedOption, index)
selectedFeedText.value = feedOption.name
currentFeedIndex.value = index
// 模拟保存数据
setTimeout(() => {
isLoadingFeed.value = false
}, 300)
}
const closePopup = () => {
emit('update:visible', false)
}
</script>
<style lang="less" scoped>
.popup-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.7);
z-index: 9999;
.popup-content {
position: absolute;
width: 750rpx;
height: 897rpx;
background-color: #f6f8fa;
overflow: hidden;
border-top-left-radius: 32rpx;
border-top-right-radius: 32rpx;
bottom: 0rpx;
padding-top: 50rpx;
.feed-list {
flex: 1;
overflow-y: auto;
padding-left: 30rpx;
padding-right: 30rpx;
.feed-item {
position: relative;
display: flex;
align-items: center;
justify-content: center;
height: 106rpx;
margin-bottom: 20rpx;
border-radius: 16rpx;
background-color: #fff;
&.selected {
background-color: transparent;
}
.feed-item-bg {
position: absolute;
width: 689rpx;
height: 108rpx;
z-index: 1;
}
.feed-text {
position: relative;
z-index: 2;
font-size: 28rpx;
color: #1d1e26;
font-weight: 400;
}
}
}
.bottom-buttons {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 20rpx;
padding-left: 30rpx;
padding-right: 30rpx;
.cancel-btn {
width: 334rpx;
height: 97rpx;
transition: transform 0.1s ease-out;
&.cancel-btn-active {
transform: scale(0.95);
}
}
.ok-btn {
width: 334rpx;
height: 97rpx;
transition: transform 0.1s ease-out;
&.ok-btn-active {
transform: scale(0.95);
}
}
}
}
}
.feeding-select {
display: flex;
align-items: center;
cursor: pointer; // 添加手型光标
.feeding-value {
font-size: 28rpx;
color: #666;
margin-right: 8rpx;
}
.dropdown-icon {
width: 20rpx;
height: 20rpx;
transition: transform 0.3s ease; // 添加旋转动画
}
// 可选:添加点击反馈效果
&:active {
opacity: 0.7;
}
}
</style>
<template>
<view v-if="visible" class="popup-overlay">
<view class="popup-content" @click.stop>
<!-- 弹窗头部 -->
<view class="popup-header">
<text class="popup-title">切换宝宝</text>
<image
class="close-btn"
src="/static/shengzhangTool/changeBaby/closeBtn.png"
mode="aspectFit"
@click="closePopup"
/>
</view>
<!-- 宝宝列表 -->
<view class="baby-list">
<view
v-for="(baby, index) in babyList"
:key="index"
class="baby-item"
:class="{ selected: selectedIndex === index }"
@click="selectBaby(index)"
>
<!-- 选中背景 -->
<image
v-if="selectedIndex === index"
class="baby-item-bg"
src="/static/shengzhangTool/changeBaby/babyItemBg.png"
mode="aspectFit"
/>
<!-- 宝宝头像 -->
<image
class="baby-avatar"
:src="baby.avatar || '/static/shengzhangTool/avatar.png'"
mode="aspectFill"
/>
<!-- 宝宝信息 -->
<view class="baby-info">
<view class="baby-name-row">
<text class="baby-name">{{ baby.name }}</text>
<image
class="gender-icon"
:src="baby.gender === 1 ? '/static/shengzhangTool/sex1.png' : '/static/shengzhangTool/sex0.png'"
mode="aspectFit"
/>
</view>
<text class="baby-birthday">宝宝生日: {{ baby.birthday }}</text>
</view>
</view>
</view>
<image
class="ok-btn"
:class="{'ok-btn-active': isOkPressed}"
src="/static/shengzhangTool/changeBaby/okBtn.png"
@touchstart="handleOkTouchStart"
@touchend="handleOkTouchEnd"
mode="aspectFit"
></image>
</view>
</view>
</template>
<script setup>
import { ref, defineEmits, defineProps } from 'vue'
const props = defineProps({
visible: {
type: Boolean,
default: false
},
babyList: {
type: Array,
default: () => []
},
selectedIndex: {
type: Number,
default: 0
}
})
const emit = defineEmits(['update:visible', 'update:selectedIndex', 'change'])
const selectHandle = () => {
}
const isOkPressed = ref(false)
const handleOkTouchStart = () => {
isOkPressed.value = true
}
const handleOkTouchEnd = () => {
isOkPressed.value = false
const index = selectIndex.value;
// 发送事件 通知主页面
emit('change', props.babyList[index], index)
closePopup();
}
const closePopup = () => {
emit('update:visible', false)
}
const selectIndex = ref(0)
const selectBaby = (index) => {
selectIndex.value = index;
emit('update:selectedIndex', index);
}
</script>
<style lang="less" scoped>
.popup-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.7);
z-index: 9999;
// display: flex;
// align-items: center;
// justify-content: center;
.popup-content {
position: absolute;
width: 750rpx;
height: 719rpx;
background-color: #f6f8fa;
overflow: hidden;
border-top-left-radius: 32rpx;
border-top-right-radius: 32rpx;
bottom: 0rpx;
.popup-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 40rpx 30rpx 20rpx;
.popup-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.close-btn {
width: 40rpx;
height: 40rpx;
}
}
.baby-list {
flex: 1;
padding-left: 31rpx;
padding-right: 31rpx;
padding-top: 20rpx;
// padding-bottom: 20rpx;
height: 360rpx;
overflow-y: auto;
.baby-item {
position: relative;
display: flex;
align-items: center;
padding-left: 30rpx;
margin-bottom: 20rpx;
height: 129rpx;
border-radius: 16rpx;
background-color: #fff;
&.selected {
background-color: transparent;
}
.baby-item-bg {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
z-index: 1;
}
.baby-avatar {
position: relative;
z-index: 2;
width: 80rpx;
height: 80rpx;
border-radius: 50%;
margin-right: 20rpx;
}
.baby-info {
position: relative;
z-index: 2;
flex: 1;
.baby-name-row {
display: flex;
align-items: center;
margin-bottom: 8rpx;
.baby-name {
font-size: 28rpx;
font-weight: bold;
color: #333;
margin-right: 10rpx;
}
.gender-icon {
width: 24rpx;
height: 24rpx;
}
}
.baby-birthday {
font-size: 24rpx;
color: #666;
}
}
}
}
.ok-btn {
position: absolute;
width: 681rpx;
height: 98rpx;
margin-left: 35rpx;
margin-top: 0rpx;
&.ok-btn-active {
transform: scale(0.95);
}
}
}
}
</style>
\ No newline at end of file
<template>
<view v-if="visible" class="popup-overlay">
<view class="popup-content" @click.stop>
<!-- 问号图标 -->
<view class="question-icon">
<image class="icon" src="/static/shengzhangTool/tipsPopIcon.png" mode="aspectFit"></image>
</view>
<!-- 提示内容区域 -->
<view class="tips-content">
<rich-text class="rich-content" :nodes="tipsContent"></rich-text>
</view>
<!-- 底部按钮 -->
<view class="bottom-buttons">
<image
class="ok-btn"
:class="{'ok-btn-active': isOkPressed}"
src="/static/shengzhangTool/tipsOkBtn.png"
@touchstart="handleOkTouchStart"
@touchend="handleOkTouchEnd"
mode="aspectFit"
/>
</view>
</view>
</view>
</template>
<script setup>
import { ref, defineEmits, defineProps } from 'vue'
const props = defineProps({
visible: {
type: Boolean,
default: false
}
})
const emit = defineEmits(['update:visible'])
// 按钮状态
const isOkPressed = ref(false)
// 富文本内容
const tipsContent = ref(`
<div style="padding: 20rpx; line-height: 1.6;">
<div style="font-size: 32rpx; font-weight: bold; color: #d3a358;">头围测量</div>
<div style="font-size: 28rpx; font-weight: 300; color: #000000;">将软尺固定于小儿眉毛上缘,软尺紧贴头皮绕过后脑最高点即为头围的长度。</div>
<br>
<div style="font-size: 32rpx; font-weight: bold; color: #d3a358;">身高测量</div>
<div style="font-size: 28rpx; font-weight: 300; color: #000000;">3岁以下的小儿躺着测身长,让小儿躺在桌上或木板床上,按直小儿的双膝,使两下肢伸直,用软尺量取头顶到脚底(注意不是足尖)的长度,3岁以上的小儿可站着测身高。</div>
<br>
<div style="font-size: 32rpx; font-weight: bold; color: #d3a358;">体重测量</div>
<div style="font-size: 28rpx; font-weight: 300; color: #000000;">1)先用小被单将孩子兜住,用称称重,然后减去小被单及包括尿布在内的一切衣物重量,即为婴儿体重;</div>
<div style="font-size: 28rpx; font-weight: 300; color: #000000;">2)家长抱着婴儿站在磅秤上称体重,减去大人的体重,即为婴儿体重。</div>
<div style="font-size: 28rpx; font-weight: 300; color: #000000;">3)测量前最好空腹,排去大小便,或两小时内没有进食,尽量脱去衣裤、鞋帽、尿布等,仅穿单衣裤;所测得的数据应减去婴儿所穿的衣物及尿布的重量。</div>
</div>
`)
// 确认按钮事件
const handleOkTouchStart = () => {
isOkPressed.value = true
}
const handleOkTouchEnd = () => {
isOkPressed.value = false
closePopup()
}
const closePopup = () => {
emit('update:visible', false)
}
</script>
<style lang="less" scoped>
.popup-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.7);
z-index: 9999;
.popup-content {
position: absolute;
width: 661rpx;
height: 883rpx;
background-color: #ffffff;
overflow: hidden;
border-radius: 52rpx;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
.question-icon {
display: flex;
justify-content: center;
align-items: center;
margin-top: 40rpx;
.icon {
width: 80rpx;
height: 80rpx;
}
}
.tips-content {
margin-top: 20rpx;
flex: 1;
padding-left: 30rpx;
padding-right: 30rpx;
overflow-y: auto;
.rich-content {
width: 100%;
height: 100%;
/deep/ div {
margin-bottom: 20rpx;
}
/deep/ br {
display: block;
margin: 10rpx 0;
}
}
}
.bottom-buttons {
display: flex;
justify-content: center;
align-items: center;
padding: 0 40rpx 40rpx;
margin-top: 30rpx;
.ok-btn {
width: 500rpx;
height: 97rpx;
transition: transform 0.1s ease-out;
&.ok-btn-active {
transform: scale(0.95);
}
}
}
}
}
</style>
\ No newline at end of file
This diff is collapsed.
......@@ -87,6 +87,12 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/shengzhangTools/shengzhangTools",
"style": {
"navigationStyle": "custom"
}
},
{
"path" : "pages/feedingAnalysis/feedingAnalysis",
"style" :
......@@ -101,6 +107,12 @@
{
"navigationBarTitleText" : "添加喂养记录"
}
},
{
"path": "pages/shengzhangTestResult/shengzhangTestResult",
"style": {
"navigationStyle": "custom"
}
}
],
"globalStyle": {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import { defineStore } from "pinia";
import { fetchBabyInfo } from "../api/user.js";
export const useFeedStore = defineStore("feed", {
state: () => {
return {
// 宝宝列表和当前选中宝宝的管理
babyList: [],
currentBabyIndex: 0,
};
},
actions: {
/**
* 获取宝宝信息
*/
async loadBabyInfo() {
const { data } = await fetchBabyInfo();
console.log("babyInfo", data);
if (data?.memberId !== "not_login") {
// 处理宝宝列表数据
this.processBabyList(data);
}
},
/**
* 处理宝宝列表数据
*/
processBabyList(data) {
if (data.allBabyBaseInfo && Array.isArray(data.allBabyBaseInfo)) {
// 转换接口数据格式为组件需要的格式
this.babyList = data.allBabyBaseInfo.map(baby => ({
id: baby.id,
name: baby.babyName || baby.content?.babyName || '未命名',
avatar: baby.content?.babyAvatar || '/static/feedingIndex/v1/avatar.png',
gender: baby.content?.babyGender,
birthday: baby.content?.babyBirthday,
babyStage: baby.babyStage,
babyType: baby.babyType,
typeName: baby.typeName,
selected: baby.selected
}))
// 找到选中的宝宝,如果没有选中的则选择第一个
const selectedIndex = this.babyList.findIndex(baby => baby.selected)
this.currentBabyIndex = selectedIndex >= 0 ? selectedIndex : 0
console.log('处理后的宝宝列表:', this.babyList)
console.log('当前选中的宝宝索引:', this.currentBabyIndex)
} else {
// 如果没有宝宝数据,使用默认数据
this.babyList = [{
id: 1,
name: '默认宝宝',
avatar: '/static/feedingIndex/v1/avatar.png',
gender: null,
birthday: null,
babyStage: 1,
babyType: null,
typeName: '默认',
selected: true
}]
this.currentBabyIndex = 0
}
},
/**
* 切换宝宝
*/
switchBaby(index) {
if (index >= 0 && index < this.babyList.length) {
this.currentBabyIndex = index
console.log('切换到宝宝:', this.babyList[index].name, '索引:', index)
}
},
/**
* 获取当前选中的宝宝
*/
getCurrentBaby() {
return this.babyList[this.currentBabyIndex] || null
},
/**
* 获取当前选中的宝宝ID
*/
getCurrentBabyId() {
const currentBaby = this.getCurrentBaby()
return currentBaby ? currentBaby.id : 1
},
},
});
\ No newline at end of file
......@@ -21,6 +21,7 @@ export const useUserStore = defineStore("userInfo", {
babyInfo: null,
memberInfo: null,
babyNickCache: [],
cepingjieguoInfo:null,
};
},
actions: {
......
......@@ -1472,6 +1472,7 @@
//banner点击事件
const bannerHandler = (item) => {
md.sensorLogTake({
xcxClick: "积分服务页-首屏页面点击",
pageName: "积分服务页-首屏",
......
......@@ -232,6 +232,8 @@ const babyInfo = computed(() => userStore?.babyInfo || {});
const showRegisterLayer = ref(false);
const showBabySwitcher = ref(false);
const babyId = ref(0);
const handleHot = (e) => {
const type = e.currentTarget.dataset.type;
md.sensorLog(e);
......@@ -245,6 +247,7 @@ const handleHot = (e) => {
}
};
// 页面跳转
const navigateTo = (url) => {
uni.navigateTo({
......@@ -299,7 +302,13 @@ const handleToolClick = async (item) => {
},
});
} else {
jump({ type: item.link.type, url: item.link.url });
const extra = item.link.extra;
if(extra && extra.babyId){
jump({ type: item.link.type, url: item.link.url+'?babyId='+extra.babyId});
}else{
jump({ type: item.link.type, url: item.link.url});
}
}
};
......@@ -323,9 +332,8 @@ const handleEditProfile = (e) => {
md.sensorLog(e);
const type =
userStore.babyInfo?.allBabyBaseInfo?.length == 0 ? "add" : "edit";
const babyId = userStore.babyInfo?.allBabyBaseInfo.find(
const type = userStore.babyInfo?.allBabyBaseInfo?.length == 0 ? "add" : "edit";
babyId.value = userStore.babyInfo?.allBabyBaseInfo.find(
(item) => item.selected
)?.id;
......@@ -436,11 +444,32 @@ onMounted(async () => {
await pageCfgStore.fetchCfg();
initData();
hideLoading();
babyId.value = userStore.babyInfo?.allBabyBaseInfo.find(
(item) => item.selected
)?.id;
console.log('babyIdsdfsdfsdfsdfsdfsdfdsfsdf=', babyId.value);
const a = {
"bgUrl": "my/babytest.png",
"desc": "生长测评",
"link": {
"extra": {babyId: babyId.value},
"type": 1,
"url": "/pages/shengzhangTools/shengzhangTools"
},
"title": "生长测评"
}
toolList.value.push(a);
});
watch([() => userStore.userInfo, () => userStore.babyInfo], () => {
console.log("userInfo/babyInfo变化", userStore.userInfo, userStore.babyInfo);
initData();
babyId.value = userStore.babyInfo?.allBabyBaseInfo.find(
(item) => item.selected
)?.id;
});
// 定义页面配置
......
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