| | |
| | | <script setup> |
| | | import {onHide, onLaunch, onShow} from "@dcloudio/uni-app"; |
| | | import {useAppStore, useUserStore} from "@/store"; |
| | | import {genTestUserSig} from '@/utils/voiceCallByTX/GenerateTestUserSig.js'; |
| | | import {onHide, onLaunch, onShow} from "@dcloudio/uni-app"; |
| | | import {useAppStore, useUserStore} from "@/store"; |
| | | import {useGlobalWS} from "@/hooks/useGlobalWS.js"; |
| | | |
| | | const appStore = useAppStore(); |
| | | const userStore = useUserStore(); |
| | | |
| | | useGlobalWS() |
| | | |
| | | const appStore = useAppStore(); |
| | | const userStore = useUserStore(); |
| | | const userId = computed(() => userStore?.userInfo?.user_id) |
| | | onShow(() => { |
| | | console.log("App Show"); |
| | | }); |
| | | |
| | | onHide(() => { |
| | | console.log("App Hide"); |
| | | }); |
| | | |
| | | |
| | | onLaunch(() => { |
| | | // 初始化系统信息 |
| | | appStore.initSystemInfo(); |
| | | |
| | | if (!userStore.userInfo) { |
| | | //不存在则跳转至登录页 |
| | | uni.reLaunch({ |
| | | url: "/pages/login/index", |
| | | }) |
| | | } |
| | | }); |
| | | |
| | | // #ifdef APP-PLUS |
| | | import TrtcCloud from '@/utils/voiceCallByTX/TrtcCloud/lib/index'; |
| | | import { TRTCAppScene } from '@/utils/voiceCallByTX/TrtcCloud/lib/TrtcDefines'; |
| | | const trtcCloud = TrtcCloud.createInstance(); |
| | | function enterRoomFun() { |
| | | const {userSig, SDKAppID} = genTestUserSig(userId.value); |
| | | const params = {sdkAppId: SDKAppID, userId: userId.value, roomId: 789456, userSig: userSig}; |
| | | trtcCloud.enterRoom(params, TRTCAppScene.TRTCAppSceneVideoCall) |
| | | trtcCloud.startLocalAudio(); |
| | | onLaunch(() => { |
| | | // 初始化系统信息 |
| | | appStore.initSystemInfo(); |
| | | if (!userStore.userInfo) { |
| | | //不存在则跳转至登录页 |
| | | uni.reLaunch({ |
| | | url: "/pages/login/index", |
| | | }) |
| | | } |
| | | // #endif |
| | | |
| | | // #ifdef H5 |
| | | import TRTC from 'trtc-sdk-v5'; |
| | | const trtc = TRTC.create(); |
| | | function enterRoomFunByH5() { |
| | | const {userSig, SDKAppID} = genTestUserSig(userId.value); |
| | | trtc.enterRoom({ sdkAppId:SDKAppID, userId:userId.value, userSig, roomId: 789456 }) |
| | | trtc.startLocalAudio() |
| | | } |
| | | // #endif |
| | | |
| | | // 初始化登陆腾讯音频平台 |
| | | watch(userId, () => { |
| | | if (!userId.value) return |
| | | // #ifdef APP-PLUS |
| | | // enterRoomFun() |
| | | // #endif |
| | | // #ifdef H5 |
| | | // enterRoomFunByH5() |
| | | // #endif |
| | | |
| | | }, { |
| | | immediate: true |
| | | }) |
| | | |
| | | onShow(() => { |
| | | console.log("App Show"); |
| | | }); |
| | | |
| | | onHide(() => { |
| | | console.log("App Hide"); |
| | | }); |
| | | }); |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | /* 每个页面公共css */ |
| | | @import "uview-plus/index.scss"; |
| | | @import "@/static/styles/common.scss"; |
| | | /* 每个页面公共css */ |
| | | @import "uview-plus/index.scss"; |
| | | @import "@/static/styles/common.scss"; |
| | | |
| | | .TUICallKit-mobile { |
| | | position: fixed; |
| | | left: 0; |
| | | top: 0; |
| | | z-index: 9999; |
| | | } |
| | | .TUICallKit-mobile { |
| | | position: fixed; |
| | | left: 0; |
| | | top: 0; |
| | | z-index: 9999; |
| | | } |
| | | |
| | | page { |
| | | background-image: url('~@/static/images/user/bg.png'); |
| | | background-size: cover; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | background-attachment: fixed; |
| | | // min-height: 10vh; |
| | | } |
| | | page { |
| | | background-image: url('~@/static/images/user/bg.png'); |
| | | background-size: cover; |
| | | background-position: center; |
| | | background-repeat: no-repeat; |
| | | background-attachment: fixed; |
| | | // min-height: 10vh; |
| | | } |
| | | |
| | | .uni-tabbar__item:nth-child(4) { |
| | | .uni-tabbar__bd { |
| | | .uni-tabbar__icon { |
| | | width: 60px !important; |
| | | height: 60px !important; |
| | | margin-top: -20px; |
| | | } |
| | | .uni-tabbar__item:nth-child(4) { |
| | | .uni-tabbar__bd { |
| | | .uni-tabbar__icon { |
| | | width: 60px !important; |
| | | height: 60px !important; |
| | | margin-top: -20px; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .uni-tabbar-border { |
| | | background-color: #f6f6f6 !important; |
| | | } |
| | | .uni-tabbar-border { |
| | | background-color: #f6f6f6 !important; |
| | | } |
| | | |
| | | .uni-page-head__title { |
| | | font-family: Source Han Sans CN, Source Han Sans CN !important; |
| | | font-weight: 400 !important; |
| | | font-size: 17px !important; |
| | | color: #222324 !important; |
| | | } |
| | | .uni-page-head__title { |
| | | font-family: Source Han Sans CN, Source Han Sans CN !important; |
| | | font-weight: 400 !important; |
| | | font-size: 17px !important; |
| | | color: #222324 !important; |
| | | } |
| | | |
| | | .uni-page-head { |
| | | background: transparent !important; |
| | | } |
| | | .uni-page-head { |
| | | background: transparent !important; |
| | | } |
| | | </style> |