3.17
This commit is contained in:
parent
4a22470f38
commit
b5cc11ddd3
@ -108,9 +108,12 @@
|
||||
<view class="item-title">{{ news.title }}</view>
|
||||
<view class="item-meta">
|
||||
<text class="item-date">{{ formatDate(news.createDate) }}</text>
|
||||
<view class="item-stats">
|
||||
<view class="item-stats middel" >
|
||||
<uni-icons type="eye" size="14" color="#999"></uni-icons>
|
||||
<text>{{ news.readnum || 0 }}</text>
|
||||
|
||||
</view>
|
||||
<view class="item-stats">
|
||||
<uni-icons type="hand-up" size="14" color="#999" style="margin-left: 20rpx;"></uni-icons>
|
||||
<text>{{ news.agreenum || 0 }}</text>
|
||||
</view>
|
||||
@ -736,17 +739,24 @@
|
||||
color: #999;
|
||||
|
||||
.item-date {
|
||||
width:125rpx;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.item-stats {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
|
||||
text {
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
}
|
||||
.middel {
|
||||
width:95rpx;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -399,7 +399,7 @@
|
||||
const videoId = video.id || video.uuid;
|
||||
|
||||
navTo({
|
||||
url: `/pages_app/videoDetail/videoDetail?id=${videoId}`
|
||||
url: `/pages_app/videoDetail/videoDetail?id=${videoId}&type=patientVideo`
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -136,10 +136,10 @@
|
||||
const requestPage = patientListPage.value
|
||||
const res = await api.patientListByGBKPage({
|
||||
page: requestPage,
|
||||
pageNum: requestPage,
|
||||
current: requestPage,
|
||||
//pageNum: requestPage,
|
||||
//current: requestPage,
|
||||
pageSize: patientListPageSize.value,
|
||||
size: patientListPageSize.value
|
||||
//size: patientListPageSize.value
|
||||
})
|
||||
if (!isApiSuccess(res)) return
|
||||
const { list, total, pageNum, pages, isLastPage } = parsePagedPatients(res)
|
||||
@ -175,8 +175,8 @@
|
||||
title: '加载中...',
|
||||
mask: true
|
||||
})
|
||||
if(options.from == 'chatMsg'){
|
||||
from.value = 'chatMsg';
|
||||
if(options.from ){
|
||||
from.value =options.from;
|
||||
}
|
||||
// 读取已选中的成员ID
|
||||
try {
|
||||
@ -257,7 +257,7 @@
|
||||
}
|
||||
const goBack = () => uni.navigateBack()
|
||||
const confirmSelect = () => {
|
||||
if(from.value == 'chatMsg'){
|
||||
if(from.value == 'chatMsg' || from.value == 'videoDetail'){
|
||||
if(selectedIds.value.length >200){
|
||||
uni.showToast({
|
||||
title: '选择人数不能超过200',
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -2,16 +2,21 @@
|
||||
<view class="container" :style="{ backgroundColor: backgroundColor }">
|
||||
<!-- 分享弹窗 -->
|
||||
|
||||
<view class="navbox">
|
||||
<view class="navbox" style="z-index:9999999999999999999999999999999">
|
||||
<view class="status_bar"></view>
|
||||
<uni-nav-bar
|
||||
left-icon="left"
|
||||
:title="title"
|
||||
@clickLeft="goBack"
|
||||
@click-left="goBack"
|
||||
color="#8B2316"
|
||||
:border="false"
|
||||
backgroundColor="#eeeeee"
|
||||
>
|
||||
<template #left>
|
||||
<view class="back-hit" @click.stop="goBack">
|
||||
<uni-icons type="left" size="22" color="#8B2316"></uni-icons>
|
||||
</view>
|
||||
</template>
|
||||
<template #right>
|
||||
<view class="nav-actions">
|
||||
<view class="collect-img" @click="shareToggle" v-if="canShare">
|
||||
@ -27,7 +32,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<web-view
|
||||
v-if="safeUrl"
|
||||
v-if="safeUrl && !usePlusWebview"
|
||||
:src="safeUrl"
|
||||
:webview-styles="webviewStyles"
|
||||
></web-view>
|
||||
@ -102,7 +107,8 @@ import docUrl from "@/utils/docUrl";
|
||||
import likeImg from "@/static/argee_sure.png";
|
||||
import dislikeImg from "@/static/argee_no.png";
|
||||
import shareImgBottom from "@/static/icon_share.png";
|
||||
|
||||
import paitientImg from "@/static/info_icon_1.png";
|
||||
const selectedPatients = ref([]);
|
||||
const title = ref("新闻详情");
|
||||
const type = ref("");
|
||||
const safeUrl = ref("");
|
||||
@ -124,11 +130,13 @@ const NAV_BAR_HEIGHT_PX = 44;
|
||||
const WEBVIEW_BOTTOM_PX = 55;
|
||||
const webviewTopPx = ref(88);
|
||||
const webviewBottomPx = ref(WEBVIEW_BOTTOM_PX);
|
||||
const usePlusWebview = ref(false);
|
||||
const appPlusWebview = ref(null);
|
||||
|
||||
const webviewStyles = ref({
|
||||
width: "100%",
|
||||
top: `${webviewTopPx.value}px`,
|
||||
bottom: `${webviewBottomPx.value}px`
|
||||
top: webviewTopPx.value,
|
||||
bottom: webviewBottomPx.value
|
||||
});
|
||||
const applyWebviewLayout = () => {
|
||||
const resInfo = uni.getSystemInfoSync();
|
||||
@ -140,9 +148,20 @@ const applyWebviewLayout = () => {
|
||||
webviewBottomPx.value = Math.round(WEBVIEW_BOTTOM_PX + safeAreaBottom);
|
||||
webviewStyles.value = {
|
||||
width: "100%",
|
||||
top: `${webviewTopPx.value}px`,
|
||||
bottom: `${webviewBottomPx.value}px`
|
||||
top: webviewTopPx.value,
|
||||
bottom: webviewBottomPx.value
|
||||
};
|
||||
// #ifdef APP-PLUS
|
||||
if (usePlusWebview.value && appPlusWebview.value) {
|
||||
appPlusWebview.value.setStyle({
|
||||
top: `${webviewTopPx.value}px`,
|
||||
bottom: `${webviewBottomPx.value}px`,
|
||||
scalable: true,
|
||||
videoFullscreen: "landscape",
|
||||
zIndex: -1,
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
};
|
||||
const initWebviewLayout = () => {
|
||||
applyWebviewLayout();
|
||||
@ -150,7 +169,34 @@ const initWebviewLayout = () => {
|
||||
const onWindowResize = () => {
|
||||
applyWebviewLayout();
|
||||
};
|
||||
|
||||
const addpoint=()=>{
|
||||
console.log('添加积分1')
|
||||
api.addBonusPointsN({
|
||||
score_type:5
|
||||
}).then(res=>{
|
||||
console.log('添加积分2')
|
||||
console.log(res)
|
||||
if(res.code==200){
|
||||
|
||||
//uni.showToast({ title: "添加积分成功", icon: "none" });
|
||||
}else{
|
||||
|
||||
//uni.showToast({ title: res.msg, icon: "none" });
|
||||
}
|
||||
}).catch(err=>{
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: res.message,
|
||||
showCancel: false,
|
||||
success: (res) => {
|
||||
if(res.confirm){
|
||||
//uni.navigateBack();
|
||||
}
|
||||
}
|
||||
});
|
||||
//uni.showToast({ title: err.msg, icon: "none" });
|
||||
})
|
||||
}
|
||||
const getCollect = () => {
|
||||
api
|
||||
.getCollect({
|
||||
@ -294,7 +340,10 @@ const getKePuCollection = () => {
|
||||
});
|
||||
};
|
||||
const goBack = () => {
|
||||
closeNativePopup();
|
||||
closeSelectNativePopup();
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
fail() {
|
||||
uni.redirectTo({
|
||||
url: "/pages/index/index",
|
||||
@ -303,8 +352,56 @@ const goBack = () => {
|
||||
});
|
||||
};
|
||||
const webviewRef = ref(null);
|
||||
const createAppPlusWebview = (url) => {
|
||||
// #ifdef APP-PLUS
|
||||
try {
|
||||
if (!url) return;
|
||||
const pages = getCurrentPages();
|
||||
const page = pages[pages.length - 1];
|
||||
const currentWebview = page && page.$getAppWebview ? page.$getAppWebview() : null;
|
||||
if (!currentWebview) return;
|
||||
if (appPlusWebview.value && appPlusWebview.value.close) {
|
||||
appPlusWebview.value.close();
|
||||
appPlusWebview.value = null;
|
||||
}
|
||||
const wv = plus.webview.create("", "webview-class-content", {
|
||||
top: `${webviewTopPx.value}px`,
|
||||
bottom: `${webviewBottomPx.value}px`,
|
||||
scalable: true,
|
||||
videoFullscreen: "landscape",
|
||||
zIndex: -1,
|
||||
});
|
||||
wv.loadURL(url);
|
||||
currentWebview.append(wv);
|
||||
appPlusWebview.value = wv;
|
||||
} catch (error) {
|
||||
console.log("createAppPlusWebview error:", error);
|
||||
}
|
||||
// #endif
|
||||
};
|
||||
const addGroupSendMsg4YunXin=async()=>{
|
||||
const res=await api.addGroupSendMsg4YunXin({
|
||||
patient_user_uuid: selectedPatients.value.map(item => item.uuid).join(','),
|
||||
msg_content: uuid.value,
|
||||
msg_type:3,
|
||||
});
|
||||
if(res.code==200){
|
||||
uni.showToast({ title: "推荐成功", icon: "none" });
|
||||
|
||||
}else{
|
||||
uni.showToast({ title: res.msg, icon: "none" });
|
||||
}
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
uni.$on('selectedChatPatientsSingle',(data)=>{
|
||||
console.log('监听数据')
|
||||
console.log(data)
|
||||
selectedPatients.value = data.patients;
|
||||
if(type.value == 'huanjiao') {
|
||||
addGroupSendMsg4YunXin()
|
||||
}
|
||||
});
|
||||
initWebviewLayout();
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
@ -329,6 +426,9 @@ onLoad((query) => {
|
||||
mask: true,
|
||||
});
|
||||
initWebviewLayout();
|
||||
// #ifdef APP-PLUS
|
||||
usePlusWebview.value = true;
|
||||
// #endif
|
||||
if (typeof uni.onWindowResize === "function") {
|
||||
uni.onWindowResize(onWindowResize);
|
||||
}
|
||||
@ -435,10 +535,12 @@ onLoad((query) => {
|
||||
// });
|
||||
// 创建并展示原生弹窗
|
||||
createNativePopup();
|
||||
createAppPlusWebview(safeUrl.value);
|
||||
|
||||
// #endif
|
||||
} catch (e) {
|
||||
safeUrl.value = raw;
|
||||
createAppPlusWebview(safeUrl.value);
|
||||
}
|
||||
});
|
||||
const shareRef = ref(null);
|
||||
@ -472,6 +574,23 @@ const closeShare = () => {
|
||||
const nativeMaskView = ref(null);
|
||||
const nativePopupView = ref(null);
|
||||
const popupShowing = ref(false);
|
||||
const shareActionLocked = ref(false);
|
||||
const nativeSelectMaskView = ref(null);
|
||||
const nativeSelectPopupView = ref(null);
|
||||
const selectPopupShowing = ref(false);
|
||||
const selectActionLocked = ref(false);
|
||||
const selectNavigateLocked = ref(false);
|
||||
const lastSelectNavigateAt = ref(0);
|
||||
const selectPopupInfo = ref({
|
||||
screenW: 0,
|
||||
screenH: 0,
|
||||
panelW: 0,
|
||||
panelH: 0,
|
||||
panelLeft: 0,
|
||||
panelTop: 0,
|
||||
titleH: 0,
|
||||
itemH: 0,
|
||||
});
|
||||
// 保存弹窗尺寸信息,供事件处理使用
|
||||
const popupInfo = ref({
|
||||
screenW: 0,
|
||||
@ -578,11 +697,17 @@ function createNativePopup() {
|
||||
weight: "500",
|
||||
}
|
||||
);
|
||||
const items = [
|
||||
{ id: "it-wechat", text: "微信" },
|
||||
{ id: "it-moments", text: "朋友圈" },
|
||||
// { id: 'it-weibo', text: '微博' }
|
||||
];
|
||||
const showPatientShare = type.value === "huanjiao";
|
||||
const items = showPatientShare
|
||||
? [
|
||||
{ id: "it-patient", text: "患者" },
|
||||
{ id: "it-wechat", text: "微信" },
|
||||
{ id: "it-moments", text: "朋友圈" },
|
||||
]
|
||||
: [
|
||||
{ id: "it-wechat", text: "微信" },
|
||||
{ id: "it-moments", text: "朋友圈" },
|
||||
];
|
||||
// 三个分享项区域(使用图标)
|
||||
const itemW = screenW / items.length;
|
||||
const iconTop = contentTop;
|
||||
@ -597,11 +722,16 @@ function createNativePopup() {
|
||||
});
|
||||
|
||||
// 图标文件名映射(直接使用文件名,避免路径转换问题)
|
||||
const iconFiles = [
|
||||
"share_weixin.png", // 微信
|
||||
"share_wxc.png", // 朋友圈
|
||||
"share_sina.png", // 微博
|
||||
];
|
||||
const iconFiles = showPatientShare
|
||||
? [
|
||||
"info_icon_1.png", // 患者
|
||||
"share_weixin.png", // 微信
|
||||
"share_wxc.png", // 朋友圈
|
||||
]
|
||||
: [
|
||||
"share_weixin.png", // 微信
|
||||
"share_wxc.png", // 朋友圈
|
||||
];
|
||||
|
||||
items.forEach((it, idx) => {
|
||||
const left = idx * itemW;
|
||||
@ -747,12 +877,22 @@ function createNativePopup() {
|
||||
}
|
||||
);
|
||||
// 事件处理函数
|
||||
const lockShareAction = () => {
|
||||
if (shareActionLocked.value) return false;
|
||||
shareActionLocked.value = true;
|
||||
setTimeout(() => {
|
||||
shareActionLocked.value = false;
|
||||
}, 300);
|
||||
return true;
|
||||
};
|
||||
const handleMaskClick = () => {
|
||||
if (!lockShareAction()) return;
|
||||
console.log("遮罩被点击");
|
||||
closeNativePopup();
|
||||
};
|
||||
|
||||
const handlePanelClick = (e) => {
|
||||
if (!lockShareAction()) return;
|
||||
console.log("面板被点击", e);
|
||||
const info = popupInfo.value;
|
||||
|
||||
@ -837,9 +977,9 @@ function createNativePopup() {
|
||||
);
|
||||
|
||||
if (relativeY >= shareAreaTop && relativeY <= shareAreaBottom) {
|
||||
// 计算点击的是第几个分享项(0:微信, 1:朋友圈, 2:微博)
|
||||
// 计算点击的是第几个分享项
|
||||
const itemWidth = info.screenW / items.length;
|
||||
const idx = Math.min(2, Math.max(0, Math.floor(relativeX / itemWidth)));
|
||||
const idx = Math.min(items.length - 1, Math.max(0, Math.floor(relativeX / itemWidth)));
|
||||
|
||||
console.log(
|
||||
"点击了分享项:",
|
||||
@ -850,18 +990,30 @@ function createNativePopup() {
|
||||
itemWidth
|
||||
);
|
||||
|
||||
if (idx === 0) {
|
||||
console.log("执行微信分享");
|
||||
shareToWechat();
|
||||
closeNativePopup();
|
||||
} else if (idx === 1) {
|
||||
console.log("执行朋友圈分享");
|
||||
shareToMoments();
|
||||
closeNativePopup();
|
||||
} else if (idx === 2) {
|
||||
console.log("执行微博分享");
|
||||
// shareToWeibo();
|
||||
// closeNativePopup();
|
||||
if (showPatientShare) {
|
||||
if (idx === 0) {
|
||||
console.log("执行患者选择");
|
||||
closeNativePopup();
|
||||
showSelectNativePopup();
|
||||
} else if (idx === 1) {
|
||||
console.log("执行微信分享");
|
||||
shareToWechat();
|
||||
closeNativePopup();
|
||||
} else if (idx === 2) {
|
||||
console.log("执行朋友圈分享");
|
||||
shareToMoments();
|
||||
closeNativePopup();
|
||||
}
|
||||
} else {
|
||||
if (idx === 0) {
|
||||
console.log("执行微信分享");
|
||||
shareToWechat();
|
||||
closeNativePopup();
|
||||
} else if (idx === 1) {
|
||||
console.log("执行朋友圈分享");
|
||||
shareToMoments();
|
||||
closeNativePopup();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log(
|
||||
@ -875,12 +1027,8 @@ function createNativePopup() {
|
||||
}
|
||||
};
|
||||
|
||||
// 同时监听 click 和 touchstart 事件
|
||||
nativeMaskView.value.addEventListener("click", handleMaskClick, false);
|
||||
nativeMaskView.value.addEventListener("touchstart", handleMaskClick, false);
|
||||
|
||||
nativePopupView.value.addEventListener("click", handlePanelClick, false);
|
||||
nativePopupView.value.addEventListener("touchstart", handlePanelClick, false);
|
||||
// 仅监听 touchend,避免 click/touchstart/touchend 重复触发
|
||||
nativeMaskView.value.addEventListener("touchend", handleMaskClick, false);
|
||||
nativePopupView.value.addEventListener("touchend", handlePanelClick, false);
|
||||
// #endif
|
||||
}
|
||||
@ -905,9 +1053,199 @@ function closeNativePopup() {
|
||||
popupShowing.value = false;
|
||||
// #endif
|
||||
}
|
||||
function createSelectNativePopup() {
|
||||
// #ifdef APP-PLUS
|
||||
if (nativeSelectMaskView.value || nativeSelectPopupView.value) return;
|
||||
const screenW = plus.screen.resolutionWidth;
|
||||
const screenH = plus.screen.resolutionHeight;
|
||||
const panelW = Math.round(uni.upx2px(650));
|
||||
const titleH = Math.round(uni.upx2px(96));
|
||||
const itemH = Math.round(uni.upx2px(110));
|
||||
const panelH = titleH + itemH * 2 + 2;
|
||||
const panelLeft = Math.round((screenW - panelW) / 2);
|
||||
const panelTop = Math.round((screenH - panelH) / 2);
|
||||
|
||||
selectPopupInfo.value = {
|
||||
screenW,
|
||||
screenH,
|
||||
panelW,
|
||||
panelH,
|
||||
panelLeft,
|
||||
panelTop,
|
||||
titleH,
|
||||
itemH,
|
||||
};
|
||||
|
||||
nativeSelectMaskView.value = new plus.nativeObj.View(
|
||||
"native-select-mask",
|
||||
{
|
||||
left: "0px",
|
||||
top: "0px",
|
||||
width: `${screenW}px`,
|
||||
height: `${screenH}px`,
|
||||
zindex: 99998,
|
||||
touchable: true,
|
||||
interceptTouchEvent: true,
|
||||
},
|
||||
[
|
||||
{
|
||||
tag: "rect",
|
||||
id: "mask",
|
||||
position: {
|
||||
left: "0px",
|
||||
top: "0px",
|
||||
width: `${screenW}px`,
|
||||
height: `${screenH}px`,
|
||||
},
|
||||
color: "rgba(0,0,0,0.6)",
|
||||
},
|
||||
]
|
||||
);
|
||||
|
||||
nativeSelectPopupView.value = new plus.nativeObj.View(
|
||||
"native-select-panel",
|
||||
{
|
||||
left: `${panelLeft}px`,
|
||||
top: `${panelTop}px`,
|
||||
width: `${panelW}px`,
|
||||
height: `${panelH}px`,
|
||||
zindex: 99999,
|
||||
touchable: true,
|
||||
interceptTouchEvent: true,
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
const radius = Math.round(uni.upx2px(16));
|
||||
nativeSelectPopupView.value.drawRect(
|
||||
{ color: "#FFFFFF", radius, rectStyles: {} },
|
||||
{ left: "0px", top: "0px", width: `${panelW}px`, height: `${panelH}px` }
|
||||
);
|
||||
nativeSelectPopupView.value.drawText(
|
||||
"温馨提示",
|
||||
{ left: "0px", top: "0px", width: `${panelW}px`, height: `${titleH}px` },
|
||||
{
|
||||
size: `${Math.round(uni.upx2px(34))}px`,
|
||||
color: "#8B2316",
|
||||
align: "center",
|
||||
verticalAlign: "middle",
|
||||
weight: "500",
|
||||
}
|
||||
);
|
||||
nativeSelectPopupView.value.drawRect(
|
||||
{ color: "#EEEEEE" },
|
||||
{ left: "0px", top: `${titleH}px`, width: `${panelW}px`, height: "1px" }
|
||||
);
|
||||
nativeSelectPopupView.value.drawText(
|
||||
"单独选择",
|
||||
{ left: "0px", top: `${titleH}px`, width: `${panelW}px`, height: `${itemH}px` },
|
||||
{
|
||||
size: `${Math.round(uni.upx2px(30))}px`,
|
||||
color: "#333333",
|
||||
align: "center",
|
||||
verticalAlign: "middle",
|
||||
}
|
||||
);
|
||||
nativeSelectPopupView.value.drawRect(
|
||||
{ color: "#EEEEEE" },
|
||||
{ left: "0px", top: `${titleH + itemH}px`, width: `${panelW}px`, height: "1px" }
|
||||
);
|
||||
nativeSelectPopupView.value.drawText(
|
||||
"分组选择",
|
||||
{ left: "0px", top: `${titleH + itemH}px`, width: `${panelW}px`, height: `${itemH}px` },
|
||||
{
|
||||
size: `${Math.round(uni.upx2px(30))}px`,
|
||||
color: "#333333",
|
||||
align: "center",
|
||||
verticalAlign: "middle",
|
||||
}
|
||||
);
|
||||
|
||||
const navigateFromSelectPopup = (url) => {
|
||||
const now = Date.now();
|
||||
if (selectNavigateLocked.value) return;
|
||||
if (now - Number(lastSelectNavigateAt.value || 0) < 800) return;
|
||||
selectNavigateLocked.value = true;
|
||||
lastSelectNavigateAt.value = now;
|
||||
uni.navigateTo({
|
||||
url,
|
||||
complete: () => {
|
||||
setTimeout(() => {
|
||||
selectNavigateLocked.value = false;
|
||||
}, 500);
|
||||
},
|
||||
});
|
||||
};
|
||||
const lockSelectAction = () => {
|
||||
if (selectActionLocked.value) return false;
|
||||
selectActionLocked.value = true;
|
||||
setTimeout(() => {
|
||||
selectActionLocked.value = false;
|
||||
}, 300);
|
||||
return true;
|
||||
};
|
||||
const handleMaskClick = () => {
|
||||
if (!lockSelectAction()) return;
|
||||
closeSelectNativePopup();
|
||||
};
|
||||
const handlePanelClick = (e) => {
|
||||
if (!lockSelectAction()) return;
|
||||
const info = selectPopupInfo.value;
|
||||
let x = 0;
|
||||
let y = 0;
|
||||
if (e.clientX !== undefined && e.clientY !== undefined) {
|
||||
x = e.clientX;
|
||||
y = e.clientY;
|
||||
} else if (e.pageX !== undefined && e.pageY !== undefined) {
|
||||
x = e.pageX;
|
||||
y = e.pageY;
|
||||
} else if (e.touches && e.touches.length > 0) {
|
||||
x = e.touches[0].clientX || e.touches[0].pageX || 0;
|
||||
y = e.touches[0].clientY || e.touches[0].pageY || 0;
|
||||
} else if (e.changedTouches && e.changedTouches.length > 0) {
|
||||
x = e.changedTouches[0].clientX || e.changedTouches[0].pageX || 0;
|
||||
y = e.changedTouches[0].clientY || e.changedTouches[0].pageY || 0;
|
||||
}
|
||||
if (!x || !y) return;
|
||||
const relativeY = y > info.panelH ? y - info.panelTop : y;
|
||||
if (relativeY >= info.titleH && relativeY < info.titleH + info.itemH) {
|
||||
closeSelectNativePopup();
|
||||
navigateFromSelectPopup("/pages_app/selectPatient/selectPatient?from=patientVideo");
|
||||
return;
|
||||
}
|
||||
if (relativeY >= info.titleH + info.itemH && relativeY < info.titleH + info.itemH * 2) {
|
||||
closeSelectNativePopup();
|
||||
navigateFromSelectPopup("/pages_chat/patientGroup/patientGroup?from=patientVideo");
|
||||
}
|
||||
};
|
||||
|
||||
nativeSelectMaskView.value.addEventListener("touchend", handleMaskClick, false);
|
||||
nativeSelectPopupView.value.addEventListener("touchend", handlePanelClick, false);
|
||||
// #endif
|
||||
}
|
||||
function showSelectNativePopup() {
|
||||
// #ifdef APP-PLUS
|
||||
if (selectPopupShowing.value) return;
|
||||
if (!nativeSelectMaskView.value || !nativeSelectPopupView.value) {
|
||||
createSelectNativePopup();
|
||||
}
|
||||
nativeSelectMaskView.value && nativeSelectMaskView.value.show();
|
||||
nativeSelectPopupView.value && nativeSelectPopupView.value.show();
|
||||
selectPopupShowing.value = true;
|
||||
// #endif
|
||||
}
|
||||
function closeSelectNativePopup() {
|
||||
// #ifdef APP-PLUS
|
||||
if (!selectPopupShowing.value) return;
|
||||
nativeSelectMaskView.value && nativeSelectMaskView.value.hide();
|
||||
nativeSelectPopupView.value && nativeSelectPopupView.value.hide();
|
||||
selectPopupShowing.value = false;
|
||||
// #endif
|
||||
}
|
||||
|
||||
// 分享到微信
|
||||
const shareToWechat = () => {
|
||||
addpoint();
|
||||
// #ifdef APP-PLUS
|
||||
// 使用系统分享
|
||||
uni.downloadFile({
|
||||
@ -926,7 +1264,9 @@ const shareToWechat = () => {
|
||||
href: safeUrl.value,
|
||||
imageUrl: res2.tempFilePath,
|
||||
success: function (res) {
|
||||
console.log('分享微信成功')
|
||||
console.log("success:" + JSON.stringify(res));
|
||||
|
||||
},
|
||||
fail: function (err) {
|
||||
console.log("fail:" + JSON.stringify(err));
|
||||
@ -991,25 +1331,40 @@ const shareToWechat = () => {
|
||||
onHide(() => {
|
||||
// #ifdef APP-PLUS
|
||||
closeNativePopup();
|
||||
closeSelectNativePopup();
|
||||
// #endif
|
||||
});
|
||||
onUnload(() => {
|
||||
// #ifdef APP-PLUS
|
||||
try {
|
||||
appPlusWebview.value &&
|
||||
appPlusWebview.value.close &&
|
||||
appPlusWebview.value.close();
|
||||
nativeMaskView.value &&
|
||||
nativeMaskView.value.close &&
|
||||
nativeMaskView.value.close();
|
||||
nativePopupView.value &&
|
||||
nativePopupView.value.close &&
|
||||
nativePopupView.value.close();
|
||||
nativeSelectMaskView.value &&
|
||||
nativeSelectMaskView.value.close &&
|
||||
nativeSelectMaskView.value.close();
|
||||
nativeSelectPopupView.value &&
|
||||
nativeSelectPopupView.value.close &&
|
||||
nativeSelectPopupView.value.close();
|
||||
} catch (e) {}
|
||||
nativeMaskView.value = null;
|
||||
nativePopupView.value = null;
|
||||
nativeSelectMaskView.value = null;
|
||||
nativeSelectPopupView.value = null;
|
||||
appPlusWebview.value = null;
|
||||
popupShowing.value = false;
|
||||
selectPopupShowing.value = false;
|
||||
// #endif
|
||||
});
|
||||
// 分享到朋友圈
|
||||
const shareToMoments = () => {
|
||||
addpoint();
|
||||
// #ifdef APP-PLUS
|
||||
uni.downloadFile({
|
||||
url: shareImg.value,
|
||||
@ -1028,6 +1383,7 @@ const shareToMoments = () => {
|
||||
imageUrl: res2.tempFilePath,
|
||||
success: function (res) {
|
||||
console.log("success:" + JSON.stringify(res));
|
||||
//addpoint();
|
||||
},
|
||||
fail: function (err) {
|
||||
console.log("fail:" + JSON.stringify(err));
|
||||
@ -1254,6 +1610,12 @@ const shareToWeibo = () => {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.back-hit {
|
||||
height: 44px;
|
||||
padding: 0 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.container {
|
||||
height: 100vh;
|
||||
|
||||
@ -126,7 +126,7 @@
|
||||
<view class="bottom-bar" @click="openModal">
|
||||
<view class="btn-primary" >群发消息</view>
|
||||
</view>
|
||||
<!-- 弹窗与遮罩 -->
|
||||
<!-- 选择弹窗 -->
|
||||
<view v-if="showModal" class="mask" @click="closeModal"></view>
|
||||
<view v-if="showModal" class="center-modal">
|
||||
<view class="modal-title">温馨提示</view>
|
||||
|
||||
@ -171,13 +171,16 @@ const selectedPatientCount = computed(() => {
|
||||
|
||||
// 合计数量:只计算去重后的患者数量
|
||||
const totalSelectedCount = computed(() => selectedPatientCount.value);
|
||||
|
||||
onLoad(() => {
|
||||
const from = ref('');
|
||||
onLoad((options) => {
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true
|
||||
});
|
||||
fetchGroupList();
|
||||
if(options.from){
|
||||
from.value = options.from;
|
||||
}
|
||||
});
|
||||
|
||||
const fetchGroupList = async () => {
|
||||
@ -311,7 +314,11 @@ const confirmGroup = () => {
|
||||
}
|
||||
|
||||
try {
|
||||
uni.navigateTo({
|
||||
if(from.value){
|
||||
uni.$emit('selectedChatPatientsSingle', { patients: dedupPatients });
|
||||
uni.navigateBack();
|
||||
}else{
|
||||
uni.navigateTo({
|
||||
url: '/pages_chat/groupSend/groupSend',
|
||||
success: (res) => {
|
||||
try {
|
||||
@ -322,6 +329,8 @@ const confirmGroup = () => {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error('跳转失败', e);
|
||||
uni.showToast({ title: '跳转失败,请重试', icon: 'none' });
|
||||
|
||||
BIN
static/info_icon_1.png
Normal file
BIN
static/info_icon_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.0 KiB |
@ -120,9 +120,9 @@ export const request = (url, data = {}, method = 'post', loading = false, conten
|
||||
if(process.env.UNI_PLATFORM == "mp-weixin"){
|
||||
uni.redirectTo({url:'/pages_app/login/login'})
|
||||
}
|
||||
// else{
|
||||
// uni.navigateTo({url:'/pages_app/login/login'})
|
||||
// }
|
||||
// else{
|
||||
// uni.navigateTo({url:'/pages_app/login/login'})
|
||||
// }
|
||||
uni.sendNativeEvent('getNewToken', {
|
||||
msg: 'getNewToken'
|
||||
},ret => {
|
||||
@ -184,7 +184,9 @@ export const request = (url, data = {}, method = 'post', loading = false, conten
|
||||
|
||||
}else if(res.data.code==106){
|
||||
e(res.data)
|
||||
}else{
|
||||
}else if(res.data.code==202){
|
||||
e(res.data)
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: res.data.message,
|
||||
icon: 'none'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user