9.26晚提交

This commit is contained in:
zoujiandong 2025-09-26 19:06:31 +08:00
parent 71136a03a6
commit 570e47698c
13 changed files with 2645 additions and 1697 deletions

View File

@ -447,7 +447,10 @@ export default {
page {
background-color: #f5f5f5;
}
.uni-navbar__header-btns-right{
min-width: 120rpx;
width:auto!important;
}
/* #endif */
.uni-nav-bar-text{
font-weight: bold;

View File

@ -458,10 +458,10 @@ const api = {
return request('/expertAPI/InterrogationPatientInfo', data, 'post', false);
},
updateInterrogationAnswer(data){
return request('/expertAPI/updateInterrogationAnswer', data, 'post', false);
return request('/expertAPI/updateInterrogationAnswerU', data, 'post', false);
},
addInterrogationAnswer(data){
return request('/expertAPI/addInterrogationAnswer', data, 'post', false);
return request('/expertAPI/addInterrogationAnswerU', data, 'post', false);
},
videoDetail(data){
return request('/expertAPI/videoDetail', data, 'post', false);
@ -571,6 +571,21 @@ const api = {
deleteConditionRecord(data){
return request('/expertAPI/delConditionRecord', data, 'post', false);
},
consultDetail(data){
return request('/expertAPI/consultDetail', data, 'post', false);
},
isConsultIng(data){
return request('/expertAPI/isConsultIng', data, 'post', false);
},
resConsult(data){
return request('/expertAPI/resConsult', data, 'post', false);
},
countConsult(data){
return request('/expertAPI/countConsult', data, 'post', false);
},
closeConsult(data){
return request('/expertAPI/closeConsult', data, 'post', false);
},
}
export default api

View File

@ -616,6 +616,16 @@
}
}
},
{
"path": "freeDetail/freeDetail",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "uni-app分页",
"app": {
"bounce": "none"
}
}
},
{
"path": "searchPatient/searchPatient",
"style": {

File diff suppressed because it is too large Load Diff

View File

@ -100,7 +100,7 @@ import { onShow, onLoad } from "@dcloudio/uni-app";
import api from "@/api/api.js";
import docUrl from "@/utils/docUrl.js";
import dayjs from "dayjs";
import { pathToBase64, base64ToPath } from "image-tools";
import { pathToBase64} from "image-tools";
//
const des = ref("");
@ -146,18 +146,14 @@ const chooseImage = () => {
//
// imageList.value = [...imageList.value, ...res.tempFilePaths]
tempImageList.value = [...tempImageList.value, ...res.tempFilePaths];
const fileManager = uni.getFileSystemManager();
for (let i = 0; i < res.tempFilePaths.length; i++) {
fileManager.readFile({
filePath: res.tempFilePaths[i],
encoding: "base64",
success: (res) => {
imageList.value.push(res.data);
},
fail: (error) => {
console.log("chooseImage", error);
},
});
pathToBase64(res.tempFilePaths[i])
.then((base64) => {
imageList.value.push(base64.split(',')[1]);
})
.catch((error) => {
console.error(error);
});
}
},
});
@ -246,7 +242,7 @@ const updateRecord = async () => {
title: "修改成功",
icon: "none",
});
uni.setStorageSync("caseRecord",null);
uni.setStorageSync("caseRecord", null);
goBack();
}
};
@ -291,19 +287,18 @@ onLoad((options) => {
for (let i = 0; i < record.photo.length; i++) {
console.log("url", docUrl + record.photo[i]);
uni.request({
url: docUrl + record.photo[i],
method: 'GET',
responseType: 'arraybuffer',
success: (res) => {
const base64 = `${uni.arrayBufferToBase64(res.data)}`
console.log(base64);
imageList.value.push(base64);
},
fail: (err) => {
reject(err);
},
})
url: docUrl + record.photo[i],
method: "GET",
responseType: "arraybuffer",
success: (res) => {
const base64 = `${uni.arrayBufferToBase64(res.data)}`;
console.log(base64);
imageList.value.push(base64);
},
fail: (err) => {
reject(err);
},
});
}
}
});

View File

@ -18,7 +18,7 @@
@scrolltolower="onReachBottom"
lower-threshold="80"
>
<view v-for="(item, idx) in displayList" :key="idx" class="consult-card" @click="goDetail(item.id)">
<view v-for="(item, idx) in displayList" :key="idx" class="consult-card" @click="goDetail(item.id,item.patientUuid)">
<view class="card-head">
<text class="user-name">{{ item.maskName }}</text>
<text class="date">{{ item.date }}</text>
@ -65,14 +65,21 @@ const pageSize=ref(10)
const hasMore = ref(true)
const isLoading = ref(false)
const isRefreshing = ref(false)
const goDetail=async(uuid)=>{
const goDetail=async(uuid,patientUuid)=>{
if(bottomActive.value==='quick'){
let userId=uni.getStorageSync('userInfo').uuid.toLowerCase();
let conversationId=userId+'|1|'+uuid.toLowerCase();
if(activeTab.value==='new'){
navTo({
url:'/pages_app/freeDetail/freeDetail?uuid='+uuid
})
}else{
let userId=uni.getStorageSync('userInfo').uuid.toLowerCase();
let conversationId=userId+'|1|'+patientUuid.toLowerCase();
await uni.$UIKitStore.uiStore.selectConversation(conversationId)
navTo({
url:'/pages_chat/chat/index?from=consult'
url:'/pages_chat/chat/index?from=consult&&patientUuid='+patientUuid+'&&uuid='+uuid
})
}
}else{
let status=0;
if(activeTab.value==='new'){
@ -111,7 +118,8 @@ const newConsultList=async(isRefresh=false)=>{
content: item.content || '',
replyCount: 0,
tag: item.diseaseName || '',
id:item.patientUuid || ''
id:item.uuid || '',
patientUuid:item.patientUuid || ''
}))
if(isRefresh){
listNew.value = mapped
@ -147,7 +155,8 @@ const consultListHis=async(isRefresh=false)=>{
content: item.content || '',
replyCount: 0,
tag: item.diseaseName || '',
id:item.patientUuid || ''
id:item.uuid || '',
patientUuid:item.patientUuid || ''
}))
if(isRefresh){
listMine.value = mapped

View File

@ -101,7 +101,7 @@
</view>
<!-- 编辑按钮 -->
<view class="edit-btn" @click="editQuestion">
<view class="edit-btn" @click="editQuestion(status)">
{{status==1?'我要编辑':'我要回答'}}
</view>
</view>
@ -121,7 +121,7 @@ const step1_uuid = ref('');
const answer_uuid = ref('');
const status = ref(0)
onLoad((options) => {
uuid.value = options.uuid || '125891f8c12145a99de01e29729978fb'
uuid.value = options.uuid
status.value = options.status || 0
console.log(uuid.value)
})
@ -163,6 +163,7 @@ const getInterrogation=()=>{
return user.uuid == item.expert_uuid
})
if(arr.length>0){
status.value = 1;
answer_uuid.value = arr[0].answer_uuid;
}
}
@ -254,10 +255,16 @@ function previewReplyImages(item, index){
//
function editQuestion() {
//
navTo({
url:'/pages_app/myAnswer/myAnswer?answer_uuid='+answer_uuid.value+'&uuid='+uuid.value
})
if(status.value == 1){
navTo({
url:'/pages_app/myAnswer/myAnswer?answer_uuid='+answer_uuid.value+'&uuid='+uuid.value
})
}else{
navTo({
url:'/pages_app/myAnswer/myAnswer?uuid='+uuid.value
})
}
}
</script>

View File

@ -0,0 +1,509 @@
<template>
<view class="consult-detail-page">
<!-- 导航栏 -->
<navBar title="咨询详情" />
<!-- 内容区域 -->
<scroll-view scroll-y class="content-scroll">
<!-- 用户信息区域 -->
<view class="user-section">
<view class="user-info">
<image v-if="userInfo.avatar" :src="userInfo.avatar" class="user-avatar" mode="aspectFill" />
<view class="user-details">
<view class="user-name">
<text class="name">{{ userInfo.name }}</text>
<text class="gender-age" v-if="userInfo.gender !== '未知'">{{ userInfo.gender }} {{ userInfo.age }}</text>
</view>
</view>
</view>
</view>
<!-- 疾病标签和日期 -->
<view class="tag-date-row">
<view class="disease-tag">
<text class="tag-text">{{ questionInfo.diseaseTag }}</text>
</view>
<view class="date">{{ questionInfo.date }}</view>
</view>
<!-- 问题内容 -->
<view class="question-content">
<text class="content-text">{{ questionInfo.diseaseDescribe }}</text>
</view>
<!-- 疾病描述 -->
<!-- <view v-if="questionInfo.diseaseDescribe" class="disease-describe">
<view class="describe-title">疾病描述</view>
<text class="describe-text">{{ questionInfo.diseaseDescribe }}</text>
</view> -->
<!-- 图片网格 -->
<view class="image-grid" v-if="questionInfo.images && questionInfo.images.length > 0">
<image
v-for="(img, index) in questionInfo.images"
:key="index"
:src="docUrl+img.path"
class="grid-image"
mode="aspectFill"
@click="previewImage(docUrl+img.path, index)"
/>
</view>
<view class="bar"></view>
</scroll-view>
<!-- 底部固定区域 -->
<view class="bottom-fixed">
<!-- 特别声明 -->
<!-- 编辑按钮 -->
<view class="edit-btn" @click="answerConsult">
我要回答
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import navBar from '@/components/navBar/navBar.vue'
import detailImg from "@/static/iv_jiwangshi.png"
import navTo from '@/utils/navTo.js'
import { onLoad,onShow } from '@dcloudio/uni-app'
import docUrl from '@/utils/docUrl'
import api from "@/api/api.js"
const uuid = ref('');
const step1_uuid = ref('');
let patientUuid = ref('');
const status = ref(0);
const hasAnswer = ref(false);
onLoad((options) => {
uuid.value = options.uuid
status.value = options.status || 0
})
const consultDetail=()=>{
api.consultDetail({
uuid:uuid.value
}).then(res=>{
console.log('咨询详情数据:', res)
if(res.code === 200 && res.data && res.data.detail) {
const detail = res.data.detail
patientUuid.value = detail.patientUuid;
//
userInfo.value = {
name: detail.patientName ,
gender: '未知', //
age: '未知' //
}
//
questionInfo.value = {
date: detail.createDate ? formatDate(detail.createDate) : '未知',
diseaseTag: detail.diseaseName || '未知疾病',
content: detail.content || '暂无问题描述',
images: res.data.imgList?res.data.imgList:[],
your_question: detail.content || '',
diseaseDescribe: detail.content || '' //
}
//
if(detail.patientPhoto) {
userInfo.value.avatar = docUrl + detail.patientPhoto
}
//
status.value = detail.state || 0
console.log('更新后的用户信息:', userInfo.value)
console.log('更新后的问题信息:', questionInfo.value)
} else {
console.error('获取咨询详情失败:', res)
uni.showToast({
title: res.msg || '获取咨询详情失败',
icon: 'none'
})
}
}).catch(err => {
console.error('请求咨询详情失败:', err)
uni.showToast({
title: '网络请求失败',
icon: 'none'
})
})
}
const countConsult=()=>{
api.countConsult({
consultUuid:uuid.value,
expertUuid:uni.getStorageSync('userInfo').uuid
}).then(res=>{
console.log('咨询数量:', res)
if(res.code ==200 && res.data){
if(res.data> 0){
uni.showModal({
title: '提示',
content: `您已回答过该患者${res.data}次公益咨询,是否确定回答`,
success: (res)=>{
if(res.confirm){
resConsult()
}
}
})
}else{
resConsult();
}
}
})
}
const answerConsult=async()=>{
if(hasAnswer.value){
let userId=uni.getStorageSync('userInfo').uuid.toLowerCase();
let conversationId=userId+'|1|'+patientUuid.value.toLowerCase();
await uni.$UIKitStore.uiStore.selectConversation(conversationId)
navTo({
url:'/pages_chat/chat/index?from=consult&patientUuid='+patientUuid.value
})
}else{
countConsult()
}
}
const resConsult=()=>{
api.resConsult({
consultUuid:uuid.value,
expertUuid:uni.getStorageSync('userInfo').uuid
}).then(async(res)=>{
if(res.code ==200){
hasAnswer.value = true;
patientUuid.value = res.data.patient_uuid;
let userId=uni.getStorageSync('userInfo').uuid.toLowerCase();
let conversationId=userId+'|1|'+patientUuid.value.toLowerCase();
await uni.$UIKitStore.uiStore.selectConversation(conversationId)
navTo({
url:'/pages_chat/chat/index?from=consult&patientUuid='+patientUuid.value+'&uuid='+uuid.value
})
}
})
}
onShow(()=>{
consultDetail()
})
//
function calculateAge(birthday) {
const birthDate = new Date(birthday)
const today = new Date()
let age = today.getFullYear() - birthDate.getFullYear()
const monthDiff = today.getMonth() - birthDate.getMonth()
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {
age--
}
return age.toString()
}
//
function formatDate(dateString) {
const date = new Date(dateString)
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
}
//
const userInfo = ref({
name: '提**',
gender: '未知',
age: '未知',
avatar: ''
})
//
const questionInfo = ref({
date: '2022-11-09',
diseaseTag: '甲型肝炎',
content: '为什么程序员总是分不清万圣节和圣诞节因为Oct31==Dec25。\n任何我写的代码超过6个月不去看它当我再看时都像是别人写的。',
diseaseDescribe: '', //
images: [
'/static/images/placeholder1.jpg',
'/static/images/placeholder2.jpg',
'/static/images/placeholder3.jpg',
'/static/images/placeholder4.jpg',
'/static/images/placeholder5.jpg',
'/static/images/placeholder6.jpg',
'/static/images/placeholder7.jpg',
'/static/images/placeholder8.jpg'
]
})
//
function goBack() {
uni.navigateBack()
}
//
function previewImage(current, index) {
uni.previewImage({
urls: questionInfo.value.images?questionInfo.value.images.map(item=> docUrl + item.path):[],
current: index
})
}
//
function editQuestion() {
navTo({
url:'/pages_app/myAnswer/myAnswer?uuid='+uuid.value
})
}
</script>
<style lang="scss" scoped>
.consult-detail-page {
background-color: #fff;
height: 100vh;
display: flex;
flex-direction: column;
}
.nav-bar {
display: flex;
align-items: center;
justify-content: space-between;
height: 88rpx;
padding: 0 32rpx;
background-color: #ffffff;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 100;
.nav-left {
width: 80rpx;
height: 80rpx;
display: flex;
align-items: center;
justify-content: center;
.back-icon {
font-size: 48rpx;
color: #8B2316;
font-weight: bold;
}
}
.nav-title {
font-size: 36rpx;
font-weight: 500;
color: #8B2316;
}
.nav-right {
width: 80rpx;
}
}
.bar{
width:100%;
height:20rpx;
background-color: #efefef;
}
.content-scroll {
flex: 1;
position: fixed;
top: 135rpx;
box-sizing: border-box;
padding: 30rpx 0;
bottom: 100rpx;
}
.user-section {
background-color: #ffffff;
border-radius: 16rpx;
margin-bottom: 24rpx;
padding: 0 30rpx;
margin: 0 30rpx;
.user-info {
display: flex;
align-items: center;
margin-bottom: 16rpx;
.user-avatar {
width: 80rpx;
height: 80rpx;
border-radius: 40rpx;
margin-right: 24rpx;
background-color: #f0f0f0;
}
.user-details {
flex: 1;
.user-name {
display: flex;
align-items: center;
margin-bottom: 8rpx;
.name {
font-size: 32rpx;
color: #8B2316;
font-weight: 500;
}
.gender-age {
font-size: 28rpx;
color: #666;
margin-left: 8rpx;
}
}
.user-status {
.status-text {
font-size: 24rpx;
color: #999;
padding: 4rpx 12rpx;
background-color: #f0f0f0;
border-radius: 12rpx;
}
}
}
.detail-btn {
display: flex;
margin-left: 10rpx;
.detail-text {
color: #ffffff;
font-size: 24rpx;
margin-right: 8rpx;
}
.detail-icon {
color: #ffffff;
font-size: 24rpx;
}
}
}
}
.tag-date-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 24rpx;
margin: 0 30rpx 30rpx;
.disease-tag {
margin-bottom: 0;
.tag-text {
display: inline-block;
background-color: #ffffff;
color: #8B2316;
border: 2rpx solid #8B2316;
border-radius: 40rpx;
padding: 7rpx 22rpx;
font-size: 24rpx;
}
}
.date {
font-size: 28rpx;
color: #999;
}
}
.question-content {
background-color: #f0f0f0;
border-radius: 16rpx;
padding: 32rpx;
margin: 0 30rpx;
margin-bottom: 24rpx;
.content-text {
font-size: 28rpx;
color: #333;
line-height: 1.6;
}
}
.disease-describe {
background-color: #f8f9fa;
border-radius: 16rpx;
padding: 32rpx;
margin: 0 30rpx 24rpx;
border-left: 6rpx solid #8B2316;
.describe-title {
font-size: 30rpx;
color: #8B2316;
font-weight: 500;
margin-bottom: 16rpx;
}
.describe-text {
font-size: 28rpx;
color: #333;
line-height: 1.6;
}
}
.image-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 8rpx;
margin: 0 30rpx 40rpx;
.grid-image {
width: 100%;
height: 160rpx;
border-radius: 8rpx;
}
}
.bottom-fixed {
position: fixed;
left: 0;
right: 0;
bottom: 0;
padding: 24rpx 32rpx;
}
.disclaimer {
background-color: #fff5f5;
border-radius: 16rpx;
padding: 24rpx;
margin-bottom: 24rpx;
.disclaimer-title {
font-size: 28rpx;
color: #8B2316;
font-weight: 500;
}
.disclaimer-text {
font-size: 28rpx;
color: #666;
line-height: 1.5;
}
}
.edit-btn {
width: 100%;
height: 88rpx;
line-height: 88rpx;
text-align: center;
border: 1rpx solid #8B2316;
background-color: #fff;
color: #8B2316;
font-size: 32rpx;
border-radius: 16rpx;
}
</style>

View File

@ -8,7 +8,7 @@
<view class="card-title">我的意见 <text class="required">*</text></view>
<view class="textarea-wrap">
<textarea
v-model="form.note"
v-model="note"
class="textarea"
:maxlength="300"
placeholder="请依据患者的个人信息、疾病资料及患者所咨询的问题详细解答患者的问题信息仅提问患者及医生可见最多输入300个字"
@ -25,16 +25,16 @@
<view class="sub-tip">可以用部分科普或文献来协助回答问题最多6张</view>
<view class="img-grid">
<view
v-if="imgList.length>0"
v-for="(img, index) in imgList"
v-if="tempImageList.length>0"
v-for="(img, index) in tempImageList"
:key="index"
class="img-item"
@click="preview(index)"
>
<image :src="docUrl+img" mode="aspectFill" class="img" />
<image :src="img" mode="aspectFill" class="img" />
<view class="del" @click.stop="remove(index)">×</view>
</view>
<view v-if="imgList.length < maxImages" class="img-item add" @click="addImages">
<view v-if="tempImageList.length < maxImages" class="img-item add" @click="addImages">
<view class="plus"></view>
</view>
</view>
@ -54,15 +54,17 @@ import navBar from '@/components/navBar/navBar.vue'
import api from '@/api/api'
import docUrl from '@/utils/docUrl'
import { onLoad,onShow } from '@dcloudio/uni-app'
import { pathToBase64} from "image-tools";
const uuid=ref('');
const answer_uuid=ref('');
const maxImages = 6;
const imgList = ref([]);
const form = ref({
note: '',
images: []
})
const tempImageList = ref([]);
const note = ref('');
onLoad((options) => {
uuid.value = options.uuid || ''
answer_uuid.value = options.answer_uuid || ''
getInterrogation()
})
const getInterrogation=()=>{
api.getInterrogation({
@ -74,23 +76,44 @@ const getInterrogation=()=>{
let arr=res.data.AnswerList.filter(item=>{
return user.uuid == item.expert_uuid
})
form.value= arr[0];
imgList.value= form.value.imgs?form.value.imgs.split(','):[];
imgList.value=[];
if(arr && arr.length>0){
note.value= arr[0].note || '';
let imgs= arr[0].imgs?arr[0].imgs.split(','):[];
tempImageList.value= imgs.map(item=>docUrl+item);
for (let i = 0; i < imgs.length; i++) {
uni.request({
url: docUrl + imgs[i],
method: "GET",
responseType: "arraybuffer",
success: (res) => {
const base64 = `${uni.arrayBufferToBase64(res.data)}`;
imgList.value.push(base64);
},
fail: (err) => {
reject(err);
},
});
}
}
}
})
}
const updateInterrogationAnswer=()=>{
if(note.value.trim().length<5){
uni.showToast({title: '输入意见至少5个字', icon: 'none'})
return
}
let imgobj={};
if(imgList.value.length>0){
let count=0;
imgList.value.forEach(item=>{
imgobj['img'+count]=docUrl+item;
imgList.value.forEach((item,index)=>{
imgobj['img'+(index+1)]=item;
})
}
api.updateInterrogationAnswer({
answer_uuid: answer_uuid.value,
note: form.value.note,
uuid: answer_uuid.value,
note:note.value,
imgsBean: imgobj
}).then(res=>{
if(res.code == 200){
@ -100,8 +123,19 @@ const updateInterrogationAnswer=()=>{
})
}
const addInterrogationAnswer=()=>{
if(note.value.trim().length<5){
uni.showToast({title: '输入意见至少5个字', icon: 'none'})
return
}
let imgobj={};
if(imgList.value.length>0){
imgList.value.forEach((item,index)=>{
imgobj['img'+(index+1)]=item;
})
}
api.addInterrogationAnswer({
note: form.value.note,
step1_uuid:uuid.value,
note: note.value,
imgsBean: imgobj
}).then(res=>{
if(res.code == 200){
@ -110,11 +144,9 @@ const addInterrogationAnswer=()=>{
}
})
}
onShow(()=>{
getInterrogation()
})
function addImages(){
const remain = maxImages - form.value.images.length
const remain = maxImages - imgList.value.length
if(remain <= 0){
uni.showToast({title: '最多6张', icon: 'none'})
return
@ -124,28 +156,36 @@ function addImages(){
sizeType: ['compressed'],
sourceType: ['album','camera'],
success: (res)=>{
const paths = (res.tempFilePaths || res.tempFiles?.map(f=>f.path) || [])
imgList.value = imgList.value.concat(paths).slice(0, maxImages)
console.log(res.tempFilePaths)
tempImageList.value = [...tempImageList.value, ...res.tempFilePaths];
for (let i = 0; i < res.tempFilePaths.length; i++) {
pathToBase64(res.tempFilePaths[i])
.then((base64) => {
imgList.value.push(base64.split(',')[1]);
})
.catch((error) => {
console.error(error);
});
}
console.log(tempImageList.value)
console.log(imgList.value)
}
})
}
function preview(index){
uni.previewImage({
urls:imgList.map(path=> docUrl + path),
urls:tempImageList.value,
current: index
})
}
function remove(index){
imgList.valuesplice(index, 1)
imgList.value.splice(index, 1)
tempImageList.value.splice(index, 1)
}
function submit(){
if(!form.value.note.trim()){
uni.showToast({title:'请输入意见', icon:'none'})
return
}
if(answer_uuid.value){
updateInterrogationAnswer()
}else{

View File

@ -48,7 +48,7 @@
</div>
<div class="block"></div>
<NetworkAlert />
<div v-if="!conversationList || conversationList.length === 0">
<div v-if="!newConversationList || newConversationList.length === 0">
<div class="conversation-search" @tap="goToSearchPage">
<div class="search-input-wrapper">
@ -65,7 +65,7 @@
</div>
<!-- 页面初始化的过程中sessionList编译到小程序和h5出现sessionList为undefined的情况即使给了默认值为空数组故在此处进行判断 -->
<Empty
v-if="!conversationList || conversationList.length === 0"
v-if="!newConversationList || newConversationList.length === 0"
:text="t('conversationEmptyText')"
/>
</div>
@ -90,7 +90,7 @@
</div>
<!-- 此处的key如果用conversationId会在ios上渲染存在问题会出现会话列表显示undefined -->
<div
v-for="conversation in conversationList"
v-for="conversation in newConversationList"
:key="conversation.renderKey"
>
<ConversationItem
@ -125,7 +125,7 @@ import { customNavigateTo } from '@/utils/im/customNavigate'
import { V2NIMConst } from '@/utils/im/nim'
import { isWxApp } from '@/utils/im/index'
import { trackInit } from '@/utils/im/reporter'
import api from '@/api/api'
import {
V2NIMConversationForUI,
V2NIMLocalConversationForUI,
@ -144,6 +144,37 @@ const addDropdownVisible = ref(false)
/** 当前左滑会话ID */
const currentMoveSessionId = ref('')
const patientList = ref([]);
const hasQeqPatient = ref(false);
const patientListByGBK = async () => {
const res = await api.patientListByGBK();
if(res.code == 1){
patientList.value = res.data;
hasQeqPatient.value = true;
comparePatient();
}
};
const handleReadMsg = () => {
if(!hasQeqPatient.value){
patientListByGBK();
}else{
comparePatient();
}
}
const newConversationList = ref([]);
const comparePatient = () => {
let arr = [];
for(let i = 0; i < patientList.value.length; i++){
for(let j = 0; j < conversationList.value.length; j++){
if(conversationList.value[j].conversationId.indexOf(patientList.value[i].uuid.toLowerCase()) > -1){
arr.push(conversationList.value[j]);
}
}
}
newConversationList.value = arr;
}
/**是否是云端会话 */
const enableV2CloudConversation =
@ -349,7 +380,8 @@ const conversationListWatch = autorun(() => {
const _conversationList = enableV2CloudConversation
? uni.$UIKitStore?.uiStore?.conversations
: uni.$UIKitStore?.uiStore?.localConversations
console.log('conversationListWatch');
console.log(_conversationList);
conversationList.value = _conversationList
?.map(
(conversation: V2NIMConversationForUI | V2NIMLocalConversationForUI) => {
@ -368,7 +400,8 @@ const conversationListWatch = autorun(() => {
) => b.sortOrder - a.sortOrder
)
setTabUnread()
//setTabUnread();
handleReadMsg();
})
/** 连接状态监听 断网重连后重新订阅 */
@ -387,7 +420,7 @@ const connectWatch = autorun(() => {
const getTotalUnreadMsgsCountWatch = autorun(() => {
//
uni.$UIKitStore?.sysMsgStore?.getTotalUnreadMsgsCount()
setContactTabUnread()
//setContactTabUnread()
})
//

View File

@ -336,10 +336,7 @@
rebuildIndexList();
};
//
const goBack = () => {
uni.navigateBack();
};
//
const applyList = ref([]);
@ -415,6 +412,17 @@
});
}
};
const goBack = () => {
uni.navigateBack({
delta: 1,
fail() {
uni.reLaunch({
url: "/pages/index/index",
});
},
});
};
const patientListByGBK = async () => {

View File

@ -4,7 +4,23 @@
:page-style="'overflow:' + (moveThrough ? 'hidden' : 'visible')"
></page-meta>
<div :class="isH5 ? 'msg-page-wrapper-h5' : 'msg-page-wrapper'">
<navBar :title="title"></navBar>
<uni-nav-bar
left-icon="left"
:title="title"
@clickLeft="goBack"
fixed
color="#8B2316"
height="140rpx"
:border="false"
backgroundColor="#eee"
>
<template #right>
<view class="nav-right">
<view class="save-btn" :class="{disabled: !isCanChat}" @click="closeConsult" v-if="fromPage==='consult'">关闭会话</view>
</view>
</template>
</uni-nav-bar>
<!-- <NavBar :title="title" :subTitle="subTitle" :showLeft="true">
<template v-slot:left>
<div @click="backToConversation">
@ -25,7 +41,7 @@
:reply-msgs-map="replyMsgsMap"
/>
</div>
<div style="height: 'auto'">
<div style="height: 'auto'" v-if="isCanChat">
<MessageInput
:reply-msgs-map="replyMsgsMap"
:conversation-type="conversationType"
@ -36,15 +52,15 @@
</template>
<script lang="ts" setup>
import { onShow, onHide } from '@dcloudio/uni-app'
import { onShow, onHide,onLoad,onUnload } from '@dcloudio/uni-app'
import { events } from '@/utils/im/constants'
import { trackInit } from '@/utils/im/reporter'
import { autorun } from 'mobx'
import { ref, onMounted, onUnmounted, nextTick } from 'vue'
import { getUniPlatform } from '@/utils/im/index'
import { onLoad, onUnload } from '@dcloudio/uni-app'
import { customSwitchTab } from '@/utils/im/customNavigate'
import NetworkAlert from '@/components/NetworkAlert.vue'
import api from '@/api/api'
//import NavBar from './message/nav-bar.vue'
import navBar from "@/components/navBar/navBar.vue"
import Icon from '@/components/Icon.vue'
@ -66,13 +82,31 @@ export interface YxReplyMsg {
idServer: string
time: number
}
const fromPage=ref('')
const fromPage=ref('');
const patientUuid=ref('');
const uuid=ref('');
trackInit('ChatUIKit')
const title = ref('')
const subTitle = ref('')
const goBack = () => {
if(uuid.value){
uni.navigateBack({
delta: 1,
fail() {
uni.redirectTo({
url: "/pages/index/index",
});
},
});
}else{
uni.reLaunch({
url: "/pages_app/patientMsg/patientMsg",
});
}
};
/**会话ID */
const conversationId = uni.$UIKitStore.uiStore.selectedConversation
/**会话类型 */
@ -137,8 +171,7 @@ const onTeamDismissed = (data: any) => {
/** 自己主动离开群组或被管理员踢出回调 */
const onTeamLeft = (data: any) => {
uni
.showToast({
uni.showToast({
title: t('onRemoveTeamText'),
icon: 'none',
duration: 1000,
@ -150,6 +183,7 @@ const onTeamLeft = (data: any) => {
/** 收到新消息 */
const onReceiveMessages = (msgs: V2NIMMessage[]) => {
console.log('收到新消息');
const routes = getCurrentPages()
const curRoute = routes[routes.length - 1].route
@ -167,6 +201,7 @@ const onReceiveMessages = (msgs: V2NIMMessage[]) => {
/** 处理收到消息的已读回执 */
const handleMsgReceipt = (msg: V2NIMMessage[]) => {
console.log('处理收到消息的已读回执');
if (
msg[0].conversationType ===
V2NIMConst.V2NIMConversationType.V2NIM_CONVERSATION_TYPE_P2P &&
@ -184,6 +219,7 @@ const handleMsgReceipt = (msg: V2NIMMessage[]) => {
/** 处理历史消息的已读未读 */
const handleHistoryMsgReceipt = (msgs: V2NIMMessage[]) => {
console.log('处理历史消息的已读未读');
/** 如果是单聊 */
if (
conversationType ===
@ -567,9 +603,39 @@ onShow(()=>{
handleHistoryMsgReceipt(_msgs)
}
})
const isCanChat=ref(true);
const closeConsult=()=>{
if(!isCanChat.value){
return;
}
api.closeConsult({
uuid:uuid.value,
}).then(res=>{
if(res.code == 200){
uni.showToast({
title: "会话关闭成功,谢谢您的回答",
icon: "none"
});
isConsultIng();
}
})
}
const isConsultIng=()=>{
api.isConsultIng({
patient_uuid:patientUuid.value,
}).then(res=>{
if(res.code == 200){
isCanChat.value = res.data;
}
})
}
onLoad((options) => {
fromPage.value=options.from;
patientUuid.value=options.patientUuid;
uuid.value=options.uuid;
if(uuid.value){
isConsultIng();
}
uni.$on(events.HANDLE_MOVE_THROUGH, (flag) => {
moveThrough.value = flag
})
@ -598,6 +664,7 @@ onMounted(() => {
//
onUnmounted(() => {
console.log('onUnmounted卸载相关事件监听');
uni.$UIKitNIM.V2NIMTeamService.off('onTeamDismissed', onTeamDismissed)
uni.$UIKitNIM.V2NIMTeamService.off('onTeamLeft', onTeamLeft)
uni.$UIKitNIM.V2NIMMessageService.off(
@ -619,6 +686,7 @@ onHide(() => {
})
onUnload(() => {
console.log('onUnload');
uni.$off(events.CONFIRM_FORWARD_MSG)
uni.$off(events.CANCEL_FORWARD_MSG)
})
@ -629,7 +697,18 @@ page {
height: 100%;
overflow: hidden;
}
.save-btn{
font-size: 26rpx;
background: #8B2316;
color: #fff;
white-space: nowrap;
padding: 10rpx 20rpx;
border-radius: 10rpx;
}
.save-btn.disabled{
background: #999;
color: #666;
}
.msg-page-wrapper {
display: flex;
flex-direction: column;

View File

@ -80,7 +80,7 @@ export const request = (url, data = {}, method = 'post', loading = false, conten
version: version,
user_uuid:userInfo.uuid,
client_type: 'A', //client_type,
timestamp:new Date().getTime()
timestamp:new Date().getTime()+""
}
postData={