新增
This commit is contained in:
@@ -92,16 +92,17 @@ const video =async (data)=>{
|
||||
const { userSig, SDKAppID } = GenerateTestUserSig.genTestUserSig({
|
||||
userID:userId,
|
||||
});
|
||||
console.log('获取签名成功:',userSig);
|
||||
getApp().globalData.userID = userId.value;
|
||||
|
||||
getApp().globalData.userID = userId;
|
||||
getApp().globalData.userSig = userSig;
|
||||
getApp().globalData.SDKAppID = SDKAppID;
|
||||
|
||||
await uni.CallManager.init({
|
||||
const cc={
|
||||
sdkAppID: SDKAppID, // 替换为用户自己的 sdkAppID
|
||||
userID: userId, // 替换为用户自己的 userID
|
||||
userSig: userSig, // 替换为用户自己的 userSig
|
||||
globalCallPagePath: "TUICallKit/src/Components/TUICallKit", // 替换为步骤一里注册的全局监听页面
|
||||
});
|
||||
}
|
||||
uni.setStorageSync('CallManager', userId)
|
||||
await uni.CallManager.init(cc);
|
||||
}
|
||||
</script>
|
||||
@@ -1,5 +1,9 @@
|
||||
<template>
|
||||
<view class="chat-container">
|
||||
<view
|
||||
class="chat-container"
|
||||
@touchend.capture="onRecordingTouchEnd"
|
||||
@touchcancel.capture="onRecordingTouchCancel"
|
||||
>
|
||||
<!-- 顶部导航栏 -->
|
||||
<!-- 消息列表 -->
|
||||
<scroll-view
|
||||
@@ -126,8 +130,20 @@
|
||||
</view>
|
||||
|
||||
<!-- 录音浮层 - 微信风格 -->
|
||||
<view v-if="isRecording" class="recording-overlay">
|
||||
<view class="recording-popup" :class="{ 'recording-cancel': willCancel }">
|
||||
<view
|
||||
v-if="isRecording"
|
||||
class="recording-overlay"
|
||||
@click="forceCancelRecording"
|
||||
@touchend="onVoiceTouchEnd"
|
||||
@touchcancel="onVoiceTouchCancel"
|
||||
>
|
||||
<view
|
||||
class="recording-popup"
|
||||
:class="{ 'recording-cancel': willCancel }"
|
||||
@click.stop
|
||||
@touchend.stop="onVoiceTouchEnd"
|
||||
@touchcancel.stop="onVoiceTouchCancel"
|
||||
>
|
||||
<view class="recording-icon">
|
||||
<view v-if="!willCancel" class="recording-waves">
|
||||
<view class="wave"></view>
|
||||
@@ -183,6 +199,9 @@
|
||||
const isRecording = ref(false);
|
||||
const recordingDuration = ref(0);
|
||||
const willCancel = ref(false); // 上滑取消
|
||||
let voiceModeSwitchTime = 0; // 切换语音模式的时间戳,用于防误触
|
||||
let voiceHoldTimer = null; // 按住计时器,必须按住超过此时间才真正开始录音
|
||||
let isVoiceTouchDown = false; // 手指是否仍在按下
|
||||
const playingAudioId = ref('');
|
||||
let innerAudioContext = null;
|
||||
let chat = null;
|
||||
@@ -210,7 +229,27 @@
|
||||
|
||||
// 切换输入模式(文字/语音)
|
||||
function toggleInputMode() {
|
||||
inputMode.value = inputMode.value === 'text' ? 'voice' : 'text';
|
||||
const isSwitchToVoice = inputMode.value === 'text';
|
||||
inputMode.value = isSwitchToVoice ? 'voice' : 'text';
|
||||
// 切换到语音时:重置录音状态,防止卡住;记录时间用于防误触
|
||||
if (isSwitchToVoice) {
|
||||
isVoiceTouchDown = false;
|
||||
if (voiceHoldTimer) {
|
||||
clearTimeout(voiceHoldTimer);
|
||||
voiceHoldTimer = null;
|
||||
}
|
||||
isRecording.value = false;
|
||||
willCancel.value = false;
|
||||
recordingDuration.value = 0;
|
||||
if (recordingTimer) {
|
||||
clearInterval(recordingTimer);
|
||||
recordingTimer = null;
|
||||
}
|
||||
if (recorderManager) {
|
||||
try { recorderManager.stop(); } catch (_) {}
|
||||
}
|
||||
voiceModeSwitchTime = Date.now();
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化录音管理器
|
||||
@@ -239,14 +278,23 @@
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 按住说话 - 开始
|
||||
// 按住说话 - 开始(必须按住超过 300ms 才真正开始录音,点击一下不会触发)
|
||||
function onVoiceTouchStart(e) {
|
||||
// #ifdef MP-WEIXIN
|
||||
// 防误触:刚切换语音模式 400ms 内忽略触摸
|
||||
if (Date.now() - voiceModeSwitchTime < 400) return;
|
||||
e.preventDefault();
|
||||
isVoiceTouchDown = true;
|
||||
willCancel.value = false;
|
||||
touchStartY = e.touches[0]?.clientY || 0;
|
||||
if (!recorderManager) initRecorderManager();
|
||||
startRecord();
|
||||
// 必须按住 300ms 才真正开始录音,点击一下不会触发
|
||||
voiceHoldTimer = setTimeout(() => {
|
||||
voiceHoldTimer = null;
|
||||
if (isVoiceTouchDown) {
|
||||
startRecord();
|
||||
}
|
||||
}, 300);
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
uni.showToast({ title: '当前平台暂不支持语音', icon: 'none' });
|
||||
@@ -257,6 +305,13 @@
|
||||
function onVoiceTouchEnd(e) {
|
||||
// #ifdef MP-WEIXIN
|
||||
e.preventDefault();
|
||||
isVoiceTouchDown = false;
|
||||
if (voiceHoldTimer) {
|
||||
clearTimeout(voiceHoldTimer);
|
||||
voiceHoldTimer = null;
|
||||
// 未按住满 300ms 就松开了,不开始录音
|
||||
return;
|
||||
}
|
||||
if (isRecording.value && recorderManager) {
|
||||
recorderManager.stop();
|
||||
}
|
||||
@@ -268,6 +323,40 @@
|
||||
onVoiceTouchEnd(e);
|
||||
}
|
||||
|
||||
// 捕获阶段监听:录音时任意位置松开都能结束(解决浮层遮挡导致 touchend 收不到的问题)
|
||||
function onRecordingTouchEnd(e) {
|
||||
if (isRecording.value) {
|
||||
e.stopPropagation();
|
||||
onVoiceTouchEnd(e);
|
||||
}
|
||||
}
|
||||
function onRecordingTouchCancel(e) {
|
||||
if (isRecording.value) {
|
||||
e.stopPropagation();
|
||||
onVoiceTouchCancel(e);
|
||||
}
|
||||
}
|
||||
|
||||
// 强制取消录音(点击蒙层逃生,防止卡住)
|
||||
function forceCancelRecording() {
|
||||
isVoiceTouchDown = false;
|
||||
if (voiceHoldTimer) {
|
||||
clearTimeout(voiceHoldTimer);
|
||||
voiceHoldTimer = null;
|
||||
}
|
||||
if (!isRecording.value) return;
|
||||
willCancel.value = true;
|
||||
if (recorderManager) {
|
||||
try { recorderManager.stop(); } catch (_) {}
|
||||
}
|
||||
isRecording.value = false;
|
||||
recordingDuration.value = 0;
|
||||
if (recordingTimer) {
|
||||
clearInterval(recordingTimer);
|
||||
recordingTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
let touchStartY = 0;
|
||||
// 监听上滑取消
|
||||
function onVoiceTouchMove(e) {
|
||||
@@ -964,16 +1053,16 @@
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
font-weight: 500;
|
||||
background: #e0e0e0;
|
||||
|
||||
}
|
||||
|
||||
.avatar-in {
|
||||
background: #e0e0e0;
|
||||
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.avatar-out {
|
||||
background: #95ec69;
|
||||
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,9 @@
|
||||
{
|
||||
"path": "pages/order/monad/monad",
|
||||
"style": {
|
||||
"navigationBarTitleText": "诊单确认"
|
||||
"navigationBarTitleText": "诊单确认",
|
||||
"navigationBarHidden": true,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -76,7 +78,7 @@
|
||||
{
|
||||
"path": "pages/chat/chat",
|
||||
"style": {
|
||||
"navigationBarTitleText": "图文问诊"
|
||||
"navigationBarTitleText": "问诊"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -46,7 +46,9 @@ const loadCardList = async () => {
|
||||
|
||||
|
||||
data.value = res.data
|
||||
|
||||
uni.setNavigationBarTitle({
|
||||
title: res.data.title
|
||||
});
|
||||
|
||||
} catch (err) {
|
||||
console.error('加载就诊卡列表失败:', err)
|
||||
|
||||
@@ -222,56 +222,11 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 诊断信息 -->
|
||||
<!-- <view class="form-section">
|
||||
<text class="section-title">诊断信息</text>
|
||||
|
||||
<view class="form-group">
|
||||
<text class="form-label">诊断类型</text>
|
||||
<picker
|
||||
:range="diagnosisTypeOptions"
|
||||
range-key="name"
|
||||
@change="onDiagnosisTypeChange"
|
||||
>
|
||||
<view class="picker-input">
|
||||
<text>{{ getDiagnosisTypeName(formData.diagnosis_type) || '请选择' }}</text>
|
||||
<text class="picker-icon">▼</text>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<view class="form-group">
|
||||
<text class="form-label">证型</text>
|
||||
<picker
|
||||
:range="syndromeTypeOptions"
|
||||
range-key="name"
|
||||
@change="onSyndromeTypeChange"
|
||||
>
|
||||
<view class="picker-input">
|
||||
<text>{{ getSyndromeTypeName(formData.syndrome_type) || '请选择' }}</text>
|
||||
<text class="picker-icon">▼</text>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<view class="form-group">
|
||||
<text class="form-label">糖尿病期数</text>
|
||||
<picker
|
||||
:range="diabetesTypeOptions"
|
||||
range-key="name"
|
||||
@change="onDiabetesTypeChange"
|
||||
>
|
||||
<view class="picker-input">
|
||||
<text>{{ getDiabetesTypeName(formData.diabetes_type) || '请选择' }}</text>
|
||||
<text class="picker-icon">▼</text>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
|
||||
<!-- 现病史 -->
|
||||
<view class="form-section">
|
||||
<text class="section-title">现病史</text>
|
||||
<!-- <text class="section-title">现病史</text> -->
|
||||
|
||||
<!-- 5、口腔感觉 -->
|
||||
<view class="form-item-block">
|
||||
@@ -1682,7 +1637,7 @@ const goBack = () => {
|
||||
}
|
||||
|
||||
.gender-radio.active {
|
||||
color: #ff8c00;
|
||||
color: #386641;
|
||||
}
|
||||
|
||||
.radio-icon {
|
||||
@@ -1699,8 +1654,8 @@ const goBack = () => {
|
||||
}
|
||||
|
||||
.gender-radio.active .radio-icon {
|
||||
background: #ff8c00;
|
||||
border-color: #ff8c00;
|
||||
background: #386641;
|
||||
border-color: #386641;
|
||||
}
|
||||
|
||||
.form-tip {
|
||||
@@ -1784,8 +1739,8 @@ const goBack = () => {
|
||||
}
|
||||
|
||||
.grid-button.active {
|
||||
border-color: #ff8c00;
|
||||
background: #ff8c00;
|
||||
border-color: #386641;
|
||||
background: #386641;
|
||||
color: #ffffff;
|
||||
font-weight: 500;
|
||||
z-index: 1;
|
||||
@@ -1891,7 +1846,7 @@ const goBack = () => {
|
||||
.form-input {
|
||||
width: 100%;
|
||||
padding: 24rpx;
|
||||
border: 2rpx solid #ffd4a3;
|
||||
border: 2rpx solid #386641;
|
||||
border-radius: 12rpx;
|
||||
font-size: 34rpx;
|
||||
line-height: 1.5;
|
||||
@@ -1911,7 +1866,7 @@ const goBack = () => {
|
||||
.form-textarea {
|
||||
width: 100%;
|
||||
padding: 24rpx;
|
||||
border: 2rpx solid #ffd4a3;
|
||||
border: 2rpx solid #386641;
|
||||
border-radius: 12rpx;
|
||||
font-size: 34rpx;
|
||||
line-height: 1.6;
|
||||
@@ -1936,7 +1891,7 @@ const goBack = () => {
|
||||
.gender-btn {
|
||||
flex: 1;
|
||||
padding: 22rpx 24rpx;
|
||||
border: 2rpx solid #ffd4a3;
|
||||
border: 2rpx solid #386641;
|
||||
border-radius: 12rpx;
|
||||
text-align: center;
|
||||
font-size: 34rpx;
|
||||
@@ -1951,9 +1906,9 @@ const goBack = () => {
|
||||
}
|
||||
|
||||
.gender-btn.active {
|
||||
border-color: #ff8c00;
|
||||
border-color: #386641;
|
||||
background: #fff4e6;
|
||||
color: #ff8c00;
|
||||
color: #386641;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
@@ -1965,7 +1920,7 @@ const goBack = () => {
|
||||
.radio-item {
|
||||
flex: 1;
|
||||
padding: 20rpx 24rpx;
|
||||
border: 2rpx solid #ffd4a3;
|
||||
border: 2rpx solid #386641;
|
||||
border-radius: 12rpx;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
@@ -1979,9 +1934,9 @@ const goBack = () => {
|
||||
}
|
||||
|
||||
.radio-item.active {
|
||||
border-color: #ff8c00;
|
||||
border-color: #386641;
|
||||
background: #fff4e6;
|
||||
color: #ff8c00;
|
||||
color: #386641;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
@@ -1993,7 +1948,7 @@ const goBack = () => {
|
||||
|
||||
.checkbox-item {
|
||||
padding: 18rpx 28rpx;
|
||||
border: 2rpx solid #ffd4a3;
|
||||
border: 2rpx solid #386641;
|
||||
border-radius: 24rpx;
|
||||
font-size: 32rpx;
|
||||
color: #666666;
|
||||
@@ -2002,9 +1957,9 @@ const goBack = () => {
|
||||
}
|
||||
|
||||
.checkbox-item.active {
|
||||
border-color: #ff8c00;
|
||||
border-color: #386641;
|
||||
background: #fff4e6;
|
||||
color: #ff8c00;
|
||||
color: #386641;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
@@ -2016,7 +1971,7 @@ const goBack = () => {
|
||||
|
||||
.multi-checkbox-item {
|
||||
padding: 18rpx 28rpx;
|
||||
border: 2rpx solid #ffd4a3;
|
||||
border: 2rpx solid #386641;
|
||||
border-radius: 24rpx;
|
||||
font-size: 32rpx;
|
||||
color: #666666;
|
||||
@@ -2025,9 +1980,9 @@ const goBack = () => {
|
||||
}
|
||||
|
||||
.multi-checkbox-item.active {
|
||||
border-color: #ff8c00;
|
||||
border-color: #386641;
|
||||
background: #fff4e6;
|
||||
color: #ff8c00;
|
||||
color: #386641;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
@@ -2036,7 +1991,7 @@ const goBack = () => {
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 24rpx;
|
||||
border: 2rpx solid #ffd4a3;
|
||||
border: 2rpx solid #386641;
|
||||
border-radius: 12rpx;
|
||||
background: #fffaf5;
|
||||
font-size: 34rpx;
|
||||
@@ -2048,7 +2003,7 @@ const goBack = () => {
|
||||
.date-icon {
|
||||
font-size: 40rpx;
|
||||
margin-left: 12rpx;
|
||||
color: #ff8c00;
|
||||
color: #386641;
|
||||
}
|
||||
|
||||
.picker-item {
|
||||
@@ -2110,7 +2065,7 @@ const goBack = () => {
|
||||
height: 80rpx;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
border: 2rpx solid #ffd4a3;
|
||||
border: 2rpx solid #386641;
|
||||
}
|
||||
|
||||
.more-item image {
|
||||
@@ -2124,7 +2079,7 @@ const goBack = () => {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 2rpx dashed #ffd4a3;
|
||||
border: 2rpx dashed #386641;
|
||||
border-radius: 12rpx;
|
||||
background: #fffaf5;
|
||||
transition: all 0.2s;
|
||||
@@ -2132,7 +2087,7 @@ const goBack = () => {
|
||||
|
||||
.upload-btn-single:active {
|
||||
background: #fff4e6;
|
||||
border-color: #ff8c00;
|
||||
border-color: #386641;
|
||||
}
|
||||
|
||||
.upload-btn {
|
||||
@@ -2141,7 +2096,7 @@ const goBack = () => {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 60rpx 40rpx;
|
||||
border: 2rpx dashed #ffd4a3;
|
||||
border: 2rpx dashed #386641;
|
||||
border-radius: 12rpx;
|
||||
background: #fffaf5;
|
||||
transition: all 0.2s;
|
||||
@@ -2149,7 +2104,7 @@ const goBack = () => {
|
||||
|
||||
.upload-btn:active {
|
||||
background: #fff4e6;
|
||||
border-color: #ff8c00;
|
||||
border-color: #386641;
|
||||
}
|
||||
|
||||
.upload-icon {
|
||||
@@ -2180,7 +2135,7 @@ const goBack = () => {
|
||||
position: relative;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
border: 2rpx solid #ffd4a3;
|
||||
border: 2rpx solid #386641;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
@@ -2242,7 +2197,7 @@ const goBack = () => {
|
||||
padding-bottom: 100%;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
border: 2rpx solid #ffd4a3;
|
||||
border: 2rpx solid #386641;
|
||||
}
|
||||
|
||||
.item-image {
|
||||
@@ -2275,7 +2230,7 @@ const goBack = () => {
|
||||
width: 100%;
|
||||
padding-bottom: 100%;
|
||||
position: relative;
|
||||
border: 2rpx dashed #ffd4a3;
|
||||
border: 2rpx dashed #386641;
|
||||
border-radius: 12rpx;
|
||||
background: #fffaf5;
|
||||
display: flex;
|
||||
@@ -2289,7 +2244,7 @@ const goBack = () => {
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
font-size: 60rpx;
|
||||
color: #ff8c00;
|
||||
color: #386641;
|
||||
}
|
||||
|
||||
|
||||
@@ -2298,7 +2253,7 @@ const goBack = () => {
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 24rpx;
|
||||
border: 2rpx solid #ffd4a3;
|
||||
border: 2rpx solid #386641;
|
||||
border-radius: 12rpx;
|
||||
background: #fffaf5;
|
||||
font-size: 34rpx;
|
||||
@@ -2309,7 +2264,7 @@ const goBack = () => {
|
||||
|
||||
.picker-icon {
|
||||
font-size: 28rpx;
|
||||
color: #ff8c00;
|
||||
color: #386641;
|
||||
margin-left: 12rpx;
|
||||
}
|
||||
|
||||
@@ -2466,7 +2421,7 @@ const goBack = () => {
|
||||
.date-btn-cancel,
|
||||
.date-btn-confirm {
|
||||
font-size: 34rpx;
|
||||
color: #ff8c00;
|
||||
color: #386641;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,29 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view v-if="!dingdan_ok">
|
||||
<!-- 就诊人信息弹窗 -->
|
||||
<view v-if="showPatientModal" class="modal-overlay" @click.self="() => {}">
|
||||
<view class="patient-modal">
|
||||
<view class="modal-title">就诊人信息</view>
|
||||
<view class="patient-info-box">
|
||||
<view class="info-row">{{ formData.patient_name || '-' }} {{ formData.gender === 1 ? '男' : '女' }} {{ formData.age || '-' }}岁</view>
|
||||
<view class="info-row">体重:{{ formData.weight ? formData.weight + ' KG' : '-' }}</view>
|
||||
<view class="info-row">身高:{{ formData.height ? formData.height + ' CM' : '-' }}</view>
|
||||
<view class="info-row">血压:{{ (formData.systolic_pressure && formData.diastolic_pressure) ? (formData.systolic_pressure + '/' + formData.diastolic_pressure + ' mmHg') : '' }} mmHg</view>
|
||||
<view class="info-row">空腹血糖:{{ formData.fasting_blood_sugar ? formData.fasting_blood_sugar + ' mmol/L' : '-' }}</view>
|
||||
<view class="info-row">发现糖尿病患病史:{{ formData.diabetes_discovery_year ? formData.diabetes_discovery_year + ' 年' : '-' }}</view>
|
||||
<view class="info-row">当地医院诊断:{{ getLocalDiagnosisText() }}</view>
|
||||
<view class="info-row">当地就诊医院名称:{{ formData.local_hospital_name || '-' }}</view>
|
||||
<view class="info-row">当地医院就诊时间:{{ formData.diagnosis_date || formData.local_hospital_visit_time || '-' }}</view>
|
||||
</view>
|
||||
<view class="agreement-row">
|
||||
<text>我已阅读并同意</text>
|
||||
<text class="agreement-link" @click="openConsentForm">《互联网诊疗知情同意书》</text>
|
||||
</view>
|
||||
<button class="modal-confirm-btn" :disabled="confirmBtnLoading" :loading="confirmBtnLoading" @click="closePatientModal">点击确认并开始视频问诊</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="false">
|
||||
<!-- 确认成功页面 -->
|
||||
<view v-if="showSuccessPage" class="success-page">
|
||||
<view class="success-icon">✓</view>
|
||||
@@ -338,27 +361,25 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-else class="success-container">
|
||||
<view class="success-content">
|
||||
<view class="success-icon-wrapper">
|
||||
<view class="success-icon-circle">
|
||||
<text class="success-icon-check">✓</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="success-title">确认成功</view>
|
||||
<view class="success-message">诊单已确认,感谢您的配合</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref,onMounted,getCurrentInstance } from "vue";
|
||||
import { onShow, onShareAppMessage } from '@dcloudio/uni-app'
|
||||
import { onShow, onShareAppMessage,onLaunch } from '@dcloudio/uni-app'
|
||||
// 2. 获取组件实例,通过 proxy 访问全局属性
|
||||
import * as GenerateTestUserSig from "@/debug/GenerateTestUserSig-es.js";
|
||||
import { CallManager } from "@/TUICallKit/src/TUICallService/serve/callManager";
|
||||
const { proxy } = getCurrentInstance()
|
||||
const globalData = {
|
||||
SDKAppID: 0,
|
||||
userID: '',
|
||||
userSig: ''
|
||||
};
|
||||
let avatarUrl = ref(""); // 声明为响应式变量
|
||||
uni.CallManager = new CallManager();
|
||||
const formData = ref({
|
||||
patient_name: '',
|
||||
id_card: '',
|
||||
@@ -410,6 +431,8 @@ const formData = ref({
|
||||
remark: ''
|
||||
});
|
||||
let dingdan_ok=ref(false)
|
||||
const showPatientModal = ref(false)
|
||||
const confirmBtnLoading = ref(false) // 防止多次点击
|
||||
// 字典选项
|
||||
const diagnosisTypeOptions = ref([]);
|
||||
const syndromeTypeOptions = ref([]);
|
||||
@@ -436,10 +459,10 @@ onMounted(() => {
|
||||
});
|
||||
onShareAppMessage((res) =>{
|
||||
return {
|
||||
title: '诊单确认',
|
||||
title: '点击进入诊室',
|
||||
path: '/pages/order/monad/monad?id='+diagnosisId+'&share_user_id='+share_user_id,
|
||||
imageUrl: '',
|
||||
desc: '诊单确认',
|
||||
imageUrl: '/static/zs.jpg',
|
||||
desc: '点击进入诊室',
|
||||
success() {
|
||||
uni.showToast({ title: '分享成功', icon: 'success' });
|
||||
},
|
||||
@@ -535,16 +558,18 @@ const getDictData = async (type) => {
|
||||
};
|
||||
let diagnosisId=''
|
||||
let share_user_id='';
|
||||
let doctorId=ref('');
|
||||
// 加载诊单详情
|
||||
const loadDiagnosisDetail = async () => {
|
||||
// 从页面参数获取诊单ID
|
||||
const pages = getCurrentPages();
|
||||
const currentPage = pages[pages.length - 1];
|
||||
const params = proxy.$parsePageParams(currentPage.options);
|
||||
dingdan_ok.value=uni.getStorageSync('dingdan_ok');
|
||||
dingdan_ok.value=false;
|
||||
diagnosisId = params.id;
|
||||
share_user_id = params.share_user_id;
|
||||
console.log('进入onMounted:', params, '诊单ID:', diagnosisId);
|
||||
doctorId.value = params.doctor_id;
|
||||
console.log('进入onMounted:', params, '诊单ID:', diagnosisId, '医生ID:', doctorId);
|
||||
|
||||
if (!diagnosisId) {
|
||||
uni.showToast({ title: '缺少诊单ID', icon: 'none' });
|
||||
@@ -567,6 +592,7 @@ const loadDiagnosisDetail = async () => {
|
||||
|
||||
if (res.code === 1) {
|
||||
formData.value = res.data;
|
||||
showPatientModal.value = true; // 进入页面后直接弹窗显示就诊人信息
|
||||
} else {
|
||||
uni.showToast({ title: res.msg || '加载失败', icon: 'none' });
|
||||
}
|
||||
@@ -578,6 +604,85 @@ const loadDiagnosisDetail = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 获取当地医院诊断文本(用顿号连接)
|
||||
const getLocalDiagnosisText = () => {
|
||||
const val = formData.value.local_hospital_diagnosis;
|
||||
if (!val) return '-';
|
||||
if (Array.isArray(val)) {
|
||||
if (val.length === 0) return '-';
|
||||
const text = val.map(v => (typeof v === 'object' && v?.name) ? v.name : String(v)).join('、');
|
||||
return text ? text + '、' : '-';
|
||||
}
|
||||
return String(val) + '、';
|
||||
};
|
||||
|
||||
// 关闭就诊人信息弹窗
|
||||
const closePatientModal = async () => {
|
||||
if (confirmBtnLoading.value) return;
|
||||
confirmBtnLoading.value = true;
|
||||
try {
|
||||
const app = getApp();
|
||||
const userID = app.globalData.userID;
|
||||
const userSig = app.globalData.userSig;
|
||||
const SDKAppID = app.globalData.SDKAppID;
|
||||
const doctor = 'doctor_' + doctorId.value;
|
||||
|
||||
if (!doctorId.value) {
|
||||
uni.showToast({ title: '诊室号不存在,联系助理处理!', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!userID || !userSig) {
|
||||
await video();
|
||||
}
|
||||
console.log(userID, app.globalData, diagnosisId);
|
||||
|
||||
confirmDiagnosis();
|
||||
showPatientModal.value = false;
|
||||
uni.redirectTo({
|
||||
url: `/TUIKit/pages/chat/chat?userID=${encodeURIComponent(userID)}&userSig=${encodeURIComponent(userSig)}&SDKAppID=${SDKAppID}&targetUserID=${doctor}`
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
uni.showToast({ title: '操作失败', icon: 'none' });
|
||||
} finally {
|
||||
confirmBtnLoading.value = false;
|
||||
}
|
||||
};
|
||||
const video =async (data)=>{
|
||||
const res = await proxy.apiUrl({
|
||||
url: '/api/tcm/getPatientSignature',
|
||||
method: 'GET',
|
||||
data: {
|
||||
patient_id:diagnosisId
|
||||
},
|
||||
}, false)
|
||||
|
||||
const {userId } = res.data;
|
||||
|
||||
const { userSig, SDKAppID } = GenerateTestUserSig.genTestUserSig({
|
||||
userID:userId,
|
||||
});
|
||||
|
||||
getApp().globalData.userID = userId;
|
||||
getApp().globalData.userSig = userSig;
|
||||
getApp().globalData.SDKAppID = SDKAppID;
|
||||
const cc={
|
||||
sdkAppID: SDKAppID, // 替换为用户自己的 sdkAppID
|
||||
userID: userId, // 替换为用户自己的 userID
|
||||
userSig: userSig, // 替换为用户自己的 userSig
|
||||
globalCallPagePath: "TUICallKit/src/Components/TUICallKit", // 替换为步骤一里注册的全局监听页面
|
||||
}
|
||||
uni.setStorageSync('CallManager', userId)
|
||||
await uni.CallManager.init(cc);
|
||||
}
|
||||
// 打开知情同意书
|
||||
const openConsentForm = () => {
|
||||
// 可跳转到知情同意书页面,或使用 web-view 打开外部链接
|
||||
uni.navigateTo({
|
||||
url: '/pages/Card/contact?type=service'
|
||||
})
|
||||
};
|
||||
|
||||
// 获取选中项名称
|
||||
const getDiagnosisTypeName = () => {
|
||||
const item = diagnosisTypeOptions.value.find(i => i.value === formData.value.diagnosis_type);
|
||||
@@ -730,17 +835,11 @@ const confirmDiagnosis = async () => {
|
||||
}, false);
|
||||
|
||||
if (res.code === 1) {
|
||||
uni.showToast({
|
||||
title: '确认成功',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
|
||||
dingdan_ok.value=res.data.is_view?true:false
|
||||
uni.setStorageSync('dingdan_ok', true);
|
||||
dingdan_ok.value=true;
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 2000);
|
||||
|
||||
} else {
|
||||
uni.showToast({ title: res.msg || '确认失败', icon: 'none' });
|
||||
}
|
||||
@@ -974,4 +1073,75 @@ const confirmDiagnosis = async () => {
|
||||
color: #777;
|
||||
animation: successSlideIn 0.6s ease-out 0.4s both;
|
||||
}
|
||||
|
||||
/* 就诊人信息弹窗 */
|
||||
.modal-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 999;
|
||||
padding: 40rpx;
|
||||
}
|
||||
|
||||
.patient-modal {
|
||||
width: 100%;
|
||||
max-width: 620rpx;
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 48rpx 40rpx 40rpx;
|
||||
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
font-size: 40rpx;
|
||||
font-weight: bold;
|
||||
color: #1a1a1a;
|
||||
text-align: center;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.patient-info-box {
|
||||
background: #f5f5f5;
|
||||
border: 2rpx solid #e8e8e8;
|
||||
border-radius: 16rpx;
|
||||
padding: 28rpx 32rpx;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.info-row {
|
||||
font-size: 35rpx;
|
||||
color: #333;
|
||||
line-height: 2;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.agreement-row {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
margin-bottom: 32rpx;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.agreement-link {
|
||||
color: #1890ff;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.modal-confirm-btn {
|
||||
width: 100%;
|
||||
height: 96rpx;
|
||||
line-height: 96rpx;
|
||||
background: #00C853;
|
||||
color: #fff;
|
||||
font-size: 34rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 48rpx;
|
||||
border: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 90 KiB |
Reference in New Issue
Block a user