|
@@ -4,20 +4,29 @@
|
|
|
<div class="video-wrapper" id="videoRef" :style="{width: pageData.videoWidth + 'px', height: pageData.videoHeight + 'px'}"></div>
|
|
|
|
|
|
<!-- 三menu键 -->
|
|
|
- <div id="foot-menu-wrap" :style="`height: ${footMenuWrapHeight}px`">
|
|
|
+ <div id="foot-menu-wrap" :style="`height: ${pageData.footMenuHeight}px`">
|
|
|
<div @click.stop="sendKey(187)"><van-icon name="wap-nav" size="24px"/></div>
|
|
|
<div @click.stop="sendKey(3)"><van-icon name="wap-home-o" size="24px"/></div>
|
|
|
<div @click.stop="sendKey(4)"><van-icon name="arrow-left" size="24px"/></div>
|
|
|
</div>
|
|
|
|
|
|
<!-- 悬浮按钮 -->
|
|
|
- <FloatBtn :width="pageData.width" :height="pageData.height" @onClick="levitatedSphereVisible = true"/>
|
|
|
+ <FloatBtn :width="pageData.width" :height="pageData.height" :latency="rtcNetwork.currentRoundTripTime" @onClick="levitatedSphereVisible = true"/>
|
|
|
|
|
|
<!-- 左侧popup -->
|
|
|
- <LeftMenuPopup ref="leftMenuPopupRef" :engine="engine" :userCardId="this.parametersData.userCardId" :levitatedSphereVisible.sync="levitatedSphereVisible" @shearplate="shearplate" @exit="exit"/>
|
|
|
+ <LeftMenuPopup
|
|
|
+ ref="leftMenuPopupRef"
|
|
|
+ :engine="engine"
|
|
|
+ :userCardId="this.parametersData.userCardId"
|
|
|
+ :levitatedSphereVisible.sync="levitatedSphereVisible"
|
|
|
+ :latency="rtcNetwork.currentRoundTripTime"
|
|
|
+ @shearplate="shearplate"
|
|
|
+ @funcHandle="funcHandle"
|
|
|
+ @exit="exit"
|
|
|
+ />
|
|
|
|
|
|
<!-- 右侧popup -->
|
|
|
- <RightPopup ref="rightPopupRef" :engine="engine" :userCardId="this.parametersData.userCardId" :levitatedSphereVisible.sync="levitatedSphereVisible" @shearplate="shearplate" @exit="exit"/>
|
|
|
+ <!-- <RightPopup ref="rightPopupRef" :engine="engine" :userCardId="this.parametersData.userCardId" :levitatedSphereVisible.sync="levitatedSphereVisible" @shearplate="shearplate" @exit="exit"/> -->
|
|
|
|
|
|
<!-- 输入并复制到粘贴板 -->
|
|
|
<InputCopy ref="inputCopyRef" @openPasteboard="openPasteboard"/>
|
|
@@ -37,6 +46,7 @@
|
|
|
import meta from './config/meta.js';
|
|
|
import request from './config/request.js';
|
|
|
import logReport from './config/logReport.js';
|
|
|
+import publicMixin from './mixins/public.js';
|
|
|
import * as uni from '../../static/static/js/uni.webview.1.5.2.js';
|
|
|
|
|
|
import FloatBtn from './components/FloatBtn.vue';
|
|
@@ -114,6 +124,7 @@ export default {
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
+ mixins: [publicMixin],
|
|
|
data() {
|
|
|
return {
|
|
|
// 日志上报实例
|
|
@@ -160,7 +171,10 @@ export default {
|
|
|
// 卡的连接信息
|
|
|
connectData: {},
|
|
|
// 云手机引擎 播放器实例
|
|
|
- engine: null,
|
|
|
+ engine: {},
|
|
|
+ rtcNetwork: {
|
|
|
+ currentRoundTripTime: 0, // 当前往返时间(网络延迟)
|
|
|
+ }, // webRtc网络分析数据
|
|
|
doConnectDirectivesWs: null, // 云手机指令通道
|
|
|
doConnectDirectivesIntervalerPing: null, // 业务通道定时标识 云手机指令通道心跳
|
|
|
doConnectDirectivesRequestNum: 1, // 业务通道重连次数
|
|
@@ -172,24 +186,17 @@ export default {
|
|
|
},
|
|
|
// 页面初始化后触发
|
|
|
async fetch() {
|
|
|
- // 预生产环境
|
|
|
- // http://192.168.211.37:3000/h5/rtcEngine/rtc/?record=2990744&userCardId=2990744&mealType=VIP&sourceType=0&userCardType=0&validTime=43200&rm=preZJHZ&authPhone=none&username=CGJkh1646034892SZX&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyYW5kb20iOiI5MTY4OCIsImNsaWVudCI6IjciLCJ1c2VyVHlwZSI6IjIiLCJtZXJjaGFudFNpZ24iOiJTWlgiLCJleHAiOjE3NDc1MjExMTIsInVzZXJuYW1lIjoiQ0dKa2gxNjQ2MDM0ODkyU1pYIn0.zqRNm0uW79VX2KV0sv3r9OsXHFOzkIpZP_tem4-lL4M&isTips=1&isWeixin=0&merchantSign=SZX
|
|
|
- // 测试环境
|
|
|
- // http://192.168.211.37:3000/h5/rtcEngine/rtc/?record=902481&userCardId=902481&mealType=sq&sourceType=0&userCardType=0&validTime=10334&rm=tencent-ap-tianjin-1&authPhone=none&username=0EsH01666175530SZX&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyYW5kb20iOiI0MTg5MyIsImNsaWVudCI6IjciLCJ1c2VyVHlwZSI6IjIiLCJtZXJjaGFudFNpZ24iOiJTWlgiLCJleHAiOjE3NDczODQ2MTgsInVzZXJuYW1lIjoiMEVzSDAxNjY2MTc1NTMwU1pYIn0.fTXawDu4SyEj4mIGr61ZXt0RSXzt3JztPq8-rFe-Zes&isTips=1&isWeixin=0&merchantSign=SZX
|
|
|
// 获取页面传递参数
|
|
|
this.parametersData = this.$route.query;
|
|
|
+
|
|
|
+ this.getCloudList();
|
|
|
+ this.getMealIconInfo();
|
|
|
},
|
|
|
computed: {
|
|
|
// 是否为微信浏览器环境
|
|
|
isWeChatBrowser() {
|
|
|
return this.$userAgent.isWx;
|
|
|
},
|
|
|
- // 底部菜单高度
|
|
|
- footMenuWrapHeight() {
|
|
|
- let num = 40;
|
|
|
- this.pageData.footMenuHeight = num;
|
|
|
- return num;
|
|
|
- }
|
|
|
},
|
|
|
created() {
|
|
|
this.$toast.loading({
|
|
@@ -309,8 +316,8 @@ export default {
|
|
|
} else {
|
|
|
// 当前视口的宽高比小于目标比例,说明高度“过高”,需要以宽度为基准
|
|
|
console.log("当前视口高度过高,应以宽度为基准调整高度");
|
|
|
- this.pageData.videoWidth = videoWidth / targetRatio;
|
|
|
- this.pageData.videoHeight = videoWidth;
|
|
|
+ this.pageData.videoWidth = videoWidth;
|
|
|
+ this.pageData.videoHeight = videoWidth / targetRatio;
|
|
|
console.log(`2目标: 宽${this.pageData.videoWidth},高${this.pageData.videoHeight}`);
|
|
|
}
|
|
|
},
|
|
@@ -567,7 +574,12 @@ export default {
|
|
|
|
|
|
// 连接关闭
|
|
|
engine.on('CONNECT_CLOSE', (r) => {
|
|
|
- console.log("webrtc关闭====★★★★★", r);
|
|
|
+ console.log("webrtc关闭====★★★★★", r);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 网络连接统计信息监听
|
|
|
+ engine.on('NETWORK_STATS', (r) => {
|
|
|
+ this.rtcNetwork = r;
|
|
|
});
|
|
|
|
|
|
// 连接异常
|
|
@@ -687,6 +699,43 @@ export default {
|
|
|
console.log('initControlChannel error', error);
|
|
|
}
|
|
|
},
|
|
|
+ /**
|
|
|
+ * popup 功能按钮点击事件
|
|
|
+ * @param {Object} val 传递的参数
|
|
|
+ * @description 传递的参数格式: { code: 'hideKey', label: '隐藏虚拟键', icon: 'icon-hide' }
|
|
|
+ */
|
|
|
+ funcHandle({code}) {
|
|
|
+ console.log('funcHandle code:', code);
|
|
|
+ switch (code) {
|
|
|
+ case 'hideKey':
|
|
|
+ // 隐藏虚拟按键
|
|
|
+ document.getElementById('foot-menu-wrap').style.display = 'none';
|
|
|
+ this.pageData.footMenuHeight = 0; // 设置底部菜单高度为0
|
|
|
+ this.getInitSize(); // 重新计算视频尺寸
|
|
|
+ this.changeVideoStyle(); // 重新设置视频尺寸
|
|
|
+ break;
|
|
|
+ case 'showKey':
|
|
|
+ // 显示虚拟按键
|
|
|
+ document.getElementById('foot-menu-wrap').style.display = 'flex';
|
|
|
+ this.pageData.footMenuHeight = 40; // 设置底部菜单高度为40px
|
|
|
+ this.getInitSize(); // 重新计算视频尺寸
|
|
|
+ this.changeVideoStyle(); // 重新设置视频尺寸
|
|
|
+ break
|
|
|
+ case 'shearplate':
|
|
|
+ // 粘贴板按钮
|
|
|
+ this.shearplate();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 重新设置视频尺寸
|
|
|
+ changeVideoStyle() {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ // 获取video元素
|
|
|
+ const video = document.getElementById("videoRef").getElementsByTagName('video')[0];
|
|
|
+ video.style.width = this.pageData.videoWidth + 'px';
|
|
|
+ video.style.height = this.pageData.videoHeight + 'px';
|
|
|
+ });
|
|
|
+ },
|
|
|
// 三键
|
|
|
sendKey (keyCode) {
|
|
|
try {
|