no message
This commit is contained in:
parent
4b75ebf647
commit
e9bea571ea
1
App.vue
1
App.vue
@ -9,7 +9,6 @@ export default {
|
||||
useAccountStore();
|
||||
|
||||
// 如果已有缓存的账户信息,尝试初始化 IM,否则重新登录
|
||||
debugger;
|
||||
if (account && account.openid) {
|
||||
console.log("App Launch: 已有登录信息,初始化 IM");
|
||||
initIMAfterLogin().catch((err) => {
|
||||
|
||||
@ -528,7 +528,7 @@ async function sendFollowUp(todo) {
|
||||
}
|
||||
|
||||
// 2. 处理文件列表(图片、宣教文章、问卷)
|
||||
debugger;
|
||||
|
||||
if (Array.isArray(todo.fileList)) {
|
||||
for (const file of todo.fileList) {
|
||||
if (file.type === "image" && file.URL) {
|
||||
|
||||
@ -378,6 +378,14 @@ $primary-color: #0877F1;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.voice-toggle-icon {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.plus-btn {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<view class="input-section">
|
||||
<view class="input-toolbar">
|
||||
<view @click="toggleVoiceInput" class="voice-toggle-btn">
|
||||
<uni-icons v-if="showVoiceInput" fontFamily="keyboard" :size="28">{{ '' }}</uni-icons>
|
||||
<image v-if="showVoiceInput" src="/static/jianpan.png" class="voice-toggle-icon" mode="aspectFit"></image>
|
||||
<uni-icons v-else type="mic" size="28" color="#666" />
|
||||
</view>
|
||||
<view class="input-area">
|
||||
@ -463,7 +463,7 @@ const morePanelButtons = computed(() => {
|
||||
// 已结束状态:显示"开启会话"按钮
|
||||
buttons.push({
|
||||
text: "开启会话",
|
||||
icon: "/static/icon/kaiqihuihua.png",
|
||||
icon: "/static/icon/openChat.png",
|
||||
action: handleOpenConsult,
|
||||
});
|
||||
} else {
|
||||
|
||||
@ -10,13 +10,13 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { computed } from "vue";
|
||||
|
||||
const props = defineProps({
|
||||
message: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
|
||||
const payload = computed(() => props.message?.payload || {});
|
||||
@ -26,16 +26,17 @@ const systemMessageData = computed(() => {
|
||||
try {
|
||||
// 尝试从 payload.data 解析系统消息
|
||||
if (payload.value.data) {
|
||||
const data = typeof payload.value.data === 'string'
|
||||
? JSON.parse(payload.value.data)
|
||||
: payload.value.data;
|
||||
|
||||
if (data.type === 'system_message') {
|
||||
const data =
|
||||
typeof payload.value.data === "string"
|
||||
? JSON.parse(payload.value.data)
|
||||
: payload.value.data;
|
||||
|
||||
if (data.type === "system_message") {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('解析系统消息失败:', e);
|
||||
console.error("解析系统消息失败:", e);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
@ -44,12 +45,12 @@ const systemMessageData = computed(() => {
|
||||
const extension = computed(() => {
|
||||
try {
|
||||
if (payload.value.extension) {
|
||||
return typeof payload.value.extension === 'string'
|
||||
return typeof payload.value.extension === "string"
|
||||
? JSON.parse(payload.value.extension)
|
||||
: payload.value.extension;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('解析扩展信息失败:', e);
|
||||
console.error("解析扩展信息失败:", e);
|
||||
}
|
||||
return {};
|
||||
});
|
||||
@ -65,20 +66,20 @@ const text = computed(() => {
|
||||
if (systemMessageData.value?.messageType) {
|
||||
const messageType = systemMessageData.value.messageType;
|
||||
switch (messageType) {
|
||||
case 'consult_pending':
|
||||
return '患者已发起咨询申请,请及时接诊';
|
||||
case 'consult_accepted':
|
||||
return '医生已接诊';
|
||||
case 'consult_rejected':
|
||||
return '医生暂时无法接诊';
|
||||
case 'consult_ended':
|
||||
return '问诊已结束';
|
||||
case 'consult_timeout':
|
||||
return '问诊已超时';
|
||||
case 'consult_reopened':
|
||||
return '会话已重新开启';
|
||||
case "consult_pending":
|
||||
return "患者已发起咨询申请,请及时接诊";
|
||||
case "consult_accepted":
|
||||
return "医生已接诊";
|
||||
case "consult_rejected":
|
||||
return "医生暂时无法接诊";
|
||||
case "consult_ended":
|
||||
return "问诊已结束";
|
||||
case "consult_timeout":
|
||||
return "问诊已超时";
|
||||
case "consult_reopened":
|
||||
return "会话已重新开启";
|
||||
default:
|
||||
return systemMessageData.value.content || '[系统消息]';
|
||||
return systemMessageData.value.content || "[系统消息]";
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +89,7 @@ const text = computed(() => {
|
||||
}
|
||||
|
||||
// 兼容旧格式:直接从 payload.data 获取
|
||||
if (payload.value.data && typeof payload.value.data === 'string') {
|
||||
if (payload.value.data && typeof payload.value.data === "string") {
|
||||
// 如果 data 不是 JSON 格式,直接显示
|
||||
try {
|
||||
JSON.parse(payload.value.data);
|
||||
@ -97,7 +98,7 @@ const text = computed(() => {
|
||||
}
|
||||
}
|
||||
|
||||
return '[系统消息]';
|
||||
return "[系统消息]";
|
||||
});
|
||||
|
||||
// 通知文本(红色提示)
|
||||
@ -111,24 +112,23 @@ const notifyText = computed(() => {
|
||||
if (systemMessageData.value) {
|
||||
const messageType = systemMessageData.value.messageType;
|
||||
switch (messageType) {
|
||||
case 'consult_pending':
|
||||
return '待接诊';
|
||||
case 'consult_rejected':
|
||||
return '已拒绝';
|
||||
case 'consult_timeout':
|
||||
return '已超时';
|
||||
case 'consult_accepted':
|
||||
return '已接诊';
|
||||
case 'consult_ended':
|
||||
return '已结束';
|
||||
case "consult_pending":
|
||||
return "待接诊";
|
||||
case "consult_rejected":
|
||||
return "已拒绝";
|
||||
case "consult_timeout":
|
||||
return "已超时";
|
||||
case "consult_accepted":
|
||||
return "已接诊";
|
||||
case "consult_ended":
|
||||
return "已结束";
|
||||
default:
|
||||
return '';
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
return "";
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@ -886,7 +886,7 @@ const handleRejectReasonConfirm = async (reason) => {
|
||||
const currentGroupId = chatInfo.value.conversationID.replace("GROUP", "");
|
||||
|
||||
// 调用后端接口发送拒绝消息
|
||||
const result = await api("sendConsultRejectedMessage", {
|
||||
const result = await api("rejectConsultation", {
|
||||
groupId: currentGroupId,
|
||||
memberName,
|
||||
reason,
|
||||
|
||||
BIN
static/icon/openChat.png
Normal file
BIN
static/icon/openChat.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 752 B |
BIN
static/jianpan.png
Normal file
BIN
static/jianpan.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
@ -24,8 +24,8 @@ export default defineStore("accountStore", () => {
|
||||
// IM 相关
|
||||
const openid = ref(cache.get(CACHE_KEYS.OPENID, ""));
|
||||
const isIMInitialized = ref(false);
|
||||
// 医生信息
|
||||
const doctorInfo = ref(cache.get(CACHE_KEYS.DOCTOR_INFO, null));
|
||||
// 医生信息 - 不做缓冲处理,每次都重新获取
|
||||
const doctorInfo = ref(null);
|
||||
|
||||
function getLoginPromise(phoneCode = '') {
|
||||
if (loginPromise.value) return loginPromise.value;
|
||||
@ -41,7 +41,7 @@ export default defineStore("accountStore", () => {
|
||||
|
||||
async function loginByCode(phoneCode = '') {
|
||||
try {
|
||||
debugger
|
||||
|
||||
const { code } = await uni.login({
|
||||
appid,
|
||||
provider: "weixin",
|
||||
@ -83,19 +83,26 @@ export default defineStore("accountStore", () => {
|
||||
|
||||
async function getDoctorInfo(data = {}) {
|
||||
try {
|
||||
debugger
|
||||
|
||||
const res = await api('getCorpMemberData', {
|
||||
...data,
|
||||
weChatOpenId: account.value.openid,
|
||||
});
|
||||
doctorInfo.value = res?.data || null;
|
||||
if (doctorInfo.value.accountState && doctorInfo.value.accountState == "disable") {
|
||||
uni.redirectTo({ url: "/pages/login/login" });
|
||||
|
||||
// 检查账号是否被禁用
|
||||
if (doctorInfo.value?.accountState === "disable") {
|
||||
uni.showModal({
|
||||
title: '账号被禁用',
|
||||
content: '您的账号已被禁用,请联系管理员',
|
||||
showCancel: false,
|
||||
confirmText: '确定',
|
||||
success: () => {
|
||||
uni.redirectTo({ url: "/pages/login/login" });
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (res?.data) {
|
||||
cache.set(CACHE_KEYS.DOCTOR_INFO, res.data);
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error('获取医生信息失败:', e);
|
||||
@ -139,7 +146,6 @@ export default defineStore("accountStore", () => {
|
||||
// 清空缓存
|
||||
cache.remove(CACHE_KEYS.ACCOUNT);
|
||||
cache.remove(CACHE_KEYS.OPENID);
|
||||
cache.remove(CACHE_KEYS.DOCTOR_INFO);
|
||||
}
|
||||
|
||||
return { account, openid, isIMInitialized, doctorInfo, login, getDoctorInfo, initIMAfterLogin, logout }
|
||||
|
||||
@ -104,7 +104,8 @@ const urlsConfig = {
|
||||
getChatRecordsByGroupId: "getChatRecordsByGroupId",
|
||||
getGroupList: "getGroupList",
|
||||
followUpInquiry: "followUpInquiry",
|
||||
supplementMedicalCase: "supplementMedicalCase"
|
||||
supplementMedicalCase: "supplementMedicalCase",
|
||||
rejectConsultation: "rejectConsultation"
|
||||
},
|
||||
todo: {
|
||||
getCustomerTodos: 'getCustomerTodos',
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
import { globalTimChatManager } from './tim-chat.js';
|
||||
import api from './api.js';
|
||||
import { toast } from './widget.js';
|
||||
|
||||
const env = __VITE_ENV__;
|
||||
/**
|
||||
* 发送文字消息
|
||||
* @param {string} content - 文字内容
|
||||
@ -137,7 +137,7 @@ export async function sendArticleMessage(article, options = {}) {
|
||||
/**
|
||||
* 发送问卷消息
|
||||
* @param {Object} survey - 问卷对象 { _id, name, surveryId, url, createBy }
|
||||
* @param {Object} options - 额外选项 { userId, customerId, customerName, corpId, env }
|
||||
* @param {Object} options - 额外选项 { userId, customerId, customerName, corpId }
|
||||
* @returns {Promise<boolean>} 发送是否成功
|
||||
*/
|
||||
export async function sendSurveyMessage(survey, options = {}) {
|
||||
@ -186,8 +186,7 @@ export async function sendSurveyMessage(survey, options = {}) {
|
||||
sendSurveyId,
|
||||
{
|
||||
corpId: options.corpId,
|
||||
userId: options.userId,
|
||||
env: options.env,
|
||||
userId: options.userId
|
||||
}
|
||||
);
|
||||
|
||||
@ -235,10 +234,10 @@ function generateRandomString(length) {
|
||||
* @returns {string} 问卷链接
|
||||
*/
|
||||
function generateSendLink(survey, answerId, customerId, customerName, sendSurveyId, context = {}) {
|
||||
const { corpId, userId, env } = context;
|
||||
const { corpId, userId } = context;
|
||||
const isSystem = survey.createBy === 'system';
|
||||
let url = '';
|
||||
|
||||
debugger
|
||||
if (isSystem) {
|
||||
// 系统问卷:使用 VITE_SURVEY_URL
|
||||
url = `${env?.MP_SURVEY_URL}?corpId=${corpId}&surveryId=${survey.surveryId}&memberId=${customerId}&sendSurveyId=${sendSurveyId}&userId=${userId}`;
|
||||
@ -318,8 +317,7 @@ export async function handleFollowUpMessages(messages, context = {}) {
|
||||
userId: context.userId,
|
||||
customerId: context.customerId,
|
||||
customerName: context.customerName,
|
||||
corpId: context.corpId,
|
||||
env: context.env,
|
||||
corpId: context.corpId
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user