4.2提交

This commit is contained in:
zoujiandong
2026-04-02 11:30:39 +08:00
parent 5f9a346960
commit 5d31c3658b
11 changed files with 208 additions and 74 deletions
+116 -20
View File
@@ -38,6 +38,9 @@
id="myVideo"
object-fit="contain"
:autoplay="false"
@play="onVideoPlay"
@pause="onVideoPause"
@ended="onVideoEnded"
@error="onVideoError"
></video>
<!-- <sunny-video
@@ -252,7 +255,7 @@
<script setup>
import { ref, nextTick } from "vue";
//import uniVideo from "@/components/uniVideo/uniVideo.vue";
import { onLoad, onShow,onReady,onUnload } from "@dcloudio/uni-app";
import { onLoad, onShow,onReady,onUnload,onHide } from "@dcloudio/uni-app";
import unidialog from "@/components/dialog/dialog.vue";
import collectImg from "@/static/icon_book_collect_sel.png";
import discollectImg from "@/static/icon_book_collect_nor.png";
@@ -282,6 +285,9 @@ const notEnoughVisible = ref(false);
const notEnoughContent = ref("");
const welfareNum = ref(0);
const isPlaying = ref(false);
const playTime = ref(0);
const timer = ref(null);
const hasPlay = ref(false);
// 删除弹窗相关
const showDeleteModal = ref(false);
const currentDeleteItem = ref(null);
@@ -314,7 +320,29 @@ const onFullscreenChange = (e) => {
};
const onVideoPlay = () => {
isPlaying.value = true;
hasPlay.value = true;
timer.value = setInterval(() => {
playTime.value++;
}, 1000);
};
const onVideoPause = () => {
isPlaying.value = false;
if(timer.value) {
clearInterval(timer.value);
timer.value = null;
}
};
const onVideoEnded = () => {
isPlaying.value = false;
if(timer.value) {
clearInterval(timer.value);
timer.value = null;
}
};
onHide(() => {
});
// const playVideo = () => {
// videoContext.value.play();
// };
@@ -506,22 +534,10 @@ const onVideoError = (e) => {
const videoDetail = async (flag = false) => {
const res = await api.videoDetail({ video_uuid: video_uuid.value });
if (res.code == 200) {
if(flag) {
uni.sendNativeEvent("portraitReport",{
msg:{
event_nickname: "detail_page",
page_type: type.value == 'patientVideo' ? '患教视频' : "肝胆视频",
resource_name:videoInfo.value.name,
resource_option:tags.value?tags.value:''
},
},
(ret) => {
console.log(ret);
});
}
const userInfo = uni.getStorageSync("userInfo");
videoInfo.value = res.video;
tags.value = res.video.tags;
//hasDownload.value = downLoadList.value.includes(video_uuid.value);
let vid =res.video.polyv_uuid || extractPolyvVid(res.video.content);
console.log(222222);
@@ -539,6 +555,24 @@ const videoDetail = async (flag = false) => {
"/video/hcp_detial?share=1&uuid=" +
video_uuid.value +
"&expertshare=videoshare&fromtype=doctor";
console.log(videoInfo.value.name)
if(flag) {
try {
uni.sendNativeEvent("portraitReport",{
msg:{
event_nickname: "detail_page",
page_type: type.value == 'patientVideo' ? '患教视频' : "肝胆视频",
resource_name:videoInfo.value.name,
resource_option:tags.value?tags.value:''
},
},
(ret) => {
console.log(ret);
});
} catch (error) {
}
}
}
};
const collection = async () => {
@@ -646,8 +680,65 @@ const resumeDownloadingTasks = () => {
});
};
onUnload(() => {
console.log('onUnload');
uni.$off('selectedChatPatientsSingle');
uni.$off('replySuccess', handleReplySuccess);
if(timer.value) {
clearInterval(timer.value);
timer.value = null;
};
if(hasPlay.value) {
let id=videoInfo.value.polyv_uuid || extractPolyvVid(videoInfo.value.content);
console.log(id);
uni.sendNativeEvent("portraitReport",{
msg:{
event_nickname: "watch_video",
page_type:'',
resource_name:id,
resource_option:tags.value?tags.value:'',
event_val:playTime.value,
event_unit:'秒',
},
});
}
});
const replySuccessLocked = ref(false);
const lastReplySuccessAt = ref(0);
const runReplySuccessOnce = (action) => {
const now = Date.now();
if (replySuccessLocked.value) return false;
if (now - Number(lastReplySuccessAt.value || 0) < 1000) return false;
replySuccessLocked.value = true;
lastReplySuccessAt.value = now;
try {
action && action();
return true;
} finally {
setTimeout(() => {
replySuccessLocked.value = false;
}, 300);
}
};
const handleReplySuccess = () => {
runReplySuccessOnce(() => {
console.log('reply-success');
try {
uni.sendNativeEvent("portraitReport",{
msg:{
event_nickname: "comment",
page_type: type.value == 'patientVideo' ? '患教视频' : "肝胆视频",
resource_name:videoInfo.value.name,
resource_option:tags.value?tags.value:'',
},
},
(ret) => {
console.log(ret);
});
} catch (error) {
}
});
};
onShow(() => {
uni.$on('selectedChatPatientsSingle',(data)=>{
console.log(data)
@@ -656,6 +747,8 @@ onShow(() => {
addGroupSendMsg4YunXin()
}
});
uni.$off('replySuccess', handleReplySuccess);
uni.$on('replySuccess', handleReplySuccess);
hasDownload.value = false;
downLoadStatus.value = 'start';
console.log('onShow');
@@ -1003,6 +1096,7 @@ const from = ref('');
const type = ref('');
// 使用uni-app的onLoad生命周期
onLoad((options) => {
console.log(options);
if(options.type) {
type.value = options.type;
}
@@ -1015,11 +1109,13 @@ onLoad((options) => {
},
});
console.log('enrtyVideoDetail');
// uni.sendNativeEvent('enrtyVideoDetail', {
// msg: 'enrtyVideoDetail'
// }, ret => {
// console.log(ret);
// })
console.log(tags.value);
//这个是处理关于滋滋声的问题,不能删掉
uni.sendNativeEvent('enrtyVideoDetail', {
msg: 'enrtyVideoDetail'
}, ret => {
console.log(ret);
})
video_uuid.value = options.id;
from.value = options.from;
if(from.value != 'download') {