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>