张田田 5 месяцев назад
Родитель
Сommit
aec1f905e2

+ 1 - 0
miniprogram/app.config.ts

@@ -9,6 +9,7 @@ if (env === "trial") {
 } else if (env === "develop") {
   // host = "wx2.hzliuzhi.com";
   host = "wx.hzliuzhi.com:4433";
+  // host = "test.hzliuzhi.com";
 }
 console.log("host",host)
 export const Base_URL = `https://${host}/manager/fdhb-mobile`;

+ 0 - 1
miniprogram/components/media-carousel/media-carousel.scss

@@ -10,7 +10,6 @@
 
 /* 自适应高度模式 */
 .media-carousel.adaptive-height {
-  /* height: auto; */
   min-height: 400rpx;
 }
 

+ 19 - 76
miniprogram/components/media-carousel/media-carousel.ts

@@ -1,120 +1,63 @@
 // components/media-carousel/media-carousel.ts
-
-// 定义微信小程序组件的类型
-interface IComponentInstance {
-  setData: (data: any) => void;
-  triggerEvent: (name: string, detail: any) => void;
-  data: any;
-  properties: any;
-}
-
-interface IComponentOptions {
-  properties: Record<string, any>;
-  data: any;
-  methods: Record<string, Function>;
-}
-
-// 声明全局的 Component 函数
-declare function Component(options: IComponentOptions): void;
-
 Component({
-  /**
-   * 组件的属性列表
-   */
   properties: {
-    // 媒体列表
     mediaList: {
       type: Array,
       value: [],
-      observer: function(this: IComponentInstance, newVal: any[]) {
+      observer: function (this: any, newVal: any[]) {
         this.setData({
-          totalCount: newVal.length
+          totalCount: newVal.length,
         });
-      }
+      },
     },
-    // 项目ID,用于标识轮播图属于哪个项目
     itemId: {
       type: String,
-      value: ''
+      value: "",
     },
     // 是否显示指示器
     showIndicator: {
       type: Boolean,
-      value: true
+      value: true,
     },
     // 指示器颜色
     indicatorColor: {
       type: String,
-      value: 'rgba(255, 255, 255, 0.6)'
+      value: "rgba(255, 255, 255, 0.6)",
     },
     // 指示器激活颜色
     indicatorActiveColor: {
       type: String,
-      value: '#fff'
+      value: "#fff",
     },
     // 是否自动播放
     autoplay: {
       type: Boolean,
-      value: true
+      value: true,
     },
     // 自动播放间隔时间
     interval: {
       type: Number,
-      value: 3000
+      value: 3000,
     },
     // 滑动动画时长
     duration: {
       type: Number,
-      value: 500
+      value: 500,
     },
     // 是否循环播放
     circular: {
       type: Boolean,
-      value: true
-    }
+      value: true,
+    },
   },
-
-  /**
-   * 组件的初始数据
-   */
   data: {
-    currentIndex: 0,
-    totalCount: 0
+    totalCount: 0,
   },
-
-  /**
-   * 组件的方法列表
-   */
   methods: {
-    // 图片加载成功
-    onImageLoad(this: IComponentInstance, e: any) {
-      const { index } = e.currentTarget.dataset;
-      this.triggerEvent('imageload', {
-        index: index,
-        item: this.data.mediaList[index],
-        itemId: this.properties.itemId
-      });
-    },
-
-    // 图片加载失败
-    onImageError(this: IComponentInstance, e: any) {
-      const { index } = e.currentTarget.dataset;
-  
-      this.triggerEvent('imageerror', {
-        index: index,
-        item: this.data.mediaList[index],
-        itemId: this.properties.itemId
-      });
+    // 全屏
+    onFullscreenChange(this: any, e: WechatMiniprogram.VideoFullScreenChange) {
+      const { fullScreen } = e.detail || {};
+      this.triggerEvent("fullscreenchange", { fullScreen });
     },
-
-    // 视频播放错误
-    onVideoError(this: IComponentInstance, e: any) {
-      const { index } = e.currentTarget.dataset;
-      this.triggerEvent('videoerror', {
-        index: index,
-        item: this.data.mediaList[index],
-        itemId: this.properties.itemId
-      });
-    }
-  }
-}); 
+  },
+});

+ 12 - 28
miniprogram/components/media-carousel/media-carousel.wxml

@@ -1,39 +1,23 @@
 <!--components/media-carousel/media-carousel.wxml-->
 <view class="media-carousel">
-  <swiper 
-    class="carousel-swiper" 
-    indicator-dots="{{showIndicator}}" 
-    indicator-color="{{indicatorColor}}" 
-    indicator-active-color="{{indicatorActiveColor}}"
-    autoplay="{{autoplay}}" 
-    interval="{{interval}}" 
-    duration="{{duration}}"
-    circular="{{circular}}"
-  >
+  <swiper class="carousel-swiper" indicator-dots="{{showIndicator}}" indicator-color="{{indicatorColor}}" indicator-active-color="{{indicatorActiveColor}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" circular="{{circular}}">
     <swiper-item wx:for="{{mediaList}}" wx:key="index" class="carousel-item">
       <!-- 图片轮播 -->
-      <view wx:if="{{item.type === 'image'}}" class="image-container">
-        <image
-          src="{{item.src}}" 
-          mode="aspectFit"
-          class="carousel-image"
-          bind:load="onImageLoad"
-          bind:error="onImageError"
-          data-index="{{index}}"
-        />
-        <view wx:if="{{item.title}}" class="image-title">{{item.title}}</view>
+      <view wx:if="{{item.type === 'image' && item.src}}" class="image-container">
+        <image src="{{item.src}}" mode="aspectFit" class="carousel-image" />
       </view>
-      
+
       <!-- 视频轮播 -->
-      <view wx:if="{{item.type === 'video'}}" class="video-container">
+      <view wx:if="{{item.type === 'video' && item.src}}" class="video-container">
         <video 
           src="{{item.src}}" 
-          class="carousel-video"
-          bind:error="onVideoError"
-          data-index="{{index}}"
-        />
-        <view wx:if="{{item.title}}" class="video-title">{{item.title}}</view>
+          class="carousel-video" 
+          controls="{{true}}" 
+          object-fit="contain"
+          bindfullscreenchange="onFullscreenChange"
+        >
+        </video>
       </view>
     </swiper-item>
   </swiper>
-</view> 
+</view>

+ 5 - 16
miniprogram/module/article/pages/order-detail/order-detail.ts

@@ -48,7 +48,6 @@ Page({
   },
   // 订单支付
   async payment() {
-    // 节流控制:如果正在处理中,直接返回
     if (this.data.isPaymentLoading) {
       return;
     }
@@ -56,23 +55,20 @@ Page({
     this.setData({ isPaymentLoading: true });
 
     try {
-      const res = await orderPayMethod(this.data.id);
-      wx.navigateTo({
+      await orderPayMethod(this.data.id);
+      wx.redirectTo({
         url: "/module/article/pages/success-page/success-page?title=订单支付成功",
       });
     } catch (error: any) {
-      // getTickleContext.call(this).showWarnMessage(error.errMsg);
       wx.showToast({
         title: error.errMsg,
         icon: "none",
       });
     } finally {
-      // 无论成功还是失败,都要重置loading状态
       this.setData({ isPaymentLoading: false });
     }
   },
   statusType(status: any) {
-    // 规范化后端返回:将 null/undefined 转为空字符串,其它转换为字符串
     const code = status == null ? "" : String(status);
     switch (code) {
       case "0":
@@ -88,7 +84,6 @@ Page({
         this.setData({ orderStatus: "completed" });
         break;
       default:
-        // 未知或空状态,重置为安全空串,避免默认展示为待付款
         this.setData({ orderStatus: "" });
         break;
     }
@@ -137,7 +132,6 @@ Page({
         this.setData({ totalPrice });
       }
     } catch (error: any) {
-      // getTickleContext.call(this).showWarnMessage(error.errMsg);
       wx.showToast({
         title: error.errMsg,
         icon: "none",
@@ -149,9 +143,7 @@ Page({
     this.setData({ showConfirm: false });
   },
   async confirmDialog() {
-    // 点击确定取消订单按钮
     const that = this;
-    /* 取消订单逻辑 */
     wx.showModal({
       title: "提示",
       content: "确认取消该订单吗?",
@@ -166,13 +158,11 @@ Page({
   async cancelOrdering() {
     try {
       await orderCancelMethod(this.data.id);
-      /* 取消订单逻辑 */
       this.setData({ showConfirm: false });
       wx.navigateTo({
         url: "/module/article/pages/success-page/success-page?title=订单取消成功",
       });
     } catch (error: any) {
-      // getTickleContext.call(this).showWarnMessage(error.errMsg);
       wx.showToast({
         title: error.errMsg,
         icon: "none",
@@ -181,7 +171,6 @@ Page({
   },
   // 取消订单
   async cancelOrder() {
-    // 确定弹窗出现
     this.setData({ showConfirm: true });
   },
   // 查看物流
@@ -195,7 +184,6 @@ Page({
   },
   // 确认收货
   async confirmReceipt() {
-    // 节流控制
     if (this.data.isConfirmLoading) {
       return;
     }
@@ -234,7 +222,6 @@ Page({
       //   url: "/module/article/pages/confirm-receiving/confirm-receiving",
       // });
     } catch (error: any) {
-      // getTickleContext.call(this).showWarnMessage(error.errMsg);
       wx.showToast({
         title: error.errMsg,
         icon: "none",
@@ -242,6 +229,8 @@ Page({
     }
   },
   onShow() {
-    this.load(this.data.id);
+    if(this.data.id){ 
+      this.load(this.data.id);
+    }
   },
 });

+ 7 - 0
miniprogram/module/article/pages/order-list/order-list.ts

@@ -289,4 +289,11 @@ Page({
       url: `/module/article/pages/order-detail/order-detail?id=${id}`,
     });
   },
+  //回到我的页面
+goMine() {
+  console.log("goMine");
+  wx.redirectTo({
+    url: "/pages/mine/mine",
+  });
+}
 });

+ 1 - 1
miniprogram/module/article/pages/order-list/order-list.wxml

@@ -1,5 +1,5 @@
 <!--module/diet/pages/delivery-address/delivery-address.wxml-->
-<t-navbar title="我的订单" left-arrow />
+<t-navbar title="我的订单" left-arrow bindtap="goMine" />
 <t-tabs value="{{currentTab}}" bindchange="onTabChange">
   <t-tab-panel label="全部" value="all" />
   <t-tab-panel label="待付款" value="pending" />

+ 1 - 0
miniprogram/module/health/pages/scheme/scheme.json

@@ -5,6 +5,7 @@
   "usingComponents": {
     "t-cell": "tdesign-miniprogram/cell/cell",
     "t-icon": "tdesign-miniprogram/icon/icon",
+    "t-popup": "tdesign-miniprogram/popup/popup",
     "report-health-index": "../../components/report-health-index/report-health-index",
     "report-health-status": "../../components/report-health-status/report-health-status",
     "form-button": "../../../../components/button/button",

+ 52 - 0
miniprogram/module/health/pages/scheme/scheme.scss

@@ -148,4 +148,56 @@
   height: 33px;
   line-height: 33px;
   text-align: center;
+}
+
+.qr-code-popup {
+  width: 80vw;
+  max-width: 600rpx;
+  background: #fff;
+  border-radius: 16rpx;
+  overflow: hidden;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+
+  &__title {
+    width: 100%;
+    padding: 40rpx 0 20rpx;
+    text-align: center;
+    font-size: 32rpx;
+    font-weight: 600;
+    color: #333;
+  }
+
+  &__content {
+    width: 100%;
+    padding: 0 40rpx;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+  }
+
+  &__footer {
+    width: 100%;
+    padding: 30rpx 40rpx 40rpx;
+    display: flex;
+    justify-content: center;
+  }
+
+  &__btn {
+    width: 200rpx;
+    height: 80rpx;
+    line-height: 80rpx;
+    text-align: center;
+    background: #1d6ff6;
+    color: #fff;
+    border-radius: 8rpx;
+    font-size: 28rpx;
+  }
+}
+
+.qr-code-image {
+  width: 100%;
+  max-width: 500rpx;
+  height: 500rpx;
 }

+ 144 - 41
miniprogram/module/health/pages/scheme/scheme.ts

@@ -1,84 +1,187 @@
 import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
-import TickleBehavior, { getTickleContext } from "../../../../core/behavior/tickle.behavior";
+import TickleBehavior, {
+  getTickleContext,
+} from "../../../../core/behavior/tickle.behavior";
 
 // module/health/pages/scheme/scheme.ts
 import { healthSchemeMethod } from "../../request";
 import { toReportPage } from "../../router";
 Component({
-  behaviors: [
-    PageContainerBehavior,
-    TickleBehavior
-  ],
+  behaviors: [PageContainerBehavior, TickleBehavior],
   lifetimes: {
     attached() {
       this.getHealthScheme(this.data.id);
-    }
+    },
   },
   properties: {
-    id: { type: String, value: '' },
+    id: { type: String, value: "" },
   },
   data: {
     dataset: null,
-    schemeId: '',
-    healthIndex: { data: [], loading: false, message: '' },
+    schemeId: "",
+    healthIndex: { data: [], loading: false, message: "" },
+    showQrCodePopup: false,
+    qrCodeImageUrl: "",
   },
   observers: {},
   methods: {
     async getHealthScheme(id: string) {
-      wx.showLoading({ title: '加载中' });
+      wx.showLoading({ title: "加载中" });
       try {
         const dataset = await healthSchemeMethod(id);
-        console.log(dataset, '1-->');
 
         this.setData({ dataset });
       } catch (error) {
         console.log(error);
 
-        getTickleContext.call(this).showErrorMessage(error.errMsg || error.message, 0);
+        getTickleContext
+          .call(this)
+          .showErrorMessage(error.errMsg || error.message, 0);
       }
       wx.hideLoading();
     },
-    toReportPage() { toReportPage(this.data.id); },
+    toReportPage() {
+      toReportPage(this.data.id);
+    },
     // 去购买
     goBuy(this: any, e: any) {
       const item = e.currentTarget.dataset.item || {};
-      const type: string = (item.buyType || '').toLowerCase();
-      const appId: string = item.appId || item.appID || item.appid || '';
-      const miniPath: string = item.path || item.miniPath || '';
-      const url: string = item.buyUrl || '';
-console.log(item, 'item',type);
-      // 优先按显式类型判断
-      if (type === 'miniprogram' || (!!appId && !type)) {
-        wx.navigateToMiniProgram({
-          appId,
-          path: miniPath,
-          envVersion: 'release',
-          fail: (err) => {
-            getTickleContext.call(this).showWarnMessage(err.errMsg || '跳转小程序失败');
+      const type: string = (item.buyType || "").toLowerCase();
+      const url: string = item.buyUrl || "";
+      const shortImageUrl: string = item.shortImageUrl || "";
+      console.log(item, "item", type, url);
+      //  跳转小程序
+      if (type === "miniprogram") {
+        // 如果没有跳转链接,直接显示小程序码或提示错误
+        if (!url) {
+          if (shortImageUrl) {
+            this.setData({
+              showQrCodePopup: true,
+              qrCodeImageUrl: shortImageUrl,
+            });
+          } else {
+            getTickleContext.call(this).showWarnMessage("缺少小程序跳转参数");
           }
-        });
-        return;
-      }
+          return;
+        }
+
+        // 解析 miniprogram:// 格式的 URL
+        let parsedAppId = "";
+        let parsedPath = "";
+        const isMiniprogramUrl = url.startsWith("miniprogram://");
+
+        if (isMiniprogramUrl) {
+          // 解析 miniprogram://?appid=xxx&path=xxx 格式
+          try {
+            // 提取查询参数字符串(去掉 miniprogram://? 前缀)
+            const queryString = url.replace(/^miniprogram:\/\/(\?)?/, "");
+            // 解析查询参数
+            const params: Record<string, string> = {};
+            queryString.split("&").forEach((param) => {
+              const [key, value] = param.split("=");
+              if (key && value) {
+                params[key] = decodeURIComponent(value);
+              }
+            });
+            parsedAppId = params.appid || "";
+            parsedPath = params.path || "";
+          } catch (error) {
+            console.error("解析 miniprogram:// URL 失败:", error);
+          }
+        }
 
-      if (type === 'url' || (!!url && !type)) {
+        // 统一的错误处理函数:显示小程序码或错误提示
+        const showErrorOrQrCode = (errMsg?: string) => {
+          if (shortImageUrl) {
+            this.setData({
+              showQrCodePopup: true,
+              qrCodeImageUrl: shortImageUrl,
+            });
+          } else {
+            getTickleContext
+              .call(this)
+              .showWarnMessage(errMsg || "跳转小程序失败");
+          }
+        };
+
+        // 统一的跳转函数:使用 appId + path 方式跳转
+        const navigateWithAppIdAndPath = (appId: string, path: string) => {
+          wx.navigateToMiniProgram({
+            appId: appId,
+            path: path,
+            envVersion: "release",
+            fail: (pathErr) => {
+              if (
+                pathErr.errMsg.includes("navigateToMiniProgram:fail cancel")
+              ) {
+                console.log("用户取消appid小程序跳转");
+              } else {
+                showErrorOrQrCode(pathErr.errMsg);
+              }
+            },
+          });
+        };
+
+        // 如果是 miniprogram:// 格式,直接使用 appId + path 方式跳转
+        if (isMiniprogramUrl) {
+          if (parsedAppId && parsedPath) {
+            navigateWithAppIdAndPath(parsedAppId, parsedPath);
+          }
+        } else {
+          // 短链接格式,优先使用短链接方式跳转
+          wx.navigateToMiniProgram({
+            shortLink: url,
+            envVersion: "release",
+            fail: (err) => {
+              if (err.errMsg.includes("navigateToMiniProgram:fail cancel")) {
+                console.log("用户取消短链跳转");
+              } else {
+                // 短链接失败,尝试使用 appId + path 方式跳转
+                if (parsedAppId && parsedPath) {
+                  navigateWithAppIdAndPath(parsedAppId, parsedPath);
+                } else {
+                  // 没有 appId 和 path,直接显示弹窗或错误提示
+                  showErrorOrQrCode(err.errMsg || "跳转小程序失败");
+                }
+              }
+            },
+          });
+        }
+      } else if (type === "url") {
+        // h5链接
         if (!url) {
-          getTickleContext.call(this).showWarnMessage('无有效链接');
+          getTickleContext.call(this).showWarnMessage("无有效链接");
           return;
         }
         wx.navigateTo({
-          url: '/module/article/pages/science-info/science-info',
+          url: "/module/article/pages/science-info/science-info",
           success: (res) => {
-            res.eventChannel?.emit?.('load', { title: item.title || '详情', url });
+            res.eventChannel?.emit?.("load", {
+              title: item.title || "详情",
+              url,
+            });
           },
           fail: (err) => {
-            getTickleContext.call(this).showWarnMessage(err.errMsg || '打开页面失败');
-          }
+            getTickleContext
+              .call(this)
+              .showWarnMessage(err.errMsg || "打开页面失败");
+          },
         });
         return;
+      } else {
+        // 无法识别
+        getTickleContext.call(this).showWarnMessage("未识别的跳转类型");
       }
-
-      // 无法识别
-      getTickleContext.call(this).showWarnMessage('未识别的跳转类型');
-    }
-  }
-})
+    },
+    // 关闭小程序码弹窗
+    closeQrCodePopup(e?: any) {
+      // 如果 visible-change 事件触发且 visible 为 false,才关闭
+      if (e === undefined || !e.detail?.visible) {
+        this.setData({
+          showQrCodePopup: false,
+          qrCodeImageUrl: "",
+        });
+      }
+    },
+  },
+});

+ 25 - 2
miniprogram/module/health/pages/scheme/scheme.wxml

@@ -20,7 +20,7 @@
           <view class="buy-container" wx:if="{{item.title || item.buyUrl}}">
             <view class="scheme__item-title scheme__title" wx:if="{{item.title}}">{{item.title}}</view>
             <view class="scheme__item-title scheme__title" wx:else></view>
-            <view class="buy-box" bindtap="goBuy" data-item="{{item}}" wx:if="{{item.buyUrl}}">去购买</view>
+            <view class="buy-box" bindtap="goBuy" data-item="{{item}}" wx:if="{{item.buyType}}">去购买</view>
           </view>
           <horizontal-scrollable dataset="{{item.children}}"></horizontal-scrollable>
           <view class="scheme__description" wx:if="{{item.description}}">{{item.description}}</view>
@@ -44,4 +44,27 @@
     </view>
   </scroll-view>
 </view>
-<t-message id="{{$messageId}}"></t-message>
+<t-message id="{{$messageId}}"></t-message>
+
+<!-- 小程序码弹窗 -->
+<t-popup
+  visible="{{showQrCodePopup}}"
+  bind:visible-change="closeQrCodePopup"
+  placement="center"
+  close-on-overlay-click="{{true}}"
+>
+  <view class="qr-code-popup"   wx:if="{{qrCodeImageUrl}}">
+    <view class="qr-code-popup__title">请长按二维码</view>
+    <view class="qr-code-popup__content">
+      <image
+        src="{{qrCodeImageUrl}}"
+        mode="aspectFit"
+        class="qr-code-image"
+        show-menu-by-longpress="{{true}}"
+      ></image>
+    </view>
+    <view class="qr-code-popup__footer">
+      <view class="qr-code-popup__btn" bind:tap="closeQrCodePopup">关闭</view>
+    </view>
+  </view>
+</t-popup>

+ 1 - 0
miniprogram/module/health/request.ts

@@ -87,6 +87,7 @@ export function healthSchemeMethod(id: string) {
             return {
               buyUrl: item?.buyUrl || '',
               buyType: item?.buyType || '',
+              shortImageUrl: item?.miniprogram || '',
               title: item?.name || '',
               descriptions: item?.attrs?.map((attr: AnyArray, k: number) => {
                 return { ...attr, id: `description-${i}-${j}-${k}`, }

+ 2 - 1
miniprogram/pages/home/home.scss

@@ -32,7 +32,8 @@
   background-image: url("/assets/bg/bg_home.png");
   background-repeat: no-repeat;
   width: 100%;
-  height: 100vh;
+  // height: 90vh;
+  height: calc(100vh - 180rpx) !important;
   background-size: cover;
   background-position: center;
   position: relative;

+ 20 - 127
miniprogram/pages/home/home.ts

@@ -25,7 +25,7 @@ import {
   getCareList,
 } from "./request";
 import { toCertificationPage, toChats } from "./router";
-import { useLocation } from "../../lib/use/use-location";
+// import { useLocation } from "../../lib/use/use-location";
 
 Page({
   data: {
@@ -47,6 +47,7 @@ Page({
     allExpanded: false,
     fixedHeight: "370rpx",
     tabbarValue: "/pages/home/home",
+    tabbarHidden: false,
     pageHeight: "100vh", // 默认值
     popupList: [] as AnyArray,
     isShowPopup: false,
@@ -78,8 +79,6 @@ Page({
     carouselMediaList: [] as Array<{
       type: "image" | "video";
       src: string;
-      poster?: string;
-      title?: string;
     }>,
   },
   behaviors: [
@@ -97,16 +96,8 @@ Page({
 
     const res = await getCareList();
     if (res && res.length > 0) {
-      res.forEach((item: any, index: number) => {
+      res.forEach((item: any) => {
         item.carouselMediaList = [];
-
-        // 确保 item.id 存在且为数字类型
-        if (!item.id && item.id !== 0) {
-          item.id = index;
-        }
-
-        // 确保 id 是数字类型
-        item.id = Number(item.id);
         // 添加photo
         if (item.photo) {
           item.carouselMediaList.push({
@@ -130,31 +121,7 @@ Page({
             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
       this.setData({
         careList: res,
@@ -201,11 +168,6 @@ Page({
   async onShow() {
     wx.showShareMenu({ withShareTicket: true, menus }).then();
     await this.load();
-    console.log(
-      this.data.switchType,
-      "home.ts中的switchType",
-      this.data.patient
-    );
     // 如果是从一体机扫码进来的  有switchType值就直接跳转到注册页面
     if (
       this.data.switchType &&
@@ -385,7 +347,7 @@ Page({
         });
       }
     } else {
-      wx.navigateTo({ url: `${page}?id=${id}` });
+      wx.redirectTo({ url: `${page}?id=${id}` });
       // wx.navigateTo({ url: `/module/follow/pages/evaluation/report?id=${id}` });
     }
   },
@@ -427,11 +389,11 @@ Page({
 
     if (!this.data._loaded) {
       this.loadScienceList();
-      useLocation()
-        .then((location) => {
-          this.setData({ location });
-        })
-        .catch(() => {});
+      // useLocation()
+      //   .then((location) => {
+      //     this.setData({ location });
+      //   })
+      //   .catch(() => {});
       getSolarTerms()
         .then((solarTerms) => {
           this.setData({ solarTerms });
@@ -667,28 +629,9 @@ Page({
     });
     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() {
     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() {
     // const { patient } = await getPatients(/*this.data.patientId*/);
     if (!this.data.patient) await toCertificationPage();
@@ -753,36 +696,6 @@ Page({
     // 获取调养计划
     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() {
     wx.redirectTo({
@@ -825,21 +738,16 @@ Page({
     // 获取新数据
     const res = await getCareList();
     if (res && res.length > 0) {
-      // 处理新数据,但保持媒体加载状态
       res.forEach((item: any) => {
         // 查找对应的旧数据
         const oldItem = currentExpandedStates.find(
           (state) => state.id === item.id
         );
-
-        // 如果找到旧数据且媒体已加载,保持媒体状态
         if (oldItem && oldItem.carouselMediaList) {
           // 保持原有的媒体列表,避免重新加载
           item.carouselMediaList = oldItem.carouselMediaList;
         } else {
-          // 否则重新构建媒体列表
           item.carouselMediaList = [];
-
           // 添加photo
           if (item.photo) {
             item.carouselMediaList.push({
@@ -862,33 +770,7 @@ Page({
               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
@@ -922,4 +804,15 @@ Page({
       });
     }
   },
+
+  /**
+   * 轮播组件进入/退出全屏时,隐藏/显示底部 tabbar,防止遮挡视频进度条
+   */
+  onCarouselFullscreenChange(e: { detail?: { fullScreen?: boolean } }) {
+    console.log(e, "全屏模式");
+    const fullScreen = !!(e.detail?.fullScreen);
+    this.setData({
+      tabbarHidden: fullScreen,
+    });
+  },
 });

+ 9 - 8
miniprogram/pages/home/home.wxml

@@ -87,12 +87,13 @@
                 <view style="width: 60%;">
                   <!-- 轮播媒体容器 -->
                   <view class="carousel-container" wx:if="{{item.carouselMediaList && item.carouselMediaList.length > 0}}">
-                    <!-- 加载状态 -->
-                    <view wx:if="{{carouselLoading[item.id]}}" class="carousel-loading">
-                      <t-loading size="40rpx" text="加载中..." />
-                    </view>
                     <!-- 轮播组件 -->
-                    <media-carousel wx:else mediaList="{{item.carouselMediaList}}" showIndicator="{{true}}" autoplay="{{true}}" interval="{{4000}}" circular="{{true}}" bind:imageload="onCarouselLoaded" bind:imageerror="onImageError" bind:videoerror="onVideoError" itemId="{{item.id}}" />
+                    <media-carousel
+                      mediaList="{{item.carouselMediaList}}" 
+                      showIndicator="{{true}}" autoplay="{{true}}"
+                      interval="{{4000}}" circular="{{true}}"
+                      bind:fullscreenchange="onCarouselFullscreenChange"
+                      itemId="{{item.id}}" />
                   </view>
                   <view class="item-box">
                     <view class="flex" wx:if="{{item.arrangeDate && item.isOffline==='Y'}}"><text>下一次时间:</text><text>{{item.arrangeDate}}</text></view>
@@ -139,8 +140,8 @@
 </view>
 
 <!-- 将 tabbar 移到最外层 -->
-<view class="tabbar-container">
-  <tabbar tabbarValue="{{tabbarValue}}" patientId="{{patient.patientId}}"></tabbar>
+<view class="tabbar-container" wx:if="{{false}}">
+  <tabbar wx:if="{{!tabbarHidden}}" tabbarValue="{{tabbarValue}}" patientId="{{patient.patientId}}"></tabbar>
 </view>
 
 
@@ -220,7 +221,7 @@
     </sticky-section>
   </scroll-view>
 
-  <tabbar tabbarValue="{{tabbarValue}}" patientId="{{patient.patientId}}"></tabbar>
+  <tabbar tabbarValue="{{tabbarValue}}" patientId="{{patient.patientId}}" wx:if="{{!tabbarHidden}}"></tabbar>
 
   <t-popup visible="{{isShowPopup}}" usingCustomNavbar bind:visible-change="onVisibleChange" placement="center">
     <view class="popup-container">