Merge remote-tracking branch 'origin/dev-wdb' into dev-hjf
This commit is contained in:
commit
ebaaa7b72f
@ -1,4 +1,5 @@
|
||||
MP_API_BASE_URL=http://localhost:8080
|
||||
MP_API_BASE_URL=https://patient.youcan365.com
|
||||
MP_CACHE_PREFIX=development
|
||||
MP_WX_APP_ID=wx93af55767423938e
|
||||
MP_TIM_SDK_APP_ID=1600123876
|
||||
MP_CORP_ID=wwe3fb2faa52cf9dfb
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
MP_API_BASE_URL=http://192.168.60.2:8080
|
||||
MP_API_BASE_URL=http://localhost:8080
|
||||
MP_CACHE_PREFIX=development
|
||||
MP_WX_APP_ID=wx93af55767423938e
|
||||
MP_TIM_SDK_APP_ID=1600123876
|
||||
MP_CORP_ID=wwe3fb2faa52cf9dfb
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view v-if="showCancel || showConfirm" class="relative px-15 py-12 bg-white text-center"
|
||||
<view v-if="showCancel || showConfirm" class="relative flex px-15 py-12 bg-white text-center"
|
||||
:class="hidedenShadow ? '' : 'shadow-up'">
|
||||
<view v-if="showCancel" class="flex-grow py-10 text-base border-primary rounded text-primary rounded"
|
||||
@click="cancel()">
|
||||
|
||||
@ -120,6 +120,9 @@
|
||||
"path": "pages/common/agreement",
|
||||
"style": {
|
||||
"navigationBarTitleText": "用户协议"
|
||||
"path": "pages/article/article-detail",
|
||||
"style": {
|
||||
"navigationBarTitleText": "宣教文章"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
201
pages/article/article-detail.vue
Normal file
201
pages/article/article-detail.vue
Normal file
@ -0,0 +1,201 @@
|
||||
<template>
|
||||
<view class="article-detail-page">
|
||||
<view v-if="loading" class="loading-container">
|
||||
<uni-icons type="spinner-cycle" size="40" color="#999" />
|
||||
<text class="loading-text">加载中...</text>
|
||||
</view>
|
||||
|
||||
<view v-else-if="error" class="error-container">
|
||||
<text class="error-text">{{ error }}</text>
|
||||
<button class="retry-btn" @click="loadArticle">重试</button>
|
||||
</view>
|
||||
|
||||
<scroll-view v-else scroll-y class="article-content">
|
||||
<view class="article-header">
|
||||
<text class="article-title">{{ articleData.title }}</text>
|
||||
<text class="article-date">{{ articleData.date }}</text>
|
||||
</view>
|
||||
<view class="article-body">
|
||||
<view class="rich-text-wrapper">
|
||||
<rich-text :nodes="articleData.content"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import api from "@/utils/api.js";
|
||||
import { ref } from "vue";
|
||||
const env = __VITE_ENV__;
|
||||
const corpId = env.MP_CORP_ID;
|
||||
const loading = ref(true);
|
||||
const error = ref("");
|
||||
const articleData = ref({
|
||||
title: "",
|
||||
content: "",
|
||||
date: "",
|
||||
});
|
||||
|
||||
let articleId = "";
|
||||
|
||||
// 处理富文本内容,使图片自适应
|
||||
const processRichTextContent = (html) => {
|
||||
if (!html) return "";
|
||||
|
||||
// 给所有 img 标签添加样式
|
||||
let processedHtml = html.replace(
|
||||
/<img/gi,
|
||||
'<img style="max-width:100%;height:auto;display:block;margin:10px 0;"'
|
||||
);
|
||||
|
||||
// 移除可能存在的固定宽度样式
|
||||
processedHtml = processedHtml.replace(
|
||||
/style="[^"]*width:\s*\d+px[^"]*"/gi,
|
||||
(match) => {
|
||||
return match.replace(/width:\s*\d+px;?/gi, "max-width:100%;");
|
||||
}
|
||||
);
|
||||
|
||||
// 处理表格,添加自适应样式
|
||||
processedHtml = processedHtml.replace(
|
||||
/<table/gi,
|
||||
'<table style="max-width:100%;overflow-x:auto;display:block;"'
|
||||
);
|
||||
|
||||
// 给整体内容添加容器样式
|
||||
processedHtml = `<div style="width:100%;overflow-x:hidden;word-wrap:break-word;word-break:break-all;">${processedHtml}</div>`;
|
||||
|
||||
return processedHtml;
|
||||
};
|
||||
|
||||
// 加载文章
|
||||
const loadArticle = async () => {
|
||||
loading.value = true;
|
||||
error.value = "";
|
||||
try {
|
||||
const res = await api("getArticle", { id: articleId, corpId });
|
||||
|
||||
if (res.success && res.data) {
|
||||
// 格式化日期
|
||||
let date = "";
|
||||
if (res.data.createTime) {
|
||||
const d = new Date(res.data.createTime);
|
||||
const year = d.getFullYear();
|
||||
const month = String(d.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(d.getDate()).padStart(2, "0");
|
||||
date = `${year}-${month}-${day}`;
|
||||
}
|
||||
|
||||
articleData.value = {
|
||||
title: res.data.title || "宣教文章",
|
||||
content: processRichTextContent(res.data.content || ""),
|
||||
date: date,
|
||||
};
|
||||
} else {
|
||||
error.value = res.message || "加载文章失败";
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("加载文章失败:", err);
|
||||
error.value = "加载失败,请重试";
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
onLoad((options) => {
|
||||
if (options.id) {
|
||||
articleId = options.id;
|
||||
loadArticle();
|
||||
} else {
|
||||
error.value = "文章信息不完整";
|
||||
loading.value = false;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.article-detail-page {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.loading-container,
|
||||
.error-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100vh;
|
||||
padding: 40rpx;
|
||||
}
|
||||
|
||||
.loading-text {
|
||||
margin-top: 20rpx;
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.error-text {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
margin-bottom: 30rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.retry-btn {
|
||||
padding: 16rpx 60rpx;
|
||||
background-color: #0877f1;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 8rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.article-content {
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.article-header {
|
||||
padding: 40rpx 30rpx 20rpx;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.article-title {
|
||||
display: block;
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.article-date {
|
||||
display: block;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.article-body {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.rich-text-wrapper {
|
||||
padding: 30rpx;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.rich-text-wrapper ::v-deep rich-text {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.rich-text-wrapper ::v-deep rich-text img {
|
||||
max-width: 100% !important;
|
||||
height: auto !important;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
@ -40,6 +40,7 @@ import { toast } from "@/utils/widget";
|
||||
|
||||
import groupAvatar from "@/components/group-avatar.vue";
|
||||
|
||||
|
||||
const team = ref(null);
|
||||
const checked = ref(false);
|
||||
const redirectUrl = ref("");
|
||||
|
||||
@ -366,10 +366,8 @@ $primary-color: #0877F1;
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 46rpx;
|
||||
}
|
||||
|
||||
.voice-input-btn {
|
||||
text-align: center;
|
||||
line-height: 80rpx;
|
||||
}
|
||||
@ -933,7 +931,16 @@ $primary-color: #0877F1;
|
||||
.text-input::-moz-placeholder,
|
||||
.text-input:-ms-input-placeholder,
|
||||
.text-input::placeholder {
|
||||
line-height: 96rpx;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.voice-input-btn::-webkit-input-placeholder,
|
||||
.voice-input-btn:-moz-placeholder,
|
||||
.voice-input-btn::-moz-placeholder,
|
||||
.voice-input-btn:-ms-input-placeholder,
|
||||
.voice-input-btn::placeholder {
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 时间分割线 */
|
||||
|
||||
@ -237,7 +237,7 @@ const getArticleData = (message) => {
|
||||
const handleArticleClick = (message) => {
|
||||
const { articleId } = getArticleData(message);
|
||||
uni.navigateTo({
|
||||
url: `/pages/message/article-detail?id=${articleId}`,
|
||||
url: `/pages/article/article-detail?id=${articleId}`,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -291,12 +291,6 @@ function handleSystemMessageReceived(message) {
|
||||
}
|
||||
}
|
||||
|
||||
// 检查是否有待接诊的系统消息
|
||||
function checkConsultPendingStatus() {
|
||||
// 直接获取最新的订单状态
|
||||
fetchGroupOrderStatus();
|
||||
}
|
||||
|
||||
// 获取消息气泡样式类
|
||||
function getBubbleClass(message) {
|
||||
// 图片消息不需要气泡背景
|
||||
@ -393,27 +387,23 @@ const initTIMCallbacks = async () => {
|
||||
handleSystemMessageReceived(message);
|
||||
}
|
||||
|
||||
// 检查是否有待接诊的系统消息
|
||||
checkConsultPendingStatus();
|
||||
|
||||
// 立即滚动到底部,不使用延迟
|
||||
nextTick(() => {
|
||||
scrollToBottom(true);
|
||||
});
|
||||
|
||||
// 立即标记会话为已读,确保未读数为0
|
||||
if (timChatManager.tim && timChatManager.isLoggedIn && chatInfo.value.conversationID) {
|
||||
if (
|
||||
timChatManager.tim &&
|
||||
timChatManager.isLoggedIn &&
|
||||
chatInfo.value.conversationID
|
||||
) {
|
||||
timChatManager.tim
|
||||
.setMessageRead({
|
||||
conversationID: chatInfo.value.conversationID,
|
||||
})
|
||||
.then(() => {
|
||||
console.log("✓ 收到新消息后已标记为已读");
|
||||
// 触发会话列表更新,确保未读数为0
|
||||
timChatManager.triggerCallback('onConversationListUpdated', {
|
||||
conversationID: chatInfo.value.conversationID,
|
||||
unreadCount: 0
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("✗ 标记已读失败:", error);
|
||||
@ -473,9 +463,6 @@ const initTIMCallbacks = async () => {
|
||||
isCompleted.value = data.isCompleted || false;
|
||||
isLoadingMore.value = false;
|
||||
|
||||
// 检查是否有待接诊的系统消息
|
||||
checkConsultPendingStatus();
|
||||
|
||||
nextTick(() => {
|
||||
if (data.isRefresh) {
|
||||
console.log("后台刷新完成,保持当前滚动位置");
|
||||
@ -570,11 +557,6 @@ const loadMessageList = async () => {
|
||||
})
|
||||
.then(() => {
|
||||
console.log("✓ 会话已标记为已读:", chatInfo.value.conversationID);
|
||||
// 触发会话列表更新回调,通知消息列表页面清空未读数
|
||||
timChatManager.triggerCallback('onConversationListUpdated', {
|
||||
conversationID: chatInfo.value.conversationID,
|
||||
unreadCount: 0
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("✗ 标记会话已读失败:", error);
|
||||
@ -731,6 +713,9 @@ onShow(() => {
|
||||
// 页面隐藏
|
||||
onHide(() => {
|
||||
stopIMMonitoring();
|
||||
// 清空当前会话ID,避免离开页面后收到的消息被错误标记为已读
|
||||
timChatManager.currentConversationID = null;
|
||||
console.log("✓ 页面隐藏,已清空当前会话ID");
|
||||
});
|
||||
|
||||
// 处理取消申请
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view v-if="member" class="flex p-15 bg-whtie shadow-lg">
|
||||
<view v-if="member" class="flex p-15 bg-white shadow-lg">
|
||||
<view class="flex-grow w-0 mr-10 leading-normal">
|
||||
<view class="flex items-center">
|
||||
<view class="mr-5 flex-shrink-0 text-xl text-dark font-semibold">{{ member.anotherName }}</view>
|
||||
|
||||
@ -8,6 +8,7 @@ const env = __VITE_ENV__;
|
||||
|
||||
export default defineStore("accountStore", () => {
|
||||
const appid = env.MP_WX_APP_ID;
|
||||
const corpId = env.MP_CORP_ID;
|
||||
const account = ref(null);
|
||||
const loading = ref(false)
|
||||
const isIMInitialized = ref(false);
|
||||
@ -25,8 +26,10 @@ export default defineStore("accountStore", () => {
|
||||
});
|
||||
if (code) {
|
||||
const res = await api('wxAppLogin', {
|
||||
appId:appid,
|
||||
phoneCode,
|
||||
code,
|
||||
corpId
|
||||
});
|
||||
loading.value = false
|
||||
if (res.success && res.data && res.data.mobile) {
|
||||
|
||||
@ -46,7 +46,7 @@ export async function mergeConversationWithGroupDetails(conversationList, option
|
||||
...options // 支持传入额外的查询参数(corpId, teamId, keyword等)
|
||||
}
|
||||
|
||||
const response = await api('getGroupList', requestData)
|
||||
const response = await api('getGroupList', requestData, false)
|
||||
|
||||
// 4. 检查响应
|
||||
if (!response || !response.success) {
|
||||
|
||||
@ -1488,8 +1488,7 @@ class TimChatManager {
|
||||
|
||||
this.markConversationAsRead(conversationID)
|
||||
|
||||
// 首先从本地接口加载聊天记录
|
||||
console.log(" 开始从本地接口加载聊天记录,groupID:", actualGroupID)
|
||||
|
||||
await this.loadMessagesFromLocalAPI(actualGroupID, count)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user