Commit e076d7e2 authored by 王炽's avatar 王炽

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

parents 3341d188 004a166e
......@@ -439,7 +439,7 @@ const $baseUrl = proxy.$baseUrl;
const version = 'v1'
// 计时器上限时间(秒)
const TIMER_MAX_DURATION = 300
const TIMER_MAX_DURATION = 3600
const feedingIndexRes = {
// 轮播图
......@@ -562,6 +562,15 @@ const homeData = ref({
const currentRecordId = ref(null) // 当前记录ID,用于区分新增和修改
const isSubmitting = ref(false) // 提交状态
const bannerHandler = (item) => {
// 检查是否正在录音
if (recordingState.value.isRecording || voiceRecognitionState.value.isRecording) {
uni.showToast({
title: '录音进行中,不可切换页面',
icon: 'none'
})
return
}
console.log(item);
jump({ type: item.jumpType, url: item.url, extra: item.extra })
}
......@@ -758,8 +767,17 @@ onShow(() => {
// 重置计时器状态,确保状态正确
resetTimerStatus()
// 重置录音状态,确保状态正确
resetRecordingState()
// 检查录音状态,如果录音管理器正在录音但状态不一致,强制重置
if (recordingState.value.isRecording || voiceRecognitionState.value.isRecording) {
console.log('检测到录音状态不一致,强制重置录音状态')
forceResetRecorderManager()
} else {
// 重置录音状态,确保状态正确
resetRecordingState()
}
// 检查录音状态
checkRecorderStatus()
// 如果处于编辑模式且有待删除的辅食,恢复编辑状态
if (hasUnfinishedEdit()) {
......@@ -773,6 +791,14 @@ onShow(() => {
// 页面隐藏时同步计时器状态
onHide(() => {
console.log('页面隐藏,处理录音状态...')
// 如果正在录音,停止录音并重置状态
if (recordingState.value.isRecording || voiceRecognitionState.value.isRecording) {
console.log('页面隐藏时检测到正在录音,停止录音')
forceResetRecorderManager()
}
// 如果页面隐藏时有计时器在运行,需要同步到后端
if (isLeftTimerRunning.value && leftTimerInterval) {
console.log('页面隐藏时同步左侧计时器状态')
......@@ -1049,6 +1075,15 @@ function resetTimerStatus() {
// 方法
function selectType(type) {
// 检查是否正在录音
if (recordingState.value.isRecording || voiceRecognitionState.value.isRecording) {
uni.showToast({
title: '录音进行中,不可切换类型',
icon: 'none'
})
return
}
// 检查是否有正在进行的计时器(只有在真正有计时器在运行时才阻止)
if ((isLeftTimerRunning.value && leftTimerInterval) || (isRightTimerRunning.value && rightTimerInterval)) {
uni.showToast({
......@@ -1828,6 +1863,15 @@ function goBack() {
}
function goToFeedingRecord() {
// 检查是否正在录音
if (recordingState.value.isRecording || voiceRecognitionState.value.isRecording) {
uni.showToast({
title: '录音进行中,不可切换页面',
icon: 'none'
})
return
}
uni.navigateTo({
url: '/pages/feedingRecord/feedingRecord'
})
......@@ -2546,6 +2590,16 @@ function resetRecordingCooldown() {
console.log('立即重置录音冷却状态')
}
// 检查录音管理器状态
function checkRecorderStatus() {
console.log('检查录音管理器状态:', {
isRecording: recordingState.value.isRecording,
voiceIsRecording: voiceRecognitionState.value.isRecording,
recognitionStatus: voiceRecognitionState.value.recognitionStatus,
canStartRecording: recordingState.value.canStartRecording
})
}
// 强制重置录音管理器状态
function forceResetRecorderManager() {
console.log('强制重置录音管理器状态')
......@@ -2567,7 +2621,14 @@ function forceResetRecorderManager() {
console.log('录音管理器状态重置完成')
// 重置防连点状态
resetRecordingCooldown()
}, 200)
// 确保状态完全重置
recordingState.value.isRecording = false
voiceRecognitionState.value.isRecording = false
voiceRecognitionState.value.recognitionStatus = 'idle'
// 检查重置后的状态
checkRecorderStatus()
}, 300)
}
// 开始录音
......@@ -3177,6 +3238,14 @@ async function completeVoiceRecord() {
// 记录成功弹窗相关方法
async function onSuccessJump() {
// 检查是否正在录音
if (recordingState.value.isRecording || voiceRecognitionState.value.isRecording) {
uni.showToast({
title: '录音进行中,不可切换页面',
icon: 'none'
})
return
}
const res = await getHealthField();
......@@ -3245,6 +3314,15 @@ function restoreUnfinishedEdit() {
// 宝宝切换相关方法
function showBabySwitch() {
// 检查是否正在录音
if (recordingState.value.isRecording || voiceRecognitionState.value.isRecording) {
uni.showToast({
title: '录音进行中,不可切换宝宝',
icon: 'none'
})
return
}
// 只有当有多个宝宝时才显示切换弹窗
if (babyList.value.length > 1) {
showBabySwitchPopup.value = true
......@@ -3353,15 +3431,18 @@ function loadDefaultFoodsData() {
/* ===== 可滚动内容区域 ===== */
.scrollable-content {
height: calc(100vh - 218rpx);
// height: 100vh;
background-color: #FFF8F1;
/* 减去底部按钮的高度 */
overflow-y: auto;
z-index: 200;
position: absolute;
}
/* ===== 底部完成按钮 ===== */
.bottom_complete-btn {
padding-top: 20rpx;
position: fixed;
position: absolute;
bottom: 0rpx;
left: 0rpx;
right: 0rpx;
......@@ -3371,7 +3452,6 @@ function loadDefaultFoodsData() {
background: #fff;
justify-content: center;
align-items: center;
z-index: 100;
.complete-btn-bg {
width: 686rpx;
......@@ -4406,36 +4486,6 @@ function loadDefaultFoodsData() {
}
.bottom_complete-btn {
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 100rpx;
width: 686rpx;
height: 94rpx;
display: flex;
align-items: center;
justify-content: center;
z-index: 2;
// cursor: pointer;
transition: all 0.3s ease;
/* 移除点击高亮效果 */
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
-webkit-user-select: none;
user-select: none;
&.disabled {
opacity: 0.6;
pointer-events: none;
}
.complete-btn-bg {
position: absolute;
width: 686rpx;
height: 94rpx;
}
}
// uni-datetime-picker样式覆盖(与feedingRecord页面保持一致)
::v-deep .uni-datetime-picker--btn {
......
......@@ -156,6 +156,9 @@ const babyId = ref(userStore.babyInfo?.content?.id)
const back_btn = ref('')
// 是否授权
const isWxNotification = ref(true)
// 弹窗控制
const showPicker = ref(false)
// 提醒时间选项
......@@ -284,7 +287,8 @@ const onBtn = (type) => {
// type 0 提醒 1 报告单 2 日历
switch (type) {
case 0:
showPicker.value = true
// 如果授权就不弹出提醒
showPicker.value = isWxNotification.value ? true : false
break;
case 1:
uni.navigateTo({
......@@ -310,6 +314,7 @@ const handleChange = (e) => {
}
// 确认选择
const handleConfirm = () => {
selectedValue.value = options[pickerValue.value].id;
console.log(selectedValue.value, homeInfo.value.wxTemplateId, babyId.value)
close();
......@@ -363,6 +368,8 @@ const getWxNotificationFn = async (notificationDate, wxTemplateId, babyId) => {
icon: 'none'
})
}
// 获取用户授权信息
getSettingFn()
}
// 修改产检时间
const onEditTime = async () => {
......@@ -410,17 +417,25 @@ const postnatalJSONFn = async () => {
});
}
}
onLoad(() => {
// 获取用户授权信息
// 获取用户授权信息
const getSettingFn = () => {
wx.getSetting({
withSubscriptions: true,
success(res) {
console.log(res.authSetting, '授权信息')
// console.log(res.authSetting, '授权信息')
console.log(res.subscriptionsSetting, '订阅信息')
if(res.subscriptionsSetting.itemSettings){
isWxNotification.value = false
console.log("🚀 ~ success ~ isWxNotification111:", isWxNotification.value)
} else {
isWxNotification.value = true
console.log("🚀 ~ success ~ isWxNotification222:", isWxNotification.value)
}
}
})
})
}
onShow(() => {
getSettingFn()
// 获取banner图
postnatalJSONFn()
// 获取信息
......
......@@ -174,6 +174,9 @@ import { useUserStore } from "@/stores/user";
const userStore = useUserStore();
const babyId = ref(userStore.babyInfo?.content?.id)
// 是否授权
const isWxNotification = ref(true)
// 提醒选择器相关状态
const showPicker = ref(false)
const options = [
......@@ -414,7 +417,8 @@ const onRemind = () => {
if (checkupDate < currentDate) {
return;
}
showPicker.value = true;
// 如果授权就不弹出提醒
showPicker.value = isWxNotification.value ? true : false
}
// 提醒关闭
......@@ -466,6 +470,8 @@ const getWxNotificationFn = async (notificationDate, wxTemplateId, babyId) => {
icon: 'none'
})
}
// 获取用户授权信息
getSettingFn()
}
// 完成检查
const onComplete = () => {
......@@ -557,12 +563,34 @@ const getDetailFn = async (id) => {
});
}
}
// 获取用户授权信息
const getSettingFn = () => {
wx.getSetting({
withSubscriptions: true,
success(res) {
// console.log(res.authSetting, '授权信息')
console.log(res.subscriptionsSetting, '订阅信息')
if(res.subscriptionsSetting.itemSettings){
isWxNotification.value = false
console.log("🚀 ~ success ~ isWxNotification111:", isWxNotification.value)
} else {
isWxNotification.value = true
console.log("🚀 ~ success ~ isWxNotification222:", isWxNotification.value)
}
}
})
}
// 获取传过来的参数
onLoad((options) => {
console.log(options)
// 获取传过来的参数:id
editId.value = options.id
// 获取用户授权信息
getSettingFn()
// 获取详情
getDetailFn(options.id)
})
</script>
<style lang="less" scoped>
......
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