|
|
@@ -146,20 +146,43 @@ Page({
|
|
|
const videoContext = wx.createVideoContext("offline-video-" + index, this);
|
|
|
videoContext.requestFullScreen({});
|
|
|
},
|
|
|
+ /** 点击图片/视频:原生全屏预览(类似 test 页) */
|
|
|
+ onPreviewMedia(e: WechatMiniprogram.TouchEvent) {
|
|
|
+ const index = e.currentTarget.dataset.index as number;
|
|
|
+ const { mediaList } = this.data;
|
|
|
+ if (index < 0 || index >= mediaList.length) return;
|
|
|
+
|
|
|
+ const sources = mediaList.map((m) => ({
|
|
|
+ url: m.path,
|
|
|
+ type: m.type as "image" | "video",
|
|
|
+ }));
|
|
|
+
|
|
|
+ const previewMedia = (wx as any).previewMedia as
|
|
|
+ | ((option: { sources: { url: string; type: "image" | "video" }[]; current: number }) => void)
|
|
|
+ | undefined;
|
|
|
+
|
|
|
+ if (typeof previewMedia === "function") {
|
|
|
+ previewMedia({ sources, current: index });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 低版本兜底:图片用 previewImage,视频用 requestFullScreen
|
|
|
+ const current = mediaList[index];
|
|
|
+ if (current.type === "image") {
|
|
|
+ const urls = mediaList.filter((m) => m.type === "image").map((m) => m.path);
|
|
|
+ wx.previewImage({ current: current.path, urls });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const ctx = wx.createVideoContext("offline-video-" + index, this);
|
|
|
+ ctx.requestFullScreen({});
|
|
|
+ },
|
|
|
onVideoFullscreenChange(e: WechatMiniprogram.VideoFullScreenChange) {
|
|
|
const fullScreen = !!(e.detail && e.detail.fullScreen);
|
|
|
this.setData({ videoFullscreen: fullScreen });
|
|
|
},
|
|
|
onRemoveService() {
|
|
|
this.setData({
|
|
|
- service: {
|
|
|
- patientConditioningRecordId: 0,
|
|
|
- patientConditioningProgramId: 0,
|
|
|
- operateTime: "",
|
|
|
- operateBy: "",
|
|
|
- conditioningProgramSupplierName: "",
|
|
|
- image: "",
|
|
|
- },
|
|
|
+ service: {} as OfflineEvaluateModel,
|
|
|
});
|
|
|
},
|
|
|
async onPublish() {
|