|
@@ -4,17 +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"
|
|
|
+ :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"/>
|
|
@@ -34,10 +46,12 @@
|
|
|
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';
|
|
|
import RightPopup from './components/RightPopup.vue';
|
|
|
+import LeftMenuPopup from './components/LeftMenuPopup.vue';
|
|
|
import InputCopy from './components/InputCopy.vue';
|
|
|
import CloudPhoneClipboard from './components/CloudPhoneClipboard.vue';
|
|
|
import TimeoutNoOps from './components/TimeoutNoOps.vue';
|
|
@@ -83,6 +97,7 @@ export default {
|
|
|
CloudPhoneClipboard,
|
|
|
TimeoutNoOps,
|
|
|
TimeBalance,
|
|
|
+ LeftMenuPopup,
|
|
|
},
|
|
|
head() {
|
|
|
return {
|
|
@@ -109,6 +124,7 @@ export default {
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
+ mixins: [publicMixin],
|
|
|
data() {
|
|
|
return {
|
|
|
// 日志上报实例
|
|
@@ -130,11 +146,35 @@ export default {
|
|
|
typeof RTCSessionDescription !== 'undefined'
|
|
|
),
|
|
|
// url 问号后的参数
|
|
|
- parametersData: {},
|
|
|
+ parametersData: {
|
|
|
+ /**
|
|
|
+ * @description: 传递的参数
|
|
|
+ * @param {String} record 数据id
|
|
|
+ * @param {Number} userCardId 云机的id
|
|
|
+ * @param {String} mealType 云机套餐类型 eg: VIP、STARBALL...
|
|
|
+ * @param {Number} sourceType 云机来源: 0:购买 1试用 2:免费激活码 3:免费活动抽奖 4:ar app注册 5:9.9元套餐年卡 ',
|
|
|
+ * @param {Number} userCardType 云机的类型 0 普通套餐 1、2、3:年卡、普通计时、自动续费普通计时
|
|
|
+ * @param {Number} validTime 卡的有效期
|
|
|
+ * @param {String} rm 卡所在的机房
|
|
|
+ * @param {Number} isShowCountdown 是否显示倒计时 0:否 1:是
|
|
|
+ * @param {Number} isShowRule 是否显示规则 0:否 1:是
|
|
|
+ * @param {Number} timingStatus 卡的计时状态 0:停止计时 1:开始计时 2:待确认开始计时"
|
|
|
+ * @param {String} isFirstConnect 是否是首次连接
|
|
|
+ * @param {Number} authPhone 0自身购买的云手机 1获取得到的云手机
|
|
|
+ * @param {String} username 用户名
|
|
|
+ * @param {String} token token
|
|
|
+ * @param {Number} isTips 是否显示提示 0:否 1:是
|
|
|
+ * @param {Number} isWeixin 是否是微信小程序环境 0:否 1:是
|
|
|
+ * @param {String} merchantSign 商户标识
|
|
|
+ */
|
|
|
+ },
|
|
|
// 卡的连接信息
|
|
|
connectData: {},
|
|
|
// 云手机引擎 播放器实例
|
|
|
- engine: null,
|
|
|
+ engine: {},
|
|
|
+ rtcNetwork: {
|
|
|
+ currentRoundTripTime: 0, // 当前往返时间(网络延迟)
|
|
|
+ }, // webRtc网络分析数据
|
|
|
doConnectDirectivesWs: null, // 云手机指令通道
|
|
|
doConnectDirectivesIntervalerPing: null, // 业务通道定时标识 云手机指令通道心跳
|
|
|
doConnectDirectivesRequestNum: 1, // 业务通道重连次数
|
|
@@ -146,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({
|
|
@@ -283,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}`);
|
|
|
}
|
|
|
},
|
|
@@ -541,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;
|
|
|
});
|
|
|
|
|
|
// 连接异常
|
|
@@ -661,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 {
|