Commit fc01e112 authored by 王炽's avatar 王炽

Merge branch 'dev' of http://gitlab2.dui88.com/fh/20250528_FHQ1 into dev

parents 49d902ff 203fb2ca
...@@ -147,4 +147,4 @@ export const feedingVoiceResult = (data) => api.get('/c/feeding/voice/result', { ...@@ -147,4 +147,4 @@ export const feedingVoiceResult = (data) => api.get('/c/feeding/voice/result', {
// export const fetchHomeJSON = () => api.get('/c/front/content',{type:'home'}); export const fetchFeedingJSON = () => api.get('/c/front/content',{type:'feeding'});
\ No newline at end of file \ No newline at end of file
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
{{ type == '1' ? '当前非宝宝状态' : '当前非孕中状态' }} {{ type == '1' ? '当前非宝宝状态' : '当前非孕中状态' }}
</view> </view>
<view class="content-3"> <view class="content-3">
可以去个人中心新增或切换{{ type == '1' ? '宝宝' : '孕中' }}状态 可以去个人中心新增或切换{{ type == '1' ? '宝宝' : '孕中' }}状态
</view> </view>
<view class="content-4"> <view class="content-4">
再使用工具哦 再使用工具哦
...@@ -25,71 +25,137 @@ ...@@ -25,71 +25,137 @@
import { import {
ref ref
} from 'vue' } from 'vue'
import { useUserStore } from "@/stores/user";
// 接受父组件参数
const props = defineProps({ const props = defineProps({
type: { type: {
type: String, type: String,
default: '1', // 1 非宝宝状态 2 非孕中状态 default: '1', // 1 非宝宝状态 2 非孕中状态
} }
}) })
// 用户信息
const userStore = useUserStore();
const babyInfo = ref(userStore.babyInfo)
// 弹窗提示
const showModalFn = (content)=>{
uni.showModal({
title: '温馨提示',
content: content,
showCancel: false,
confirmColor: '#d3a358',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
uni.navigateBack();
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
// 跳转新增宝宝状态页面
const navigateToFn = () =>{
const type = 'add'
uni.navigateTo({
url: `/pages/person/person?type=${type}`
})
}
// 跳转新增产检页面 // 跳转新增产检页面
const onAdd = () => { const onAdd = () => {
const type = 'add' // jump({
uni.navigateBack(); // type: JumpType.INNER,
// uni.navigateTo({ // url: "/pages/index/index"
// url: `/pages/person/person?type=${type}` // })
// }) console.log('babyInfo', babyInfo)
console.log('babyInfo', babyInfo.value)
const babyBaseInfo = babyInfo.value.allBabyBaseInfo
// 1 首先判断是否有宝宝信息
if (babyBaseInfo) {
// 2 判断宝宝信息是否达到上限 3个
if (babyBaseInfo.length >= 3) {
showModalFn('状态添加已到达上限,可以尝试切换状态哦')
} else {
// 宝宝生长测试和喂养记录
if (props.type == '1') {
const hasStage = babyBaseInfo.some(baby => baby.babyStage == 2)
if (hasStage) {
showModalFn('已有宝宝状态,可以尝试切换状态哦')
} else {
navigateToFn()
}
} else { // 产检提醒
const hasStage = babyBaseInfo.some(baby => baby.babyStage == 1)
if (hasStage) {
showModalFn('已有孕中状态,可以尝试切换状态哦')
} else {
navigateToFn()
}
}
}
} else {
navigateToFn()
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.popup-tip{ .popup-tip {
position: fixed; position: fixed;
left: 0; left: 0;
top: 0; top: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
z-index: 999;
background: rgba(0, 0, 0, 0.5); background: rgba(0, 0, 0, 0.5);
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
&-content{
width: 661rpx; &-content {
height: 492rpx; width: 661rpx;
display: flex; height: 492rpx;
flex-direction: column; display: flex;
align-items: center; flex-direction: column;
border-radius: 52rpx; align-items: center;
background: #ffffff; border-radius: 52rpx;
.content-1{ background: #ffffff;
width: 79rpx;
height: 79rpx; .content-1 {
margin-top: 35rpx; width: 79rpx;
image{ height: 79rpx;
width: 100%; margin-top: 35rpx;
height: 100%;
image {
width: 100%;
height: 100%;
}
} }
}
.content-2{ .content-2 {
font-size: 37rpx; font-size: 37rpx;
color: #d3a358; color: #d3a358;
margin-top: 20rpx; margin-top: 20rpx;
} }
.content-3{
margin-top: 20rpx; .content-3 {
} margin-top: 20rpx;
.content-4{ }
margin-top: 12rpx;
} .content-4 {
.content-3, .content-4{ margin-top: 12rpx;
font-size: 30rpx; }
color: #000000;
} .content-3,
.content-4 {
font-size: 30rpx;
color: #000000;
}
} }
} }
// 保存 // 保存
.form-btn { .form-btn {
width: 565rpx; width: 565rpx;
...@@ -102,6 +168,7 @@ const onAdd = () => { ...@@ -102,6 +168,7 @@ const onAdd = () => {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin-top: 55rpx; margin-top: 55rpx;
image { image {
width: 42rpx; width: 42rpx;
height: 42rpx; height: 42rpx;
......
{
"swiperData": [
{
"jumpType": 3,
"bannerImg": "https://firmus-member.oss-cn-beijing.aliyuncs.com/momclub-picture/feedingIndex/v1/banner.png",
"url": "https://www.baidu.com"
},
{
"jumpType": 2,
"extra": {
"envVersion": "release",
"appId": "wx4205ec55b793245e"
},
"bannerImg": "https://firmus-member.oss-cn-beijing.aliyuncs.com/momclub-picture/feedingIndex/v1/banner.png",
"url": "subPackages/xmhMainProcess/member/index?entrySource=xmh_wechatmp_points_recgoodsbot"
},
{
"jumpType": 1,
"bannerImg": "https://firmus-member.oss-cn-beijing.aliyuncs.com/momclub-picture/feedingIndex/v1/banner.png",
"url": "/pages/index/index"
}
]
}
\ No newline at end of file
...@@ -11,9 +11,7 @@ ...@@ -11,9 +11,7 @@
"path" : "pages/postnatalCheckUp/postnatalCheckUp", "path" : "pages/postnatalCheckUp/postnatalCheckUp",
"style" : "style" :
{ {
"navigationBarTitleText" : "", "navigationBarTitleText" : "产检提醒"
"enablePullDownRefresh" : false,
"navigationStyle": "custom"
} }
}, },
{ {
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
<view class="feeding-record-add-page"> <view class="feeding-record-add-page">
<!-- 可滚动内容区域 --> <!-- 可滚动内容区域 -->
<!-- 广告横幅 --> <!-- 广告横幅 -->
<swiper class="banner-swiper" :indicator-dots="swiperData.length > 1" :autoplay="swiperData.length > 1" <swiper class="banner-swiper" v-if="swiperData.length > 0" :indicator-dots="swiperData.length > 1"
:circular="swiperData.length > 1" indicator-color="#dfddd9" indicator-active-color="#b27c1e" :autoplay="swiperData.length > 1" :circular="swiperData.length > 1" indicator-color="#dfddd9"
:indicator-top="596"> indicator-active-color="#b27c1e" :indicator-top="596">
<swiper-item v-for="(item, index) in swiperData" :key="index"> <swiper-item v-for="(item, index) in swiperData" :key="index">
<image class="banner-img" :src="`${item?.bannerImg}`" mode="aspectFill" @click="bannerHandler(item)" /> <image class="banner-img" :src="`${item?.bannerImg}`" mode="aspectFill" @click="bannerHandler(item)" />
</swiper-item> </swiper-item>
...@@ -416,13 +416,16 @@ ...@@ -416,13 +416,16 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<popupTip v-if="isTip" type="1"></popupTip>
</template> </template>
<script setup> <script setup>
import { ref, computed, onMounted, onUnmounted, getCurrentInstance } from 'vue' import { ref, computed, onMounted, onUnmounted, getCurrentInstance } from 'vue'
import { onShow, onLoad, onHide } from '@dcloudio/uni-app' import { onShow, onLoad, onHide } from '@dcloudio/uni-app'
import BabySwitchPopup from '@/components/BabySwitchPopup.vue' import BabySwitchPopup from '@/components/BabySwitchPopup.vue'
import { feedingHome, feedingRecords, feedingFoodsCustom, feedingFoodsCustomAdd, feedingFoodsCustomDelete, feedingTimerStart, feedingTimerStop, feedingVoiceUpload, feedingVoiceResult } from '@/api/feeding.js' import popupTip from '../../components/popup-tip/popup-tip.vue'
import { fetchFeedingJSON, feedingHome, feedingRecords, feedingFoodsCustom, feedingFoodsCustomAdd, feedingFoodsCustomDelete, feedingTimerStart, feedingTimerStop, feedingVoiceUpload, feedingVoiceResult } from '@/api/feeding.js'
import { useUserStore } from '@/stores/user.js' import { useUserStore } from '@/stores/user.js'
import { jump, JumpType } from '../../utils' import { jump, JumpType } from '../../utils'
import { getHealthField } from "@/api/common"; import { getHealthField } from "@/api/common";
...@@ -510,27 +513,9 @@ const feedingIndexRes = { ...@@ -510,27 +513,9 @@ const feedingIndexRes = {
icon_btn_cancel: $baseUrl + `feedingIndex/${version}/icon_btn_cancel.png`, icon_btn_cancel: $baseUrl + `feedingIndex/${version}/icon_btn_cancel.png`,
} }
const swiperData = ref([{ const swiperData = ref([
bannerImg: feedingIndexRes.banner,
jumpType: JumpType.H5, ]);
url: 'https://www.baidu.com'
}, {
bannerImg: feedingIndexRes.banner,
jumpType: JumpType.MINI,
extra: {
appId: 'wx4205ec55b793245e',
envVersion: 'release',
success: () => {
console.log('跳转成功')
},
},
url: 'subPackages/xmhMainProcess/member/index?entrySource=xmh_wechatmp_points_recgoodsbot'
}, {
bannerImg: feedingIndexRes.banner,
jumpType: JumpType.INNER,
url: '/pages/index/index'
}]);
const indicatorStyle = `height: 40px; border: none;` const indicatorStyle = `height: 40px; border: none;`
// 当前时间,使用 home 接口的 timestamp // 当前时间,使用 home 接口的 timestamp
...@@ -671,6 +656,8 @@ const babyId = computed(() => userStore.babyInfo?.content?.id) ...@@ -671,6 +656,8 @@ const babyId = computed(() => userStore.babyInfo?.content?.id)
// 宝宝切换相关状态 // 宝宝切换相关状态
const showBabySwitchPopup = ref(false) const showBabySwitchPopup = ref(false)
const isTip = ref(false)
// 为每种喂养方式设置独立的数据 - 根据接口数据初始化 // 为每种喂养方式设置独立的数据 - 根据接口数据初始化
const feedingData = ref({ const feedingData = ref({
breastfeeding: { breastfeeding: {
...@@ -925,12 +912,18 @@ async function loadBabyInfo() { ...@@ -925,12 +912,18 @@ async function loadBabyInfo() {
// 使用全局状态管理加载宝宝信息 // 使用全局状态管理加载宝宝信息
// 加载宝宝信息 - 由 userStore 管理 // 加载宝宝信息 - 由 userStore 管理
await userStore.loadBabyInfo() await userStore.loadBabyInfo()
console.log('宝宝信息加载完成:', userStore.babyInfo) console.log('宝宝信息加载完成:', userStore.babyInfo, userStore.babyInfo.babyStage)
if (userStore.babyInfo.babyStage != 2) {
isTip.value = true
} else {
console.log('宝宝信息加载完成') console.log('宝宝信息加载完成')
// 加载宝宝信息后,加载首页数据
await loadHomeData()
}
// 加载宝宝信息后,加载首页数据
await loadHomeData()
} catch (error) { } catch (error) {
console.error('获取宝宝信息失败:', error) console.error('获取宝宝信息失败:', error)
...@@ -946,6 +939,9 @@ async function loadBabyInfo() { ...@@ -946,6 +939,9 @@ async function loadBabyInfo() {
// 获取首页数据 // 获取首页数据
async function loadHomeData() { async function loadHomeData() {
if (!babyId.value) {
return
}
try { try {
const response = await feedingHome(babyId.value) const response = await feedingHome(babyId.value)
console.log('首页数据:', response) console.log('首页数据:', response)
...@@ -987,6 +983,21 @@ async function loadHomeData() { ...@@ -987,6 +983,21 @@ async function loadHomeData() {
icon: 'none' icon: 'none'
}) })
} }
// 获取轮播图数据
try {
const feedingResponse = await fetchFeedingJSON()
console.log('轮播图数据:', feedingResponse)
if (feedingResponse && feedingResponse.data) {
swiperData.value = feedingResponse.data.swiperData
}
} catch (error) {
console.error('获取轮播图数据失败:', error)
// 使用默认的轮播图数据作为fallback
swiperData.value = []
}
} }
// 根据接口数据初始化页面状态 // 根据接口数据初始化页面状态
...@@ -3461,7 +3472,7 @@ function loadDefaultFoodsData() { ...@@ -3461,7 +3472,7 @@ function loadDefaultFoodsData() {
/* ===== 广告横幅 ===== */ /* ===== 广告横幅 ===== */
.banner-swiper { .banner-swiper {
position: absolute; position: relative;
top: 0; top: 0;
left: 16rpx; left: 16rpx;
width: 718rpx; width: 718rpx;
...@@ -3476,8 +3487,8 @@ function loadDefaultFoodsData() { ...@@ -3476,8 +3487,8 @@ function loadDefaultFoodsData() {
/* ===== 喂养时间区域 ===== */ /* ===== 喂养时间区域 ===== */
.feeding-time { .feeding-time {
position: absolute; position: relative;
top: 174rpx; // margin-top: 174rpx;
left: 0; left: 0;
right: 0; right: 0;
display: flex; display: flex;
...@@ -3564,8 +3575,8 @@ function loadDefaultFoodsData() { ...@@ -3564,8 +3575,8 @@ function loadDefaultFoodsData() {
/* ===== 喂养记录链接 ===== */ /* ===== 喂养记录链接 ===== */
.feeding-records { .feeding-records {
position: absolute; position: relative;
top: 270rpx; // margin-top: 270rpx;
left: 0; left: 0;
right: 0; right: 0;
display: flex; display: flex;
...@@ -3595,8 +3606,8 @@ function loadDefaultFoodsData() { ...@@ -3595,8 +3606,8 @@ function loadDefaultFoodsData() {
/* ===== 喂养类型选择 ===== */ /* ===== 喂养类型选择 ===== */
.feeding-types { .feeding-types {
position: absolute; position: relative;
top: 320rpx; // margin-top: 320rpx;
left: 0; left: 0;
right: 0; right: 0;
display: flex; display: flex;
...@@ -3663,8 +3674,8 @@ function loadDefaultFoodsData() { ...@@ -3663,8 +3674,8 @@ function loadDefaultFoodsData() {
/* ===== 温馨提示 ===== */ /* ===== 温馨提示 ===== */
.warm-tip { .warm-tip {
position: absolute; position: relative;
top: 20rpx; // margin-top: 20rpx;
left: 0; left: 0;
right: 0; right: 0;
text-align: center; text-align: center;
...@@ -4467,8 +4478,7 @@ function loadDefaultFoodsData() { ...@@ -4467,8 +4478,7 @@ function loadDefaultFoodsData() {
/* ===== 下半部分背景区域 ===== */ /* ===== 下半部分背景区域 ===== */
.bottom-section { .bottom-section {
position: absolute; position: relative;
top: 460rpx;
left: 0; left: 0;
right: 0; right: 0;
width: 100%; width: 100%;
......
...@@ -227,7 +227,7 @@ const feedingRecordRes = { ...@@ -227,7 +227,7 @@ const feedingRecordRes = {
add_btn: $baseUrl + `feedingRecord/${version}/addBtn.png`, add_btn: $baseUrl + `feedingRecord/${version}/addBtn.png`,
icon_change_btn_confirm: $baseUrl + `feedingRecord/${version}/icon_change_btn_confirm.png`, icon_change_btn_confirm: $baseUrl + `feedingRecord/${version}/icon_change_btn_confirm.png`,
icon_change_btn_cancel: $baseUrl + `feedingRecord/${version}/icon_change_btn_cancel.png`, icon_change_btn_cancel: $baseUrl + `feedingRecord/${version}/icon_change_btn_cancel.png`,
avatar: $baseUrl + `feedingRecord/${version}/avatar.png`, avatar: $baseUrl + `feedingIndex/${version}/avatar.png`,
} }
......
...@@ -231,7 +231,7 @@ import { showLoading, hideLoading } from "../../utils/index.js"; ...@@ -231,7 +231,7 @@ import { showLoading, hideLoading } from "../../utils/index.js";
import { updateBabyInfo, getGestationalWeeks } from "../../api/user.js"; import { updateBabyInfo, getGestationalWeeks } from "../../api/user.js";
import { usePageCfgStore } from "../../stores/pageCfg"; import { usePageCfgStore } from "../../stores/pageCfg";
import md from "../../md.js"; import md from "../../md.js";
import { jump, JumpType } from '../../utils/index.js';
const userStore = useUserStore(); const userStore = useUserStore();
const pageType = ref("add"); const pageType = ref("add");
const babyId = ref(""); const babyId = ref("");
...@@ -585,7 +585,11 @@ const onSubmit = async (e) => { ...@@ -585,7 +585,11 @@ const onSubmit = async (e) => {
title: "提交成功", title: "提交成功",
icon: "success", icon: "success",
}); });
uni.navigateBack(); // uni.navigateBack();
jump({
type: JumpType.INNER,
url: "/pages/index/index"
})
showLoading(); showLoading();
await userStore.loadUserInfo(); await userStore.loadUserInfo();
await userStore.loadBabyInfo(); await userStore.loadBabyInfo();
......
<template> <template>
<view> <view>
<view class="postnatal"> <view class="postnatal">
<!-- <view class="page-top">
<image @tap="backHandler" class="btnback" src="/static/chanjianTool/back.png"></image> <!-- 自定义头部 -->
<view class="page_title">产检提醒</view> <!-- <customize-navigation>
</view> -->
<!-- 自定义导航 -->
<customize-navigation>
<template v-slot:navbar-content> <template v-slot:navbar-content>
<view class="page-top"> <view class="page-top">
<image @tap="backHandler" class="btnback" :src="`${$baseUrl}chanjianTool/1001/back.png`"> <image @tap="backHandler" class="btnback" :src="`${$baseUrl}chanjianTool/1001/back.png`">
...@@ -14,7 +11,7 @@ ...@@ -14,7 +11,7 @@
<view class="page_title">产检提醒</view> <view class="page_title">产检提醒</view>
</view> </view>
</template> </template>
</customize-navigation> </customize-navigation> -->
<view class="postnatal-con"> <view class="postnatal-con">
<!-- 轮播图 --> <!-- 轮播图 -->
<swiper class="banner-swiper" :autoplay="true" :circular="true" v-if="bannerList.length > 0 "> <swiper class="banner-swiper" :autoplay="true" :circular="true" v-if="bannerList.length > 0 ">
...@@ -400,10 +397,13 @@ const getInfoFn = async () => { ...@@ -400,10 +397,13 @@ const getInfoFn = async () => {
console.log('产检提醒首页获取信息', code, success, message, data) console.log('产检提醒首页获取信息', code, success, message, data)
if (success) { if (success) {
homeInfo.value = data homeInfo.value = data
uni.setStorageSync('dueDate', data.dueDate); uni.setStorageSync('dueDate', data.dueDate);
} else { } else {
isTip.value = true uni.showToast({
title: message,
icon: "none",
});
// isTip.value = true
} }
} }
...@@ -440,8 +440,15 @@ onShow(() => { ...@@ -440,8 +440,15 @@ onShow(() => {
getSettingFn() getSettingFn()
// 获取banner图 // 获取banner图
postnatalJSONFn() postnatalJSONFn()
console.log("🚀 ~ onShow ~ userStore:", userStore.babyInfo)
const babyInfo = userStore.babyInfo
if(babyInfo && babyInfo.babyStage == 1){
getInfoFn()
} else{
isTip.value = true
}
// 获取信息 // 获取信息
getInfoFn()
}) })
</script> </script>
...@@ -451,17 +458,19 @@ onShow(() => { ...@@ -451,17 +458,19 @@ onShow(() => {
.postnatal { .postnatal {
// position: absolute; // position: absolute;
width: 100%; width: 100%;
min-height: 100vh; height: 100vh;
background-color: #fdf6eb; background-color: #fdf6eb;
padding: 0 31rpx 31rpx 31rpx;
box-sizing: border-box;
&-con { &-con {
position: absolute; // position: absolute;
// width: 750rpx; // // width: 750rpx;
top: 190rpx; // top: 190rpx;
left: 31rpx; // left: 31rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: calc(100vh - 200rpx); height: 100%;
&-info { &-info {
font-size: 24rpx; font-size: 24rpx;
...@@ -469,7 +478,7 @@ onShow(() => { ...@@ -469,7 +478,7 @@ onShow(() => {
align-items: center; align-items: center;
margin-top: 50rpx; margin-top: 50rpx;
font-weight: 500; font-weight: 500;
flex-shrink: 0; flex-shrink: 0;
height: 32rpx; height: 32rpx;
.info-c { .info-c {
width: 2rpx; width: 2rpx;
...@@ -721,7 +730,6 @@ onShow(() => { ...@@ -721,7 +730,6 @@ onShow(() => {
height: 177rpx; height: 177rpx;
border-radius: 12rpx; border-radius: 12rpx;
overflow: hidden; overflow: hidden;
.banner-img { .banner-img {
width: 100%; width: 100%;
height: 100%; height: 100%;
......
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