|
|
@@ -83,9 +83,8 @@ Page({
|
|
|
|
|
|
switchType: "",
|
|
|
|
|
|
- carouselLoading: {} as Record<string | number, boolean>, // 用于跟踪每个轮播图的加载状态
|
|
|
+ carouselLoading: {} as Record<string | number, boolean>,
|
|
|
|
|
|
- // 轮播媒体列表
|
|
|
carouselMediaList: [] as Array<{
|
|
|
type: "image" | "video";
|
|
|
src: string;
|
|
|
@@ -100,9 +99,7 @@ Page({
|
|
|
DraggableSheetBehavior(".draggable-sheet-wrapper"),
|
|
|
],
|
|
|
|
|
|
- // 获取调养计划
|
|
|
async getCareLists() {
|
|
|
- // 保存当前的展开状态
|
|
|
const currentExpandedStates = this.data.displayList.map((item: any) => ({
|
|
|
id: item.id,
|
|
|
expanded: item.expanded,
|
|
|
@@ -342,11 +339,9 @@ Page({
|
|
|
isShowPopup: e.detail.visible,
|
|
|
});
|
|
|
},
|
|
|
- // 诊疗随访提醒
|
|
|
async goComplete(e: {
|
|
|
currentTarget: { dataset: { page: string; id: number; title: string } };
|
|
|
}) {
|
|
|
- // 防止重复点击
|
|
|
if (this.data.isCompleting) {
|
|
|
return;
|
|
|
}
|
|
|
@@ -390,7 +385,6 @@ Page({
|
|
|
wx.redirectTo({ url: `${page}?id=${id}` });
|
|
|
}
|
|
|
} finally {
|
|
|
- // 延迟重置标志,防止快速连续点击
|
|
|
setTimeout(() => {
|
|
|
this.setData({ isCompleting: false });
|
|
|
}, 500);
|
|
|
@@ -432,7 +426,6 @@ Page({
|
|
|
return;
|
|
|
}
|
|
|
// 加载健康宣教的文章
|
|
|
- // 每次页面显示时重置到第一页,确保返回首页时显示最新的第一页内容
|
|
|
this.loadScienceList(true);
|
|
|
if (!this.data._loaded) {
|
|
|
getSolarTerms()
|
|
|
@@ -704,17 +697,14 @@ Page({
|
|
|
},
|
|
|
|
|
|
async loadScienceList(reset = false) {
|
|
|
- // 如果正在加载,直接返回(防止重复请求)
|
|
|
if (this.data.scienceListLoading) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- // 如果没有更多数据且不是重置,直接返回
|
|
|
if (!reset && !this.data.scienceListHasMore) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- // 重置分页信息
|
|
|
if (reset) {
|
|
|
this.setData({
|
|
|
scienceListPage: 1,
|
|
|
@@ -743,7 +733,6 @@ Page({
|
|
|
scienceListHasMore: hasMore,
|
|
|
scienceListLoading: false,
|
|
|
});
|
|
|
- // 分配卡片到两列,实现瀑布流布局
|
|
|
this.distributeCardsToColumns(newList, reset);
|
|
|
} catch (error) {
|
|
|
this.setData({ scienceListLoading: false });
|
|
|
@@ -800,11 +789,9 @@ Page({
|
|
|
0
|
|
|
);
|
|
|
|
|
|
- // 追加新卡片到较短的列(重置时从空数组开始)
|
|
|
const leftColumn = reset ? [] : [...this.data.leftColumnList];
|
|
|
const rightColumn = reset ? [] : [...this.data.rightColumnList];
|
|
|
|
|
|
- // 智能分配:总是将卡片放到当前高度较短的列
|
|
|
itemsToDistribute.forEach((item: any) => {
|
|
|
const estimatedHeight = this.estimateCardHeight(item);
|
|
|
|
|
|
@@ -823,7 +810,6 @@ Page({
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- // 预估卡片高度(基于内容特征,更准确的预估)
|
|
|
estimateCardHeight(item: any): number {
|
|
|
let height = 0;
|
|
|
|
|
|
@@ -840,7 +826,6 @@ Page({
|
|
|
height += imgHeight;
|
|
|
}
|
|
|
|
|
|
- // 内容区域
|
|
|
const title = item.title || "";
|
|
|
const titleLength = title.length;
|
|
|
const charsPerLine = 12;
|
|
|
@@ -961,7 +946,6 @@ Page({
|
|
|
const res = await getCareList();
|
|
|
if (res && res.length > 0) {
|
|
|
res.forEach((item: any) => {
|
|
|
- // 查找对应的旧数据
|
|
|
const oldItem = currentExpandedStates.find(
|
|
|
(state) => state.id === item.id
|
|
|
);
|