Files
video_mini/App.vue
T
2025-08-25 11:20:35 +08:00

175 lines
4.4 KiB
Vue

<script>
import login from "@/utils/login";
// #ifdef MP-WEIXIN
const PlayerManager = require('@/utils/playerManager')
const playletPlugin = requirePlugin('playlet-plugin')
// #endif
export default {
data() {
return {
playerManagerList: [],
}
},
onLaunch: function(e) {
uni.getLocation({
})
let that = this;
if (e.query.invite) {
uni.setStorageSync('invite_number', e.query.invite);
}
if (e.query.fxpid && e.query.fxpid > 0) {
uni.setStorageSync('fxpid', e.query.fxpid);
}
if (e.invite) {
uni.setStorageSync('invite_number', e.invite)
}
if (e.fxpid && e.fxpid > 0) {
uni.setStorageSync('fxpid', e.fxpid)
}
const extConfig = uni.getExtConfigSync ? uni.getExtConfigSync() : {};
if (extConfig.appid) {
this.$config.appId = extConfig.appid;
}
// #ifdef MP-WEIXIN
// 扫描小程序二维码使用
this.getScence(e.query.scene)
this.$nextTick(() => {
playletPlugin.onPageLoad(this.onPlayerLoad.bind(this))
})
// wx.setVisualEffectOnCapture({
// visualEffect: 'hidden',
// success: (res) => {
// console.log(res)
// },
// fail: (err) => {
// console.log(err)
// },
// complete: (res) => {
// console.log(res)
// }
// })
let info = uni.getStorageSync("userinfo");
let token = info ? info.token : '';
if (token) {
login.wxLogin();
}
// #endif
//跨屏幕防止ios录频
// if (/ios/i.test(wx.getSystemInfoSync().system) && wx.getScreenRecordingState) {
// // res.state的值有两种情况 on(正在录屏) | off(没有开始录屏)
// wx.getScreenRecordingState({
// success: res => {
// if (res.state != 'off') {
// // that.setData({
// // isShow: false //这里我对页面进行了遮挡处理
// // })
// } else {
// // that.setData({
// // isShow: true
// // })
// }
// }
// })
// }
// 在当前页面点击录频
// if (/ios/i.test(wx.getSystemInfoSync().system) && wx.onScreenRecordingStateChanged) {
// // res.state的值有两种情况 start(开始录屏) | stop(结束录屏)
// wx.onScreenRecordingStateChanged(res => {
// if (res.state == 'start') {
// that.setData({
// isShow: false //这里我对页面进行了遮挡处理
// })
//
// } else {
// that.setData({
// isShow: true
// })
// }
// })
// }
// 小程序新版本检测
uni.getUpdateManager().onCheckForUpdate(function(res) {
// 请求完新版本信息的回调
if (res.hasUpdate) {
uni.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
uni.getUpdateManager().applyUpdate()
}
}
})
}
})
uni.getSystemInfo({
success: function(res) {
if (res.statusBarHeight == 0) {
res.statusBarHeight = 30;
}
// menuButtonInfo.statusBarHeight = res.statusBarHeight;
// res.menuButtonInfo = menuButtonInfo;
// uni.setStorageSync("setGetSystemInfo", res);
}
})
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
},
methods: {
//获取扫描小程序二维码
getScence(scene) {
const sceneParams = {};
const params = decodeURIComponent(scene).split('&');
for (const param of params) {
const [key, value] = param.split('=');
sceneParams[key] = value;
}
if (sceneParams.invite) {
uni.setStorageSync("invite_number", sceneParams.invite)
}
},
onPlayerLoad(info) {
let destroyedIndex = -1
for (let i = 0; i < this.playerManagerList.length; i++) {
if (this.playerManagerList[i].isDestroy && this.playerManagerList[i].isDestroy()) {
destroyedIndex = i
break
}
}
if (destroyedIndex >= 0) {
this.playerManagerList.splice(destroyedIndex, 1)
}
const playerManager = new PlayerManager()
playerManager._onPlayerLoad(info)
this.playerManagerList.push(playerManager)
console.log('this.playerManagerList', this.playerManagerList.length)
},
}
}
</script>
<style>
@import url("@/utils/default.css");
view {
box-sizing: border-box;
}
/*每个页面公共css */
</style>