|
@@ -25,7 +25,7 @@ import {
|
|
|
getCareList,
|
|
getCareList,
|
|
|
} from "./request";
|
|
} from "./request";
|
|
|
import { toCertificationPage, toChats } from "./router";
|
|
import { toCertificationPage, toChats } from "./router";
|
|
|
-import { useLocation } from "../../lib/use/use-location";
|
|
|
|
|
|
|
+// import { useLocation } from "../../lib/use/use-location";
|
|
|
|
|
|
|
|
Page({
|
|
Page({
|
|
|
data: {
|
|
data: {
|
|
@@ -47,6 +47,7 @@ Page({
|
|
|
allExpanded: false,
|
|
allExpanded: false,
|
|
|
fixedHeight: "370rpx",
|
|
fixedHeight: "370rpx",
|
|
|
tabbarValue: "/pages/home/home",
|
|
tabbarValue: "/pages/home/home",
|
|
|
|
|
+ tabbarHidden: false,
|
|
|
pageHeight: "100vh", // 默认值
|
|
pageHeight: "100vh", // 默认值
|
|
|
popupList: [] as AnyArray,
|
|
popupList: [] as AnyArray,
|
|
|
isShowPopup: false,
|
|
isShowPopup: false,
|
|
@@ -78,8 +79,6 @@ Page({
|
|
|
carouselMediaList: [] as Array<{
|
|
carouselMediaList: [] as Array<{
|
|
|
type: "image" | "video";
|
|
type: "image" | "video";
|
|
|
src: string;
|
|
src: string;
|
|
|
- poster?: string;
|
|
|
|
|
- title?: string;
|
|
|
|
|
}>,
|
|
}>,
|
|
|
},
|
|
},
|
|
|
behaviors: [
|
|
behaviors: [
|
|
@@ -97,16 +96,8 @@ Page({
|
|
|
|
|
|
|
|
const res = await getCareList();
|
|
const res = await getCareList();
|
|
|
if (res && res.length > 0) {
|
|
if (res && res.length > 0) {
|
|
|
- res.forEach((item: any, index: number) => {
|
|
|
|
|
|
|
+ res.forEach((item: any) => {
|
|
|
item.carouselMediaList = [];
|
|
item.carouselMediaList = [];
|
|
|
-
|
|
|
|
|
- // 确保 item.id 存在且为数字类型
|
|
|
|
|
- if (!item.id && item.id !== 0) {
|
|
|
|
|
- item.id = index;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 确保 id 是数字类型
|
|
|
|
|
- item.id = Number(item.id);
|
|
|
|
|
// 添加photo
|
|
// 添加photo
|
|
|
if (item.photo) {
|
|
if (item.photo) {
|
|
|
item.carouselMediaList.push({
|
|
item.carouselMediaList.push({
|
|
@@ -130,31 +121,7 @@ Page({
|
|
|
src: item.itemVideoFirst,
|
|
src: item.itemVideoFirst,
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // 如果有轮播图内容,设置加载状态
|
|
|
|
|
- if (item.carouselMediaList.length > 0) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- [`carouselLoading.${item.id}`]: true,
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- // 设置超时,防止一直显示加载中
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- // 检查是否还在加载状态,如果是则自动隐藏
|
|
|
|
|
- const currentLoading = this.data.carouselLoading;
|
|
|
|
|
- if (currentLoading && currentLoading[item.id]) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- [`carouselLoading.${item.id}`]: false,
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- }, 10000); // 10秒后自动隐藏加载状态
|
|
|
|
|
- } else {
|
|
|
|
|
- // 如果没有轮播图内容,确保不显示加载状态
|
|
|
|
|
- this.setData({
|
|
|
|
|
- [`carouselLoading.${item.id}`]: false,
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
// 先设置 careList
|
|
// 先设置 careList
|
|
|
this.setData({
|
|
this.setData({
|
|
|
careList: res,
|
|
careList: res,
|
|
@@ -201,11 +168,6 @@ Page({
|
|
|
async onShow() {
|
|
async onShow() {
|
|
|
wx.showShareMenu({ withShareTicket: true, menus }).then();
|
|
wx.showShareMenu({ withShareTicket: true, menus }).then();
|
|
|
await this.load();
|
|
await this.load();
|
|
|
- console.log(
|
|
|
|
|
- this.data.switchType,
|
|
|
|
|
- "home.ts中的switchType",
|
|
|
|
|
- this.data.patient
|
|
|
|
|
- );
|
|
|
|
|
// 如果是从一体机扫码进来的 有switchType值就直接跳转到注册页面
|
|
// 如果是从一体机扫码进来的 有switchType值就直接跳转到注册页面
|
|
|
if (
|
|
if (
|
|
|
this.data.switchType &&
|
|
this.data.switchType &&
|
|
@@ -385,7 +347,7 @@ Page({
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- wx.navigateTo({ url: `${page}?id=${id}` });
|
|
|
|
|
|
|
+ wx.redirectTo({ url: `${page}?id=${id}` });
|
|
|
// wx.navigateTo({ url: `/module/follow/pages/evaluation/report?id=${id}` });
|
|
// wx.navigateTo({ url: `/module/follow/pages/evaluation/report?id=${id}` });
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -427,11 +389,11 @@ Page({
|
|
|
|
|
|
|
|
if (!this.data._loaded) {
|
|
if (!this.data._loaded) {
|
|
|
this.loadScienceList();
|
|
this.loadScienceList();
|
|
|
- useLocation()
|
|
|
|
|
- .then((location) => {
|
|
|
|
|
- this.setData({ location });
|
|
|
|
|
- })
|
|
|
|
|
- .catch(() => {});
|
|
|
|
|
|
|
+ // useLocation()
|
|
|
|
|
+ // .then((location) => {
|
|
|
|
|
+ // this.setData({ location });
|
|
|
|
|
+ // })
|
|
|
|
|
+ // .catch(() => {});
|
|
|
getSolarTerms()
|
|
getSolarTerms()
|
|
|
.then((solarTerms) => {
|
|
.then((solarTerms) => {
|
|
|
this.setData({ solarTerms });
|
|
this.setData({ solarTerms });
|
|
@@ -667,28 +629,9 @@ Page({
|
|
|
});
|
|
});
|
|
|
wx.setStorageSync("isAnalysis", 3);
|
|
wx.setStorageSync("isAnalysis", 3);
|
|
|
},
|
|
},
|
|
|
- toHealthPage() {
|
|
|
|
|
- wx.navigateTo({ url: `/module/health/pages/home/home` });
|
|
|
|
|
- },
|
|
|
|
|
- toDietTonicPage() {
|
|
|
|
|
- wx.navigateTo({
|
|
|
|
|
- url: `/module/article/pages/diet-list/diet-list?classify=tonic`,
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- toDietTeaPage() {
|
|
|
|
|
- wx.navigateTo({
|
|
|
|
|
- url: `/module/article/pages/diet-list/diet-list?classify=tea`,
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
toSciencePage() {
|
|
toSciencePage() {
|
|
|
wx.navigateTo({ url: `/module/article/pages/science-list/science-list` });
|
|
wx.navigateTo({ url: `/module/article/pages/science-list/science-list` });
|
|
|
},
|
|
},
|
|
|
- toSchemePage() {
|
|
|
|
|
- const id = this.data.healthId;
|
|
|
|
|
- if (id)
|
|
|
|
|
- wx.navigateTo({ url: `/module/health/pages/scheme/scheme?id=${id}` });
|
|
|
|
|
- else wx.showToast({ title: "暂无调理方案", icon: "none" });
|
|
|
|
|
- },
|
|
|
|
|
async toReportPage() {
|
|
async toReportPage() {
|
|
|
// const { patient } = await getPatients(/*this.data.patientId*/);
|
|
// const { patient } = await getPatients(/*this.data.patientId*/);
|
|
|
if (!this.data.patient) await toCertificationPage();
|
|
if (!this.data.patient) await toCertificationPage();
|
|
@@ -753,36 +696,6 @@ Page({
|
|
|
// 获取调养计划
|
|
// 获取调养计划
|
|
|
this.getCareLists();
|
|
this.getCareLists();
|
|
|
},
|
|
},
|
|
|
- // 轮播图加载完成
|
|
|
|
|
- onCarouselLoaded(e: any) {
|
|
|
|
|
- const { itemId } = e.detail;
|
|
|
|
|
- if (itemId) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- [`carouselLoading.${itemId}`]: false,
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- // 图片加载失败
|
|
|
|
|
- onImageError(e: any) {
|
|
|
|
|
- const { itemId } = e.detail;
|
|
|
|
|
- // 图片加载失败时也要隐藏加载状态
|
|
|
|
|
- if (itemId) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- [`carouselLoading.${itemId}`]: false,
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- // 视频播放错误
|
|
|
|
|
- onVideoError(e: any) {
|
|
|
|
|
- const { itemId } = e.detail;
|
|
|
|
|
- // 视频播放错误时也要隐藏加载状态
|
|
|
|
|
- if (itemId) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- [`carouselLoading.${itemId}`]: false,
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
// 没有健康分析去做健康分析
|
|
// 没有健康分析去做健康分析
|
|
|
goHealthAnalyze() {
|
|
goHealthAnalyze() {
|
|
|
wx.redirectTo({
|
|
wx.redirectTo({
|
|
@@ -825,21 +738,16 @@ Page({
|
|
|
// 获取新数据
|
|
// 获取新数据
|
|
|
const res = await getCareList();
|
|
const res = await getCareList();
|
|
|
if (res && res.length > 0) {
|
|
if (res && res.length > 0) {
|
|
|
- // 处理新数据,但保持媒体加载状态
|
|
|
|
|
res.forEach((item: any) => {
|
|
res.forEach((item: any) => {
|
|
|
// 查找对应的旧数据
|
|
// 查找对应的旧数据
|
|
|
const oldItem = currentExpandedStates.find(
|
|
const oldItem = currentExpandedStates.find(
|
|
|
(state) => state.id === item.id
|
|
(state) => state.id === item.id
|
|
|
);
|
|
);
|
|
|
-
|
|
|
|
|
- // 如果找到旧数据且媒体已加载,保持媒体状态
|
|
|
|
|
if (oldItem && oldItem.carouselMediaList) {
|
|
if (oldItem && oldItem.carouselMediaList) {
|
|
|
// 保持原有的媒体列表,避免重新加载
|
|
// 保持原有的媒体列表,避免重新加载
|
|
|
item.carouselMediaList = oldItem.carouselMediaList;
|
|
item.carouselMediaList = oldItem.carouselMediaList;
|
|
|
} else {
|
|
} else {
|
|
|
- // 否则重新构建媒体列表
|
|
|
|
|
item.carouselMediaList = [];
|
|
item.carouselMediaList = [];
|
|
|
-
|
|
|
|
|
// 添加photo
|
|
// 添加photo
|
|
|
if (item.photo) {
|
|
if (item.photo) {
|
|
|
item.carouselMediaList.push({
|
|
item.carouselMediaList.push({
|
|
@@ -862,33 +770,7 @@ Page({
|
|
|
src: item.itemVideoFirst,
|
|
src: item.itemVideoFirst,
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // 如果有轮播图内容,设置加载状态
|
|
|
|
|
- if (item.carouselMediaList.length > 0) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- [`carouselLoading.${item.id}`]: true,
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- // 设置超时,防止一直显示加载中
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- // 检查是否还在加载状态,如果是则自动隐藏
|
|
|
|
|
- const currentLoading = this.data.carouselLoading;
|
|
|
|
|
- if (currentLoading && currentLoading[item.id]) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- [`carouselLoading.${item.id}`]: false,
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- }, 10000); // 10秒后自动隐藏加载状态
|
|
|
|
|
- } else {
|
|
|
|
|
- // 如果没有轮播图内容,确保不显示加载状态
|
|
|
|
|
- this.setData({
|
|
|
|
|
- [`carouselLoading.${item.id}`]: false,
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // 确保 id 是数字类型
|
|
|
|
|
- item.id = Number(item.id);
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// 更新 careList
|
|
// 更新 careList
|
|
@@ -922,4 +804,15 @@ Page({
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 轮播组件进入/退出全屏时,隐藏/显示底部 tabbar,防止遮挡视频进度条
|
|
|
|
|
+ */
|
|
|
|
|
+ onCarouselFullscreenChange(e: { detail?: { fullScreen?: boolean } }) {
|
|
|
|
|
+ console.log(e, "全屏模式");
|
|
|
|
|
+ const fullScreen = !!(e.detail?.fullScreen);
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ tabbarHidden: fullScreen,
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
});
|
|
});
|