Merge branch 'dev-wdb' of http://175.27.226.205:3000/huxuejian/ykt-wxapp into dev-wdb
This commit is contained in:
commit
4e0a123bdd
@ -113,6 +113,35 @@ const showItems = computed(() => {
|
|||||||
|
|
||||||
const formRef = ref(null);
|
const formRef = ref(null);
|
||||||
|
|
||||||
|
function normalizeMedicalType(raw) {
|
||||||
|
const s = String(raw || '').trim();
|
||||||
|
if (!s) return '';
|
||||||
|
const lower = s.toLowerCase();
|
||||||
|
if (lower.includes('preconsultationrecord')) return 'preConsultationRecord';
|
||||||
|
if (lower.includes('preconsult') || (lower.includes('pre') && lower.includes('consult'))) return 'preConsultationRecord';
|
||||||
|
if (lower === 'outpatient' || lower === 'out_patient' || lower === 'out-patient') return 'outpatient';
|
||||||
|
if (lower === 'inhospital' || lower === 'in_hospital' || lower === 'in-hospital' || lower === 'inpatient') return 'inhospital';
|
||||||
|
if (lower === 'physicalexaminationtemplate' || lower === 'physicalexamination' || lower === 'physical_examination') return 'physicalExaminationTemplate';
|
||||||
|
if (s === 'outPatient') return 'outpatient';
|
||||||
|
if (s === 'inHospital') return 'inhospital';
|
||||||
|
if (s === 'preConsultation') return 'preConsultationRecord';
|
||||||
|
if (s === 'preConsultationRecord') return 'preConsultationRecord';
|
||||||
|
if (s === 'physicalExaminationTemplate') return 'physicalExaminationTemplate';
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveSortTimeKey() {
|
||||||
|
const ui = normalizeMedicalType(templateType.value);
|
||||||
|
// 预问诊:时间字段固定使用 consultationDate,避免被模板配置覆盖,且与列表展示一致
|
||||||
|
if (ui === 'preConsultationRecord') return 'consultationDate';
|
||||||
|
const t = temp.value || {};
|
||||||
|
if (t?.service?.timeTitle) return String(t.service.timeTitle);
|
||||||
|
if (ui === 'outpatient') return 'visitTime';
|
||||||
|
if (ui === 'inhospital') return 'inhosDate';
|
||||||
|
if (ui === 'physicalExaminationTemplate') return 'inspectDate';
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
function ensureFilesField() {
|
function ensureFilesField() {
|
||||||
if (form.files !== undefined) return;
|
if (form.files !== undefined) return;
|
||||||
if (detail.value && detail.value.files !== undefined) return;
|
if (detail.value && detail.value.files !== undefined) return;
|
||||||
@ -151,7 +180,7 @@ onLoad(async (options) => {
|
|||||||
ensureFilesField();
|
ensureFilesField();
|
||||||
|
|
||||||
// 默认填充模板时间字段
|
// 默认填充模板时间字段
|
||||||
const timeKey = temp.value?.service?.timeTitle || '';
|
const timeKey = resolveSortTimeKey();
|
||||||
if (timeKey && !form[timeKey]) form[timeKey] = dayjs().format('YYYY-MM-DD');
|
if (timeKey && !form[timeKey]) form[timeKey] = dayjs().format('YYYY-MM-DD');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +266,7 @@ async function save() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sortTime:使用模板中的时间字段
|
// sortTime:使用模板中的时间字段
|
||||||
const sortTimeKey = temp.value?.service?.timeTitle || '';
|
const sortTimeKey = resolveSortTimeKey();
|
||||||
if (sortTimeKey) {
|
if (sortTimeKey) {
|
||||||
const sortTimeValue = forms.value?.[sortTimeKey];
|
const sortTimeValue = forms.value?.[sortTimeKey];
|
||||||
if (sortTimeValue && dayjs(sortTimeValue).isValid()) {
|
if (sortTimeValue && dayjs(sortTimeValue).isValid()) {
|
||||||
|
|||||||
@ -15,7 +15,6 @@ $primary-color: #0877F1;
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
transition: padding-bottom 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 患者信息栏样式 - 固定在顶部 */
|
/* 患者信息栏样式 - 固定在顶部 */
|
||||||
@ -96,11 +95,10 @@ $primary-color: #0877F1;
|
|||||||
top: 100rpx; /* 患者信息栏高度,根据实际调整 */
|
top: 100rpx; /* 患者信息栏高度,根据实际调整 */
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 120rpx; /* 输入框高度,根据实际调整 */
|
bottom: 200rpx; /* 输入框高度,根据实际调整 */
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
transition: bottom 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-content-compressed {
|
.chat-content-compressed {
|
||||||
@ -370,12 +368,16 @@ $primary-color: #0877F1;
|
|||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-top: 1rpx solid #e0e0e0;
|
|
||||||
z-index: 200;
|
z-index: 200;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
transform: translateZ(0); /* 开启硬件加速,提升性能 */
|
transform: translateZ(0); /* 开启硬件加速,提升性能 */
|
||||||
transition: bottom 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
display: flex;
|
||||||
will-change: bottom;
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ai-assistant-slot {
|
||||||
|
width: 100%;
|
||||||
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-toolbar {
|
.input-toolbar {
|
||||||
@ -384,6 +386,8 @@ $primary-color: #0877F1;
|
|||||||
padding: 12rpx 20rpx;
|
padding: 12rpx 20rpx;
|
||||||
padding-bottom: env(safe-area-inset-bottom);
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
gap: 12rpx;
|
gap: 12rpx;
|
||||||
|
border-top: 1rpx solid #e0e0e0;
|
||||||
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.voice-toggle-btn {
|
.voice-toggle-btn {
|
||||||
|
|||||||
@ -383,7 +383,6 @@ defineExpose({
|
|||||||
gap: 16rpx;
|
gap: 16rpx;
|
||||||
padding: 16rpx 24rpx;
|
padding: 16rpx 24rpx;
|
||||||
background-color: #f8f9fa;
|
background-color: #f8f9fa;
|
||||||
border-bottom: 1rpx solid #e5e5e5;
|
|
||||||
|
|
||||||
.ai-button {
|
.ai-button {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="input-section" :style="{ bottom: props.keyboardHeight + 'px' }">
|
<view class="input-section">
|
||||||
<!-- AI助手按钮组 -->
|
<!-- AI助手按钮组 -->
|
||||||
<slot name="ai-assistant"></slot>
|
<view class="ai-assistant-slot">
|
||||||
|
<slot name="ai-assistant"></slot>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="input-toolbar">
|
<view class="input-toolbar">
|
||||||
<view @click="toggleVoiceInput" class="voice-toggle-btn">
|
<view @click="toggleVoiceInput" class="voice-toggle-btn">
|
||||||
@ -11,7 +13,7 @@
|
|||||||
<view class="input-area">
|
<view class="input-area">
|
||||||
<textarea v-if="!showVoiceInput" class="text-input" v-model="inputText" placeholder="我来说两句..."
|
<textarea v-if="!showVoiceInput" class="text-input" v-model="inputText" placeholder="我来说两句..."
|
||||||
@confirm="sendTextMessage" @focus="handleInputFocus" @input="handleInput"
|
@confirm="sendTextMessage" @focus="handleInputFocus" @input="handleInput"
|
||||||
:auto-height="true" :show-confirm-bar="false" :adjust-position="false" :hold-keyboard="true"
|
:auto-height="true" :show-confirm-bar="false" :hold-keyboard="true"
|
||||||
ref="textareaRef"
|
ref="textareaRef"
|
||||||
/>
|
/>
|
||||||
<input v-else class="voice-input-btn" :class="{ recording: isRecording }" @touchstart="startRecord"
|
<input v-else class="voice-input-btn" :class="{ recording: isRecording }" @touchstart="startRecord"
|
||||||
@ -88,7 +90,6 @@ const props = defineProps({
|
|||||||
corpId: { type: String, default: "" },
|
corpId: { type: String, default: "" },
|
||||||
orderStatus: { type: String, default: "" },
|
orderStatus: { type: String, default: "" },
|
||||||
isGenerating: { type: Boolean, default: false },
|
isGenerating: { type: Boolean, default: false },
|
||||||
keyboardHeight: { type: Number, default: 0 },
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Emits
|
// Emits
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<page-meta :page-style="'overflow:' + (keyboardHeight > 0 ? 'hidden' : 'visible')"></page-meta>
|
<view class="chat-page">
|
||||||
<view class="chat-page" :style="{ paddingBottom: keyboardHeight + 'px' }">
|
|
||||||
<!-- 患者信息栏 -->
|
<!-- 患者信息栏 -->
|
||||||
<view class="patient-info-bar" v-if="patientInfo.name">
|
<view class="patient-info-bar" v-if="patientInfo.name">
|
||||||
<view class="patient-info-content">
|
<view class="patient-info-content">
|
||||||
@ -19,7 +18,6 @@
|
|||||||
<!-- 聊天消息区域 -->
|
<!-- 聊天消息区域 -->
|
||||||
<scroll-view
|
<scroll-view
|
||||||
class="chat-content"
|
class="chat-content"
|
||||||
:style="{ bottom: (keyboardHeight > 0 ? keyboardHeight + 60 : 60) + 'px' }"
|
|
||||||
scroll-y="true"
|
scroll-y="true"
|
||||||
enhanced="true"
|
enhanced="true"
|
||||||
bounces="false"
|
bounces="false"
|
||||||
@ -153,7 +151,6 @@
|
|||||||
:patientInfo="patientInfo"
|
:patientInfo="patientInfo"
|
||||||
:orderStatus="orderStatus"
|
:orderStatus="orderStatus"
|
||||||
:isGenerating="isGenerating"
|
:isGenerating="isGenerating"
|
||||||
:keyboardHeight="keyboardHeight"
|
|
||||||
@scrollToBottom="() => scrollToBottom(true)"
|
@scrollToBottom="() => scrollToBottom(true)"
|
||||||
@messageSent="() => scrollToBottom(true)"
|
@messageSent="() => scrollToBottom(true)"
|
||||||
@endConsult="handleEndConsult"
|
@endConsult="handleEndConsult"
|
||||||
@ -305,9 +302,6 @@ const chatInfo = ref({
|
|||||||
avatar: "/static/home/avatar.svg",
|
avatar: "/static/home/avatar.svg",
|
||||||
});
|
});
|
||||||
|
|
||||||
// 键盘高度
|
|
||||||
const keyboardHeight = ref(0);
|
|
||||||
|
|
||||||
// 评价弹窗状态
|
// 评价弹窗状态
|
||||||
const isEvaluationPopupOpen = ref(false);
|
const isEvaluationPopupOpen = ref(false);
|
||||||
|
|
||||||
@ -464,22 +458,6 @@ onLoad((options) => {
|
|||||||
chatInfo.value.userID = decodeQueryValue(options.userID);
|
chatInfo.value.userID = decodeQueryValue(options.userID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 监听键盘高度变化
|
|
||||||
uni.onKeyboardHeightChange((res) => {
|
|
||||||
console.log("键盘高度变化:", res.height);
|
|
||||||
const oldHeight = keyboardHeight.value;
|
|
||||||
keyboardHeight.value = res.height;
|
|
||||||
|
|
||||||
// 键盘弹出时(从0变为非0),自动滚动到底部
|
|
||||||
if (oldHeight === 0 && res.height > 0) {
|
|
||||||
nextTick(() => {
|
|
||||||
setTimeout(() => {
|
|
||||||
scrollToBottom(true);
|
|
||||||
}, 100);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
checkLoginAndInitTIM();
|
checkLoginAndInitTIM();
|
||||||
updateNavigationTitle();
|
updateNavigationTitle();
|
||||||
});
|
});
|
||||||
@ -1194,9 +1172,6 @@ const handleOpenConsult = async () => {
|
|||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
clearMessageCache();
|
clearMessageCache();
|
||||||
|
|
||||||
// 移除键盘监听
|
|
||||||
uni.offKeyboardHeightChange();
|
|
||||||
|
|
||||||
timChatManager.setCallback("onSDKReady", null);
|
timChatManager.setCallback("onSDKReady", null);
|
||||||
timChatManager.setCallback("onSDKNotReady", null);
|
timChatManager.setCallback("onSDKNotReady", null);
|
||||||
timChatManager.setCallback("onMessageReceived", null);
|
timChatManager.setCallback("onMessageReceived", null);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user