From 8b455b192065f97228a8d72b330adacaa1ad1261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=90=A6?= Date: Tue, 21 Jul 2026 16:05:09 +0800 Subject: [PATCH] =?UTF-8?q?feat(home/chat):=20=E5=88=97=E8=A1=A8=E9=AA=A8?= =?UTF-8?q?=E6=9E=B6=E5=B1=8F=E3=80=81=E8=81=8A=E5=A4=A9=E5=AE=A4=E5=B7=B1?= =?UTF-8?q?=E6=96=B9=E5=A4=B4=E5=83=8F=E4=B8=8E=E5=8D=8F=E8=AE=AE/?= =?UTF-8?q?=E5=8C=BB=E7=94=9F=E8=AF=A6=E6=83=85=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增分包组件 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 只读医生详情, 隐藏预约挂号区 --- pages.json | 3 + pages/cate/index.vue | 57 +- pages/home/home.vue | 51 +- pages/index/index.vue | 31 +- request/api/request.js | 20 +- .../common/components/ListSkeleton.vue | 171 ++++-- subPackages/my/my-drug/drug-info.vue | 48 +- subPackages/my/record-pay.vue | 66 ++- subPackages/product/product.vue | 496 ++++++++++-------- subPackages/product/symptoms.vue | 64 ++- utils/ws/websocket.js | 4 +- 11 files changed, 658 insertions(+), 353 deletions(-) diff --git a/pages.json b/pages.json index 6f767fb..228de21 100644 --- a/pages.json +++ b/pages.json @@ -17,6 +17,7 @@ "style": { // "navigationBarTitleText": "custom", "navigationStyle": "custom", + "enablePullDownRefresh": true, // "navigationStyle": "default", // "navigationBarBackgroundColor": "#298DFF", // "navigationBarTextStyle": "white" @@ -60,6 +61,7 @@ "path": "pages/cate/index", "style": { "navigationBarTitleText": "健康资讯", + "enablePullDownRefresh": true, // 主包异步引用分包 ListSkeleton "componentPlaceholder": { "list-skeleton": "view" @@ -78,6 +80,7 @@ "path": "pages/index/index", "style": { "navigationBarTitleText": "消息", + "enablePullDownRefresh": true, // 主包异步引用分包 ListSkeleton "componentPlaceholder": { "list-skeleton": "view" diff --git a/pages/cate/index.vue b/pages/cate/index.vue index d8db7c3..9a910d3 100644 --- a/pages/cate/index.vue +++ b/pages/cate/index.vue @@ -5,7 +5,8 @@ + @search="toSearch" + @clear="clearSearch"> @@ -88,9 +89,18 @@ }, methods: { - // 搜索 + // 搜索:按当前分类 + 标题关键词拉文章(不再误调分类接口) toSearch() { - this.getList() + this.infoList = [] + this.articleFetchingEmpty = true + this.getArticleList() + }, + // 清空搜索词后重新拉当前分类文章 + clearSearch() { + this.keyword = '' + this.infoList = [] + this.articleFetchingEmpty = true + this.getArticleList() }, /*切换需要*/ changeStyle(id) { @@ -102,16 +112,17 @@ url: '/pages/cate/info-detail?id=' + e }) }, - //点击药品一级分类e:不清空 infoList,有旧数据则保留到新结果返回 + // 切分类:立即清空文章出骨架 handleCategory1(e, index) { this.num = e this.cid = e + this.infoList = [] + this.articleFetchingEmpty = true this.getArticleList() }, - - //获取药品分类:成功后再覆盖,失败保留旧分类 + // 获取分类:返回 Promise 供下拉刷新等待 getList() { - categoriesList({ + return categoriesList({ method: "post", data: { store_id: uni.getStorageSync('store_id') || '11001', @@ -129,23 +140,28 @@ const firstId = list[0].id this.num = firstId this.cid = firstId - this.getArticleList() + return this.getArticleList() } }).finally(() => { this.categoryInitialLoading = false }) }, - // 文章列表:请求前不清空;仅当当前无文章可展示时打骨架标记 + // 文章列表:可选 keyword 标题搜索 getArticleList() { if (!this.infoList || this.infoList.length === 0) { this.articleFetchingEmpty = true } - articleList({ + const data = { + store_id: uni.getStorageSync('store_id') || '11001', + cid: this.cid + } + const kw = (this.keyword || '').trim() + if (kw) { + data.keyword = kw + } + return articleList({ method: "get", - data: { - store_id: uni.getStorageSync('store_id') || '11001', - cid: this.cid - } + data }).then((res) => { if (res.data.code == 0) { this.infoList = (res.data.result && res.data.result.list) || [] @@ -154,6 +170,19 @@ this.articleInitialLoading = false this.articleFetchingEmpty = false }) + }, + /** + * 下拉刷新:清空分类/文章并重走开骨架 + */ + onPullDownRefresh() { + this.categoryLists = [] + this.infoList = [] + this.categoryInitialLoading = true + this.articleInitialLoading = true + this.articleFetchingEmpty = false + Promise.resolve(this.getList()).finally(() => { + uni.stopPullDownRefresh() + }) } }, mounted() { diff --git a/pages/home/home.vue b/pages/home/home.vue index cb5387d..5ce3641 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -86,14 +86,20 @@ - + 预约购药 正品保障 · 种类齐全 · 快速配送 - + + + @@ -200,7 +206,7 @@ 更多 - +