This commit is contained in:
zoujiandong
2026-03-17 18:59:46 +08:00
parent 4a22470f38
commit b5cc11ddd3
9 changed files with 600 additions and 62 deletions
+162 -7
View File
@@ -204,6 +204,12 @@
<view class="share-popup">
<view class="share-title">分享到</view>
<view class="share-content">
<view class="share-item" @click="shareToPatient" v-if="type == 'patientVideo'">
<view class="share-icon wechat-icon" style="background: none;">
<image class="share-img" :src="paitientImg" mode="aspectFill" />
</view>
<text class="share-text">患者</text>
</view>
<view class="share-item" @click="shareToWechat">
<view class="share-icon wechat-icon">
<image class="share-img" :src="wxImg" mode="aspectFill" />
@@ -228,12 +234,25 @@
</view>
</view>
</uni-popup>
<!-- 选择弹窗(复制自 groupMessage) -->
<view v-if="showModal" class="mask" @click="closeModal"></view>
<view v-if="showModal" class="center-modal">
<view class="modal-title">温馨提示</view>
<view class="modal-divider"></view>
<view class="modal-item" @click="onSelect('single')">
<text class="text">单独选择</text>
</view>
<view class="modal-divider"></view>
<view class="modal-item" @click="onSelect('group')">
<text class="text">分组选择</text>
</view>
</view>
</template>
<script setup>
import { ref, nextTick } from "vue";
//import uniVideo from "@/components/uniVideo/uniVideo.vue";
import { onLoad, onShow,onReady } from "@dcloudio/uni-app";
import { onLoad, onShow,onReady,onUnload } 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";
@@ -245,11 +264,13 @@ import logoImg from "@/static/weiboShare.png";
import isAndroid from "@/utils/platform.js";
import avastarImg from "@/static/avastar.png";
import playImg from "@/static/play.png";
import paitientImg from "@/static/info_icon_1.png";
import api from "@/api/api";
import docUrl from "@/utils/docUrl";
import navTo from "@/utils/navTo";
const shareLink = ref("");
import otherHost from "@/utils/otherHost";
const selectedPatients = ref([]);
const video_uuid = ref("");
const videoInfo = ref({});
const networkVisible = ref(false);
@@ -270,6 +291,7 @@ const downLoadStatus = ref('start');
let downList = uni.getStorageSync("downLoadVideo") || [];
const downLoadList = ref(downList);
const isFullScreen = ref(false);
const showModal = ref(false);
//import DomVideoPlayer from 'uniapp-video-player'
//import sunnyVideo from "@/uni_modules/sunny-video/components/sunny-video/sunny-video.vue";
@@ -500,6 +522,16 @@ const collection = async () => {
videoDetail();
}
};
const addpoint=()=>{
api.addBonusPointsN({
score_type:5
}).then(res=>{
if(res.code==200){
}
})
}
const discollection = async () => {
const res = await api.discollection({
other_uuid: video_uuid.value,
@@ -573,8 +605,17 @@ const resumeDownloadingTasks = () => {
});
});
};
onUnload(() => {
uni.$off('selectedChatPatientsSingle');
});
onShow(() => {
uni.$on('selectedChatPatientsSingle',(data)=>{
console.log(data)
selectedPatients.value = data.patients;
if(type.value == 'patientVideo') {
addGroupSendMsg4YunXin()
}
});
hasDownload.value = false;
downLoadStatus.value = 'start';
console.log('onShow');
@@ -622,10 +663,65 @@ onShow(() => {
});
const shareRef = ref();
const shareActionLocked = ref(false);
const lastShareActionAt = ref(0);
const runShareActionOnce = (action) => {
const now = Date.now();
if (shareActionLocked.value) return false;
if (now - Number(lastShareActionAt.value || 0) < 800) return false;
shareActionLocked.value = true;
lastShareActionAt.value = now;
try {
action && action();
} finally {
setTimeout(() => {
shareActionLocked.value = false;
}, 500);
}
return true;
};
// 分享APP
const shareToggle = () => {
shareRef.value.open();
};
const shareToPatient = () => {
if (!runShareActionOnce(() => {})) return;
closeShare();
setTimeout(() => {
openModal();
}, 120);
};
const openModal = () => {
showModal.value = true;
};
const closeModal = () => {
showModal.value = false;
};
const addGroupSendMsg4YunXin=async()=>{
const res=await api.addGroupSendMsg4YunXin({
patient_user_uuid: selectedPatients.value.map(item => item.uuid).join(','),
msg_content: videoInfo.value.uuid,
msg_type:4,
});
if(res.code==200){
uni.showToast({ title: "推荐成功", icon: "none" });
}else{
uni.showToast({ title: res.msg, icon: "none" });
}
}
const onSelect = (type) => {
showModal.value = false;
if (type === "single") {
navTo({
url: "/pages_app/selectPatient/selectPatient?from=videoDetail",
});
} else if (type === "group") {
navTo({
url: "/pages_chat/patientGroup/patientGroup?from=videoDetail",
});
}
};
// 关闭分享弹窗
const closeShare = () => {
@@ -634,6 +730,10 @@ const closeShare = () => {
// 分享到微信
const shareToWechat = () => {
if (!runShareActionOnce(() => {})) return;
if(type.value == 'patientVideo') {
addpoint();
}
// #ifdef APP-PLUS
// 使用系统分享
uni.downloadFile({
@@ -652,6 +752,7 @@ const shareToWechat = () => {
href: shareLink.value,
imageUrl: res2.tempFilePath,
success: function (res) {
console.log("success:" + JSON.stringify(res));
},
fail: function (err) {
@@ -729,6 +830,10 @@ const shareToWechat = () => {
// 分享到朋友圈
const shareToMoments = () => {
if (!runShareActionOnce(() => {})) return;
if(type.value == 'patientVideo') {
addpoint();
}
// #ifdef APP-PLUS
uni.downloadFile({
url: isAndroid?docUrl + videoInfo.value.imgpath:'https://doc.igandan.com/app/html/img/2016/20160714132557.png',
@@ -746,6 +851,7 @@ const shareToMoments = () => {
href: shareLink.value,
imageUrl: res2.tempFilePath,
success: function (res) {
//console.log("success:" + JSON.stringify(res));
},
fail: function (err) {
@@ -783,6 +889,7 @@ const shareToMoments = () => {
// 分享到新浪微博
const shareToWeibo = () => {
if (!runShareActionOnce(() => {})) return;
// #ifdef APP-PLUS
uni.share({
provider: "sinaweibo",
@@ -831,19 +938,23 @@ const shareToWeibo = () => {
closeShare();
};
const from = ref('');
const type = ref('');
// 使用uni-app的onLoad生命周期
onLoad((options) => {
if(options.type) {
type.value = options.type;
}
uni.getSystemInfo({
success: function (res) {
videoWidth.value = res.windowWidth; // 窗口宽度
},
});
console.log('enrtyVideoDetail');
uni.sendNativeEvent('enrtyVideoDetail', {
msg: 'enrtyVideoDetail'
}, ret => {
console.log(ret);
})
// uni.sendNativeEvent('enrtyVideoDetail', {
// msg: 'enrtyVideoDetail'
// }, ret => {
// console.log(ret);
// })
video_uuid.value = options.id;
from.value = options.from;
if(from.value != 'download') {
@@ -1503,6 +1614,50 @@ $theme-color: #8b2316;
background-color: #f5f5f5;
}
/* 选择弹窗(与 groupMessage 保持一致) */
.mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.6);
z-index: 1100;
}
.center-modal {
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
margin-top:100rpx;
width: 650rpx;
background: #ffffff;
border-radius: 16rpx;
z-index: 9999999;
overflow: hidden;
box-shadow: 0 10rpx 40rpx rgba(0, 0, 0, 0.15);
}
.modal-title {
text-align: center;
font-size: 34rpx;
color: #8b2316;
padding: 28rpx 20rpx;
}
.modal-item {
padding: 36rpx 28rpx;
font-size: 30rpx;
color: #333333;
background: #ffffff;
}
.modal-divider {
height: 2rpx;
background: #eeeeee;
}
// 删除确认弹窗
.delete-modal-mask {
position: fixed;