Commit b8e974de authored by weishengfei's avatar weishengfei

refactor(postnatal): 重构产检相关页面逻辑

- 新增编辑产检页面
- 优化新增产检页面,移除冗余逻辑
- 完善我的报告单页面加载逻辑
- 调整产检日历页面样式
- 重构产检详情页面,优化修改功能
parent 15385b49
......@@ -127,6 +127,15 @@
"navigationBarBackgroundColor":"#ffffff",
"enablePullDownRefresh" : false
}
},
{
"path" : "pages/editPostnatal/editPostnatal",
"style" :
{
"navigationBarTitleText" : "产检项目",
"navigationBarBackgroundColor":"#ffffff",
"enablePullDownRefresh" : false
}
}
],
"globalStyle": {
......
<template>
<view class="add-postnatal">
<!-- 产检时间 -->
<view class="add-postnatal-time style1" v-if="isType">
<view class="add-postnatal-time style1">
<view class="time-l">
<image src="/static/chanjianTool/icon7.png" />
产检时间
......@@ -36,7 +36,7 @@
</view>
<!-- 报告单 -->
<view class="add-postnatal-bgd" v-if="isType">
<view class="add-postnatal-bgd">
<view class="style1">
<view class="time-l">
<image src="/static/chanjianTool/icon9.png" />
......@@ -143,8 +143,6 @@
// 导入日期选择器组件
import DatePicker from '@/components/DatePicker.vue'
// 控制显示修改字段
const isType = ref(true)
// 默认产检时间
const time = ref(dateFormatter(new Date(), 'yyyy-MM-dd'));
......@@ -219,12 +217,12 @@
}
// 检查是否已选中
const isSelected = (id) => {
return selectedAirports.value.some(item => item.id === id);
return selectedAirports.value.some(item => item.id == id);
};
// 切换选择状态
const toggleSelect = (airport) => {
const index = selectedAirports.value.findIndex(item => item.id === airport.id);
const index = selectedAirports.value.findIndex(item => item.id == airport.id);
if (index === -1) {
selectedAirports.value.push({
id: airport.id,
......@@ -255,7 +253,7 @@
// 删除所选产品项目
const onDetele = (id) => {
listData.value.filter((item, index) => {
if (item.id === id) {
if (item.id == id) {
listData.value.splice(index, 1)
}
})
......@@ -390,17 +388,6 @@
}
onLoad((options) => {
console.log(options)
if(Object.keys(options ?? {}).length){
isType.value = false
uni.setNavigationBarTitle({
title: '修改项目'
});
}else{
isType.value = true
uni.setNavigationBarTitle({
title: '新增产检'
});
}
getList()
})
</script>
......
This diff is collapsed.
......@@ -155,6 +155,7 @@
}
// 获取报告单
const getReportListFn = async () => {
console.log('获取报告单')
// const { code, message, data, success } = await getReportList()
const {
code,
......@@ -200,9 +201,9 @@
}
onLoad(() => {
// 我的报告单
getReportListFn()
})
// 我的报告单
getReportListFn()
})
</script>
<style lang="less" scoped>
......
......@@ -85,7 +85,7 @@
import {
ref,
getCurrentInstance,
watch
onMounted
} from 'vue'
import {
onLoad,
......@@ -289,7 +289,7 @@
checkupDate: '2025-8-22',
index: '一', // 产检次数
pregnancyWeek: '5-6', // 周数
status: 'pending', //待产检、已过期、已产检,
status: 'completed', //待产检、已过期、已产检,
// 产检项目
examinationItems: [{
itemName: '测量胎儿颈部透明层厚度(NT)',
......@@ -312,7 +312,7 @@
});
}
}
onLoad(() => {
onShow(() => {
// 获取信息
getInfoFn()
})
......
......@@ -5,11 +5,11 @@
<image @tap="backHandler" class="btnback" src="/static/chanjianTool/back.png"></image>
<view class="page_title">
<view class="info-l">
<image :src="info.head"></image>
<image :src="$baseUrl + 'common/default_avatar.png'"></image>
</view>
<view class="info-r">
<view class="info-r-t">
{{info.name}}
孕期
</view>
<view class="info-r-b">
怀孕{{info.gestationalWeeks}}
......
......@@ -84,7 +84,7 @@
<image src="/static/chanjianTool/icon19.png" />
产检项目
</view>
<view class="style1" @click="onModify">
<view class="style1" @click="onModify(infoData)">
修改项目
</view>
</view>
......@@ -190,12 +190,15 @@
onLoad
} from '@dcloudio/uni-app'
import {
throttleTap
throttleTap,
showLoading,
hideLoading
} from '@/utils/index.js';
// 时间组件
import DatePicker from '@/components/DatePicker.vue'
import { uploadImage } from '../../api/common.js'
import {
getDetail,
getUpdate
......@@ -229,9 +232,12 @@
const time = ref('2025-07-21')
const onModify = () =>{
// 修改项目
const onModify = (item) =>{
console.log(item)
const items = JSON.stringify(item)
uni.navigateTo({
url:`/pages/addPostnatal/addPostnatal?time=${time.value}&type=1`
url:`/pages/editPostnatal/editPostnatal?item=${items}`
})
}
......@@ -331,6 +337,13 @@ const scrollToSection = (index) => {
bgdImgList.value.splice(index, 1)
}
})
console.log("🚀 ~ bgdImgList.value.filter ~ bgdImgList:", bgdImgList)
// 直接保存
const params = {
id: editId.value,
reportImages: bgdImgList.value
}
onEditTime(params)
}
// 上传图片
const onUpload = throttleTap(() => {
......@@ -353,16 +366,21 @@ const scrollToSection = (index) => {
hideLoading();
if (uploadRes.success) {
console.log(uploadRes)
bgdImgList.value.push({
url: uploadRes.data.url,
id: Date.now() + Math.floor(Math.random() * 1000)
})
bgdImgList.value.push(uploadRes.data.url)
console.log("🚀 ~ success: ~ bgdImgList:", bgdImgList)
// 直接保存
const params = {
id: editId.value,
reportImages: bgdImgList.value
}
onEditTime(params)
} else {
uni.showToast({
title: uploadRes.message,
icon: "none",
});
}
},
});
})
......@@ -406,6 +424,11 @@ const scrollToSection = (index) => {
// 切换状态
isCompleted.value = !isCompleted.value
console.log(isCompleted.value)
const params = {
id: editId.value,
status: isCompleted.value
}
onEditTime(params)
}
// 修改时间
......@@ -417,12 +440,17 @@ const scrollToSection = (index) => {
const handleDateConfirm = (date) => {
visible.value = false
time.value = date
onEditTime()
const params = {
id: editId.value,
checkupDate: time.value
}
onEditTime(params)
}
// 修改产检时间
const onEditTime = async () => {
// const { code, success, message } = await getUpdate({id: editId.value,checkupDate: time.value})
// 修改产检接口
const onEditTime = async (params) => {
console.log(params)
// const { code, success, message } = await getUpdate(params)
const { code, success, message } = {
code: 200,
success: true,
......@@ -467,7 +495,7 @@ const scrollToSection = (index) => {
content:'', // 产检须知
suggestionCheckupDate:'2025-08-09至2025-09-16', // 建议时间
wxTemplateId:'', // 订阅模版id
status: 'pending', // 待产检 - pending,已过期 - expired, 已产检 - completed
status: 'completed', // 待产检 - pending,已过期 - expired, 已产检 - completed
// 产检项目
examinationItems: [{
itemName: '测量胎儿颈部透明层厚度(NT)',
......@@ -479,12 +507,7 @@ const scrollToSection = (index) => {
}
],
// 报告单
reportImages:[
'https://momclub-picture-1253290912.cos.ap-beijing.myqcloud.com/xmh-mini-program/user/image/2025/07/17/xmh-mini-program_1752739702325_167279.jpeg',
'https://momclub-picture-1253290912.cos.ap-beijing.myqcloud.com/xmh-mini-program/user/image/2025/07/17/xmh-mini-program_1752739702325_167279.jpeg',
'https://momclub-picture-1253290912.cos.ap-beijing.myqcloud.com/xmh-mini-program/user/image/2025/07/17/xmh-mini-program_1752739702325_167279.jpeg',
'https://momclub-picture-1253290912.cos.ap-beijing.myqcloud.com/xmh-mini-program/user/image/2025/07/17/xmh-mini-program_1752739702325_167279.jpeg'
]
reportImages:[]
}
}
}
......@@ -494,6 +517,7 @@ const scrollToSection = (index) => {
} = data
infoData.value = checkupList
bgdImgList.value = checkupList.reportImages
isCompleted.value = checkupList.status === 'completed'
} else{
uni.showToast({
title: message,
......
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