fix: OSS客户端直传
This commit is contained in:
@@ -75,6 +75,7 @@ const sendUploadedFile = () => {
|
|||||||
room_id: chatStore.currentFriend.room_id,
|
room_id: chatStore.currentFriend.room_id,
|
||||||
read: true,
|
read: true,
|
||||||
duration: 0,
|
duration: 0,
|
||||||
|
isSent: true, // 标记为自己发送的消息,确保显示在右侧
|
||||||
};
|
};
|
||||||
|
|
||||||
chatStore.addMessage(messageObj, userStore.currentUser.doctor_id);
|
chatStore.addMessage(messageObj, userStore.currentUser.doctor_id);
|
||||||
@@ -83,6 +84,7 @@ const sendUploadedFile = () => {
|
|||||||
sendMessage({
|
sendMessage({
|
||||||
senderId: userStore.currentUser.doctor_id,
|
senderId: userStore.currentUser.doctor_id,
|
||||||
receiverId: chatStore.currentFriend.id,
|
receiverId: chatStore.currentFriend.id,
|
||||||
|
roomId: chatStore.currentFriend.room_id, // 添加房间ID
|
||||||
type: uploadPreview.value.type,
|
type: uploadPreview.value.type,
|
||||||
content: uploadPreview.value.url,
|
content: uploadPreview.value.url,
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ export function useWebSocket() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// const wsUrl = import.meta.env.VITE_WS_URL || "wss://g-ws.nailaoyun.cn/ws"
|
// const wsUrl = import.meta.env.VITE_WS_URL || "wss://g-ws.nailaoyun.cn/ws"
|
||||||
const wsUrl = import.meta.env.VITE_WS_URL || 'ws://localhost:12080/ws';
|
// const wsUrl = import.meta.env.VITE_WS_URL || 'ws://localhost:12080/ws';
|
||||||
|
const wsUrl = 'wss://api.ws.g.xiaokang88.com/ws';
|
||||||
// const wsUrl = import.meta.env.VITE_WS_URL || "wss://g-ws.nailaoyun.cn/ws"
|
// const wsUrl = import.meta.env.VITE_WS_URL || "wss://g-ws.nailaoyun.cn/ws"
|
||||||
socket.value = new WebSocket(wsUrl);
|
socket.value = new WebSocket(wsUrl);
|
||||||
|
|
||||||
|
|||||||
@@ -67,11 +67,14 @@ export async function getPatientList(type: number) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取患者详情
|
* 获取患者详情
|
||||||
* @param roomId 房间ID
|
* @param roomId 房间ID(可选,如果没有room_id但有registerId,可以通过registerId查询)
|
||||||
* @param registerId 挂号ID(可选)
|
* @param registerId 挂号ID(可选)
|
||||||
*/
|
*/
|
||||||
export async function getPatientDetail(roomId: string, registerId?: number) {
|
export async function getPatientDetail(roomId?: string, registerId?: number) {
|
||||||
const params: any = { room_id: roomId };
|
const params: any = {};
|
||||||
|
if (roomId) {
|
||||||
|
params.room_id = roomId;
|
||||||
|
}
|
||||||
if (registerId) {
|
if (registerId) {
|
||||||
params.register_id = registerId;
|
params.register_id = registerId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ const receptionLoading = ref(false);
|
|||||||
|
|
||||||
// 获取患者详情
|
// 获取患者详情
|
||||||
const fetchPatientDetail = async () => {
|
const fetchPatientDetail = async () => {
|
||||||
if (!props.patient || !props.patient.room_id) {
|
// 至少需要 room_id 或 register_id 其中之一
|
||||||
|
if (!props.patient || (!props.patient.room_id && !props.patient.register_id)) {
|
||||||
patientDetail.value = null;
|
patientDetail.value = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -43,9 +44,10 @@ const fetchPatientDetail = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('查询患者详情,register_id:', registerId, 'patient:', props.patient);
|
console.log('查询患者详情,register_id:', registerId, 'room_id:', props.patient.room_id, 'patient:', props.patient);
|
||||||
|
|
||||||
const res = await getPatientDetail(props.patient.room_id, registerId);
|
// 支持只有 register_id 没有 room_id 的情况
|
||||||
|
const res = await getPatientDetail(props.patient.room_id || '', registerId);
|
||||||
console.log('患者详情API响应:', res);
|
console.log('患者详情API响应:', res);
|
||||||
// 确保正确解析返回数据
|
// 确保正确解析返回数据
|
||||||
const data = res?.result || res?.data || res || null;
|
const data = res?.result || res?.data || res || null;
|
||||||
@@ -63,8 +65,12 @@ const fetchPatientDetail = async () => {
|
|||||||
|
|
||||||
// 接诊
|
// 接诊
|
||||||
const handleReception = async () => {
|
const handleReception = async () => {
|
||||||
if (!props.patient || !props.patient.register_id) {
|
if (!props.patient) {
|
||||||
message.error('患者信息不存在或缺少挂号ID');
|
message.error('患者信息不存在');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!props.patient.register_id) {
|
||||||
|
message.error('缺少挂号ID');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,8 +106,12 @@ const getSexText = (sex) => {
|
|||||||
|
|
||||||
// 进入聊天
|
// 进入聊天
|
||||||
const handleEnterChat = () => {
|
const handleEnterChat = () => {
|
||||||
if (!props.patient || !props.patient.room_id) {
|
if (!props.patient) {
|
||||||
message.warning('患者信息不完整,无法进入聊天');
|
message.warning('患者信息不存在');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!props.patient.room_id) {
|
||||||
|
message.warning('患者尚未创建聊天房间,请先接诊');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emit('enter-chat', props.patient);
|
emit('enter-chat', props.patient);
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ export default defineConfig(async () => {
|
|||||||
rewrite: (path) => path.replace(/^\/im-api/, ''),
|
rewrite: (path) => path.replace(/^\/im-api/, ''),
|
||||||
// mock代理目标地址
|
// mock代理目标地址
|
||||||
// target: 'https://api.xiaokang88.com/api/admin/',
|
// target: 'https://api.xiaokang88.com/api/admin/',
|
||||||
target: 'http://localhost:12080/api/',
|
target: 'https://api.ws.g.xiaokang88.com/api/',
|
||||||
|
// target: 'http://localhost:12080/api/',
|
||||||
// target: 'http://api.xiaokang88.com/api/admin/',
|
// target: 'http://api.xiaokang88.com/api/admin/',
|
||||||
ws: true,
|
ws: true,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user