feat(home/chat): 列表骨架屏、聊天室己方头像与协议/医生详情优化

- 新增分包组件 ListSkeleton(doctor/message/product/article/category/zone)
- 首页/消息/资讯首次加载改用骨架屏,刷新不再清空旧数据避免闪空
  · 去掉 home getList、消息 onShow 中的数组清空
  · 三页 pages.json 增加 easycom 与 componentPlaceholder 主包异步引用
- 聊天室己方头像改为读取本地 userinfo.avatarurl(登录后微信头像),
  mycollection 上传头像成功后同步写回 storage
- 修复协议抽屉点不开:page-container 改为 v-if + :show;
  协议名单独可点节点,匹配放宽 name/desc 双向 includes
- 医生气泡头像可点击进入 doctor-detail?readonly=1 只读医生详情,
  隐藏预约挂号区
This commit is contained in:
李琦
2026-07-19 16:08:04 +08:00
parent 2c739324d6
commit 2d2a8abfd4
21 changed files with 1657 additions and 466 deletions

View File

@@ -13,7 +13,9 @@
<!-- //药品分类左 -->
<view class="goods">
<view class="goods_left" @touchmove.stop>
<scroll-view scroll-y scroll-with-animation class="u-menu-scroll-view" :scroll-top="scrollTop"
<!-- 首次加载分类骨架 -->
<ListSkeleton v-if="categoryInitialLoading" type="category" :rows="8" />
<scroll-view v-else scroll-y scroll-with-animation class="u-menu-scroll-view" :scroll-top="scrollTop"
:scroll-into-view="itemId">
<view v-for="(item,index) in categoryLists" :key="item.id" class="u-tab-item"
:class="[num == item.id ? 'u-item-active' : '']" @tap.stop="changeStyle(item.id)"
@@ -26,15 +28,18 @@
<view class="goods_right">
<!-- 药品 -->
<view class="second">
<!-- 商品列表 -->
<view class="list" v-for="(item,index) in infoList" @click="toDetail(item.id)" :key="item.id">
<view class="list_">
<image :src="item.cover||'https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/xx/cp.png'" mode=""></image>
<view class="list_title">
{{item.title}}
<!-- 首次或切分类且当前无文章时展示骨架有旧文章则保留至新结果 -->
<ListSkeleton v-if="showArticleSkeleton" type="article" :rows="4" />
<template v-else>
<view class="list" v-for="(item,index) in infoList" @click="toDetail(item.id)" :key="item.id">
<view class="list_">
<image :src="item.cover||'https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/xx/cp.png'" mode=""></image>
<view class="list_title">
{{item.title}}
</view>
</view>
</view>
</view>
</template>
</view>
</view>
</view>
@@ -65,7 +70,18 @@
selectIndex: 0,
arr: [], // 储存距离顶部高度的数组
scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度
show: false
show: false,
// 首次加载骨架
categoryInitialLoading: true,
articleInitialLoading: true,
// 切分类且当前列表为空时拉文章期间展示骨架
articleFetchingEmpty: false
}
},
computed: {
// 是否展示右侧文章骨架:首次加载,或请求中且当前无文章可保留
showArticleSkeleton() {
return this.articleInitialLoading || this.articleFetchingEmpty
}
},
onLoad(op) {
@@ -86,14 +102,14 @@
url: '/pages/cate/info-detail?id=' + e
})
},
//点击药品一级分类e
//点击药品一级分类e:不清空 infoList有旧数据则保留到新结果返回
handleCategory1(e, index) {
this.num = e
this.cid = e
this.getArticleList()
},
//获取药品分类
//获取药品分类:成功后再覆盖,失败保留旧分类
getList() {
categoriesList({
method: "post",
@@ -101,12 +117,13 @@
store_id: uni.getStorageSync('store_id') || '11001',
}
}).then((res) => {
// console.log(res, 'list');
if (res.data.code == 0) {
const list = (res.data.result && res.data.result.list) || []
this.categoryLists = list
if (!list.length) {
this.infoList = []
this.articleInitialLoading = false
this.articleFetchingEmpty = false
return
}
const firstId = list[0].id
@@ -114,10 +131,15 @@
this.cid = firstId
this.getArticleList()
}
}).finally(() => {
this.categoryInitialLoading = false
})
},
// 文章列表
// 文章列表:请求前不清空;仅当当前无文章可展示时打骨架标记
getArticleList() {
if (!this.infoList || this.infoList.length === 0) {
this.articleFetchingEmpty = true
}
articleList({
method: "get",
data: {
@@ -125,12 +147,12 @@
cid: this.cid
}
}).then((res) => {
// console.log(res, 'list');
if (res.data.code == 0) {
this.infoList = (res.data.result && res.data.result.list) || []
// console.log(res, 'list')
}
}).finally(() => {
this.articleInitialLoading = false
this.articleFetchingEmpty = false
})
}
},
@@ -138,6 +160,7 @@
// this.getList();
},
onShow() {
// 不清空 categoryLists / infoList成功后再替换
this.getList();
}
}
@@ -251,4 +274,4 @@
}
}
}
</style>
</style>

View File

@@ -49,7 +49,10 @@
</view>
<!-- 2.5 金刚区 (Zone) - 支持滑动/换行切换 -->
<view v-if="homeZones.length > 0" class="zone-wrapper" :class="zoneLayoutMode === 'scroll' ? 'zone-scroll-mode' : 'zone-wrap-mode'">
<view v-if="homeZonesInitialLoading" class="zone-wrapper">
<ListSkeleton type="zone" :rows="5" />
</view>
<view v-else-if="homeZones.length > 0" class="zone-wrapper" :class="zoneLayoutMode === 'scroll' ? 'zone-scroll-mode' : 'zone-wrap-mode'">
<view v-for="(item, index) in homeZones" :key="index" class="zone-item" @click="goZoneList(item)">
<view class="zone-icon-box">
<image
@@ -197,41 +200,45 @@
<view class="section-more" @click="goYard(0)">更多 <text class="iconfont icon-jiantou1" style="font-size: 20rpx;"></text></view>
</view>
<view class="doctor-card" @click="goLookDoctor(item.id)" v-for="(item,index) in doctorList" :key="item.id">
<view class="doc-main">
<view class="doc-avatar-box">
<image :src="item.avatar || 'https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/mine/avatar_1.png'" mode="aspectFill" class="doc-avatar"></image>
<view class="status-dot"></view>
</view>
<view class="doc-info">
<view class="doc-name-row">
<text class="doc-name">{{item.name}}</text>
<text class="doc-title">{{item.title}}</text>
<!-- 首次加载展示骨架刷新时保留旧列表避免闪空 -->
<ListSkeleton v-if="doctorListInitialLoading" type="doctor" :rows="3" />
<template v-else>
<view class="doctor-card" @click="goLookDoctor(item.id)" v-for="(item,index) in doctorList" :key="item.id">
<view class="doc-main">
<view class="doc-avatar-box">
<image :src="item.avatar || 'https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/mine/avatar_1.png'" mode="aspectFill" class="doc-avatar"></image>
<view class="status-dot"></view>
</view>
<view class="doc-dept">{{item.depart}} | {{item.store}}</view>
<view class="doc-skill">
<text class="skill-tag">擅长</text>
{{item.good_at}}
<view class="doc-info">
<view class="doc-name-row">
<text class="doc-name">{{item.name}}</text>
<text class="doc-title">{{item.title}}</text>
</view>
<view class="doc-dept">{{item.depart}} | {{item.store}}</view>
<view class="doc-skill">
<text class="skill-tag">擅长</text>
{{item.good_at}}
</view>
</view>
<!-- <view class="consult-btn">咨询</view>-->
<!-- <view class="consult-btn">查看</view>-->
</view>
<view class="doc-stats-bar">
<view class="stat-item">
<text class="stat-num">{{item.inquiry_num || '0'}}</text>
<view class="stat-label">问诊量</view>
</view>
<view class="stat-item">
<text class="stat-num">{{item.accept_percent || '100%'}}</text>
<view class="stat-label">接诊率</view>
</view>
<view class="stat-item">
<text class="stat-num">{{item.average_response_time || 5}}分钟</text>
<view class="stat-label">平均响应</view>
</view>
</view>
<!-- <view class="consult-btn">咨询</view>-->
<!-- <view class="consult-btn">查看</view>-->
</view>
<view class="doc-stats-bar">
<view class="stat-item">
<text class="stat-num">{{item.inquiry_num || '0'}}</text>
<view class="stat-label">问诊量</view>
</view>
<view class="stat-item">
<text class="stat-num">{{item.accept_percent || '100%'}}</text>
<view class="stat-label">接诊率</view>
</view>
<view class="stat-item">
<text class="stat-num">{{item.average_response_time || 5}}分钟</text>
<view class="stat-label">平均响应</view>
</view>
</view>
</view>
</template>
</view>
<!-- 5. 药店模式内容热销好药 -->
@@ -243,32 +250,35 @@
<!-- 优化后的药品列表使用计算属性 displayProductList 解决循环报错 -->
<view class="product-list-container">
<view class="product-card" @click="goProductDetail(item)" v-for="(item, index) in displayProductList" :key="index">
<view class="prod-img-box">
<image :src="(item.drug && item.drug.image) ? item.drug.image : 'https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/mine/avatar_1.png'" mode="aspectFill" class="prod-img" :class="{ 'prescription-blur': item.drug && item.drug.type == 2 && (item.drug.is_otc === 0 || item.drug.is_otc === '0') }"></image>
</view>
<ListSkeleton v-if="productListInitialLoading" type="product" :rows="3" />
<template v-else>
<view class="product-card" @click="goProductDetail(item)" v-for="(item, index) in displayProductList" :key="index">
<view class="prod-img-box">
<image :src="(item.drug && item.drug.image) ? item.drug.image : 'https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/mine/avatar_1.png'" mode="aspectFill" class="prod-img" :class="{ 'prescription-blur': item.drug && item.drug.type == 2 && (item.drug.is_otc === 0 || item.drug.is_otc === '0') }"></image>
</view>
<view class="prod-info">
<view>
<view class="prod-title">{{ item.drug ? item.drug.drug_name : '' }}</view>
<view class="tag-row">
<!-- 只有西药type == 2才显示OTC/Rx标签 -->
<text v-if="item.drug && item.drug.type == 2" class="otc-tag" :class="item.drug.is_otc ? 'otc-green' : 'otc-red'">{{item.drug.is_otc ? 'OTC' : 'Rx'}}</text>
<view class="prod-info">
<view>
<view class="prod-title">{{ item.drug ? item.drug.drug_name : '' }}</view>
<view class="tag-row">
<!-- 只有西药type == 2才显示OTC/Rx标签 -->
<text v-if="item.drug && item.drug.type == 2" class="otc-tag" :class="item.drug.is_otc ? 'otc-green' : 'otc-red'">{{item.drug.is_otc ? 'OTC' : 'Rx'}}</text>
</view>
<view class="prod-spec">{{ item.drug ? item.drug.specification : '' }}</view>
</view>
<view class="prod-spec">{{ item.drug ? item.drug.specification : '' }}</view>
</view>
<view class="prod-bottom">
<view class="price-box">
<text class="price-symbol">¥</text>
<text>{{ item.price || '0.00' }}</text>
</view>
<!-- 简化点击事件防止 template 编译错误 -->
<view class="buy-btn" @click.stop="handleAddToCart(item)">
<u-icon name="shopping-cart" color="#ffffff" size="32"></u-icon>
<view class="prod-bottom">
<view class="price-box">
<text class="price-symbol">¥</text>
<text>{{ item.price || '0.00' }}</text>
</view>
<!-- 简化点击事件防止 template 编译错误 -->
<view class="buy-btn" @click.stop="handleAddToCart(item)">
<u-icon name="shopping-cart" color="#ffffff" size="32"></u-icon>
</view>
</view>
</view>
</view>
</view>
</template>
</view>
<!-- 6. 资质证明 -->
@@ -332,6 +342,10 @@ export default {
doctorList: [],
productList: [],
homeZones: [],
// 首次加载骨架标记:仅第一次请求结束前为 true刷新时保留旧数据不闪空
doctorListInitialLoading: true,
productListInitialLoading: true,
homeZonesInitialLoading: true,
topProductsTitle: '热销商品',
topProductsList: [],
qualifications: [],
@@ -683,7 +697,7 @@ export default {
})
},
getList() {
this.doctorList = [];
// 不再请求前清空 doctorList避免 onShow 刷新时出现「先空后满」
doctorList({
method: "post",
data: { store_id: uni.getStorageSync('store_id') || '11001' }
@@ -699,6 +713,8 @@ export default {
const responseData = isGuest && res.data.result ? res.data.result : res.data.data;
this.doctorList = (responseData.list || []).slice(0, 5)
}
}).finally(() => {
this.doctorListInitialLoading = false
})
},
toChang(e) {
@@ -750,6 +766,9 @@ export default {
if (res.data.code == 0) {
this.productList = res.data.result.records;
}
}).finally(() => {
// top 与 product 任一返回即可结束首次骨架(见 getHomeTopProducts
this._markProductInitialLoaded()
})
},
getHomeTopProducts() {
@@ -761,8 +780,17 @@ export default {
this.topProductsTitle = result.title || '热销商品';
this.topProductsList = result.list || [];
}
}).finally(() => {
this._markProductInitialLoaded()
})
},
// 商品区依赖 topProducts 或 productList两者都结束首次请求后再关骨架
_markProductInitialLoaded() {
this._productFetchDone = (this._productFetchDone || 0) + 1
if (this._productFetchDone >= 2) {
this.productListInitialLoading = false
}
},
getHomeZones() {
getHomeZonesApi({
store_id: uni.getStorageSync('store_id') || '11001',
@@ -770,7 +798,14 @@ export default {
if (res.data.code == 0) {
this.homeZones = res.data.result || res.data.data || [];
}
}).catch(() => { this.homeZones = []; })
}).catch(() => {
// 仅尚无数据时清空,避免刷新失败抹掉已有专区
if (!this.homeZones || this.homeZones.length === 0) {
this.homeZones = [];
}
}).finally(() => {
this.homeZonesInitialLoading = false
})
},
getPlatformQualifications() {
getPlatformQualificationsApi({
@@ -965,12 +1000,12 @@ $card-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.04);
&:active { transform: scale(0.95); }
.zone-icon-box {
width: 100rpx; height: 100rpx;
background: linear-gradient(180deg, #FFFFFF 0%, #F5F9FF 100%);
//background: linear-gradient(180deg, #FFFFFF 0%, #F5F9FF 100%);
border-radius: 36rpx;
display: flex; align-items: center; justify-content: center;
box-shadow: 0 8rpx 24rpx rgba(65, 117, 238, 0.08);
//box-shadow: 0 8rpx 24rpx rgba(65, 117, 238, 0.08);
margin-bottom: 12rpx;
.zone-img { width: 56rpx; height: 56rpx; }
.zone-img { width: 100rpx; height: 100rpx; }
}
.zone-text { font-size: 24rpx; color: #555; font-weight: 500; }
}

View File

@@ -12,111 +12,118 @@
</view>
</view>
<!-- 消息列表 -->
<view class="list" @click="goSystem">
<!-- 头像 -->
<view class="avator">
<view class="img">
<image src="https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/xx/xt.png" mode=""></image>
<!-- 首次加载四条固定入口用骨架避免 num 未定义时闪暂无新消息 -->
<ListSkeleton v-if="noticeInitialLoading" type="message" :rows="4" />
<template v-else>
<!-- 消息列表 -->
<view class="list" @click="goSystem">
<!-- 头像 -->
<view class="avator">
<view class="img">
<image src="https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/xx/xt.png" mode=""></image>
</view>
<u-badge size="default" v-if="system.num>=0" :count="system.num" :is-dot="system.num==0?true:false"
type="error" :offset="system.num>0?[-4,-8]:[0,0]"></u-badge>
</view>
<u-badge size="default" v-if="system.num>=0" :count="system.num" :is-dot="system.num==0?true:false"
type="error" :offset="system.num>0?[-4,-8]:[0,0]"></u-badge>
</view>
<!-- 描述 -->
<view class="info">
<view class="infos_title">
<text class="infos">系统消息</text>
<text class="time">{{ system.time }}</text>
</view>
<view class="preview" v-if="system.num >0">
您有{{ system.num }}条未读信
</view>
<view class="preview" v-if="system.num==undefined">
暂无新消息
<!-- 描述 -->
<view class="info">
<view class="infos_title">
<text class="infos">系统消息</text>
<text class="time">{{ system.time }}</text>
</view>
<view class="preview" v-if="system.num >0">
您有{{ system.num }}条未读信息
</view>
<view class="preview" v-if="system.num==undefined">
暂无新消
</view>
</view>
</view>
</view>
<view class="list" @click="goOrder">
<!-- 头像 -->
<view class="avator">
<view class="img">
<image src="https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/xx/cp.png" mode=""></image>
<view class="list" @click="goOrder">
<!-- 头像 -->
<view class="avator">
<view class="img">
<image src="https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/xx/cp.png" mode=""></image>
</view>
<u-badge size="default" v-if="order.num>=0" :count="order.num" :is-dot="order.num==0?true:false"
type="error" :offset="order.num>0?[-4,-8]:[0,0]"></u-badge>
</view>
<u-badge size="default" v-if="order.num>=0" :count="order.num" :is-dot="order.num==0?true:false"
type="error" :offset="order.num>0?[-4,-8]:[0,0]"></u-badge>
</view>
<!-- 描述 -->
<view class="info">
<view class="infos_title">
<text class="infos">产品订单</text>
<text class="time">{{ order.time }}</text>
</view>
<view class="preview" v-if="order.num>0">
您有{{ order.num }}条未读信
</view>
<view class="preview" v-if="order.num==undefined">
暂无新消息
<!-- 描述 -->
<view class="info">
<view class="infos_title">
<text class="infos">产品订单</text>
<text class="time">{{ order.time }}</text>
</view>
<view class="preview" v-if="order.num>0">
您有{{ order.num }}条未读信息
</view>
<view class="preview" v-if="order.num==undefined">
暂无新消
</view>
</view>
</view>
</view>
<view class="list" @click="goDoctor">
<!-- 头像 -->
<view class="avator">
<view class="img">
<image src="https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/xx/ysxx.png" mode=""></image>
<view class="list" @click="goDoctor">
<!-- 头像 -->
<view class="avator">
<view class="img">
<image src="https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/xx/ysxx.png" mode=""></image>
</view>
<u-badge size="default" v-if="doctor.num>=0" :count="doctor.num" :is-dot="doctor.num==0?true:false"
type="error" :offset="doctor.num>0?[-4,-8]:[0,0]"></u-badge>
</view>
<u-badge size="default" v-if="doctor.num>=0" :count="doctor.num" :is-dot="doctor.num==0?true:false"
type="error" :offset="doctor.num>0?[-4,-8]:[0,0]"></u-badge>
</view>
<!-- 描述 -->
<view class="info">
<view class="infos_title">
<text class="infos">医生消息</text>
<text class="time">{{ doctor.time }}</text>
</view>
<view class="preview" v-if="doctor.num>0">
您有{{ doctor.num }}条新的消息
</view>
<view class="preview" v-if="doctor.num==undefined">
暂无新消息
<!-- 描述 -->
<view class="info">
<view class="infos_title">
<text class="infos">医生消息</text>
<text class="time">{{ doctor.time }}</text>
</view>
<view class="preview" v-if="doctor.num>0">
您有{{ doctor.num }}条新的消息
</view>
<view class="preview" v-if="doctor.num==undefined">
暂无新消息
</view>
</view>
</view>
</view>
<!-- 转诊消息 -->
<view class="list" @click="goTransfer">
<!-- 头像 -->
<view class="avator">
<view class="img">
<image src="https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/xx/ysxx.png" mode=""></image>
<!-- <image src="https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/xx/zhuanzhen.png" mode=""></image>-->
<!-- 转诊消息 -->
<view class="list" @click="goTransfer">
<!-- 头像 -->
<view class="avator">
<view class="img">
<image src="https://xiaokang88.oss-cn-hangzhou.aliyuncs.com/xk-client-wx/static/xx/ysxx.png" mode=""></image>
</view>
<u-badge size="default" v-if="transfer.num>=0" :count="transfer.num" :is-dot="transfer.num==0?true:false"
type="error" :offset="transfer.num>0?[-4,-8]:[0,0]"></u-badge>
</view>
<u-badge size="default" v-if="transfer.num>=0" :count="transfer.num" :is-dot="transfer.num==0?true:false"
type="error" :offset="transfer.num>0?[-4,-8]:[0,0]"></u-badge>
</view>
<!-- 描述 -->
<view class="info">
<view class="infos_title">
<text class="infos">转诊消息</text>
<text class="time">{{ transfer.time }}</text>
</view>
<view class="preview" v-if="transfer.num>0">
您有{{ transfer.num }}转诊消息待处理
</view>
<view class="preview" v-if="transfer.num==undefined || transfer.num==0">
暂无转诊消息
<!-- 描述 -->
<view class="info">
<view class="infos_title">
<text class="infos">转诊消息</text>
<text class="time">{{ transfer.time }}</text>
</view>
<view class="preview" v-if="transfer.num>0">
您有{{ transfer.num }}条转诊消息待处理
</view>
<view class="preview" v-if="transfer.num==undefined || transfer.num==0">
暂无转诊消息
</view>
</view>
</view>
</view>
<!-- 模拟<u-divider>在线问诊</u-divider>效果-->
</template>
<!-- 标题 - 在线咨询 -->
<view v-if="checkDev('open-im') && onlineConsultationList.length > 0" class="title">
<text>在线咨询</text>
</view>
<!-- IM 会话首次骨架有旧数据时直接展示旧列表直至替换 -->
<ListSkeleton
v-if="checkDev('open-im') && chatInitialLoading && onlineConsultationList.length === 0 && onlineReconsultationList.length === 0"
type="message"
:rows="3"
/>
<!-- 在线咨询 - 用户 (type=1) -->
<view v-if="checkDev('open-im')" v-for="(item, index) in onlineConsultationList" :key="item.id" class="list" @click="goChat(item, index)">
<!-- 头像 -->
@@ -136,7 +143,6 @@
</view>
<view class="preview">
<p>{{ item.last_message }}</p>
<!-- <p v-if="item.un_read_count>0">您有{{item.un_read_count}}条新的消息</p>-->
</view>
<view class="preview" v-if="item.last_message===''">
暂无新消息
@@ -167,7 +173,6 @@
</view>
<view class="preview">
<p>{{ item.last_message }}</p>
<!-- <p v-if="item.un_read_count>0">您有{{item.un_read_count}}条新的消息</p>-->
</view>
<view class="preview" v-if="item.last_message===''">
暂无新消息
@@ -203,7 +208,10 @@ export default {
imChat: [],
onlineConsultationList: [], // 在线咨询列表 (type=1)
onlineReconsultationList: [], // 在线复诊列表 (type=3)
type: ""
type: "",
// 首次加载骨架:刷新时不再清空数据,故仅首次为 true
noticeInitialLoading: true,
chatInitialLoading: true
}
},
onLoad() {
@@ -235,7 +243,6 @@ export default {
type: "all"
}
}).then((res) => {
// console.log(res, 'res');
uni.showToast({
title: '清除成功',
duration: 2000,
@@ -257,7 +264,6 @@ export default {
type: "system"
}
}).then((res) => {
// console.log(res, 'res');
})
},
// 详情
@@ -272,7 +278,6 @@ export default {
type: "order"
}
}).then((res) => {
// console.log(res, 'res');
})
},
goDoctor() {
@@ -286,7 +291,6 @@ export default {
type: "doctor_news"
}
}).then((res) => {
// console.log(res, 'res');
})
},
// 转诊消息
@@ -299,17 +303,8 @@ export default {
uni.navigateTo({
url: `/subPackages/chat/chat?room_id=${item.room_id}&nick_name=${item.nick_name}&user_id=${item.id}&avatar=${encodeURIComponent(item.avatar || '')}&room_status=${item.room_status || 0}`
})
// getseesionRead({
// method: "post",
// data: {
// store_id: uni.getStorageSync('store_id') || 11001,
// type: "doctor_news"
// }
// }).then((res) => {
// // console.log(res, 'res');
// })
},
//
// 获取系统/订单/医生消息概览;成功才覆盖,失败保留旧数据
async getInfo() {
try {
const res = await getSystemNoticeIndexApi({
@@ -322,8 +317,11 @@ export default {
}
} catch (error) {
console.error('获取消息概览失败:', error)
} finally {
this.noticeInitialLoading = false
}
},
// 拉取 IM 好友会话列表,成功后整份替换,失败不写空
getMyChatFriendsList() {
getChatFriendsListApi().then((res) => {
const allChatList = res.data.result || []
@@ -332,9 +330,13 @@ export default {
this.onlineReconsultationList = allChatList.filter(item => (item.type === 3 || item.type === 2)) // type=3的为在线复诊
// 保持imChat兼容性包含所有
this.imChat = allChatList
}).catch((error) => {
console.error('获取聊天列表失败:', error)
}).finally(() => {
this.chatInitialLoading = false
})
},
// 获取转诊消息列表
// 获取转诊消息列表;失败不重置 transfer避免闪空
getTransferList() {
getTransferPrescriptionListApi().then((res) => {
if (res.data && res.data.code == 0) {
@@ -362,15 +364,7 @@ export default {
this.getInfo()
},
onShow() {
this.order = []
this.system = []
this.doctor = []
this.transfer = {
num: 0,
time: ''
}
this.onlineConsultationList = []
this.onlineReconsultationList = []
// 不再清空列表:保留旧 UI接口成功后再覆盖
this.getInfo()
this.getMyChatFriendsList()
this.getTransferList()
@@ -493,4 +487,4 @@ export default {
}
}
</style>
</style>